Patchwork tcp: tcp_process_frto() should not set snd_cwnd to 0

login
register
mail settings
Submitter Neal Cardwell
Date Feb. 2, 2013, 3:57 p.m.
Message ID <CADVnQykbufy-kQrEnJm0bbt=n7C8OfE1=Kr-2KfP7Mbu5Eq58w@mail.gmail.com>
Download mbox | patch
Permalink /patch/217679/
State RFC
Delegated to: David Miller
Headers show

Comments

Neal Cardwell - Feb. 2, 2013, 3:57 p.m.
On Sat, Feb 2, 2013 at 10:14 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 8aca4ee..37760df 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -3506,7 +3506,7 @@ static bool tcp_process_frto(struct sock *sk, int flag)
>                 if (!(flag & FLAG_DATA_ACKED) && (tp->frto_counter == 1)) {
>                         /* Prevent sending of new data. */
>                         tp->snd_cwnd = min(tp->snd_cwnd,
> -                                          tcp_packets_in_flight(tp));
> +                                          max(tcp_packets_in_flight(tp), 1U));
>                         return true;
>                 }

This seems better than what we have now, but it seems to paper over a
significant bug somewhere in FRTO. If we are at this spot and
tcp_packets_in_flight() is zero, then this means that we have lost our
chance to disambiguate whether this loss timeout was spurious, and we
should assume it was a legit loss, so we should call:
    tcp_enter_frto_loss(sk, 2, flag);

One possible approach (please excuse the formatting for this informal proposal):


neal
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet - Feb. 2, 2013, 5:32 p.m.
On Sat, 2013-02-02 at 10:57 -0500, Neal Cardwell wrote:
> On Sat, Feb 2, 2013 at 10:14 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> > index 8aca4ee..37760df 100644
> > --- a/net/ipv4/tcp_input.c
> > +++ b/net/ipv4/tcp_input.c
> > @@ -3506,7 +3506,7 @@ static bool tcp_process_frto(struct sock *sk, int flag)
> >                 if (!(flag & FLAG_DATA_ACKED) && (tp->frto_counter == 1)) {
> >                         /* Prevent sending of new data. */
> >                         tp->snd_cwnd = min(tp->snd_cwnd,
> > -                                          tcp_packets_in_flight(tp));
> > +                                          max(tcp_packets_in_flight(tp), 1U));
> >                         return true;
> >                 }
> 
> This seems better than what we have now, but it seems to paper over a
> significant bug somewhere in FRTO. If we are at this spot and
> tcp_packets_in_flight() is zero, then this means that we have lost our
> chance to disambiguate whether this loss timeout was spurious, and we
> should assume it was a legit loss, so we should call:
>     tcp_enter_frto_loss(sk, 2, flag);
> 
> One possible approach (please excuse the formatting for this informal proposal):
> 
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 0905997..66f7c32 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -3482,7 +3482,8 @@ static bool tcp_process_frto(struct sock *sk, int flag)
>      ((tp->frto_counter >= 2) && (flag & FLAG_RETRANS_DATA_ACKED)))
>   tp->undo_marker = 0;
> 
> - if (!before(tp->snd_una, tp->frto_highmark)) {
> + if (!before(tp->snd_una, tp->frto_highmark) ||
> +    !tcp_packets_in_flight(tp)) {
>   tcp_enter_frto_loss(sk, (tp->frto_counter == 1 ? 2 : 3), flag);
>   return true;
>   }

Thanks Neal for this suggestion, I'll make tests before submitting an
official patch.




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 0905997..66f7c32 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3482,7 +3482,8 @@  static bool tcp_process_frto(struct sock *sk, int flag)
     ((tp->frto_counter >= 2) && (flag & FLAG_RETRANS_DATA_ACKED)))
  tp->undo_marker = 0;

- if (!before(tp->snd_una, tp->frto_highmark)) {
+ if (!before(tp->snd_una, tp->frto_highmark) ||
+    !tcp_packets_in_flight(tp)) {
  tcp_enter_frto_loss(sk, (tp->frto_counter == 1 ? 2 : 3), flag);
  return true;
  }