ipv6: make lookups simpler and faster
authorEric Dumazet <edumazet@google.com>
Thu, 3 Oct 2013 22:42:29 +0000 (15:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Oct 2013 04:01:25 +0000 (00:01 -0400)
commitefe4208f47f907b86f528788da711e8ab9dea44d
tree8246b487be087877ba26d166f629d8c53d553ec1
parent05dbc7b59481ca891bbcfe6799a562d48159fbf7
ipv6: make lookups simpler and faster

TCP listener refactoring, part 4 :

To speed up inet lookups, we moved IPv4 addresses from inet to struct
sock_common

Now is time to do the same for IPv6, because it permits us to have fast
lookups for all kind of sockets, including upcoming SYN_RECV.

Getting IPv6 addresses in TCP lookups currently requires two extra cache
lines, plus a dereference (and memory stall).

inet6_sk(sk) does the dereference of inet_sk(__sk)->pinet6

This patch is way bigger than its IPv4 counter part, because for IPv4,
we could add aliases (inet_daddr, inet_rcv_saddr), while on IPv6,
it's not doable easily.

inet6_sk(sk)->daddr becomes sk->sk_v6_daddr
inet6_sk(sk)->rcv_saddr becomes sk->sk_v6_rcv_saddr

And timewait socket also have tw->tw_v6_daddr & tw->tw_v6_rcv_saddr
at the same offset.

We get rid of INET6_TW_MATCH() as INET6_MATCH() is now the generic
macro.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
35 files changed:
include/linux/ipv6.h
include/net/inet6_hashtables.h
include/net/inet_timewait_sock.h
include/net/ip.h
include/net/ip6_checksum.h
include/net/sock.h
net/dccp/ipv6.c
net/dccp/ipv6.h
net/dccp/minisocks.c
net/ipv4/inet_diag.c
net/ipv4/ping.c
net/ipv4/tcp_metrics.c
net/ipv4/tcp_minisocks.c
net/ipv4/tcp_probe.c
net/ipv4/tcp_timer.c
net/ipv6/af_inet6.c
net/ipv6/datagram.c
net/ipv6/inet6_connection_sock.c
net/ipv6/inet6_hashtables.c
net/ipv6/ipv6_sockglue.c
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
net/ipv6/ping.c
net/ipv6/raw.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c
net/l2tp/l2tp_core.c
net/l2tp/l2tp_debugfs.c
net/l2tp/l2tp_ip6.c
net/l2tp/l2tp_netlink.c
net/l2tp/l2tp_ppp.c
net/netfilter/xt_TPROXY.c
net/netfilter/xt_socket.c
net/sctp/ipv6.c
net/sunrpc/svcsock.c
security/lsm_audit.c