aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDenis Vlasenko <vda@ilport.com.ua>2006-04-10 01:48:59 -0400
committerDavid S. Miller <davem@davemloft.net>2006-04-10 01:48:59 -0400
commitb1a7ffcb7a047e99ab02424e651e0492f36095f7 (patch)
treece84ddd2087b512ae484d6c6d21f985ef2e32a09 /include
parent55c0022e53452360064ea264c41410c70565d9f8 (diff)
[IPV6]: Deinline few large functions in inet6 code
Deinline a few functions which produce 200+ bytes of code. Size Uses Wasted Name and definition ===== ==== ====== ================================================ 429 3 818 __inet6_lookup include/net/inet6_hashtables.h 404 2 384 __inet6_lookup_established include/net/inet6_hashtables.h 206 3 372 __inet6_hash include/net/inet6_hashtables.h Signed-off-by: Denis Vlasenko <vda@ilport.com.ua> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/inet6_hashtables.h70
1 files changed, 3 insertions, 67 deletions
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 25f708ff020e..59f0c83d55a2 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -48,31 +48,7 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
48 return inet6_ehashfn(laddr, lport, faddr, fport); 48 return inet6_ehashfn(laddr, lport, faddr, fport);
49} 49}
50 50
51static inline void __inet6_hash(struct inet_hashinfo *hashinfo, 51extern void __inet6_hash(struct inet_hashinfo *hashinfo, struct sock *sk);
52 struct sock *sk)
53{
54 struct hlist_head *list;
55 rwlock_t *lock;
56
57 BUG_TRAP(sk_unhashed(sk));
58
59 if (sk->sk_state == TCP_LISTEN) {
60 list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)];
61 lock = &hashinfo->lhash_lock;
62 inet_listen_wlock(hashinfo);
63 } else {
64 unsigned int hash;
65 sk->sk_hash = hash = inet6_sk_ehashfn(sk);
66 hash &= (hashinfo->ehash_size - 1);
67 list = &hashinfo->ehash[hash].chain;
68 lock = &hashinfo->ehash[hash].lock;
69 write_lock(lock);
70 }
71
72 __sk_add_node(sk, list);
73 sock_prot_inc_use(sk->sk_prot);
74 write_unlock(lock);
75}
76 52
77/* 53/*
78 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 54 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
@@ -80,52 +56,12 @@ static inline void __inet6_hash(struct inet_hashinfo *hashinfo,
80 * 56 *
81 * The sockhash lock must be held as a reader here. 57 * The sockhash lock must be held as a reader here.
82 */ 58 */
83static inline struct sock * 59extern struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo,
84 __inet6_lookup_established(struct inet_hashinfo *hashinfo,
85 const struct in6_addr *saddr, 60 const struct in6_addr *saddr,
86 const u16 sport, 61 const u16 sport,
87 const struct in6_addr *daddr, 62 const struct in6_addr *daddr,
88 const u16 hnum, 63 const u16 hnum,
89 const int dif) 64 const int dif);
90{
91 struct sock *sk;
92 const struct hlist_node *node;
93 const __u32 ports = INET_COMBINED_PORTS(sport, hnum);
94 /* Optimize here for direct hit, only listening connections can
95 * have wildcards anyways.
96 */
97 unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport);
98 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash);
99
100 prefetch(head->chain.first);
101 read_lock(&head->lock);
102 sk_for_each(sk, node, &head->chain) {
103 /* For IPV6 do the cheaper port and family tests first. */
104 if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif))
105 goto hit; /* You sunk my battleship! */
106 }
107 /* Must check for a TIME_WAIT'er before going to listener hash. */
108 sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) {
109 const struct inet_timewait_sock *tw = inet_twsk(sk);
110
111 if(*((__u32 *)&(tw->tw_dport)) == ports &&
112 sk->sk_family == PF_INET6) {
113 const struct inet6_timewait_sock *tw6 = inet6_twsk(sk);
114
115 if (ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) &&
116 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) &&
117 (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif))
118 goto hit;
119 }
120 }
121 read_unlock(&head->lock);
122 return NULL;
123
124hit:
125 sock_hold(sk);
126 read_unlock(&head->lock);
127 return sk;
128}
129 65
130extern struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo, 66extern struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo,
131 const struct in6_addr *daddr, 67 const struct in6_addr *daddr,