All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 1/2] tcp: fix lost retransmit SNMP under-counting
@ 2017-04-04 21:15 Yuchung Cheng
  2017-04-04 21:15 ` [PATCH net 2/2] tcp: fix reordering " Yuchung Cheng
  2017-04-06  1:41 ` [PATCH net 1/2] tcp: fix lost retransmit " David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Yuchung Cheng @ 2017-04-04 21:15 UTC (permalink / raw)
  To: davem; +Cc: netdev, ncardwell, edumazet, soheil, Yuchung Cheng

The lost retransmit SNMP stat is under-counting retransmission
that uses segment offloading. This patch fixes that so all
retransmission related SNMP counters are consistent.

Fixes: 10d3be569243 ("tcp-tso: do not split TSO packets at retransmit time")
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: Soheil Hassas Yeganeh <soheil@google.com>
---
 net/ipv4/tcp_recovery.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c
index 4ecb38ae8504..d8acbd9f477a 100644
--- a/net/ipv4/tcp_recovery.c
+++ b/net/ipv4/tcp_recovery.c
@@ -12,7 +12,8 @@ static void tcp_rack_mark_skb_lost(struct sock *sk, struct sk_buff *skb)
 		/* Account for retransmits that are lost again */
 		TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS;
 		tp->retrans_out -= tcp_skb_pcount(skb);
-		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPLOSTRETRANSMIT);
+		NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPLOSTRETRANSMIT,
+			      tcp_skb_pcount(skb));
 	}
 }
 
-- 
2.12.2.715.g7642488e1d-goog

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

* [PATCH net 2/2] tcp: fix reordering SNMP under-counting
  2017-04-04 21:15 [PATCH net 1/2] tcp: fix lost retransmit SNMP under-counting Yuchung Cheng
@ 2017-04-04 21:15 ` Yuchung Cheng
  2017-04-06  1:42   ` David Miller
  2017-04-06  1:41 ` [PATCH net 1/2] tcp: fix lost retransmit " David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Yuchung Cheng @ 2017-04-04 21:15 UTC (permalink / raw)
  To: davem; +Cc: netdev, ncardwell, edumazet, soheil, Yuchung Cheng

Currently the reordering SNMP counters only increase if a connection
sees a higher degree then it has previously seen. It ignores if the
reordering degree is not greater than the default system threshold.
This significantly under-counts the number of reordering events
and falsely convey that reordering is rare on the network.

This patch properly and faithfully records the number of reordering
events detected by the TCP stack, just like the comment says "this
exciting event is worth to be remembered". Note that even so TCP
still under-estimate the actual reordering events because TCP
requires TS options or certain packet sequences to detect reordering
(i.e. ACKing never-retransmitted sequence in recovery or disordered
 state).

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: Soheil Hassas Yeganeh <soheil@google.com>
---
 net/ipv4/tcp_input.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a75c48f62e27..5bfe17fc8064 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -874,22 +874,11 @@ static void tcp_update_reordering(struct sock *sk, const int metric,
 				  const int ts)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
-	if (metric > tp->reordering) {
-		int mib_idx;
+	int mib_idx;
 
+	if (metric > tp->reordering) {
 		tp->reordering = min(sysctl_tcp_max_reordering, metric);
 
-		/* This exciting event is worth to be remembered. 8) */
-		if (ts)
-			mib_idx = LINUX_MIB_TCPTSREORDER;
-		else if (tcp_is_reno(tp))
-			mib_idx = LINUX_MIB_TCPRENOREORDER;
-		else if (tcp_is_fack(tp))
-			mib_idx = LINUX_MIB_TCPFACKREORDER;
-		else
-			mib_idx = LINUX_MIB_TCPSACKREORDER;
-
-		NET_INC_STATS(sock_net(sk), mib_idx);
 #if FASTRETRANS_DEBUG > 1
 		pr_debug("Disorder%d %d %u f%u s%u rr%d\n",
 			 tp->rx_opt.sack_ok, inet_csk(sk)->icsk_ca_state,
@@ -902,6 +891,18 @@ static void tcp_update_reordering(struct sock *sk, const int metric,
 	}
 
 	tp->rack.reord = 1;
+
+	/* This exciting event is worth to be remembered. 8) */
+	if (ts)
+		mib_idx = LINUX_MIB_TCPTSREORDER;
+	else if (tcp_is_reno(tp))
+		mib_idx = LINUX_MIB_TCPRENOREORDER;
+	else if (tcp_is_fack(tp))
+		mib_idx = LINUX_MIB_TCPFACKREORDER;
+	else
+		mib_idx = LINUX_MIB_TCPSACKREORDER;
+
+	NET_INC_STATS(sock_net(sk), mib_idx);
 }
 
 /* This must be called before lost_out is incremented */
-- 
2.12.2.715.g7642488e1d-goog

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

* Re: [PATCH net 1/2] tcp: fix lost retransmit SNMP under-counting
  2017-04-04 21:15 [PATCH net 1/2] tcp: fix lost retransmit SNMP under-counting Yuchung Cheng
  2017-04-04 21:15 ` [PATCH net 2/2] tcp: fix reordering " Yuchung Cheng
@ 2017-04-06  1:41 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2017-04-06  1:41 UTC (permalink / raw)
  To: ycheng; +Cc: netdev, ncardwell, edumazet, soheil

From: Yuchung Cheng <ycheng@google.com>
Date: Tue,  4 Apr 2017 14:15:39 -0700

> The lost retransmit SNMP stat is under-counting retransmission
> that uses segment offloading. This patch fixes that so all
> retransmission related SNMP counters are consistent.
> 
> Fixes: 10d3be569243 ("tcp-tso: do not split TSO packets at retransmit time")
> 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: Soheil Hassas Yeganeh <soheil@google.com>

Applied.

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

* Re: [PATCH net 2/2] tcp: fix reordering SNMP under-counting
  2017-04-04 21:15 ` [PATCH net 2/2] tcp: fix reordering " Yuchung Cheng
@ 2017-04-06  1:42   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-04-06  1:42 UTC (permalink / raw)
  To: ycheng; +Cc: netdev, ncardwell, edumazet, soheil

From: Yuchung Cheng <ycheng@google.com>
Date: Tue,  4 Apr 2017 14:15:40 -0700

> Currently the reordering SNMP counters only increase if a connection
> sees a higher degree then it has previously seen. It ignores if the
> reordering degree is not greater than the default system threshold.
> This significantly under-counts the number of reordering events
> and falsely convey that reordering is rare on the network.
> 
> This patch properly and faithfully records the number of reordering
> events detected by the TCP stack, just like the comment says "this
> exciting event is worth to be remembered". Note that even so TCP
> still under-estimate the actual reordering events because TCP
> requires TS options or certain packet sequences to detect reordering
> (i.e. ACKing never-retransmitted sequence in recovery or disordered
>  state).
> 
> 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: Soheil Hassas Yeganeh <soheil@google.com>

Applied.

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

end of thread, other threads:[~2017-04-06  1:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 21:15 [PATCH net 1/2] tcp: fix lost retransmit SNMP under-counting Yuchung Cheng
2017-04-04 21:15 ` [PATCH net 2/2] tcp: fix reordering " Yuchung Cheng
2017-04-06  1:42   ` David Miller
2017-04-06  1:41 ` [PATCH net 1/2] tcp: fix lost retransmit " 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.