diff options
author | Jerry Chu <hkchu@google.com> | 2012-08-31 08:29:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-08-31 20:02:19 -0400 |
commit | 8336886f786fdacbc19b719c1f7ea91eb70706d4 (patch) | |
tree | c1fa912f7583ce0ffcb5ae673802da4a7dfb3b19 /include/net | |
parent | 1046716368979dee857a2b8a91c4a8833f21b9cb (diff) |
tcp: TCP Fast Open Server - support TFO listeners
This patch builds on top of the previous patch to add the support
for TFO listeners. This includes -
1. allocating, properly initializing, and managing the per listener
fastopen_queue structure when TFO is enabled
2. changes to the inet_csk_accept code to support TFO. E.g., the
request_sock can no longer be freed upon accept(), not until 3WHS
finishes
3. allowing a TCP_SYN_RECV socket to properly poll() and sendmsg()
if it's a TFO socket
4. properly closing a TFO listener, and a TFO socket before 3WHS
finishes
5. supporting TCP_FASTOPEN socket option
6. modifying tcp_check_req() to use to check a TFO socket as well
as request_sock
7. supporting TCP's TFO cookie option
8. adding a new SYN-ACK retransmit handler to use the timer directly
off the TFO socket rather than the listener socket. Note that TFO
server side will not retransmit anything other than SYN-ACK until
the 3WHS is completed.
The patch also contains an important function
"reqsk_fastopen_remove()" to manage the somewhat complex relation
between a listener, its request_sock, and the corresponding child
socket. See the comment above the function for the detail.
Signed-off-by: H.K. Jerry Chu <hkchu@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/request_sock.h | 13 | ||||
-rw-r--r-- | include/net/tcp.h | 6 |
2 files changed, 4 insertions, 15 deletions
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index c3cdd6c9f448..b01d8dd9ee7c 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
@@ -226,19 +226,6 @@ static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue | |||
226 | return req; | 226 | return req; |
227 | } | 227 | } |
228 | 228 | ||
229 | static inline struct sock *reqsk_queue_get_child(struct request_sock_queue *queue, | ||
230 | struct sock *parent) | ||
231 | { | ||
232 | struct request_sock *req = reqsk_queue_remove(queue); | ||
233 | struct sock *child = req->sk; | ||
234 | |||
235 | WARN_ON(child == NULL); | ||
236 | |||
237 | sk_acceptq_removed(parent); | ||
238 | __reqsk_free(req); | ||
239 | return child; | ||
240 | } | ||
241 | |||
242 | static inline int reqsk_queue_removed(struct request_sock_queue *queue, | 229 | static inline int reqsk_queue_removed(struct request_sock_queue *queue, |
243 | struct request_sock *req) | 230 | struct request_sock *req) |
244 | { | 231 | { |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 9f8821e3293a..1421b02a7905 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -424,7 +424,8 @@ extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock * | |||
424 | const struct tcphdr *th); | 424 | const struct tcphdr *th); |
425 | extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, | 425 | extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, |
426 | struct request_sock *req, | 426 | struct request_sock *req, |
427 | struct request_sock **prev); | 427 | struct request_sock **prev, |
428 | bool fastopen); | ||
428 | extern int tcp_child_process(struct sock *parent, struct sock *child, | 429 | extern int tcp_child_process(struct sock *parent, struct sock *child, |
429 | struct sk_buff *skb); | 430 | struct sk_buff *skb); |
430 | extern bool tcp_use_frto(struct sock *sk); | 431 | extern bool tcp_use_frto(struct sock *sk); |
@@ -478,7 +479,8 @@ extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, | |||
478 | extern int tcp_connect(struct sock *sk); | 479 | extern int tcp_connect(struct sock *sk); |
479 | extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, | 480 | extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, |
480 | struct request_sock *req, | 481 | struct request_sock *req, |
481 | struct request_values *rvp); | 482 | struct request_values *rvp, |
483 | struct tcp_fastopen_cookie *foc); | ||
482 | extern int tcp_disconnect(struct sock *sk, int flags); | 484 | extern int tcp_disconnect(struct sock *sk, int flags); |
483 | 485 | ||
484 | void tcp_connect_init(struct sock *sk); | 486 | void tcp_connect_init(struct sock *sk); |