diff options
Diffstat (limited to 'include/net/inet_hashtables.h')
-rw-r--r-- | include/net/inet_hashtables.h | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index c83baa79f66e..135d80fd658e 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/wait.h> | 26 | #include <linux/wait.h> |
27 | 27 | ||
28 | #include <net/inet_connection_sock.h> | 28 | #include <net/inet_connection_sock.h> |
29 | #include <net/inet_sock.h> | ||
29 | #include <net/route.h> | 30 | #include <net/route.h> |
30 | #include <net/sock.h> | 31 | #include <net/sock.h> |
31 | #include <net/tcp_states.h> | 32 | #include <net/tcp_states.h> |
@@ -128,26 +129,6 @@ struct inet_hashinfo { | |||
128 | kmem_cache_t *bind_bucket_cachep; | 129 | kmem_cache_t *bind_bucket_cachep; |
129 | }; | 130 | }; |
130 | 131 | ||
131 | static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, | ||
132 | const __u32 faddr, const __u16 fport) | ||
133 | { | ||
134 | unsigned int h = (laddr ^ lport) ^ (faddr ^ fport); | ||
135 | h ^= h >> 16; | ||
136 | h ^= h >> 8; | ||
137 | return h; | ||
138 | } | ||
139 | |||
140 | static inline int inet_sk_ehashfn(const struct sock *sk) | ||
141 | { | ||
142 | const struct inet_sock *inet = inet_sk(sk); | ||
143 | const __u32 laddr = inet->rcv_saddr; | ||
144 | const __u16 lport = inet->num; | ||
145 | const __u32 faddr = inet->daddr; | ||
146 | const __u16 fport = inet->dport; | ||
147 | |||
148 | return inet_ehashfn(laddr, lport, faddr, fport); | ||
149 | } | ||
150 | |||
151 | static inline struct inet_ehash_bucket *inet_ehash_bucket( | 132 | static inline struct inet_ehash_bucket *inet_ehash_bucket( |
152 | struct inet_hashinfo *hashinfo, | 133 | struct inet_hashinfo *hashinfo, |
153 | unsigned int hash) | 134 | unsigned int hash) |