Commit 6731d2095bd4aef18027c72ef845ab1087c3ba63

Authored by Ilpo Järvinen
Committed by David S. Miller
1 parent b6ec447df9

tcp: fix for zero packets_in_flight was too broad

There are transients during normal FRTO procedure during which
the packets_in_flight can go to zero between write_queue state
updates and firing the resulting segments out. As FRTO processing
occurs during that window the check must be more precise to
not match "spuriously" :-). More specificly, e.g., when
packets_in_flight is zero but FLAG_DATA_ACKED is true the problematic
branch that set cwnd into zero would not be taken and new segments
might be sent out later.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Tested-by: Eric Dumazet <edumazet@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 6 additions and 2 deletions Side-by-side Diff

net/ipv4/tcp_input.c
... ... @@ -3484,8 +3484,7 @@
3484 3484 ((tp->frto_counter >= 2) && (flag & FLAG_RETRANS_DATA_ACKED)))
3485 3485 tp->undo_marker = 0;
3486 3486  
3487   - if (!before(tp->snd_una, tp->frto_highmark) ||
3488   - !tcp_packets_in_flight(tp)) {
  3487 + if (!before(tp->snd_una, tp->frto_highmark)) {
3489 3488 tcp_enter_frto_loss(sk, (tp->frto_counter == 1 ? 2 : 3), flag);
3490 3489 return true;
3491 3490 }
... ... @@ -3505,6 +3504,11 @@
3505 3504 }
3506 3505 } else {
3507 3506 if (!(flag & FLAG_DATA_ACKED) && (tp->frto_counter == 1)) {
  3507 + if (!tcp_packets_in_flight(tp)) {
  3508 + tcp_enter_frto_loss(sk, 2, flag);
  3509 + return true;
  3510 + }
  3511 +
3508 3512 /* Prevent sending of new data. */
3509 3513 tp->snd_cwnd = min(tp->snd_cwnd,
3510 3514 tcp_packets_in_flight(tp));