diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2008-11-21 18:49:19 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-21 18:49:19 -0500 |
commit | f757fec4b0d45dfcb52f9a914a12225a6a0a3e05 (patch) | |
tree | d8fbf1095f723f8ad19014910a92a44ff2058c16 /include/net | |
parent | 98aa9c80f1fee01e98dfdc484ab7316af45f8f17 (diff) |
net: use net_eq() in INET_MATCH and INET_TW_MATCH
We can avoid some useless instructions if !CONFIG_NET_NS
Because of RCU, we use INET_MATCH or INET_TW_MATCH twice for the found
socket, so thats six instructions less per incoming TCP packet.
Yet another tbench speedup :)
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/inet_hashtables.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 28b3ee3e8d6d..ec7ee2e46d8c 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -291,25 +291,25 @@ typedef __u64 __bitwise __addrpair; | |||
291 | ((__force __u64)(__be32)(__saddr))); | 291 | ((__force __u64)(__be32)(__saddr))); |
292 | #endif /* __BIG_ENDIAN */ | 292 | #endif /* __BIG_ENDIAN */ |
293 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 293 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
294 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ | 294 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ |
295 | ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ | 295 | ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ |
296 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 296 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ |
297 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 297 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
298 | #define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 298 | #define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
299 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ | 299 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ |
300 | ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ | 300 | ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ |
301 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ | 301 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ |
302 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 302 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
303 | #else /* 32-bit arch */ | 303 | #else /* 32-bit arch */ |
304 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) | 304 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) |
305 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ | 305 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ |
306 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ | 306 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ |
307 | (inet_sk(__sk)->daddr == (__saddr)) && \ | 307 | (inet_sk(__sk)->daddr == (__saddr)) && \ |
308 | (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ | 308 | (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ |
309 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 309 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ |
310 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 310 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
311 | #define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ | 311 | #define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ |
312 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ | 312 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ |
313 | (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ | 313 | (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ |
314 | (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ | 314 | (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ |
315 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ | 315 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ |