All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuchung Cheng <ycheng@google.com>
To: Benoit Sigoure <tsunanet@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Benoit Sigoure <tsuna@stumbleupon.com>,
	Hsiao-keng Jerry Chu <hkchu@google.com>
Subject: Re: [PATCH] tcp: Lower the initial RTO to 1s as per draft RFC 2988bis-02.
Date: Thu, 19 May 2011 10:42:19 -0700	[thread overview]
Message-ID: <BANLkTinzF1LrvR_3Q5b02CFd6nLWqGgERg@mail.gmail.com> (raw)
In-Reply-To: <1305786976-84532-1-git-send-email-tsunanet@gmail.com>

Hi Benoit,

AFAICT, the passive open side would not fall back the
RTO to 3sec in this change because SYNACK timeouts are not
recorded in icsk_retransmits but reqsk->retrans?

Yuchung

On Wed, May 18, 2011 at 11:36 PM, Benoit Sigoure <tsunanet@gmail.com> wrote:
>
> From: Benoit Sigoure <tsuna@stumbleupon.com>
>
> Draft RFC 2988bis-02 recommends that the initial RTO be lowered
> from 3 seconds down to 1 second, and that in case of a timeout
> during the TCP 3WHS, the RTO should fallback to 3 seconds when
> data transmission begins.
> ---
>
> On Wed, May 18, 2011 at 10:46 PM, David Miller <davem@davemloft.net> wrote:
> > From: tsuna <tsunanet@gmail.com>
> > Date: Wed, 18 May 2011 21:33:21 -0700
> >
> >> On Wed, May 18, 2011 at 9:14 PM, David Miller <davem@davemloft.net> wrote:
> >>> I really would rather see the initial RTO be static and be set to 1
> >>> with fallback RTO of 3.
> >>
> >> I can also provide a simple patch for this if you want to start from
> >> there.  And then maybe we can discuss having a runtime knob some more
> >> :-)
> >
> > Yeah why don't we do that :-)
>
> Alright, here we go.
>
>
>  include/net/tcp.h    |    5 ++++-
>  net/ipv4/tcp_input.c |   13 +++++++++----
>  2 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index cda30ea..274d761 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -122,7 +122,10 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
>  #endif
>  #define TCP_RTO_MAX    ((unsigned)(120*HZ))
>  #define TCP_RTO_MIN    ((unsigned)(HZ/5))
> -#define TCP_TIMEOUT_INIT ((unsigned)(3*HZ))    /* RFC 1122 initial RTO value   */
> +/* The next 2 values come from Draft RFC 2988bis-02. */
> +#define TCP_TIMEOUT_INIT ((unsigned)(1*HZ))            /* initial RTO value    */
> +#define TCP_TIMEOUT_INIT_FALLBACK ((unsigned)(3*HZ))   /* initial RTO to fallback to when
> +                                                        * a timeout happens during the 3WHS.   */
>
>  #define TCP_RESOURCE_PROBE_INTERVAL ((unsigned)(HZ/2U)) /* Maximal interval between probes
>                                                         * for local resources.
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index bef9f04..a36bc35 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -868,6 +868,11 @@ static void tcp_init_metrics(struct sock *sk)
>  {
>        struct tcp_sock *tp = tcp_sk(sk);
>        struct dst_entry *dst = __sk_dst_get(sk);
> +       /* If we had to retransmit anything during the 3WHS, use
> +        * the initial fallback RTO as per draft RFC 2988bis-02.
> +        */
> +       int init_rto = inet_csk(sk)->icsk_retransmits ?
> +               TCP_TIMEOUT_INIT_FALLBACK : TCP_TIMEOUT_INIT;
>
>        if (dst == NULL)
>                goto reset;
> @@ -890,7 +895,7 @@ static void tcp_init_metrics(struct sock *sk)
>        if (dst_metric(dst, RTAX_RTT) == 0)
>                goto reset;
>
> -       if (!tp->srtt && dst_metric_rtt(dst, RTAX_RTT) < (TCP_TIMEOUT_INIT << 3))
> +       if (!tp->srtt && dst_metric_rtt(dst, RTAX_RTT) < (init_rto << 3))
>                goto reset;
>
>        /* Initial rtt is determined from SYN,SYN-ACK.
> @@ -916,7 +921,7 @@ static void tcp_init_metrics(struct sock *sk)
>                tp->mdev_max = tp->rttvar = max(tp->mdev, tcp_rto_min(sk));
>        }
>        tcp_set_rto(sk);
> -       if (inet_csk(sk)->icsk_rto < TCP_TIMEOUT_INIT && !tp->rx_opt.saw_tstamp) {
> +       if (inet_csk(sk)->icsk_rto < init_rto && !tp->rx_opt.saw_tstamp) {
>  reset:
>                /* Play conservative. If timestamps are not
>                 * supported, TCP will fail to recalculate correct
> @@ -924,8 +929,8 @@ reset:
>                 */
>                if (!tp->rx_opt.saw_tstamp && tp->srtt) {
>                        tp->srtt = 0;
> -                       tp->mdev = tp->mdev_max = tp->rttvar = TCP_TIMEOUT_INIT;
> -                       inet_csk(sk)->icsk_rto = TCP_TIMEOUT_INIT;
> +                       tp->mdev = tp->mdev_max = tp->rttvar = init_rto;
> +                       inet_csk(sk)->icsk_rto = init_rto;
>                }
>        }
>        tp->snd_cwnd = tcp_init_cwnd(tp, dst);
> --
> 1.7.0.4
>
> --
> 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

  reply	other threads:[~2011-05-19 17:42 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-17  7:40 [PATCH] tcp: Expose the initial RTO via a new sysctl Benoit Sigoure
2011-05-17  7:40 ` Benoit Sigoure
2011-05-17  8:01   ` Alexander Zimmermann
2011-05-17  8:34     ` Eric Dumazet
2011-05-17  8:07   ` Eric Dumazet
2011-05-17 11:02     ` Hagen Paul Pfeifer
2011-05-17 11:02       ` Hagen Paul Pfeifer
2011-05-17 12:20       ` Eric Dumazet
2011-05-18 10:43     ` Benoit Sigoure
2011-05-18 19:26       ` David Miller
2011-05-18 19:40         ` tsuna
2011-05-18 19:52           ` David Miller
2011-05-18 20:20             ` Hagen Paul Pfeifer
2011-05-18 20:23               ` David Miller
2011-05-18 20:27                 ` Hagen Paul Pfeifer
2011-05-20 10:27               ` H.K. Jerry Chu
2011-05-20 11:00                 ` Hagen Paul Pfeifer
2011-05-20 11:00                   ` Hagen Paul Pfeifer
2011-05-20 12:37                   ` Alan Cox
2011-05-21  0:06                   ` H.K. Jerry Chu
2011-05-31 14:48                     ` tsuna
2011-05-31 15:25                       ` Hagen Paul Pfeifer
2011-05-31 15:25                         ` Hagen Paul Pfeifer
2011-05-31 15:28                         ` tsuna
2011-05-31 15:43                           ` Hagen Paul Pfeifer
2011-05-31 15:43                             ` Hagen Paul Pfeifer
2011-05-19  2:22             ` [PATCH] tcp: Implement a two-level initial RTO as per draft RFC 2988bis-02 Benoit Sigoure
2011-05-19  2:22               ` Benoit Sigoure
2011-05-19  2:36               ` David Miller
2011-05-19  3:56                 ` tsuna
2011-05-19  4:14                   ` David Miller
2011-05-19  4:33                     ` tsuna
2011-05-19  5:46                       ` David Miller
2011-05-19  6:36                         ` [PATCH] tcp: Lower the initial RTO to 1s " Benoit Sigoure
2011-05-19  6:36                           ` Benoit Sigoure
2011-05-19 17:42                           ` Yuchung Cheng [this message]
2011-05-19  6:47                         ` Benoit Sigoure
2011-05-19  6:47                           ` Benoit Sigoure
2011-05-19 20:16                           ` David Miller
2011-05-19  6:10                       ` [PATCH] tcp: Implement a two-level initial RTO " Alexander Zimmermann
2011-05-19  6:25                         ` tsuna
2011-05-19  6:36                           ` Alexander Zimmermann
2011-05-19  6:42                             ` tsuna
2011-05-19  6:52                               ` Alexander Zimmermann
2011-05-19  7:07                                 ` tsuna
2011-05-19  8:02                                 ` Hagen Paul Pfeifer
2011-05-19  8:02                                   ` Hagen Paul Pfeifer
2011-05-19 16:40                                   ` tsuna
2011-05-19 16:55                                     ` Alexander Zimmermann
2011-05-19 17:11                                       ` tsuna
2011-05-19 19:27                                         ` David Miller
2011-05-19 20:30                                           ` tsuna
2011-05-20  2:01           ` [PATCH] tcp: Expose the initial RTO via a new sysctl H.K. Jerry Chu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTinzF1LrvR_3Q5b02CFd6nLWqGgERg@mail.gmail.com \
    --to=ycheng@google.com \
    --cc=hkchu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tsuna@stumbleupon.com \
    --cc=tsunanet@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.