Skip to content

Commit ed25497

Browse files
yuchungchengdavem330
authored andcommitted
tcp: avoid setting cwnd to invalid ssthresh after cwnd reduction states
If the sender switches the congestion control during ECN-triggered cwnd-reduction state (CA_CWR), upon exiting recovery cwnd is set to the ssthresh value calculated by the previous congestion control. If the previous congestion control is BBR that always keep ssthresh to TCP_INIFINITE_SSTHRESH, cwnd ends up being infinite. The safe step is to avoid assigning invalid ssthresh value when recovery ends. Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Neal Cardwell <ncardwell@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4d96f12 commit ed25497

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ipv4/tcp_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,8 +2520,8 @@ static inline void tcp_end_cwnd_reduction(struct sock *sk)
25202520
return;
25212521

25222522
/* Reset cwnd to ssthresh in CWR or Recovery (unless it's undone) */
2523-
if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR ||
2524-
(tp->undo_marker && tp->snd_ssthresh < TCP_INFINITE_SSTHRESH)) {
2523+
if (tp->snd_ssthresh < TCP_INFINITE_SSTHRESH &&
2524+
(inet_csk(sk)->icsk_ca_state == TCP_CA_CWR || tp->undo_marker)) {
25252525
tp->snd_cwnd = tp->snd_ssthresh;
25262526
tp->snd_cwnd_stamp = tcp_jiffies32;
25272527
}

0 commit comments

Comments
 (0)