aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ipv6_sockglue.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2014-06-27 11:36:16 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-02 02:46:21 -0400
commit9fe516ba3fb29b6f6a752ffd93342fdee500ec01 (patch)
tree4254ea02ed5d51d92fd7109d33d28bc95b8d3fb1 /net/ipv6/ipv6_sockglue.c
parent090cce42639c2c82bce2cc26a902e4c674c62882 (diff)
inet: move ipv6only in sock_common
When an UDP application switches from AF_INET to AF_INET6 sockets, we have a small performance degradation for IPv4 communications because of extra cache line misses to access ipv6only information. This can also be noticed for TCP listeners, as ipv6_only_sock() is also used from __inet_lookup_listener()->compute_score() This is magnified when SO_REUSEPORT is used. Move ipv6only into struct sock_common so that it is available at no extra cost in lookups. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ipv6_sockglue.c')
-rw-r--r--net/ipv6/ipv6_sockglue.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index edb58aff4ae7..cc34f65179e4 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -235,7 +235,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
235 if (optlen < sizeof(int) || 235 if (optlen < sizeof(int) ||
236 inet_sk(sk)->inet_num) 236 inet_sk(sk)->inet_num)
237 goto e_inval; 237 goto e_inval;
238 np->ipv6only = valbool; 238 sk->sk_ipv6only = valbool;
239 retv = 0; 239 retv = 0;
240 break; 240 break;
241 241
@@ -1058,7 +1058,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
1058 } 1058 }
1059 1059
1060 case IPV6_V6ONLY: 1060 case IPV6_V6ONLY:
1061 val = np->ipv6only; 1061 val = sk->sk_ipv6only;
1062 break; 1062 break;
1063 1063
1064 case IPV6_RECVPKTINFO: 1064 case IPV6_RECVPKTINFO: