+1 For the MSS option

I've actually submitted similar patch a while ago
http://lists.gnu.org/archive/html/grub-devel/2015-10/msg00120.html

Didn't have time to finish it at first, but then decided to back off until
window scaling gets merged to follow generic way of declaring TCP options.
But this is a must-have as it greatly improves netboot over http.

The one thing is missing from the above patch is that we are announcing our
MSS but ignore peer's MSS and send them TCP packets close to L2 MTU. There
may be the case when the peer might be a low-memory device with 1500 bytes
MTU on the NIC, but 600 byte buffer in its software/firmware, so we might
overflow it. You may adapt code from my patch for this if you like.



On Wed, Feb 24, 2016 at 7:11 PM, Josef Bacik <jba...@fb.com> wrote:

> We were continuing to see transfer rates drop between datacenters that
> would
> result in timeouts, so I added the mss option and suddenly we went from
> ~200
> kb/s to ~100mb/s.  So seems like I probably should have started there
> rather
> than all these other options but whatever, now things are super awesome.
>
> Signed-off-by: Josef Bacik <jba...@fb.com>
> ---
>  grub-core/net/tcp.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c
> index 6902c10..2d1706e 100644
> --- a/grub-core/net/tcp.c
> +++ b/grub-core/net/tcp.c
> @@ -111,6 +111,7 @@ struct tcphdr
>
>  enum
>    {
> +    TCP_MSS_OPT = 2,
>      TCP_SCALE_OPT = 3,
>      TCP_TIMESTAMP_OPT = 8,
>    };
> @@ -134,6 +135,12 @@ struct tcp_timestamp_opt
>    grub_uint32_t tsecr;
>  } GRUB_PACKED;
>
> +struct tcp_mss_opt
> +{
> +  struct tcp_opt_hdr opt;
> +  grub_uint16_t mss;
> +} GRUB_PACKED;
> +
>  struct tcp_pseudohdr
>  {
>    grub_uint32_t src;
> @@ -620,6 +627,7 @@ grub_net_tcp_open (char *server,
>    struct tcphdr *tcph;
>    struct tcp_scale_opt *scale;
>    struct tcp_timestamp_opt *timestamp;
> +  struct tcp_mss_opt *mss;
>    int i;
>    grub_uint8_t *nbd;
>    grub_net_link_level_address_t ll_target_addr;
> @@ -659,7 +667,7 @@ grub_net_tcp_open (char *server,
>    socket->hook_data = hook_data;
>
>    headersize = ALIGN_UP (sizeof (*tcph) + sizeof (*scale) +
> -                        sizeof (*timestamp), 4);
> +                        sizeof (*timestamp) + sizeof (*mss), 4);
>    nb = grub_netbuff_alloc (headersize + 128);
>    if (!nb)
>      {
> @@ -718,6 +726,11 @@ grub_net_tcp_open (char *server,
>    timestamp->tsval = grub_cpu_to_be32 (grub_get_time_ms ());
>    timestamp->tsecr = 0;
>
> +  mss = (struct tcp_mss_opt *)(timestamp + 1);
> +  mss->opt.kind = TCP_MSS_OPT;
> +  mss->opt.length = sizeof (struct tcp_mss_opt);
> +  mss->mss = grub_cpu_to_be16 (inf->card->mtu - 128 - sizeof (*tcph));
> +
>    tcph->checksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_TCP,
>                                                    &socket->inf->address,
>                                                    &socket->out_nla);
> --
> 2.5.0
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to