Skip to contentSkip to conversation

: Move hash masking to call sites

PATCH In review David S. Miller 1 participant 1 message Sep 24, 2004

Subsystems (3)
lore
Share & tools
lore

David S. Miller

author maintainer
#0 lore raw

PATCH 2/6 : Move hash masking to call sites

Another step towards moving all hashing details
into net/core/neighbour.c

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/09/23 15:20:38-07:00 [email protected]
# [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: David S. Miller <[email protected]>
#

# net/ipv6/ndisc.c
#   2004/09/23 15:20:09-07:00 [email protected] +1 -1
#   [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: David S. Miller <[email protected]>
# 
# net/ipv4/arp.c
#   2004/09/23 15:20:09-07:00 [email protected] +1 -1
#   [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: David S. Miller <[email protected]>
# 
# net/decnet/dn_neigh.c
#   2004/09/23 15:20:09-07:00 [email protected] +1 -1
#   [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: David S. Miller <[email protected]>
# 
# net/core/neighbour.c
#   2004/09/23 15:20:09-07:00 [email protected] +2 -2
#   [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: David S. Miller <[email protected]>
# 
# net/atm/clip.c
#   2004/09/23 15:20:09-07:00 [email protected] +1 -1
#   [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: David S. Miller <[email protected]>
# 
diff -Nru a/net/atm/clip.c b/net/atm/clip.c
--- a/net/atm/clip.c	2004-09-23 22:26:08 -07:00
+++ b/net/atm/clip.c	2004-09-23 22:26:08 -07:00
@@ -334,7 +334,7 @@
 	hash_val ^= (hash_val>>16);
 	hash_val ^= hash_val>>8;
 	hash_val ^= hash_val>>3;
-	hash_val = (hash_val^dev->ifindex)&NEIGH_HASHMASK;
+	hash_val = (hash_val^dev->ifindex);

return hash_val;
}

net/core/neighbour.c +2 -2
diff -Nru a/net/core/neighbour.c b/net/core/neighbour.c
@@ -291,7 +291,7 @@
 {
 	struct neighbour *n;
 	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);
 	for (n = tbl->hash_buckets[hash_val]; n; n = n->next) {
@@ -336,7 +336,7 @@
 
 	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);
 	if (n->parms->dead) {
net/decnet/dn_neigh.c +1 -1
diff -Nru a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
@@ -128,7 +128,7 @@
 	hash_val ^= (hash_val >> 10);
 	hash_val ^= (hash_val >> 3);
 
-	return hash_val & NEIGH_HASHMASK;
+	return hash_val;
 }
 
 static int dn_neigh_construct(struct neighbour *neigh)
net/ipv4/arp.c +1 -1
diff -Nru a/net/ipv4/arp.c b/net/ipv4/arp.c
@@ -229,7 +229,7 @@
 	hash_val ^= (hash_val>>16);
 	hash_val ^= hash_val>>8;
 	hash_val ^= hash_val>>3;
-	hash_val = (hash_val^dev->ifindex)&NEIGH_HASHMASK;
+	hash_val = (hash_val^dev->ifindex);
 
 	return hash_val;
 }
net/ipv6/ndisc.c +1 -1
diff -Nru a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
@@ -276,7 +276,7 @@
 	hash_val ^= (hash_val>>16);
 	hash_val ^= hash_val>>8;
 	hash_val ^= hash_val>>3;
-	hash_val = (hash_val^dev->ifindex)&NEIGH_HASHMASK;
+	hash_val = (hash_val^dev->ifindex);
 
 	return hash_val;
 }