inet_hashtables.c (d585a021c0b10b0477d6b608c53e1feb8cde0507) inet_hashtables.c (f373b53b5fe67aa4a6f28f921a529cc90f88e79b)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Generic INET transport hashtables
7 *
8 * Authors: Lotsa people, from code originally in tcp

--- 195 unchanged lines hidden (view full) ---

204 INET_ADDR_COOKIE(acookie, saddr, daddr)
205 const __portpair ports = INET_COMBINED_PORTS(sport, hnum);
206 struct sock *sk;
207 const struct hlist_nulls_node *node;
208 /* Optimize here for direct hit, only listening connections can
209 * have wildcards anyways.
210 */
211 unsigned int hash = inet_ehashfn(net, daddr, hnum, saddr, sport);
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Generic INET transport hashtables
7 *
8 * Authors: Lotsa people, from code originally in tcp

--- 195 unchanged lines hidden (view full) ---

204 INET_ADDR_COOKIE(acookie, saddr, daddr)
205 const __portpair ports = INET_COMBINED_PORTS(sport, hnum);
206 struct sock *sk;
207 const struct hlist_nulls_node *node;
208 /* Optimize here for direct hit, only listening connections can
209 * have wildcards anyways.
210 */
211 unsigned int hash = inet_ehashfn(net, daddr, hnum, saddr, sport);
212 unsigned int slot = hash & (hashinfo->ehash_size - 1);
212 unsigned int slot = hash & hashinfo->ehash_mask;
213 struct inet_ehash_bucket *head = &hashinfo->ehash[slot];
214
215 rcu_read_lock();
216begin:
217 sk_nulls_for_each_rcu(sk, node, &head->chain) {
218 if (INET_MATCH(sk, net, hash, acookie,
219 saddr, daddr, ports, dif)) {
220 if (unlikely(!atomic_inc_not_zero(&sk->sk_refcnt)))

--- 323 unchanged lines hidden ---
213 struct inet_ehash_bucket *head = &hashinfo->ehash[slot];
214
215 rcu_read_lock();
216begin:
217 sk_nulls_for_each_rcu(sk, node, &head->chain) {
218 if (INET_MATCH(sk, net, hash, acookie,
219 saddr, daddr, ports, dif)) {
220 if (unlikely(!atomic_inc_not_zero(&sk->sk_refcnt)))

--- 323 unchanged lines hidden ---