aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_minisocks.c
diff options
context:
space:
mode:
authorNeal Cardwell <ncardwell@google.com>2012-09-22 00:18:56 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-22 15:47:10 -0400
commit072539880156fafd86c753070e598c23e8e74586 (patch)
treebbecfbbcbf46bedda82d5816ee26518903b82ee2 /net/ipv4/tcp_minisocks.c
parent016818d076871c4ee34db1e8d74dc17ac1de626a (diff)
tcp: TCP Fast Open Server - note timestamps and retransmits for SYNACK RTT
Previously, when using TCP Fast Open a server would return from tcp_check_req() before updating snt_synack based on TCP timestamp echo replies and whether or not we've retransmitted the SYNACK. The result was that (a) for TFO connections using timestamps we used an incorrect baseline SYNACK send time (tcp_time_stamp of SYNACK send instead of rcv_tsecr), and (b) for TFO connections that do not have TCP timestamps but retransmit the SYNACK we took a SYNACK RTT sample when we should not take a sample. This fix merely moves the snt_synack update logic a bit earlier in the function, so that connections using TCP Fast Open will properly do these updates when the ACK for the SYNACK arrives. Moving this snt_synack update logic means that with TCP_DEFER_ACCEPT enabled we do a few instructions of wasted work on each bare ACK, but that seems OK. Signed-off-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_minisocks.c')
-rw-r--r--net/ipv4/tcp_minisocks.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 5792577b5bc5..27536ba16c9d 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -692,6 +692,12 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
692 if (!(flg & TCP_FLAG_ACK)) 692 if (!(flg & TCP_FLAG_ACK))
693 return NULL; 693 return NULL;
694 694
695 /* Got ACK for our SYNACK, so update baseline for SYNACK RTT sample. */
696 if (tmp_opt.saw_tstamp && tmp_opt.rcv_tsecr)
697 tcp_rsk(req)->snt_synack = tmp_opt.rcv_tsecr;
698 else if (req->retrans) /* don't take RTT sample if retrans && ~TS */
699 tcp_rsk(req)->snt_synack = 0;
700
695 /* For Fast Open no more processing is needed (sk is the 701 /* For Fast Open no more processing is needed (sk is the
696 * child socket). 702 * child socket).
697 */ 703 */
@@ -705,10 +711,6 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
705 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPDEFERACCEPTDROP); 711 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPDEFERACCEPTDROP);
706 return NULL; 712 return NULL;
707 } 713 }
708 if (tmp_opt.saw_tstamp && tmp_opt.rcv_tsecr)
709 tcp_rsk(req)->snt_synack = tmp_opt.rcv_tsecr;
710 else if (req->retrans) /* don't take RTT sample if retrans && ~TS */
711 tcp_rsk(req)->snt_synack = 0;
712 714
713 /* OK, ACK is valid, create big socket and 715 /* OK, ACK is valid, create big socket and
714 * feed this segment to it. It will repeat all 716 * feed this segment to it. It will repeat all