MCPcopy Index your code
hub / github.com/F-Stack/f-stack / toeplitz_hash

Function toeplitz_hash

lib/ff_dpdk_if.c:2428–2449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2426}
2427
2428static uint32_t
2429toeplitz_hash(unsigned keylen, const uint8_t *key,
2430 unsigned datalen, const uint8_t *data)
2431{
2432 uint32_t hash = 0, v;
2433 u_int i, b;
2434
2435 /* XXXRW: Perhaps an assertion about key length vs. data length? */
2436
2437 v = (key[0]<<24) + (key[1]<<16) + (key[2] <<8) + key[3];
2438 for (i = 0; i < datalen; i++) {
2439 for (b = 0; b < 8; b++) {
2440 if (data[i] & (1<<(7-b)))
2441 hash ^= v;
2442 v <<= 1;
2443 if ((i + 4) < keylen &&
2444 (key[i+4] & (1<<(7-b))))
2445 v |= 1;
2446 }
2447 }
2448 return (hash);
2449}
2450
2451int
2452ff_in_pcbladdr(uint16_t family, void *faddr, uint16_t fport, void *laddr)

Callers 1

ff_rss_checkFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected