From 0b4419162aa6c4204843f3a13b48d9ab821d3167 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 16 Jun 2008 17:14:11 -0700 Subject: netns: introduce the net_hash_mix "salt" for hashes There are many possible ways to add this "salt", thus I made this patch to be the last in the series to change it if required. Currently I propose to use the struct net pointer itself as this salt, but since this pointer is most often cache-line aligned, shift this right to eliminate the bits, that are most often zeroed. After this, simply add this mix to prepared hashfn-s. For CONFIG_NET_NS=n case this salt is 0 and no changes in hashfn appear. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/inet6_hashtables.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/net/inet6_hashtables.h') diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index 72f13a9928e4..e48989f04c24 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h @@ -24,6 +24,7 @@ #include #include +#include struct inet_hashinfo; @@ -36,7 +37,7 @@ static inline unsigned int inet6_ehashfn(struct net *net, return jhash_3words((__force u32)laddr->s6_addr32[3], (__force u32)faddr->s6_addr32[3], - ports, inet_ehash_secret); + ports, inet_ehash_secret + net_hash_mix(net)); } static inline int inet6_sk_ehashfn(const struct sock *sk) -- cgit v1.2.3-59-g8ed1b