From owner-freebsd-stable@freebsd.org Thu Aug 20 12:03:49 2015 Return-Path: Delivered-To: freebsd-stable@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 C3F769BED08; Thu, 20 Aug 2015 12:03:49 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.net.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id 4C89C159; Thu, 20 Aug 2015 12:03:48 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) IronPort-PHdr: 9a23:c4mtjRVinxux5MmOj2cbwepSweHV8LGtZVwlr6E/grcLSJyIuqrYZhGAt8tkgFKBZ4jH8fUM07OQ6PC7HzBQqsvZ+Fk5M7VyFDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3CwN5K6zPF5LIiIzvjqbpq8aVP1UD2WL1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu3SNp41Rr1ADTkgL3t9pIiy7UGCHkOz4S4EQ3gQgxpgDA3M7RW8VZD04QXgse8o4iiRPoXTRLs3XTmnp/NxTRbjiyMKMhYk927Kh8hojORQqUTy9FRE34fIbdTNZ7JFdaTHcIZfHDIZUw== X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BYAgBLwdVV/61jaINdg29pBoMfui0BCYFtCoUxSgKBaBQBAQEBAQEBAYEJgh2CBgEBAQMBAQEBICsgCwULAgEIGAICDRkCAicBCSYCDAcEARwEiAUIDbkclgQBAQEBAQEBAwEBAQEBGQSBIooxhDEBBgEBHDQHgmmBQwWVKIUFhQiELJA/hEiDZwImgg4cgW8iMwd+AQgXI4EEAQEB X-IronPort-AV: E=Sophos;i="5.15,714,1432612800"; d="scan'208";a="233568830" Received: from nipigon.cs.uoguelph.ca (HELO zcs1.mail.uoguelph.ca) ([131.104.99.173]) by esa-annu.net.uoguelph.ca with ESMTP; 20 Aug 2015 08:03:41 -0400 Received: from localhost (localhost [127.0.0.1]) by zcs1.mail.uoguelph.ca (Postfix) with ESMTP id 039F715F55D; Thu, 20 Aug 2015 08:03:41 -0400 (EDT) Received: from zcs1.mail.uoguelph.ca ([127.0.0.1]) by localhost (zcs1.mail.uoguelph.ca [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ydQ8_x38jF7C; Thu, 20 Aug 2015 08:03:40 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by zcs1.mail.uoguelph.ca (Postfix) with ESMTP id 2012815F563; Thu, 20 Aug 2015 08:03:40 -0400 (EDT) X-Virus-Scanned: amavisd-new at zcs1.mail.uoguelph.ca Received: from zcs1.mail.uoguelph.ca ([127.0.0.1]) by localhost (zcs1.mail.uoguelph.ca [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id QiqjKPhbu5_J; Thu, 20 Aug 2015 08:03:39 -0400 (EDT) Received: from zcs1.mail.uoguelph.ca (zcs1.mail.uoguelph.ca [172.17.95.18]) by zcs1.mail.uoguelph.ca (Postfix) with ESMTP id EA2C315F55D; Thu, 20 Aug 2015 08:03:39 -0400 (EDT) Date: Thu, 20 Aug 2015 08:03:39 -0400 (EDT) From: Rick Macklem To: pyunyh@gmail.com Cc: Hans Petter Selasky , FreeBSD stable , FreeBSD Net , Slawa Olhovchenkov , Christopher Forgeron Message-ID: <1935256446.26896702.1440072219573.JavaMail.zimbra@uoguelph.ca> In-Reply-To: <20150820045125.GA982@michelle.fasterthan.com> References: <473274181.23263108.1439814072514.JavaMail.zimbra@uoguelph.ca> <1325951625.25292515.1439934848268.JavaMail.zimbra@uoguelph.ca> <55D429A4.3010407@selasky.org> <20150819074212.GB964@michelle.fasterthan.com> <55D43590.8050508@selasky.org> <20150819081308.GC964@michelle.fasterthan.com> <1154739904.25677089.1439986439408.JavaMail.zimbra@uoguelph.ca> <20150820045125.GA982@michelle.fasterthan.com> Subject: Re: ix(intel) vs mlxen(mellanox) 10Gb performance MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.95.11] X-Mailer: Zimbra 8.0.9_GA_6191 (ZimbraWebClient - FF34 (Win)/8.0.9_GA_6191) Thread-Topic: ix(intel) vs mlxen(mellanox) 10Gb performance Thread-Index: rwJq7qWbysh2G9XrT4qz/e9qa1lX4w== X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2015 12:03:50 -0000 Yonghyeon PYUN wrote: > On Wed, Aug 19, 2015 at 08:13:59AM -0400, Rick Macklem wrote: > > Yonghyeon PYUN wrote: > > > On Wed, Aug 19, 2015 at 09:51:44AM +0200, Hans Petter Selasky wrote: > > > > On 08/19/15 09:42, Yonghyeon PYUN wrote: > > > > >On Wed, Aug 19, 2015 at 09:00:52AM +0200, Hans Petter Selasky wrote: > > > > >>On 08/18/15 23:54, Rick Macklem wrote: > > > > >>>Ouch! Yes, I now see that the code that counts the # of mbufs is > > > > >>>before > > > > >>>the > > > > >>>code that adds the tcp/ip header mbuf. > > > > >>> > > > > >>>In my opinion, this should be fixed by setting if_hw_tsomaxsegcount > > > > >>>to > > > > >>>whatever > > > > >>>the driver provides - 1. It is not the driver's responsibility to > > > > >>>know > > > > >>>if > > > > >>>a tcp/ip > > > > >>>header mbuf will be added and is a lot less confusing that expecting > > > > >>>the > > > > >>>driver > > > > >>>author to know to subtract one. (I had mistakenly thought that > > > > >>>tcp_output() had > > > > >>>added the tc/ip header mbuf before the loop that counts mbufs in the > > > > >>>list. > > > > >>>Btw, > > > > >>>this tcp/ip header mbuf also has leading space for the MAC layer > > > > >>>header.) > > > > >>> > > > > >> > > > > >>Hi Rick, > > > > >> > > > > >>Your question is good. With the Mellanox hardware we have separate > > > > >>so-called inline data space for the TCP/IP headers, so if the TCP > > > > >>stack > > > > >>subtracts something, then we would need to add something to the > > > > >>limit, > > > > >>because then the scatter gather list is only used for the data part. > > > > >> > > > > > > > > > >I think all drivers in tree don't subtract 1 for > > > > >if_hw_tsomaxsegcount. Probably touching Mellanox driver would be > > > > >simpler than fixing all other drivers in tree. > > > > > > > > Hi, > > > > > > > > If you change the behaviour don't forget to update and/or add comments > > > > describing it. Maybe the amount of subtraction could be defined by some > > > > macro? Then drivers which inline the headers can subtract it? > > > > > > > > > > I'm also ok with your suggestion. > > > > > > > Your suggestion is fine by me. > > > > > > > > > > > The initial TSO limits were tried to be preserved, and I believe that > > > > TSO limits never accounted for IP/TCP/ETHERNET/VLAN headers! > > > > > > > > > > I guess FreeBSD used to follow MS LSOv1 specification with minor > > > exception in pseudo checksum computation. If I recall correctly the > > > specification says upper stack can generate up to IP_MAXPACKET sized > > > packet. Other L2 headers like ethernet/vlan header size is not > > > included in the packet and it's drivers responsibility to allocate > > > additional DMA buffers/segments for L2 headers. > > > > > Yep. The default for if_hw_tsomax was reduced from IP_MAXPACKET to > > 32 * MCLBYTES - max_ethernet_header_size as a workaround/hack so that > > devices limited to 32 transmit segments would work (ie. the entire packet, > > including MAC header would fit in 32 MCLBYTE clusters). > > This implied that many drivers did end up using m_defrag() to copy the mbuf > > list to one made up of 32 MCLBYTE clusters. > > > > If a driver sets if_hw_tsomaxsegcount correctly, then it can set > > if_hw_tsomax > > to whatever it can handle as the largest TSO packet (without MAC header) > > the > > hardware can handle. If it can handle > IP_MAXPACKET, then it can set it to > > that. > > > > I thought the upper limit was still IP_MAXPACKET. If driver > increase it (i.e. > IP_MAXPACKET, the length field in the IP > header would overflow which in turn may break firewalls and other > packet handling in IPv4/IPv6 code path. I have no idea if a bogus value in the ip_len field of the TSO segment would break something in ip_output() or not. This would need to be checked before anyone configures if_hw_tsomax > IP_MAXPACKET. I didn't think of any effect this would have in ip_output(), I just knew that the hardware would be replacing ip_len when it generated the TCP/IP segments from the TSO segment. As you note, I vaguely recall some hardware being able to handle a TSO segment > IP_MAXPACKET (presumably getting the TSO segment's length some other way). It would be nice if this was checked, but yes, the comment should specify an upper bound on if_hw_tsomax of IP_MAXPACKET until then. rick > If the limit no longer apply to network stack, that's great. Some > controllers can handle up to 256KB TCP/UDP segmentation and > supporting that feature wouldn't be hard. > _______________________________________________ > freebsd-stable@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org" >