Commit 2edc9783 authored by Neal Cardwell's avatar Neal Cardwell Committed by Luis Henriques

tcp_yeah: don't set ssthresh below 2

commit 83d15e70 upstream.

For tcp_yeah, use an ssthresh floor of 2, the same floor used by Reno
and CUBIC, per RFC 5681 (equation 4).

tcp_yeah_ssthresh() was sometimes returning a 0 or negative ssthresh
value if the intended reduction is as big or bigger than the current
cwnd. Congestion control modules should never return a zero or
negative ssthresh. A zero ssthresh generally results in a zero cwnd,
causing the connection to stall. A negative ssthresh value will be
interpreted as a u32 and will set a target cwnd for PRR near 4
billion.

Oleksandr Natalenko reported that a system using tcp_yeah with ECN
could see a warning about a prior_cwnd of 0 in
tcp_cwnd_reduction(). Testing verified that this was due to
tcp_yeah_ssthresh() misbehaving in this way.
Reported-by: default avatarOleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 3c2a5619
...@@ -222,7 +222,7 @@ static u32 tcp_yeah_ssthresh(struct sock *sk) { ...@@ -222,7 +222,7 @@ static u32 tcp_yeah_ssthresh(struct sock *sk) {
yeah->fast_count = 0; yeah->fast_count = 0;
yeah->reno_count = max(yeah->reno_count>>1, 2U); yeah->reno_count = max(yeah->reno_count>>1, 2U);
return tp->snd_cwnd - reduction; return max_t(int, tp->snd_cwnd - reduction, 2);
} }
static struct tcp_congestion_ops tcp_yeah __read_mostly = { static struct tcp_congestion_ops tcp_yeah __read_mostly = {
......
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