diff options
author | Eric Dumazet <edumazet@google.com> | 2015-03-17 21:32:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-17 22:01:56 -0400 |
commit | 4e9a578e5b6bdfa8b7fed7a41f28a86a7cffc85f (patch) | |
tree | 2aa5dfb5e6885aaa15b6802ec6bffba15f4099f4 /include/net/request_sock.h | |
parent | e49bb337d77d54afebe4fe5b9008955e1337f83d (diff) |
inet: add rsk_listener field to struct request_sock
Once we'll be able to lookup request sockets in ehash table,
we'll need to get access to listener which created this request.
This avoid doing a lookup to find the listener, which benefits
for a more solid SO_REUSEPORT, and is needed once we no
longer queue request sock into a listener private queue.
Note that 'struct tcp_request_sock'->listener could be reduced
to a single bit, as TFO listener should match req->rsk_listener.
TFO will no longer need to hold a reference on the listener.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/request_sock.h')
-rw-r--r-- | include/net/request_sock.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index 56dc2faba47e..723d1cbdf20e 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
@@ -52,6 +52,7 @@ struct request_sock { | |||
52 | #define rsk_refcnt __req_common.skc_refcnt | 52 | #define rsk_refcnt __req_common.skc_refcnt |
53 | 53 | ||
54 | struct request_sock *dl_next; | 54 | struct request_sock *dl_next; |
55 | struct sock *rsk_listener; | ||
55 | u16 mss; | 56 | u16 mss; |
56 | u8 num_retrans; /* number of retransmits */ | 57 | u8 num_retrans; /* number of retransmits */ |
57 | u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */ | 58 | u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */ |
@@ -67,13 +68,16 @@ struct request_sock { | |||
67 | u32 peer_secid; | 68 | u32 peer_secid; |
68 | }; | 69 | }; |
69 | 70 | ||
70 | static inline struct request_sock *reqsk_alloc(const struct request_sock_ops *ops) | 71 | static inline struct request_sock * |
72 | reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener) | ||
71 | { | 73 | { |
72 | struct request_sock *req = kmem_cache_alloc(ops->slab, GFP_ATOMIC); | 74 | struct request_sock *req = kmem_cache_alloc(ops->slab, GFP_ATOMIC); |
73 | 75 | ||
74 | if (req != NULL) | 76 | if (req) { |
75 | req->rsk_ops = ops; | 77 | req->rsk_ops = ops; |
76 | 78 | sock_hold(sk_listener); | |
79 | req->rsk_listener = sk_listener; | ||
80 | } | ||
77 | return req; | 81 | return req; |
78 | } | 82 | } |
79 | 83 | ||
@@ -88,6 +92,8 @@ static inline void reqsk_free(struct request_sock *req) | |||
88 | WARN_ON_ONCE(atomic_read(&req->rsk_refcnt) != 0); | 92 | WARN_ON_ONCE(atomic_read(&req->rsk_refcnt) != 0); |
89 | 93 | ||
90 | req->rsk_ops->destructor(req); | 94 | req->rsk_ops->destructor(req); |
95 | if (req->rsk_listener) | ||
96 | sock_put(req->rsk_listener); | ||
91 | kmem_cache_free(req->rsk_ops->slab, req); | 97 | kmem_cache_free(req->rsk_ops->slab, req); |
92 | } | 98 | } |
93 | 99 | ||