Received: from list by lists.gnu.org with archive (Exim 4.71) id 1aYeql-00007k-RW for mharc-grub-devel@gnu.org; Wed, 24 Feb 2016 14:11:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYeqf-00005S-QB for grub-devel@gnu.org; Wed, 24 Feb 2016 14:11:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYeqb-0005pL-RA for grub-devel@gnu.org; Wed, 24 Feb 2016 14:11:45 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:5441) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYeqb-0005pF-I1 for grub-devel@gnu.org; Wed, 24 Feb 2016 14:11:41 -0500 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id u1OJAHHq018322 for ; Wed, 24 Feb 2016 11:11:41 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : mime-version : content-type; s=facebook; bh=AeegXCeGxf/Xu9bA/5nhwOuV4jmiysU/voAKT1mL5yE=; b=okHw0CzhIgQiBzsvmdyCi5LptNJOfcAOKSxC0XRrUGhQR7sD/qx4Ic+FauPBYvCTH9h6 gKjN5pGLaWYcGOpg2mJqIzZ1JbqgRtAz+sAelyxIIupw1+uy984F0fyMAWhScjphY0Yw Yaga6b36xd2B7WjWDEm2aeq0tEGC6r41xNc= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 219eef1cjt-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Wed, 24 Feb 2016 11:11:41 -0800 Received: from localhost (192.168.52.123) by mail.thefacebook.com (192.168.16.24) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 24 Feb 2016 11:11:38 -0800 From: Josef Bacik To: , Subject: [PATCH] tcp: add mss option support Date: Wed, 24 Feb 2016 14:11:36 -0500 Message-ID: <1456341096-13497-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.5.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-02-24_10:, , signatures=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 67.231.145.42 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: Wed, 24 Feb 2016 19:11:50 -0000 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 --- 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