Skip to content

Commit f698204

Browse files
nealcardwelldavem330
authored andcommitted
tcp: allow undo from reordered DSACKs
Previously, SACK-enabled connections hung around in TCP_CA_Disorder state while snd_una==high_seq, just waiting to accumulate DSACKs and hopefully undo a cwnd reduction. This could and did lead to the following unfortunate scenario: if some incoming ACKs advance snd_una beyond high_seq then we were setting undo_marker to 0 and moving to TCP_CA_Open, so if (due to reordering in the ACK return path) we shortly thereafter received a DSACK then we were no longer able to undo the cwnd reduction. The change: Simplify the congestion avoidance state machine by removing the behavior where SACK-enabled connections hung around in the TCP_CA_Disorder state just waiting for DSACKs. Instead, when snd_una advances to high_seq or beyond we typically move to TCP_CA_Open immediately and allow an undo in either TCP_CA_Open or TCP_CA_Disorder if we later receive enough DSACKs. Other patches in this series will provide other changes that are necessary to fully fix this problem. Signed-off-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e95ae2f commit f698204

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

‎net/ipv4/tcp_input.c‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,7 +2858,7 @@ static void tcp_try_keep_open(struct sock *sk)
28582858
struct tcp_sock *tp = tcp_sk(sk);
28592859
int state = TCP_CA_Open;
28602860

2861-
if (tcp_left_out(tp) || tcp_any_retrans_done(sk) || tp->undo_marker)
2861+
if (tcp_left_out(tp) || tcp_any_retrans_done(sk))
28622862
state = TCP_CA_Disorder;
28632863

28642864
if (inet_csk(sk)->icsk_ca_state != state) {
@@ -3066,17 +3066,6 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked,
30663066
}
30673067
break;
30683068

3069-
case TCP_CA_Disorder:
3070-
tcp_try_undo_dsack(sk);
3071-
if (!tp->undo_marker ||
3072-
/* For SACK case do not Open to allow to undo
3073-
* catching for all duplicate ACKs. */
3074-
tcp_is_reno(tp) || tp->snd_una != tp->high_seq) {
3075-
tp->undo_marker = 0;
3076-
tcp_set_ca_state(sk, TCP_CA_Open);
3077-
}
3078-
break;
3079-
30803069
case TCP_CA_Recovery:
30813070
if (tcp_is_reno(tp))
30823071
tcp_reset_reno_sack(tp);
@@ -3117,7 +3106,7 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked,
31173106
tcp_add_reno_sack(sk);
31183107
}
31193108

3120-
if (icsk->icsk_ca_state == TCP_CA_Disorder)
3109+
if (icsk->icsk_ca_state <= TCP_CA_Disorder)
31213110
tcp_try_undo_dsack(sk);
31223111

31233112
if (!tcp_time_to_recover(sk)) {

0 commit comments

Comments
 (0)