From 1932c36167562a07c6f254b25bd31c496bc08348 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 11 Jul 2011 01:37:28 -0700 Subject: [PATCH] --- yaml --- r: 256249 b: refs/heads/master c: f610b74b14d74a069f61583131e689550fd5bab3 h: refs/heads/master i: 256247: c240629e8e46ff8b592a5d22850c71f8bb849f7e v: v3 --- [refs] | 2 +- trunk/include/net/arp.h | 7 +++++++ trunk/net/core/neighbour.c | 1 + trunk/net/ipv4/arp.c | 3 +-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index ba6db7935f92..0e444e2003ea 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: cd0893369ca85fd11bc517081b2d9079d2ef2f90 +refs/heads/master: f610b74b14d74a069f61583131e689550fd5bab3 diff --git a/trunk/include/net/arp.h b/trunk/include/net/arp.h index 91f0568a04ef..723bde501c64 100644 --- a/trunk/include/net/arp.h +++ b/trunk/include/net/arp.h @@ -8,6 +8,13 @@ extern struct neigh_table arp_tbl; +static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd) +{ + u32 val = key ^ dev->ifindex; + + return val * hash_rnd; +} + extern void arp_init(void); extern int arp_find(unsigned char *haddr, struct sk_buff *skb); extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg); diff --git a/trunk/net/core/neighbour.c b/trunk/net/core/neighbour.c index 4d5fc9433fd9..50bd960983e0 100644 --- a/trunk/net/core/neighbour.c +++ b/trunk/net/core/neighbour.c @@ -334,6 +334,7 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift) ret->hash_buckets = buckets; ret->hash_shift = shift; get_random_bytes(&ret->hash_rnd, sizeof(ret->hash_rnd)); + ret->hash_rnd |= 1; return ret; } diff --git a/trunk/net/ipv4/arp.c b/trunk/net/ipv4/arp.c index 1b74d3b64371..4412b57f6ff6 100644 --- a/trunk/net/ipv4/arp.c +++ b/trunk/net/ipv4/arp.c @@ -97,7 +97,6 @@ #include #include #include -#include #include #ifdef CONFIG_SYSCTL #include @@ -232,7 +231,7 @@ static u32 arp_hash(const void *pkey, const struct net_device *dev, __u32 hash_rnd) { - return jhash_2words(*(u32 *)pkey, dev->ifindex, hash_rnd); + return arp_hashfn(*(u32 *)pkey, dev, hash_rnd); } static int arp_constructor(struct neighbour *neigh)