summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-06-17 04:11:50 +0400
committerDavid S. Miller <davem@davemloft.net>2008-06-17 04:11:50 +0400
commitd6266281f8175e3ad68c28b20a609b278b47ade5 (patch)
tree16e8643eb5560d70daf1097c3a09df21b6d186c1 /include/linux
parent942e7b102a4827fdb69a39c7f07c544542589ef9 (diff)
downloadlinux-d6266281f8175e3ad68c28b20a609b278b47ade5.tar.xz
udp: introduce a udp_hashfn function
Currently the chain to store a UDP socket is calculated with simple (x & (UDP_HTABLE_SIZE - 1)). But taking net into account would make this calculation a bit more complex, so moving it into a function would help. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/udp.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 581ca2c14c52..9c94312b2de5 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -46,6 +46,11 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
#define UDP_HTABLE_SIZE 128
+static inline int udp_hashfn(const unsigned num)
+{
+ return num & (UDP_HTABLE_SIZE - 1);
+}
+
struct udp_sock {
/* inet_sock has to be the first member */
struct inet_sock inet;