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>
This commit is contained in:

committed by
David S. Miller

parent
942e7b102a
commit
d6266281f8
@@ -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;
|
||||
|
Reference in New Issue
Block a user