aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_hashtables.c
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 /net/ipv4/inet_hashtables.c
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 'net/ipv4/inet_hashtables.c')
-rw-r--r--net/ipv4/inet_hashtables.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 8dfd5a691e5f..2e5814a84360 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -190,6 +190,44 @@ sherry_cache:
190} 190}
191EXPORT_SYMBOL_GPL(__inet_lookup_listener); 191EXPORT_SYMBOL_GPL(__inet_lookup_listener);
192 192
193struct sock * __inet_lookup_established(struct inet_hashinfo *hashinfo,
194 const __be32 saddr, const __be16 sport,
195 const __be32 daddr, const u16 hnum,
196 const int dif)
197{
198 INET_ADDR_COOKIE(acookie, saddr, daddr)
199 const __portpair ports = INET_COMBINED_PORTS(sport, hnum);
200 struct sock *sk;
201 const struct hlist_node *node;
202 /* Optimize here for direct hit, only listening connections can
203 * have wildcards anyways.
204 */
205 unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport);
206 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash);
207 rwlock_t *lock = inet_ehash_lockp(hashinfo, hash);
208
209 prefetch(head->chain.first);
210 read_lock(lock);
211 sk_for_each(sk, node, &head->chain) {
212 if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif))
213 goto hit; /* You sunk my battleship! */
214 }
215
216 /* Must check for a TIME_WAIT'er before going to listener hash. */
217 sk_for_each(sk, node, &head->twchain) {
218 if (INET_TW_MATCH(sk, hash, acookie, saddr, daddr, ports, dif))
219 goto hit;
220 }
221 sk = NULL;
222out:
223 read_unlock(lock);
224 return sk;
225hit:
226 sock_hold(sk);
227 goto out;
228}
229EXPORT_SYMBOL_GPL(__inet_lookup_established);
230
193/* called with local bh disabled */ 231/* called with local bh disabled */
194static int __inet_check_established(struct inet_timewait_death_row *death_row, 232static int __inet_check_established(struct inet_timewait_death_row *death_row,
195 struct sock *sk, __u16 lport, 233 struct sock *sk, __u16 lport,