From owner-svn-src-head@freebsd.org Fri Nov 6 21:14:23 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 D1DE2A280D8 for ; Fri, 6 Nov 2015 21:14:23 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A4AA182F for ; Fri, 6 Nov 2015 21:14:23 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 522F91FE023; Fri, 6 Nov 2015 22:14:20 +0100 (CET) Subject: Re: question about trimning data "len" conditions in TSO in tcp_output.c To: "Cui, Cheng" References: Cc: "svn-src-head@freebsd.org" From: Hans Petter Selasky Message-ID: <563D1892.3050406@selasky.org> Date: Fri, 6 Nov 2015 22:16:02 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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:14:23 -0000 On 11/06/15 21:46, Cui, Cheng wrote: > Hello Hans, > > Sorry if my previous email does not reach you because of a bad subject. > > 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=271946&r2=271945&pathrev=271946 > > trim data "len" under TSO: > > 885 /* > 886 * Prevent the last segment from being > 887 * fractional unless the send sockbuf can be > 888 * emptied: > 889 */ > 890 max_len = (tp->t_maxopd - optlen); > 891 if ((off + len) < sbavail(&so->so_snd)) { <== > 892 moff = len % max_len; > 893 if (moff != 0) { > 894 len -= moff; > 895 sendalot = 1; > 896 } > 897 } > > Is there a specific reason that it should skip trimming the data "len" under the condition of "(off + len) == sbavail(&so->so_snd)" in TSO? > Because I am wondering if we can trim the data "len" directly without checking the "(off + len)" condition. Hi Cheng, I believe the reason is to avoid looping one more time outputting a single 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 generated packet sequence? --HPS > > Thanks, > --Cheng Cui > NetApp Scale Out Networking > >