tcp: fix infinite cwnd in tcp_complete_cwr()
Subsystems (3)
PATCH 1/1 tcp: fix infinite cwnd in tcp_complete_cwr()
When the cwnd reduction is done, ssthresh may be infinite if TCP enters CWR via ECN or F-RTO. If cwnd is not undone, i.e., undo_marker is set, tcp_complete_cwr() falsely set cwnd to the infinite ssthresh value. The correct operation is to keep cwnd intact because it has been updated in ECN or F-RTO.
--- net/ipv4/tcp_input.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
net/ipv4/tcp_input.c +5 -3
@@ -2868,11 +2868,13 @@ static inline void tcp_complete_cwr(struct sock *sk)/* Do not moderate cwnd if it's already undone in cwr or recovery. */ if (tp->undo_marker) { -if (inet_csk (sk)->icsk_ca_state ==TCP_CA_CWR ) +if (inet_csk (sk)->icsk_ca_state ==TCP_CA_CWR ) { tp->snd_cwnd =min (tp->snd_cwnd, tp->snd_ssthresh); -else /* PRR */ + }else if (tp->snd_ssthresh <TCP_INFINITE_SSTHRESH ) { +/* PRR algorithm. */ tp->snd_cwnd = tp->snd_ssthresh; - tp->snd_cwnd_stamp = tcp_time_stamp; + tp->snd_cwnd_stamp = tcp_time_stamp; + } }tcp_ca_event (sk,CA_EVENT_COMPLETE_CWR ); }
Signature · 1 line
1.7.7.3
Neal Cardwell
maintainerQuoted 16 lines · Yuchung Cheng
When the cwnd reduction is done, ssthresh may be infinite if TCP enters CWR via ECN or F-RTO. If cwnd is not undone, i.e.,
undo_markeris set,tcp_complete_cwr()falsely set cwnd to the infinite ssthresh value. The correct operation is to keep cwnd intact because it has been updated in ECN or F-RTO.Signed-off-by Yuchung Cheng <[email protected]>---
net/ipv4/tcp_input.c | 8 +++++---1 files changed, 5 insertions(+), 3 deletions(-)net/ipv4/tcp_input.c +0
-0
net/ipv4/tcp_input.c static inline void tcp_complete_cwr(struct sock *sk) · line 2872
Quoted 6 lines
net/ipv4/tcp_input.c +1
-1@@ -2868,11 +2868,13 @@ static inline void tcp_complete_cwr(struct sock *sk) /* Do not moderate cwnd if it's already undone in cwr or recovery. */ if (tp->undo_marker) { - if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) + if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) { tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh);
In this TCP_CA_CWR case the patch needs to add the assignment:
tp->snd_cwnd_stamp = tcp_time_stamp;
I know that was in earlier versions of your patch; looks like it just got accidentally dropped on this latest version.
Otherwise, looks good to me.
neal