From 4a3eabf6ca3666a0f871d478ab7ed3b94d4cefcc Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 17 Jul 2012 13:23:08 -0700 Subject: [PATCH] --- yaml --- r: 315437 b: refs/heads/master c: d3a25c980fc231238256f8d80816367674e5caaf h: refs/heads/master i: 315435: 6ef5e07251ecf3c0a4eb0442504f2d2de0a226eb v: v3 --- [refs] | 2 +- trunk/net/ipv4/route.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 2446de03889a..1a83983f5d96 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a6ff1a2f1e91578860b37df9fd861ef7af207de4 +refs/heads/master: d3a25c980fc231238256f8d80816367674e5caaf diff --git a/trunk/net/ipv4/route.c b/trunk/net/ipv4/route.c index a5bd0b4acc61..812e4447a223 100644 --- a/trunk/net/ipv4/route.c +++ b/trunk/net/ipv4/route.c @@ -1347,6 +1347,16 @@ static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash, __be3 return oldest; } +static inline u32 fnhe_hashfun(__be32 daddr) +{ + u32 hval; + + hval = (__force u32) daddr; + hval ^= (hval >> 11) ^ (hval >> 22); + + return hval & (FNHE_HASH_SIZE - 1); +} + static struct fib_nh_exception *find_or_create_fnhe(struct fib_nh *nh, __be32 daddr) { struct fnhe_hash_bucket *hash = nh->nh_exceptions; @@ -1361,8 +1371,7 @@ static struct fib_nh_exception *find_or_create_fnhe(struct fib_nh *nh, __be32 da return NULL; } - hval = (__force u32) daddr; - hval ^= (hval >> 11) ^ (hval >> 22); + hval = fnhe_hashfun(daddr); hash += hval; depth = 0; @@ -1890,8 +1899,7 @@ static void rt_bind_exception(struct rtable *rt, struct fib_nh *nh, __be32 daddr struct fib_nh_exception *fnhe; u32 hval; - hval = (__force u32) daddr; - hval ^= (hval >> 11) ^ (hval >> 22); + hval = fnhe_hashfun(daddr); for (fnhe = rcu_dereference(hash[hval].chain); fnhe; fnhe = rcu_dereference(fnhe->fnhe_next)) {