aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2013-01-22 04:50:39 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-23 13:44:01 -0500
commit5ba24953e9707387cce87b07f0d5fbdd03c5c11b (patch)
treec98e56f8a06f07ff585f85cbe6af8cd9c19f2ca6 /include
parentba418fa357a7b3c9d477f4706c6c7c96ddbd1360 (diff)
soreuseport: TCP/IPv6 implementation
Motivation for soreuseport would be something like a web server binding to port 80 running with multiple threads, where each thread might have it's own listener socket. This could be done as an alternative to other models: 1) have one listener thread which dispatches completed connections to workers. 2) accept on a single listener socket from multiple threads. In case #1 the listener thread can easily become the bottleneck with high connection turn-over rate. In case #2, the proportion of connections accepted per thread tends to be uneven under high connection load (assuming simple event loop: while (1) { accept(); process() }, wakeup does not promote fairness among the sockets. We have seen the disproportion to be as high as 3:1 ratio between thread accepting most connections and the one accepting the fewest. With so_reusport the distribution is uniform. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/inet6_hashtables.h5
-rw-r--r--include/net/netfilter/nf_tproxy_core.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 9e34c877a770..7ca75cbbf75e 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -71,6 +71,8 @@ extern struct sock *__inet6_lookup_established(struct net *net,
71 71
72extern struct sock *inet6_lookup_listener(struct net *net, 72extern struct sock *inet6_lookup_listener(struct net *net,
73 struct inet_hashinfo *hashinfo, 73 struct inet_hashinfo *hashinfo,
74 const struct in6_addr *saddr,
75 const __be16 sport,
74 const struct in6_addr *daddr, 76 const struct in6_addr *daddr,
75 const unsigned short hnum, 77 const unsigned short hnum,
76 const int dif); 78 const int dif);
@@ -88,7 +90,8 @@ static inline struct sock *__inet6_lookup(struct net *net,
88 if (sk) 90 if (sk)
89 return sk; 91 return sk;
90 92
91 return inet6_lookup_listener(net, hashinfo, daddr, hnum, dif); 93 return inet6_lookup_listener(net, hashinfo, saddr, sport,
94 daddr, hnum, dif);
92} 95}
93 96
94static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, 97static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h
index 193796445642..36d9379d4c4b 100644
--- a/include/net/netfilter/nf_tproxy_core.h
+++ b/include/net/netfilter/nf_tproxy_core.h
@@ -152,6 +152,7 @@ nf_tproxy_get_sock_v6(struct net *net, const u8 protocol,
152 break; 152 break;
153 case NFT_LOOKUP_LISTENER: 153 case NFT_LOOKUP_LISTENER:
154 sk = inet6_lookup_listener(net, &tcp_hashinfo, 154 sk = inet6_lookup_listener(net, &tcp_hashinfo,
155 saddr, sport,
155 daddr, ntohs(dport), 156 daddr, ntohs(dport),
156 in->ifindex); 157 in->ifindex);
157 158