Commit 4e181ca7 authored by David S. Miller's avatar David S. Miller Committed by David S. Miller

[NET]: Apply NEIGH_HASHMASK at tbl->hash() caller.

Now there is no reason for any neigh implementation
to know the value of {P,}NEIGH_HASHMASK
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fdab4b10
...@@ -334,7 +334,7 @@ static u32 clip_hash(const void *pkey, const struct net_device *dev) ...@@ -334,7 +334,7 @@ static u32 clip_hash(const void *pkey, const struct net_device *dev)
hash_val ^= (hash_val>>16); hash_val ^= (hash_val>>16);
hash_val ^= hash_val>>8; hash_val ^= hash_val>>8;
hash_val ^= hash_val>>3; hash_val ^= hash_val>>3;
hash_val = (hash_val^dev->ifindex)&NEIGH_HASHMASK; hash_val = (hash_val^dev->ifindex);
return hash_val; return hash_val;
} }
......
...@@ -291,7 +291,7 @@ struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey, ...@@ -291,7 +291,7 @@ struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey,
{ {
struct neighbour *n; struct neighbour *n;
int key_len = tbl->key_len; int key_len = tbl->key_len;
u32 hash_val = tbl->hash(pkey, dev); u32 hash_val = tbl->hash(pkey, dev) & NEIGH_HASHMASK;
read_lock_bh(&tbl->lock); read_lock_bh(&tbl->lock);
for (n = tbl->hash_buckets[hash_val]; n; n = n->next) { for (n = tbl->hash_buckets[hash_val]; n; n = n->next) {
...@@ -336,7 +336,7 @@ struct neighbour *neigh_create(struct neigh_table *tbl, const void *pkey, ...@@ -336,7 +336,7 @@ struct neighbour *neigh_create(struct neigh_table *tbl, const void *pkey,
n->confirmed = jiffies - (n->parms->base_reachable_time << 1); n->confirmed = jiffies - (n->parms->base_reachable_time << 1);
hash_val = tbl->hash(pkey, dev); hash_val = tbl->hash(pkey, dev) & NEIGH_HASHMASK;
write_lock_bh(&tbl->lock); write_lock_bh(&tbl->lock);
if (n->parms->dead) { if (n->parms->dead) {
......
...@@ -128,7 +128,7 @@ static u32 dn_neigh_hash(const void *pkey, const struct net_device *dev) ...@@ -128,7 +128,7 @@ static u32 dn_neigh_hash(const void *pkey, const struct net_device *dev)
hash_val ^= (hash_val >> 10); hash_val ^= (hash_val >> 10);
hash_val ^= (hash_val >> 3); hash_val ^= (hash_val >> 3);
return hash_val & NEIGH_HASHMASK; return hash_val;
} }
static int dn_neigh_construct(struct neighbour *neigh) static int dn_neigh_construct(struct neighbour *neigh)
......
...@@ -229,7 +229,7 @@ static u32 arp_hash(const void *pkey, const struct net_device *dev) ...@@ -229,7 +229,7 @@ static u32 arp_hash(const void *pkey, const struct net_device *dev)
hash_val ^= (hash_val>>16); hash_val ^= (hash_val>>16);
hash_val ^= hash_val>>8; hash_val ^= hash_val>>8;
hash_val ^= hash_val>>3; hash_val ^= hash_val>>3;
hash_val = (hash_val^dev->ifindex)&NEIGH_HASHMASK; hash_val = (hash_val^dev->ifindex);
return hash_val; return hash_val;
} }
......
...@@ -276,7 +276,7 @@ static u32 ndisc_hash(const void *pkey, const struct net_device *dev) ...@@ -276,7 +276,7 @@ static u32 ndisc_hash(const void *pkey, const struct net_device *dev)
hash_val ^= (hash_val>>16); hash_val ^= (hash_val>>16);
hash_val ^= hash_val>>8; hash_val ^= hash_val>>8;
hash_val ^= hash_val>>3; hash_val ^= hash_val>>3;
hash_val = (hash_val^dev->ifindex)&NEIGH_HASHMASK; hash_val = (hash_val^dev->ifindex);
return hash_val; return hash_val;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment