Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Sep 2015 11:48:59 +0300
From:      Alexander V. Chernikov <melifaro@freebsd.org>
To:        Hans Petter Selasky <hselasky@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r287775 - in head/sys: net netinet
Message-ID:  <1482471442220539@web24g.yandex.ru>
In-Reply-To: <201509140836.t8E8aNXW051334@repo.freebsd.org>
References:  null <201509140836.t8E8aNXW051334@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help


14.09.2015, 11:36, "Hans Petter Selasky" <hselasky@FreeBSD.org>:
> 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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1482471442220539>