Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 3142

kernel-2.6.18-238.el5.src.rpm

From: Thomas Graf <tgraf@redhat.com>
Date: Fri, 23 Jul 2010 15:36:26 -0400
Subject: [net] tcp: fix Vegas bug in disabling slow start
Message-id: <20100723153626.GM14925@lsx.localdomain>
Patchwork-id: 27071
O-Subject: [RHEL5.6 PATCH 11/14] tcp: Fix Vegas bug in disabling slow start by
	gamma parameter.
Bugzilla: 612709
RH-Acked-by: Neil Horman <nhorman@redhat.com>
RH-Acked-by: David S. Miller <davem@redhat.com>

commit c940587bf603b4295a7f5e9ff8fed123368a1ef7
Author: Xiaoliang (David) Wei <davidwei79@gmail.com>
Date:   Mon Oct 29 20:24:36 2007 -0700

    [TCP] vegas: Fix a bug in disabling slow start by gamma parameter.

    TCP Vegas implementation has a bug in the process of disabling
    slow-start with gamma parameter. The bug may lead to extreme
    unfairness in the presence of early packet loss. See details in:
    http://www.cs.caltech.edu/~weixl/technical/ns2linux/known_linux/index.html#vegas

    Switch the order of "if (tp->snd_cwnd <= tp->snd_ssthresh)" statement
    and "if (diff > gamma)" statement to eliminate the problem.

    Signed-off-by: Xiaoliang (David) Wei <davidwei79@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Jarod Wilson <jarod@redhat.com>

diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c
index 2caa10a..0189f8d 100644
--- a/net/ipv4/tcp_vegas.c
+++ b/net/ipv4/tcp_vegas.c
@@ -265,26 +265,25 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack,
 			 */
 			diff = (old_wnd << V_PARAM_SHIFT) - target_cwnd;
 
-			if (tp->snd_cwnd <= tp->snd_ssthresh) {
-				/* Slow start.  */
-				if (diff > gamma) {
-					/* Going too fast. Time to slow down
-					 * and switch to congestion avoidance.
-					 */
-					tp->snd_ssthresh = 2;
-
-					/* Set cwnd to match the actual rate
-					 * exactly:
-					 *   cwnd = (actual rate) * baseRTT
-					 * Then we add 1 because the integer
-					 * truncation robs us of full link
-					 * utilization.
-					 */
-					tp->snd_cwnd = min(tp->snd_cwnd,
-							   (target_cwnd >>
-							    V_PARAM_SHIFT)+1);
+			if (diff > gamma && tp->snd_ssthresh > 2 ) {
+				/* Going too fast. Time to slow down
+				 * and switch to congestion avoidance.
+				 */
+				tp->snd_ssthresh = 2;
+
+				/* Set cwnd to match the actual rate
+				 * exactly:
+				 *   cwnd = (actual rate) * baseRTT
+				 * Then we add 1 because the integer
+				 * truncation robs us of full link
+				 * utilization.
+				 */
+				tp->snd_cwnd = min(tp->snd_cwnd,
+						   (target_cwnd >>
+						    V_PARAM_SHIFT)+1);
 
-				}
+			} else if (tp->snd_cwnd <= tp->snd_ssthresh) {
+				/* Slow start.  */
 				tcp_slow_start(tp);
 			} else {
 				/* Congestion avoidance. */