All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: Andrei Borzenkov <arvidjaar@gmail.com>,
	The development of GNU GRUB <grub-devel@gnu.org>
Cc: Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH V2] tcp: add window scaling and RTTM support
Date: Mon, 1 Feb 2016 11:00:07 -0500	[thread overview]
Message-ID: <56AF8107.3000300@fb.com> (raw)
In-Reply-To: <CAA91j0UmxHtPpT5yzFVO5n58et9Uf9Bap3KUr_XoFW9AKF_gzw@mail.gmail.com>

On 02/01/2016 03:43 AM, Andrei Borzenkov wrote:
> On Sat, Jan 30, 2016 at 12:48 AM, Josef Bacik <jbacik@fb.com> wrote:
>> Sometimes we have to provision boxes across regions, such as California to
>> Sweden.  The http server has a 10 minute timeout, so if we can't get our 250mb
>> image transferred fast enough our provisioning fails, which is not ideal.  So
>> add tcp window scaling on open connections and set the window size to 1mb.  With
>> this change we're able to get higher sustained transfers between regions and can
>> transfer our image in well below 10 minutes.  Without this patch we'd time out
>> every time halfway through the transfer.
>>
>> RTTM is needed in order to make window scaling work well under heavy congestion
>> or packet loss.  In most cases grub could recover with just window scaling
>> enabled, but on some machines the congestion would be so high that it would
>> never recover and would timeout.
>>
>> I've made the window size configureable with the grub env variable
>> "tcp_window_size".  By default this is set to 1mb but can be configured to
>> whatever a user wants, and we will calculate the appropriate window size and
>> scale settings.  Thanks,
>>

<snip>

>> @@ -906,6 +1027,8 @@ grub_net_recv_tcp_packet (struct grub_net_buff *nb,
>>                return err;
>>              }
>>
>> +         /* We only update the tsecr when we advance the window. */
>> +         sock->cur_tsecr = tsecr;
>
> As far as I can tell, this does not agree with algorithm proposed in
> RFC 7323. It recommends that TSecr be advanced on immediate segment
> arrival and only if TSval is greater than previous one. I read it that
> TSecr advance should be done before queue processing, probably at the
> spot where we look for TS option.
>
> (2)  If:
>
>              SEG.TSval >= TS.Recent and SEG.SEQ <= Last.ACK.sent
>
>          then SEG.TSval is copied to TS.Recent; otherwise, it is ignored.
>
> and
>
>     It is important to note that the timestamp MUST be checked only when
>     a segment first arrives at the receiver, regardless of whether it is
>     in sequence or it must be queued for later delivery.

So if you look further down it shows an example of what I've 
implemented, where we get packets out of order.  We only increment 
TS.Recent (which in our case is sock->cur_tsecr) when we've gotten the 
next segment that we are expecting, which is what that bit

(2)  If:

              SEG.TSval >= TS.Recent and SEG.SEQ <= Last.ACK.sent

is talking about.  Look at the page 17 for the example, I was super 
confused about this as well until I saw the example they gave.  I 
probably should check for SEG.TSval >= TS.Recent before resetting it, so 
I'll do that.

>
> Note that it also recommends that if TS option was negotiated, packets
> without TS option should be discarded. Not sure if we need to follow
> it.
>

I'll go ahead and do this just to be on the safe side.  Thanks,

Josef


      parent reply	other threads:[~2016-02-01 16:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29 21:48 [PATCH V2] tcp: add window scaling and RTTM support Josef Bacik
2016-02-01  8:43 ` Andrei Borzenkov
2016-02-01 15:23   ` Josef Bacik
2016-02-01 16:00   ` Josef Bacik [this message]

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=56AF8107.3000300@fb.com \
    --to=jbacik@fb.com \
    --cc=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=kernel-team@fb.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.