From owner-svn-src-all@freebsd.org Mon Sep 14 08:49:09 2015 Return-Path: Delivered-To: svn-src-all@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 897F29CDF74; Mon, 14 Sep 2015 08:49:09 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward15p.cmail.yandex.net (forward15p.cmail.yandex.net [IPv6:2a02:6b8:0:1465::bd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Certum Level IV CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 26AD0104D; Mon, 14 Sep 2015 08:49:08 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from web24g.yandex.ru (web24g.yandex.ru [95.108.253.233]) by forward15p.cmail.yandex.net (Yandex) with ESMTP id 377C5214B1; Mon, 14 Sep 2015 11:49:04 +0300 (MSK) Received: from 127.0.0.1 (localhost [127.0.0.1]) by web24g.yandex.ru (Yandex) with ESMTP id 087AF58E153D; Mon, 14 Sep 2015 11:49:01 +0300 (MSK) Received: by web24g.yandex.ru with HTTP; Mon, 14 Sep 2015 11:48:59 +0300 From: Alexander V. Chernikov Envelope-From: melifaro@ipfw.ru To: Hans Petter Selasky , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" In-Reply-To: <201509140836.t8E8aNXW051334@repo.freebsd.org> References: null <201509140836.t8E8aNXW051334@repo.freebsd.org> Subject: Re: svn commit: r287775 - in head/sys: net netinet MIME-Version: 1.0 Message-Id: <1482471442220539@web24g.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Mon, 14 Sep 2015 11:48:59 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=koi8-r X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 08:49:09 -0000 14.09.2015, 11:36, "Hans Petter Selasky" : > Author: hselasky > Date: Mon Sep 14 08:36:22 2015 > New Revision: 287775 > URL: https://svnweb.freebsd.org/changeset/base/287775 > > Log: > ššUpdate TSO limits to include all headers. > > ššTo make driver programming easier the TSO limits are changed to > ššreflect the values used in the BUSDMA tag a network adapter driver is > ššusing. The TCP/IP network stack will subtract space for all linklevel > ššand protocol level headers and ensure that the full mbuf chain passed > ššto the network adapter fits within the given limits. > > ššImplementation notes: > > ššIf a network adapter driver needs to fixup the first mbuf in order to > ššsupport VLAN tag insertion, the size of the VLAN tag should be > ššsubtracted from the TSO limit. Else not. > > ššNetwork adapters which typically inline the complete header mbuf could > šštechnically transmit one more segment. This patch does not implement a > ššmechanism to recover the last segment for data transmission. It is > ššbelieved when sufficiently large mbuf clusters are used, the segment > ššlimit will not be reached and recovering the last segment will not > ššhave any effect. > > ššThe current TSO algorithm tries to send MTU-sized packets, where the > ššMTU typically is 1500 bytes, which gives 1448 bytes of TCP data > ššpayload per packet for IPv4. That means if the TSO length limitiation > ššis set to 65536 bytes, there will be a data payload remainder of > šš(65536 - 1500) mod 1448 bytes which is equal to 324 bytes. Trying to > ššrecover total TSO length due to inlining mbuf header data will not > ššhave any effect, because adding or removing the ETH/IP/TCP headers > ššto or from 324 bytes will not cause more or less TCP payload to be > ššTSO'ed. > > ššExisting network adapter limits will be updated separately. > > ššDifferential Revision: https://reviews.freebsd.org/D3458 Probably different revision id ? > ššReviewed by: rmacklem > ššMFC after: 2 weeks > > Modified: > ššhead/sys/net/if_var.h > ššhead/sys/netinet/tcp_output.c > > Modified: head/sys/net/if_var.h > ============================================================================== > --- head/sys/net/if_var.h Mon Sep 14 08:01:05 2015 (r287774) > +++ head/sys/net/if_var.h Mon Sep 14 08:36:22 2015 (r287775) > @@ -243,11 +243,12 @@ struct ifnet { > šššššššššš* count limit does not apply. If all three fields are zero, > šššššššššš* there is no TSO limit. > šššššššššš* > - * NOTE: The TSO limits only apply to the data payload part of > - * a TCP/IP packet. That means there is no need to subtract > - * space for ethernet-, vlan-, IP- or TCP- headers from the > - * TSO limits unless the hardware driver in question requires > - * so. > + * NOTE: The TSO limits should reflect the values used in the > + * BUSDMA tag a network adapter is using to load a mbuf chain > + * for transmission. The TCP/IP network stack will subtract > + * space for all linklevel and protocol level headers and > + * ensure that the full mbuf chain passed to the network > + * adapter fits within the given limits. > šššššššššš*/ > šššššššššu_int if_hw_tsomax; /* TSO maximum size in bytes */ > šššššššššu_int if_hw_tsomaxsegcount; /* TSO maximum segment count */ > > Modified: head/sys/netinet/tcp_output.c > ============================================================================== > --- head/sys/netinet/tcp_output.c Mon Sep 14 08:01:05 2015 (r287774) > +++ head/sys/netinet/tcp_output.c Mon Sep 14 08:36:22 2015 (r287775) > @@ -811,7 +811,8 @@ send: > šššššššššššššššššššššššššš*/ > šššššššššššššššššššššššššif (if_hw_tsomax != 0) { > ššššššššššššššššššššššššššššššššš/* compute maximum TSO length */ > - max_len = (if_hw_tsomax - hdrlen); > + max_len = (if_hw_tsomax - hdrlen - > + max_linkhdr); > šššššššššššššššššššššššššššššššššif (max_len <= 0) { > šššššššššššššššššššššššššššššššššššššššššlen = 0; > ššššššššššššššššššššššššššššššššš} else if (len > max_len) { > @@ -826,6 +827,15 @@ send: > šššššššššššššššššššššššššš*/ > šššššššššššššššššššššššššif (if_hw_tsomaxsegcount != 0 && > šššššššššššššššššššššššššššššif_hw_tsomaxsegsize != 0) { > + /* > + * Subtract one segment for the LINK > + * and TCP/IP headers mbuf that will > + * be prepended to this mbuf chain > + * after the code in this section > + * limits the number of mbufs in the > + * chain to if_hw_tsomaxsegcount. > + */ > + if_hw_tsomaxsegcount -= 1; > šššššššššššššššššššššššššššššššššmax_len = 0; > šššššššššššššššššššššššššššššššššmb = sbsndmbuf(&so->so_snd, off, &moff);