diff options
-rw-r--r-- | include/net/ip_fib.h | 3 | ||||
-rw-r--r-- | net/ipv4/route.c | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index f30fd554127e..dc9d2a27c315 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -65,7 +65,8 @@ struct fnhe_hash_bucket { | |||
65 | struct fib_nh_exception __rcu *chain; | 65 | struct fib_nh_exception __rcu *chain; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | #define FNHE_HASH_SIZE 2048 | 68 | #define FNHE_HASH_SHIFT 11 |
69 | #define FNHE_HASH_SIZE (1 << FNHE_HASH_SHIFT) | ||
69 | #define FNHE_RECLAIM_DEPTH 5 | 70 | #define FNHE_RECLAIM_DEPTH 5 |
70 | 71 | ||
71 | struct fib_nh { | 72 | struct fib_nh { |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 44b0cbdd76f1..234a43e233dc 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -596,12 +596,12 @@ static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash) | |||
596 | 596 | ||
597 | static inline u32 fnhe_hashfun(__be32 daddr) | 597 | static inline u32 fnhe_hashfun(__be32 daddr) |
598 | { | 598 | { |
599 | static u32 fnhe_hashrnd __read_mostly; | ||
599 | u32 hval; | 600 | u32 hval; |
600 | 601 | ||
601 | hval = (__force u32) daddr; | 602 | net_get_random_once(&fnhe_hashrnd, sizeof(fnhe_hashrnd)); |
602 | hval ^= (hval >> 11) ^ (hval >> 22); | 603 | hval = jhash_1word((__force u32) daddr, fnhe_hashrnd); |
603 | 604 | return hash_32(hval, FNHE_HASH_SHIFT); | |
604 | return hval & (FNHE_HASH_SIZE - 1); | ||
605 | } | 605 | } |
606 | 606 | ||
607 | static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe) | 607 | static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe) |