aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inet_sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/inet_sock.h')
-rw-r--r--include/net/inet_sock.h22
1 files changed, 6 insertions, 16 deletions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 06da91efbc83..7a6c7f80a8fd 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -208,26 +208,16 @@ extern u32 inet_ehash_secret;
208extern u32 ipv6_hash_secret; 208extern u32 ipv6_hash_secret;
209void build_ehash_secret(void); 209void build_ehash_secret(void);
210 210
211static inline unsigned int inet_ehashfn(struct net *net, 211static inline unsigned int __inet_ehashfn(const __be32 laddr,
212 const __be32 laddr, const __u16 lport, 212 const __u16 lport,
213 const __be32 faddr, const __be16 fport) 213 const __be32 faddr,
214 const __be16 fport,
215 u32 initval)
214{ 216{
215 return jhash_3words((__force __u32) laddr, 217 return jhash_3words((__force __u32) laddr,
216 (__force __u32) faddr, 218 (__force __u32) faddr,
217 ((__u32) lport) << 16 | (__force __u32)fport, 219 ((__u32) lport) << 16 | (__force __u32)fport,
218 inet_ehash_secret + net_hash_mix(net)); 220 initval);
219}
220
221static inline int inet_sk_ehashfn(const struct sock *sk)
222{
223 const struct inet_sock *inet = inet_sk(sk);
224 const __be32 laddr = inet->inet_rcv_saddr;
225 const __u16 lport = inet->inet_num;
226 const __be32 faddr = inet->inet_daddr;
227 const __be16 fport = inet->inet_dport;
228 struct net *net = sock_net(sk);
229
230 return inet_ehashfn(net, laddr, lport, faddr, fport);
231} 221}
232 222
233static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) 223static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops)