tcp: fix under-accounting retransmit SNMP counters
Subsystems (3)
PATCH 1/1 tcp: fix under-accounting retransmit SNMP counters
This patch fixes these under-accounting SNMP rtx stats LINUX_MIB_TCPFORWARDRETRANS LINUX_MIB_TCPFASTRETRANS LINUX_MIB_TCPSLOWSTARTRETRANS
when retransmitting TSO packets
--- net/ipv4/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_output.c +1 -1
@@ -2822,7 +2822,7 @@ begin_fwd:if (tcp_retransmit_skb (sk, skb, segs))return ; -NET_INC_STATS (sock_net (sk), mib_idx); +NET_ADD_STATS (sock_net (sk), mib_idx,tcp_skb_pcount (skb));if (tcp_in_cwnd_reduction (sk)) tp->prr_out +=tcp_skb_pcount (skb);
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH 1/1 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.
--- net/ipv4/tcp_input.c | 2 +- net/ipv4/tcp_output.c | 2 ++ net/ipv4/tcp_timer.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-)
net/ipv4/tcp_input.c +1 -1
@@ -5852,7 +5852,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)* so release it. */ if (req) { - tp->total_retrans = req->num_retrans; +inet_csk (sk)->icsk_retransmits =0 ;reqsk_fastopen_remove (sk, req, false); }else {/* Make sure socket is routed, for correct metrics. */
net/ipv4/tcp_output.c +2 -0
@@ -3559,6 +3559,8 @@ int tcp_rtx_synack(const struct sock *sk, struct request_sock *req)if (!res) {__TCP_INC_STATS (sock_net (sk),TCP_MIB_RETRANSSEGS );__NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPSYNRETRANS ); +if (unlikely (tcp_passive_fastopen (sk))) +tcp_sk (sk)->total_retrans++; }return res; }
net/ipv4/tcp_timer.c +1 -0
@@ -346,6 +346,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk)*/ inet_rtx_syn_ack (sk, req); req->num_timeout++; + icsk->icsk_retransmits++;inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS ,TCP_TIMEOUT_INIT << req->num_timeout,TCP_RTO_MAX ); }
Signature · 1 line
2.8.0.rc3.226.g39d4020
Re: [PATCH net] tcp: properly account Fast Open SYN-ACK retrans
From: Yuchung Cheng <[email protected]>
Date: Wed, 21 Sep 2016 16:16:15 -0700
Quoted 10 lines
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 Yuchung Cheng <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Signed-off-by Neal Cardwell <[email protected]>Signed-off-by Soheil Hassas Yeganeh <[email protected]>
Applied.
Quoted 9 lines · Yuchung Cheng
This patch fixes these under-accounting SNMP rtx stats
LINUX_MIB_TCPFORWARDRETRANSLINUX_MIB_TCPFASTRETRANSLINUX_MIB_TCPSLOWSTARTRETRANS
when retransmitting TSO packetsFixes 10d3be569243 ("tcp-tso: do not split TSO packets at retransmit time")Signed-off-by Yuchung Cheng <[email protected]>---
Good catch, thanks Yuchung !
From: Yuchung Cheng <[email protected]>
Date: Wed, 21 Sep 2016 16:16:14 -0700
Quoted 8 lines
This patch fixes these under-accounting SNMP rtx stats
LINUX_MIB_TCPFORWARDRETRANSLINUX_MIB_TCPFASTRETRANSLINUX_MIB_TCPSLOWSTARTRETRANS
when retransmitting TSO packetsFixes 10d3be569243 ("tcp-tso: do not split TSO packets at retransmit time")Signed-off-by Yuchung Cheng <[email protected]>
Applied.