aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_timer.c
diff options
context:
space:
mode:
authorYuchung Cheng <ycheng@google.com>2018-11-28 19:06:45 -0500
committerDavid S. Miller <davem@davemloft.net>2018-11-30 20:22:41 -0500
commite1561fe2dd69dc5dddd69bd73aa65355bdfb048b (patch)
tree40da17c4bfcd170c22ffd81e392f3f3c54407270 /net/ipv4/tcp_timer.c
parentec641b39457e17774313b66697a8a1dc070257bd (diff)
tcp: fix SNMP TCP timeout under-estimation
Previously the SNMP TCPTIMEOUTS counter has inconsistent accounting: 1. It counts all SYN and SYN-ACK timeouts 2. It counts timeouts in other states except recurring timeouts and timeouts after fast recovery or disorder state. Such selective accounting makes analysis difficult and complicated. For example the monitoring system needs to collect many other SNMP counters to infer the total amount of timeout events. This patch makes TCPTIMEOUTS counter simply counts all the retransmit timeout (SYN or data or FIN). Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_timer.c')
-rw-r--r--net/ipv4/tcp_timer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 25efdae4368a..f87dbc78b6bc 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -484,11 +484,12 @@ void tcp_retransmit_timer(struct sock *sk)
484 goto out_reset_timer; 484 goto out_reset_timer;
485 } 485 }
486 486
487 __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPTIMEOUTS);
487 if (tcp_write_timeout(sk)) 488 if (tcp_write_timeout(sk))
488 goto out; 489 goto out;
489 490
490 if (icsk->icsk_retransmits == 0) { 491 if (icsk->icsk_retransmits == 0) {
491 int mib_idx; 492 int mib_idx = 0;
492 493
493 if (icsk->icsk_ca_state == TCP_CA_Recovery) { 494 if (icsk->icsk_ca_state == TCP_CA_Recovery) {
494 if (tcp_is_sack(tp)) 495 if (tcp_is_sack(tp))
@@ -503,10 +504,9 @@ void tcp_retransmit_timer(struct sock *sk)
503 mib_idx = LINUX_MIB_TCPSACKFAILURES; 504 mib_idx = LINUX_MIB_TCPSACKFAILURES;
504 else 505 else
505 mib_idx = LINUX_MIB_TCPRENOFAILURES; 506 mib_idx = LINUX_MIB_TCPRENOFAILURES;
506 } else {
507 mib_idx = LINUX_MIB_TCPTIMEOUTS;
508 } 507 }
509 __NET_INC_STATS(sock_net(sk), mib_idx); 508 if (mib_idx)
509 __NET_INC_STATS(sock_net(sk), mib_idx);
510 } 510 }
511 511
512 tcp_enter_loss(sk); 512 tcp_enter_loss(sk);