aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inet_hashtables.h
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-12-20 18:32:17 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:59:27 -0500
commit77a5ba55dab7b4ece12f37c717022819e3f77b44 (patch)
tree23af7c17e48403dc8d847f3839a4b005939272bf /include/net/inet_hashtables.h
parent152da81deb9a4870aeac352336184b2b14d4b2ba (diff)
[INET]: Uninline the __inet_lookup_established function.
This is -700 bytes from the net/ipv4/built-in.o add/remove: 1/0 grow/shrink: 1/3 up/down: 340/-1040 (-700) function old new delta __inet_lookup_established - 339 +339 tcp_sacktag_write_queue 2254 2255 +1 tcp_v4_err 1304 973 -331 tcp_v4_rcv 2089 1744 -345 tcp_v4_do_rcv 826 462 -364 Exporting is for dccp module (used via e.g. inet_lookup). Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inet_hashtables.h')
-rw-r--r--include/net/inet_hashtables.h40
1 files changed, 3 insertions, 37 deletions
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 982d487751f9..65ddb25d62e8 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -374,43 +374,9 @@ typedef __u64 __bitwise __addrpair;
374 * 374 *
375 * Local BH must be disabled here. 375 * Local BH must be disabled here.
376 */ 376 */
377static inline struct sock * 377extern struct sock * __inet_lookup_established(struct inet_hashinfo *hashinfo,
378 __inet_lookup_established(struct inet_hashinfo *hashinfo, 378 const __be32 saddr, const __be16 sport,
379 const __be32 saddr, const __be16 sport, 379 const __be32 daddr, const u16 hnum, const int dif);
380 const __be32 daddr, const u16 hnum,
381 const int dif)
382{
383 INET_ADDR_COOKIE(acookie, saddr, daddr)
384 const __portpair ports = INET_COMBINED_PORTS(sport, hnum);
385 struct sock *sk;
386 const struct hlist_node *node;
387 /* Optimize here for direct hit, only listening connections can
388 * have wildcards anyways.
389 */
390 unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport);
391 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash);
392 rwlock_t *lock = inet_ehash_lockp(hashinfo, hash);
393
394 prefetch(head->chain.first);
395 read_lock(lock);
396 sk_for_each(sk, node, &head->chain) {
397 if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif))
398 goto hit; /* You sunk my battleship! */
399 }
400
401 /* Must check for a TIME_WAIT'er before going to listener hash. */
402 sk_for_each(sk, node, &head->twchain) {
403 if (INET_TW_MATCH(sk, hash, acookie, saddr, daddr, ports, dif))
404 goto hit;
405 }
406 sk = NULL;
407out:
408 read_unlock(lock);
409 return sk;
410hit:
411 sock_hold(sk);
412 goto out;
413}
414 380
415static inline struct sock * 381static inline struct sock *
416 inet_lookup_established(struct inet_hashinfo *hashinfo, 382 inet_lookup_established(struct inet_hashinfo *hashinfo,