All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/3] fixes in timeout and retransmission accounting
@ 2018-11-29  0:06 Yuchung Cheng
  2018-11-29  0:06 ` [PATCH net 1/3] tcp: fix off-by-one bug on aborting window-probing socket Yuchung Cheng
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Yuchung Cheng @ 2018-11-29  0:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, edumazet, ncardwell, Yuchung Cheng

This patch set has assorted fixes of minor accounting issues in
timeout, window probe, and retransmission stats.

Yuchung Cheng (3):
  tcp: fix off-by-one bug on aborting window-probing socket
  tcp: fix SNMP under-estimation on failed retransmission
  tcp: fix SNMP TCP timeout under-estimation

 net/ipv4/tcp_output.c |  2 +-
 net/ipv4/tcp_timer.c  | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.20.0.rc0.387.gc7a69e6b6c-goog

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net 1/3] tcp: fix off-by-one bug on aborting window-probing socket
  2018-11-29  0:06 [PATCH net 0/3] fixes in timeout and retransmission accounting Yuchung Cheng
@ 2018-11-29  0:06 ` Yuchung Cheng
  2018-11-29  0:06 ` [PATCH net 2/3] tcp: fix SNMP under-estimation on failed retransmission Yuchung Cheng
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Yuchung Cheng @ 2018-11-29  0:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, edumazet, ncardwell, Yuchung Cheng

Previously there is an off-by-one bug on determining when to abort
a stalled window-probing socket. This patch fixes that so it is
consistent with tcp_write_timeout().

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
 net/ipv4/tcp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 5f8b6d3cd855..94d858c604f6 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -376,7 +376,7 @@ static void tcp_probe_timer(struct sock *sk)
 			return;
 	}
 
-	if (icsk->icsk_probes_out > max_probes) {
+	if (icsk->icsk_probes_out >= max_probes) {
 abort:		tcp_write_err(sk);
 	} else {
 		/* Only send another probe if we didn't close things up. */
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 2/3] tcp: fix SNMP under-estimation on failed retransmission
  2018-11-29  0:06 [PATCH net 0/3] fixes in timeout and retransmission accounting Yuchung Cheng
  2018-11-29  0:06 ` [PATCH net 1/3] tcp: fix off-by-one bug on aborting window-probing socket Yuchung Cheng
@ 2018-11-29  0:06 ` Yuchung Cheng
  2018-11-29  0:06 ` [PATCH net 3/3] tcp: fix SNMP TCP timeout under-estimation Yuchung Cheng
  2018-12-01  1:23 ` [PATCH net 0/3] fixes in timeout and retransmission accounting David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Yuchung Cheng @ 2018-11-29  0:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, edumazet, ncardwell, Yuchung Cheng

Previously the SNMP counter LINUX_MIB_TCPRETRANSFAIL is not counting
the TSO/GSO properly on failed retransmission. This patch fixes that.

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
 net/ipv4/tcp_output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index c5dc4c4fdadd..87bd1c61f4bf 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2929,7 +2929,7 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)
 		TCP_SKB_CB(skb)->sacked |= TCPCB_EVER_RETRANS;
 		trace_tcp_retransmit_skb(sk, skb);
 	} else if (err != -EBUSY) {
-		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRETRANSFAIL);
+		NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPRETRANSFAIL, segs);
 	}
 	return err;
 }
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 3/3] tcp: fix SNMP TCP timeout under-estimation
  2018-11-29  0:06 [PATCH net 0/3] fixes in timeout and retransmission accounting Yuchung Cheng
  2018-11-29  0:06 ` [PATCH net 1/3] tcp: fix off-by-one bug on aborting window-probing socket Yuchung Cheng
  2018-11-29  0:06 ` [PATCH net 2/3] tcp: fix SNMP under-estimation on failed retransmission Yuchung Cheng
@ 2018-11-29  0:06 ` Yuchung Cheng
  2018-12-01  1:23 ` [PATCH net 0/3] fixes in timeout and retransmission accounting David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Yuchung Cheng @ 2018-11-29  0:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, edumazet, ncardwell, Yuchung Cheng

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>
---
 net/ipv4/tcp_timer.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 94d858c604f6..5cd02b7b62f6 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -482,11 +482,12 @@ void tcp_retransmit_timer(struct sock *sk)
 		goto out_reset_timer;
 	}
 
+	__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPTIMEOUTS);
 	if (tcp_write_timeout(sk))
 		goto out;
 
 	if (icsk->icsk_retransmits == 0) {
-		int mib_idx;
+		int mib_idx = 0;
 
 		if (icsk->icsk_ca_state == TCP_CA_Recovery) {
 			if (tcp_is_sack(tp))
@@ -501,10 +502,9 @@ void tcp_retransmit_timer(struct sock *sk)
 				mib_idx = LINUX_MIB_TCPSACKFAILURES;
 			else
 				mib_idx = LINUX_MIB_TCPRENOFAILURES;
-		} else {
-			mib_idx = LINUX_MIB_TCPTIMEOUTS;
 		}
-		__NET_INC_STATS(sock_net(sk), mib_idx);
+		if (mib_idx)
+			__NET_INC_STATS(sock_net(sk), mib_idx);
 	}
 
 	tcp_enter_loss(sk);
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net 0/3] fixes in timeout and retransmission accounting
  2018-11-29  0:06 [PATCH net 0/3] fixes in timeout and retransmission accounting Yuchung Cheng
                   ` (2 preceding siblings ...)
  2018-11-29  0:06 ` [PATCH net 3/3] tcp: fix SNMP TCP timeout under-estimation Yuchung Cheng
@ 2018-12-01  1:23 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-12-01  1:23 UTC (permalink / raw)
  To: ycheng; +Cc: netdev, edumazet, ncardwell

From: Yuchung Cheng <ycheng@google.com>
Date: Wed, 28 Nov 2018 16:06:42 -0800

> This patch set has assorted fixes of minor accounting issues in
> timeout, window probe, and retransmission stats.

Looks good, series applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-12-01 12:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29  0:06 [PATCH net 0/3] fixes in timeout and retransmission accounting Yuchung Cheng
2018-11-29  0:06 ` [PATCH net 1/3] tcp: fix off-by-one bug on aborting window-probing socket Yuchung Cheng
2018-11-29  0:06 ` [PATCH net 2/3] tcp: fix SNMP under-estimation on failed retransmission Yuchung Cheng
2018-11-29  0:06 ` [PATCH net 3/3] tcp: fix SNMP TCP timeout under-estimation Yuchung Cheng
2018-12-01  1:23 ` [PATCH net 0/3] fixes in timeout and retransmission accounting David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.