[PATCH net-next 09/17] tcp: cleanup ca_state mess in tcp_timer

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ilpo Järvinen
Date: Saturday, February 28, 2009 - 7:44 am

From: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>

Redundant checks made indentation impossible to follow.
However, it might be useful to make this ca_state+is_sack
indexed array.

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

diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 0170e91..b144a26 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -328,19 +328,16 @@ static void tcp_retransmit_timer(struct sock *sk)
 	if (icsk->icsk_retransmits == 0) {
 		int mib_idx;
 
-		if (icsk->icsk_ca_state == TCP_CA_Disorder ||
-		    icsk->icsk_ca_state == TCP_CA_Recovery) {
-			if (tcp_is_sack(tp)) {
-				if (icsk->icsk_ca_state == TCP_CA_Recovery)
-					mib_idx = LINUX_MIB_TCPSACKRECOVERYFAIL;
-				else
-					mib_idx = LINUX_MIB_TCPSACKFAILURES;
-			} else {
-				if (icsk->icsk_ca_state == TCP_CA_Recovery)
-					mib_idx = LINUX_MIB_TCPRENORECOVERYFAIL;
-				else
-					mib_idx = LINUX_MIB_TCPRENOFAILURES;
-			}
+		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 (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 {
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/17]: tcp &amp; more tcp, Ilpo Järvinen, (Sat Feb 28, 7:44 am)
[PATCH net-2.6 01/17] tcp: fix retrans_out leaks, Ilpo Järvinen, (Sat Feb 28, 7:44 am)
[PATCH net-next 02/17] tcp: don't backtrack to sacked skbs, Ilpo Järvinen, (Sat Feb 28, 7:44 am)
[PATCH net-next 03/17] tcp: fix lost_cnt_hint miscounts, Ilpo Järvinen, (Sat Feb 28, 7:44 am)
[PATCH net-next 09/17] tcp: cleanup ca_state mess in tcp_timer, Ilpo Järvinen, (Sat Feb 28, 7:44 am)
[PATCH net-next 11/17] htcp: merge icsk_ca_state compare, Ilpo Järvinen, (Sat Feb 28, 7:44 am)
[PATCH net-next 12/17] tcp: add helper for AI algorithm, Ilpo Järvinen, (Sat Feb 28, 7:44 am)
[PATCH net-next 14/17] tcp: remove pointless .dsack code, Ilpo Järvinen, (Sat Feb 28, 7:44 am)
Re: [PATCH net-2.6 01/17] tcp: fix retrans_out leaks, David Miller, (Sun Mar 1, 1:22 am)