From owner-freebsd-net@FreeBSD.ORG Thu Oct 20 16:32:33 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C7331065675; Thu, 20 Oct 2011 16:32:33 +0000 (UTC) (envelope-from bhutchings@solarflare.com) Received: from exchange.solarflare.com (mail.solarflare.com [216.237.3.220]) by mx1.freebsd.org (Postfix) with ESMTP id 2ABFC8FC19; Thu, 20 Oct 2011 16:32:32 +0000 (UTC) Received: from [10.17.20.137] ([10.17.20.137]) by exchange.solarflare.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 20 Oct 2011 09:32:32 -0700 From: Ben Hutchings To: Andre Oppermann In-Reply-To: <1318894136.2784.76.camel@bwh-desktop> References: <1317309906.2743.9.camel@bwh-desktop> <1318865394.2784.4.camel@bwh-desktop> <4E9C534D.4090405@freebsd.org> <1318894136.2784.76.camel@bwh-desktop> Content-Type: text/plain; charset="UTF-8" Organization: Solarflare Communications Date: Thu, 20 Oct 2011 17:32:29 +0100 Message-ID: <1319128350.3147.6.camel@bwh-desktop> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 (2.32.2-1.fc14) Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 20 Oct 2011 16:32:32.0698 (UTC) FILETIME=[DE0051A0:01CC8F45] X-TM-AS-Product-Ver: SMEX-8.0.0.1181-6.500.1024-18460.005 X-TM-AS-Result: No--21.510700-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No Cc: freebsd-net@freebsd.org Subject: Re: TSO broken with jumbo MTU X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 16:32:33 -0000 On Tue, 2011-10-18 at 00:28 +0100, Ben Hutchings wrote: > On Mon, 2011-10-17 at 18:09 +0200, Andre Oppermann wrote: > > On 17.10.2011 17:29, Ben Hutchings wrote: > > > This is the fix/workaround I used: > > > > Thanks for the fix. I'll review it and put it into FreeBSD maybe in > > a slightly different form. > > Which one? One is tested but maybe not right; the other looks right but > is not tested! I have now run the same test that originally triggered the assertion failure, with the 'right' change, and it passes. The test script performed various interface reconfiguration (including MTU changes) and link state changes with TCP and UDP flows active through the interface, over a period of 12 hours. For reference, the 'right' change is: --- a/netinet/tcp_input.c +++ b/netinet/tcp_input.c @@ -3087,7 +3087,7 @@ tcp_mss_update(struct tcpcb *tp, int offer, struct hc_metrics_lite *metricptr, int *mtuflags) { - int mss; + int mss, ts_len; u_long maxmtu; struct inpcb *inp = tp->t_inpcb; struct hc_metrics_lite metrics; @@ -3212,22 +3212,17 @@ mss = max(mss, 64); /* - * maxopd stores the maximum length of data AND options - * in a segment; maxseg is the amount of data in a normal - * segment. We need to store this value (maxopd) apart - * from maxseg, because now every segment carries options - * and thus we normally have somewhat less data in segments. - */ - tp->t_maxopd = mss; - - /* * origoffer==-1 indicates that no segments were received yet. * In this case we just guess. */ if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP && (origoffer == -1 || (tp->t_flags & TF_RCVD_TSTMP) == TF_RCVD_TSTMP)) - mss -= TCPOLEN_TSTAMP_APPA; + ts_len = TCPOLEN_TSTAMP_APPA; + else + ts_len = 0; + + mss -= ts_len; #if (MCLBYTES & (MCLBYTES - 1)) == 0 if (mss > MCLBYTES) @@ -3237,6 +3232,15 @@ mss = mss / MCLBYTES * MCLBYTES; #endif tp->t_maxseg = mss; + + /* + * maxopd stores the maximum length of data AND options + * in a segment; maxseg is the amount of data in a normal + * segment. We need to store this value (maxopd) apart + * from maxseg, because now every segment carries options + * and thus we normally have somewhat less data in segments. + */ + tp->t_maxopd = mss + ts_len; } void --- END --- -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.