netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcp: use correct counters in CA_CWR state too
@ 2010-10-14 11:52 Ilpo Järvinen
  2010-10-17 20:47 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ilpo Järvinen @ 2010-10-14 11:52 UTC (permalink / raw)
  To: David Miller, Netdev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1536 bytes --]

As CWR is stronger than CA_Disorder state, we can miscount
SACK/Reno failure into other timeouts. Not a bad problem as
it can happen only due to ECN, FRTO detecting spurious RTO
or xmit error which are the only callers of tcp_enter_cwr.
And even then losses and RTO must still follow thereafter
to actually end up into the relevant code paths.

Compile tested.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 net/ipv4/tcp_timer.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 74c54b3..16e591e 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -365,18 +365,19 @@ void tcp_retransmit_timer(struct sock *sk)
 	if (icsk->icsk_retransmits == 0) {
 		int mib_idx;
 
-		if (icsk->icsk_ca_state == TCP_CA_Disorder) {
-			if (tcp_is_sack(tp))
-				mib_idx = LINUX_MIB_TCPSACKFAILURES;
-			else
-				mib_idx = LINUX_MIB_TCPRENOFAILURES;
-		} else if (icsk->icsk_ca_state == TCP_CA_Recovery) {
+		if (icsk->icsk_ca_state == TCP_CA_Recovery) {
 			if (tcp_is_sack(tp))
 				mib_idx = LINUX_MIB_TCPSACKRECOVERYFAIL;
 			else
 				mib_idx = LINUX_MIB_TCPRENORECOVERYFAIL;
 		} else if (icsk->icsk_ca_state == TCP_CA_Loss) {
 			mib_idx = LINUX_MIB_TCPLOSSFAILURES;
+		} else if ((icsk->icsk_ca_state == TCP_CA_Disorder) ||
+			   tp->sacked_out) {
+			if (tcp_is_sack(tp))
+				mib_idx = LINUX_MIB_TCPSACKFAILURES;
+			else
+				mib_idx = LINUX_MIB_TCPRENOFAILURES;
 		} else {
 			mib_idx = LINUX_MIB_TCPTIMEOUTS;
 		}
-- 
1.5.6.3

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

* Re: [PATCH] tcp: use correct counters in CA_CWR state too
  2010-10-14 11:52 [PATCH] tcp: use correct counters in CA_CWR state too Ilpo Järvinen
@ 2010-10-17 20:47 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-10-17 20:47 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: netdev

From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Thu, 14 Oct 2010 14:52:09 +0300 (EEST)

> As CWR is stronger than CA_Disorder state, we can miscount
> SACK/Reno failure into other timeouts. Not a bad problem as
> it can happen only due to ECN, FRTO detecting spurious RTO
> or xmit error which are the only callers of tcp_enter_cwr.
> And even then losses and RTO must still follow thereafter
> to actually end up into the relevant code paths.
> 
> Compile tested.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>

Also applied to net-next-2.6, thanks.

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

end of thread, other threads:[~2010-10-17 20:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-14 11:52 [PATCH] tcp: use correct counters in CA_CWR state too Ilpo Järvinen
2010-10-17 20:47 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).