MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ipv6_hash_crc

Function ipv6_hash_crc

dpdk/examples/l3fwd/l3fwd_em.c:165–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165static inline uint32_t
166ipv6_hash_crc(const void *data, __rte_unused uint32_t data_len,
167 uint32_t init_val)
168{
169 const union ipv6_5tuple_host *k;
170 uint32_t t;
171 const uint32_t *p;
172#ifdef EM_HASH_CRC
173 const uint32_t *ip_src0, *ip_src1, *ip_src2, *ip_src3;
174 const uint32_t *ip_dst0, *ip_dst1, *ip_dst2, *ip_dst3;
175#endif
176
177 k = data;
178 t = k->proto;
179 p = (const uint32_t *)&k->port_src;
180
181#ifdef EM_HASH_CRC
182 ip_src0 = (const uint32_t *) k->ip_src;
183 ip_src1 = (const uint32_t *)(k->ip_src+4);
184 ip_src2 = (const uint32_t *)(k->ip_src+8);
185 ip_src3 = (const uint32_t *)(k->ip_src+12);
186 ip_dst0 = (const uint32_t *) k->ip_dst;
187 ip_dst1 = (const uint32_t *)(k->ip_dst+4);
188 ip_dst2 = (const uint32_t *)(k->ip_dst+8);
189 ip_dst3 = (const uint32_t *)(k->ip_dst+12);
190 init_val = rte_hash_crc_4byte(t, init_val);
191 init_val = rte_hash_crc_4byte(*ip_src0, init_val);
192 init_val = rte_hash_crc_4byte(*ip_src1, init_val);
193 init_val = rte_hash_crc_4byte(*ip_src2, init_val);
194 init_val = rte_hash_crc_4byte(*ip_src3, init_val);
195 init_val = rte_hash_crc_4byte(*ip_dst0, init_val);
196 init_val = rte_hash_crc_4byte(*ip_dst1, init_val);
197 init_val = rte_hash_crc_4byte(*ip_dst2, init_val);
198 init_val = rte_hash_crc_4byte(*ip_dst3, init_val);
199 init_val = rte_hash_crc_4byte(*p, init_val);
200#else
201 init_val = rte_jhash_1word(t, init_val);
202 init_val = rte_jhash(k->ip_src,
203 sizeof(uint8_t) * IPV6_ADDR_LEN, init_val);
204 init_val = rte_jhash(k->ip_dst,
205 sizeof(uint8_t) * IPV6_ADDR_LEN, init_val);
206 init_val = rte_jhash_1word(*p, init_val);
207#endif
208 return init_val;
209}
210
211static uint8_t ipv4_l3fwd_out_if[L3FWD_HASH_ENTRIES] __rte_cache_aligned;
212static uint8_t ipv6_l3fwd_out_if[L3FWD_HASH_ENTRIES] __rte_cache_aligned;

Callers

nothing calls this directly

Calls 3

rte_hash_crc_4byteFunction · 0.50
rte_jhash_1wordFunction · 0.50
rte_jhashFunction · 0.50

Tested by

no test coverage detected