Commit 7e32b443 authored by Yuchung Cheng's avatar Yuchung Cheng Committed by David S. Miller

tcp: properly account Fast Open SYN-ACK retrans

Since the TFO socket is accepted right off SYN-data, the socket
owner can call getsockopt(TCP_INFO) to collect ongoing SYN-ACK
retransmission or timeout stats (i.e., tcpi_total_retrans,
tcpi_retransmits). Currently those stats are only updated
upon handshake completes. This patch fixes it.
Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
Signed-off-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent de1d6578
...@@ -5885,7 +5885,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) ...@@ -5885,7 +5885,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
* so release it. * so release it.
*/ */
if (req) { if (req) {
tp->total_retrans = req->num_retrans; inet_csk(sk)->icsk_retransmits = 0;
reqsk_fastopen_remove(sk, req, false); reqsk_fastopen_remove(sk, req, false);
} else { } else {
/* Make sure socket is routed, for correct metrics. */ /* Make sure socket is routed, for correct metrics. */
......
...@@ -3568,6 +3568,8 @@ int tcp_rtx_synack(const struct sock *sk, struct request_sock *req) ...@@ -3568,6 +3568,8 @@ int tcp_rtx_synack(const struct sock *sk, struct request_sock *req)
if (!res) { if (!res) {
__TCP_INC_STATS(sock_net(sk), TCP_MIB_RETRANSSEGS); __TCP_INC_STATS(sock_net(sk), TCP_MIB_RETRANSSEGS);
__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSYNRETRANS); __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSYNRETRANS);
if (unlikely(tcp_passive_fastopen(sk)))
tcp_sk(sk)->total_retrans++;
} }
return res; return res;
} }
......
...@@ -384,6 +384,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk) ...@@ -384,6 +384,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk)
*/ */
inet_rtx_syn_ack(sk, req); inet_rtx_syn_ack(sk, req);
req->num_timeout++; req->num_timeout++;
icsk->icsk_retransmits++;
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX); TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment