Commit c940587b authored by Xiaoliang (David) Wei's avatar Xiaoliang (David) Wei Committed by David S. Miller

[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: default avatarXiaoliang (David) Wei <davidwei79@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5c81833c
...@@ -266,26 +266,25 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, ...@@ -266,26 +266,25 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack,
*/ */
diff = (old_wnd << V_PARAM_SHIFT) - target_cwnd; diff = (old_wnd << V_PARAM_SHIFT) - target_cwnd;
if (tp->snd_cwnd <= tp->snd_ssthresh) { if (diff > gamma && tp->snd_ssthresh > 2 ) {
/* Slow start. */ /* Going too fast. Time to slow down
if (diff > gamma) { * and switch to congestion avoidance.
/* Going too fast. Time to slow down */
* and switch to congestion avoidance. tp->snd_ssthresh = 2;
*/
tp->snd_ssthresh = 2; /* Set cwnd to match the actual rate
* exactly:
/* Set cwnd to match the actual rate * cwnd = (actual rate) * baseRTT
* exactly: * Then we add 1 because the integer
* cwnd = (actual rate) * baseRTT * truncation robs us of full link
* Then we add 1 because the integer * utilization.
* truncation robs us of full link */
* utilization. tp->snd_cwnd = min(tp->snd_cwnd,
*/ (target_cwnd >>
tp->snd_cwnd = min(tp->snd_cwnd, V_PARAM_SHIFT)+1);
(target_cwnd >>
V_PARAM_SHIFT)+1);
} } else if (tp->snd_cwnd <= tp->snd_ssthresh) {
/* Slow start. */
tcp_slow_start(tp); tcp_slow_start(tp);
} else { } else {
/* Congestion avoidance. */ /* Congestion avoidance. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment