diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-06-16 20:14:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-16 20:14:11 -0400 |
commit | 0b4419162aa6c4204843f3a13b48d9ab821d3167 (patch) | |
tree | 1c475a8f59b7fce528eb97c6709b25145c110c33 /include/linux/udp.h | |
parent | 33de014c63646f69f36f3673e3b4676f931dc878 (diff) |
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 <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/udp.h')
-rw-r--r-- | include/linux/udp.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/udp.h b/include/linux/udp.h index 3deccac2e815..0cf5c4c0ec81 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h | |||
@@ -38,6 +38,7 @@ struct udphdr { | |||
38 | #ifdef __KERNEL__ | 38 | #ifdef __KERNEL__ |
39 | #include <net/inet_sock.h> | 39 | #include <net/inet_sock.h> |
40 | #include <linux/skbuff.h> | 40 | #include <linux/skbuff.h> |
41 | #include <net/netns/hash.h> | ||
41 | 42 | ||
42 | static inline struct udphdr *udp_hdr(const struct sk_buff *skb) | 43 | static inline struct udphdr *udp_hdr(const struct sk_buff *skb) |
43 | { | 44 | { |
@@ -48,7 +49,7 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb) | |||
48 | 49 | ||
49 | static inline int udp_hashfn(struct net *net, const unsigned num) | 50 | static inline int udp_hashfn(struct net *net, const unsigned num) |
50 | { | 51 | { |
51 | return num & (UDP_HTABLE_SIZE - 1); | 52 | return (num + net_hash_mix(net)) & (UDP_HTABLE_SIZE - 1); |
52 | } | 53 | } |
53 | 54 | ||
54 | struct udp_sock { | 55 | struct udp_sock { |