From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZRN4J-0000vq-7V for mharc-grub-devel@gnu.org; Mon, 17 Aug 2015 12:15:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRN4G-0000v4-Lx for grub-devel@gnu.org; Mon, 17 Aug 2015 12:15:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZRN4B-0007Am-Kr for grub-devel@gnu.org; Mon, 17 Aug 2015 12:15:24 -0400 Received: from mail-la0-x22a.google.com ([2a00:1450:4010:c03::22a]:34357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRN4B-0007AT-CZ for grub-devel@gnu.org; Mon, 17 Aug 2015 12:15:19 -0400 Received: by labd1 with SMTP id d1so82776736lab.1 for ; Mon, 17 Aug 2015 09:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=no5LA/W6eB5LwLJFrsixsj3jVSKyqV7h9QsS4i64+Vg=; b=M6O+SbvEv0wREtmEG7ihBbZWwYrG8ADfQSc94gcxP5QaCvbpxYng92wdCtm2LLmpoV kTy2ADTM7j+UTsvgigV3JOtQYynHnOcgwvnxgyzD33ZDA4FHo5XpH2lAC1pF1O7cknMW byiJ4cPAs9nNM4dJr76zcS17wkc/fjGV25bwOgEuxvklpMc7KnlzzWBfXGMrIREChjvP hiHvAZ5kDzLcb6r5P9ijmpRHIRuq+ivZQkUyRonu+Iz+kLlGzLjhlWGF0J+5YkvjKH+U 1gso1K3Np1wQAvfSisnrul/dOsSADseZQ2O8iBAxER0I8zxUvZd71QQS1rssrVHFZbvx 84lA== X-Received: by 10.152.22.133 with SMTP id d5mr1727384laf.112.1439828118656; Mon, 17 Aug 2015 09:15:18 -0700 (PDT) Received: from [192.168.1.43] (ppp91-76-5-127.pppoe.mtu-net.ru. [91.76.5.127]) by smtp.gmail.com with ESMTPSA id kb5sm4015656lbc.16.2015.08.17.09.15.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Aug 2015 09:15:17 -0700 (PDT) Message-ID: <55D20894.2010605@gmail.com> Date: Mon, 17 Aug 2015 19:15:16 +0300 From: Andrei Borzenkov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: The development of GNU GRUB , kernel-team@fb.com Subject: Re: [PATCH] tcp: add window scaling support References: <1439395075-3225623-1-git-send-email-jbacik@fb.com> In-Reply-To: <1439395075-3225623-1-git-send-email-jbacik@fb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22a Cc: Josef Bacik X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2015 16:15:25 -0000 12.08.2015 18:57, Josef Bacik пишет: > 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. Thanks, > I do not think having 1M TCP window by default is good idea. We probably could make it configurable if there are evidences that it is really required. > Signed-off-by: Josef Bacik > --- > grub-core/net/tcp.c | 42 +++++++++++++++++++++++++++++------------- > 1 file changed, 29 insertions(+), 13 deletions(-) > > diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c > index 5da8b11..57a6d4e 100644 > --- a/grub-core/net/tcp.c > +++ b/grub-core/net/tcp.c > @@ -106,6 +106,18 @@ struct tcphdr > grub_uint16_t urgent; > } GRUB_PACKED; > > +struct tcp_scale_opt { > + grub_uint8_t kind; > + grub_uint8_t length; > + grub_uint8_t scale; > +} GRUB_PACKED; > + > +struct tcp_synhdr { > + struct tcphdr tcphdr; > + struct tcp_scale_opt scale_opt; > + grub_uint8_t padding; > +}; > + No, this does not scale. Just allocate large enough buffer and use pointers inside it. We may want to support multiple options at some point. > struct tcp_pseudohdr > { > grub_uint32_t src; > @@ -555,7 +567,7 @@ grub_net_tcp_open (char *server, > grub_net_tcp_socket_t socket; > static grub_uint16_t in_port = 21550; > struct grub_net_buff *nb; > - struct tcphdr *tcph; > + struct tcp_synhdr *tcph; > int i; > grub_uint8_t *nbd; > grub_net_link_level_address_t ll_target_addr; > @@ -617,20 +629,24 @@ grub_net_tcp_open (char *server, > } > > tcph = (void *) nb->data; > + grub_memset(tcph, 0, sizeof (*tcph)); > socket->my_start_seq = grub_get_time_ms (); > socket->my_cur_seq = socket->my_start_seq + 1; > - socket->my_window = 8192; > - tcph->seqnr = grub_cpu_to_be32 (socket->my_start_seq); > - tcph->ack = grub_cpu_to_be32_compile_time (0); > - tcph->flags = grub_cpu_to_be16_compile_time ((5 << 12) | TCP_SYN); > - tcph->window = grub_cpu_to_be16 (socket->my_window); > - tcph->urgent = 0; > - tcph->src = grub_cpu_to_be16 (socket->in_port); > - tcph->dst = grub_cpu_to_be16 (socket->out_port); > - tcph->checksum = 0; > - tcph->checksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_TCP, > - &socket->inf->address, > - &socket->out_nla); > + socket->my_window = 32768; > + tcph->tcphdr.seqnr = grub_cpu_to_be32 (socket->my_start_seq); > + tcph->tcphdr.ack = grub_cpu_to_be32_compile_time (0); > + tcph->tcphdr.flags = grub_cpu_to_be16_compile_time ((6 << 12) | TCP_SYN); > + tcph->tcphdr.window = grub_cpu_to_be16 (socket->my_window); > + tcph->tcphdr.urgent = 0; > + tcph->tcphdr.src = grub_cpu_to_be16 (socket->in_port); > + tcph->tcphdr.dst = grub_cpu_to_be16 (socket->out_port); > + tcph->tcphdr.checksum = 0; > + tcph->scale_opt.kind = 3; > + tcph->scale_opt.length = 3; > + tcph->scale_opt.scale = 5; > + tcph->tcphdr.checksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_TCP, > + &socket->inf->address, > + &socket->out_nla); > > tcp_socket_register (socket); > > There is one more place - grub_net_tcp_accept. Not sure if it ever be used though.