From owner-svn-src-head@freebsd.org Fri Nov 6 21:57:53 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00B12A28785 for ; Fri, 6 Nov 2015 21:57:52 +0000 (UTC) (envelope-from Cheng.Cui@netapp.com) Received: from mx143.netapp.com (mx143.netapp.com [216.240.21.24]) (using TLSv1.2 with cipher RC4-SHA (128/128 bits)) (Client CN "mx143.netapp.com", Issuer "Symantec Class 3 Secure Server CA - G4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B067B18A6 for ; Fri, 6 Nov 2015 21:57:52 +0000 (UTC) (envelope-from Cheng.Cui@netapp.com) X-IronPort-AV: E=Sophos;i="5.20,254,1444719600"; d="scan'208";a="77154156" Received: from hioexcmbx06-prd.hq.netapp.com ([10.122.105.39]) by mx143-out.netapp.com with ESMTP; 06 Nov 2015 13:56:44 -0800 Received: from HIOEXCMBX03-PRD.hq.netapp.com (10.122.105.36) by hioexcmbx06-prd.hq.netapp.com (10.122.105.39) with Microsoft SMTP Server (TLS) id 15.0.1104.5; Fri, 6 Nov 2015 13:56:43 -0800 Received: from HIOEXCMBX03-PRD.hq.netapp.com ([::1]) by hioexcmbx03-prd.hq.netapp.com ([fe80::25cc:26bf:f7e1:4fa2%21]) with mapi id 15.00.1104.000; Fri, 6 Nov 2015 13:56:43 -0800 From: "Cui, Cheng" To: Hans Petter Selasky CC: "Cui, Cheng" , "svn-src-head@freebsd.org" Subject: Re: question about trimning data "len" conditions in TSO in tcp_output.c Thread-Topic: question about trimning data "len" conditions in TSO in tcp_output.c Thread-Index: AQHRGNRH3ZqdnMKQ9kSAjiggGnHKap6QBSEAgAALXQA= Date: Fri, 6 Nov 2015 21:56:43 +0000 Message-ID: References: <563D1892.3050406@selasky.org> In-Reply-To: <563D1892.3050406@selasky.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.1878.6) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.122.56.79] Content-Type: text/plain; charset="Windows-1252" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2015 21:57:53 -0000 On Nov 6, 2015, at 4:16 PM, Hans Petter Selasky wrote: > On 11/06/15 21:46, Cui, Cheng wrote: >> Hello Hans, >>=20 >> Sorry if my previous email does not reach you because of a bad subject. >>=20 >> This is Cheng Cui. I am reading the CURRENT FreeBSD code in tcp_output.c= , and find this question regarding your change in revision 271946. >> https://svnweb.freebsd.org/base/head/sys/netinet/tcp_output.c?r1=3D27194= 6&r2=3D271945&pathrev=3D271946 >>=20 >> trim data "len" under TSO: >>=20 >> 885 /* >> 886 * Prevent the last segment from being >> 887 * fractional unless the send sockbuf can be >> 888 * emptied: >> 889 */ >> 890 max_len =3D (tp->t_maxopd - optlen); >> 891 if ((off + len) < sbavail(&so->so_snd)) { = <=3D=3D >> 892 moff =3D len % max_len; >> 893 if (moff !=3D 0) { >> 894 len -=3D moff; >> 895 sendalot =3D 1; >> 896 } >> 897 } >>=20 >> Is there a specific reason that it should skip trimming the data "len" u= nder the condition of "(off + len) =3D=3D sbavail(&so->so_snd)" in TSO? > > Because I am wondering if we can trim the data "len" directly without c= hecking the "(off + len)" condition. >=20 > Hi Cheng, >=20 > I believe the reason is to avoid looping one more time outputting a singl= e packet containing the remainder of the available data, with regard to max= _len. How did you envision the removal of this check would influence the ge= nerated packet sequence? >=20 > --HPS >=20 Hi Hans, I may be wrong but my assumption is that the remainder of the available dat= a may be larger than one single packet. Suppose max_len=3D=3D1500, sb_acc=3D=3D3001, off=3D=3D2, and (off+len)=3D= =3D3001. In this case, the current code will not trim the "len" and let it = go directly to the NIC. I think it skips the Nagle's algorithm. As len=3D= =3D2999, the last packet is 1499, it is supposed to be held until all outst= anding data are ACKed, but it has been sent out. Cheng