neigh: Store hash shift instead of mask.

And mask the hash function result by simply shifting
down the "->hash_shift" most significant bits.

Currently which bits we use is arbitrary since jhash
produces entropy evenly across the whole hash function
result.

But soon we'll be using universal hashing functions,
and in those cases more entropy exists in the higher
bits than the lower bits, because they use multiplies.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller
2011-07-11 01:28:12 -07:00
parent d84e0bd797
commit cd0893369c
2 changed files with 24 additions and 25 deletions

View File

@@ -142,7 +142,7 @@ struct pneigh_entry {
struct neigh_hash_table {
struct neighbour __rcu **hash_buckets;
unsigned int hash_mask;
unsigned int hash_shift;
__u32 hash_rnd;
struct rcu_head rcu;
};