netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] tcp_yeah: don't set ssthresh below 2
@ 2016-01-11 18:42 Neal Cardwell
  2016-01-11 22:25 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Neal Cardwell @ 2016-01-11 18:42 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Neal Cardwell, Yuchung Cheng, Eric Dumazet

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: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/tcp_yeah.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_yeah.c b/net/ipv4/tcp_yeah.c
index 17d3566..3e6a472 100644
--- a/net/ipv4/tcp_yeah.c
+++ b/net/ipv4/tcp_yeah.c
@@ -219,7 +219,7 @@ static u32 tcp_yeah_ssthresh(struct sock *sk)
 	yeah->fast_count = 0;
 	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 = {
-- 
2.6.0.rc2.230.g3dd15c0

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

* Re: [PATCH net] tcp_yeah: don't set ssthresh below 2
  2016-01-11 18:42 [PATCH net] tcp_yeah: don't set ssthresh below 2 Neal Cardwell
@ 2016-01-11 22:25 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-01-11 22:25 UTC (permalink / raw)
  To: ncardwell; +Cc: netdev, ycheng, edumazet

From: Neal Cardwell <ncardwell@google.com>
Date: Mon, 11 Jan 2016 13:42:43 -0500

> 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: Oleksandr Natalenko <oleksandr@natalenko.name>
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable, thanks!

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

end of thread, other threads:[~2016-01-11 22:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-11 18:42 [PATCH net] tcp_yeah: don't set ssthresh below 2 Neal Cardwell
2016-01-11 22:25 ` 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).