Skip to contentSkip to conversation

tcp: fix infinite cwnd in tcp_complete_cwr()

PATCH In review Yuchung Cheng 3 participants 3 messages Apr 30, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

---
ChangeLog since v1:
- Add snd_cwnd_stamp timestamping in CWR mode

 net/ipv4/tcp_input.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
net/ipv4/tcp_input.c +6 -3
index c93b0cb..e0a9b89 100644
@@ -2868,11 +2868,14 @@ 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 */
+			tp->snd_cwnd_stamp = tcp_time_stamp;
+		} 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
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 6 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_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.

Quoted 7 lines

---
ChangeLog since v1:
 - Add snd_cwnd_stamp timestamping in CWR mode

 net/ipv4/tcp_input.c |    9 ++++++---

 1 files changed, 6 insertions(+), 3 deletions(-)

neal

maintainer
#2 lore raw

From: Neal Cardwell <[email protected]>
Date: Mon, 30 Apr 2012 12:25:56 -0400

Quoted 12 lines · Yuchung Cheng
Quoted 11 lines

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.

---
ChangeLog since v1:
 - Add snd_cwnd_stamp timestamping in CWR mode

Quoted 4 lines
Quoted 2 lines

 net/ipv4/tcp_input.c |    9 ++++++---

 1 files changed, 6 insertions(+), 3 deletions(-)

Applied and queued up for -stable, thanks.