netdev
[Top] [All Lists]

[2/6]: Move hash masking to call sites

To: laforge@xxxxxxxxxxxx
Subject: [2/6]: Move hash masking to call sites
From: "David S. Miller" <davem@xxxxxxxxxxxxx>
Date: Thu, 23 Sep 2004 22:49:21 -0700
Cc: netdev@xxxxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
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 davem@xxxxxxxxxxxxxxxxxx 
#   [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 <davem@xxxxxxxxxxxxx>
# 
# net/ipv6/ndisc.c
#   2004/09/23 15:20:09-07:00 davem@xxxxxxxxxxxxxxxxxx +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 <davem@xxxxxxxxxxxxx>
# 
# net/ipv4/arp.c
#   2004/09/23 15:20:09-07:00 davem@xxxxxxxxxxxxxxxxxx +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 <davem@xxxxxxxxxxxxx>
# 
# net/decnet/dn_neigh.c
#   2004/09/23 15:20:09-07:00 davem@xxxxxxxxxxxxxxxxxx +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 <davem@xxxxxxxxxxxxx>
# 
# net/core/neighbour.c
#   2004/09/23 15:20:09-07:00 davem@xxxxxxxxxxxxxxxxxx +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 <davem@xxxxxxxxxxxxx>
# 
# net/atm/clip.c
#   2004/09/23 15:20:09-07:00 davem@xxxxxxxxxxxxxxxxxx +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 <davem@xxxxxxxxxxxxx>
# 
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;
 }
diff -Nru a/net/core/neighbour.c b/net/core/neighbour.c
--- a/net/core/neighbour.c      2004-09-23 22:26:08 -07:00
+++ b/net/core/neighbour.c      2004-09-23 22:26:08 -07:00
@@ -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) {
diff -Nru a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
--- a/net/decnet/dn_neigh.c     2004-09-23 22:26:08 -07:00
+++ b/net/decnet/dn_neigh.c     2004-09-23 22:26:08 -07:00
@@ -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)
diff -Nru a/net/ipv4/arp.c b/net/ipv4/arp.c
--- a/net/ipv4/arp.c    2004-09-23 22:26:08 -07:00
+++ b/net/ipv4/arp.c    2004-09-23 22:26:08 -07:00
@@ -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;
 }
diff -Nru a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
--- a/net/ipv6/ndisc.c  2004-09-23 22:26:08 -07:00
+++ b/net/ipv6/ndisc.c  2004-09-23 22:26:08 -07:00
@@ -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;
 }

<Prev in Thread] Current Thread [Next in Thread>
  • [2/6]: Move hash masking to call sites, David S. Miller <=