From owner-freebsd-stable@freebsd.org Wed Aug 19 08:13:21 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 7A9E59BD96A; Wed, 19 Aug 2015 08:13:21 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-pa0-x22c.google.com (mail-pa0-x22c.google.com [IPv6:2607:f8b0:400e:c03::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 456BA24B; Wed, 19 Aug 2015 08:13:21 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: by pawq9 with SMTP id q9so55586183paw.3; Wed, 19 Aug 2015 01:13:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=CLkjp+SqMahrtwi6FLVeLyQrvmoXwkpvvLRb8VLmBnQ=; b=zRQlmWuUhdPEueQTUHWN6PlbAi3ALpkq1vpKv1dReKcTFrdBFEpwOHJe2MMWnO7hbD 5QRPq8nWkMVD90DbgF9CcIigUZwPK1/y1yV1cUWolyzJwT8BdrzrhC11CzxoDIxo9JC3 4L5KYMttH3TjFAFLmxenMGzRLse0u0ud9/RZqC8RuViyagib7OZqhi+4Vp7sGuHu3Cfg cE2AlxlyJaj7ZAgM3pgIR8Ny0SkB4gt5r3rrR0jiiWAcfW2T4FVNnsfpt6P8L7jaHq9u rH1f7Bg/5BFbiq4u9pBC9WxUs8QjU1tqQVTdvtAqcv2teKf2wm01IjlFod17o+4nrRRP O9dg== X-Received: by 10.68.250.98 with SMTP id zb2mr22368291pbc.40.1439972000644; Wed, 19 Aug 2015 01:13:20 -0700 (PDT) Received: from pyunyh@gmail.com ([106.247.248.2]) by smtp.gmail.com with ESMTPSA id d5sm20648024pdn.74.2015.08.19.01.13.15 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 19 Aug 2015 01:13:19 -0700 (PDT) From: Yonghyeon PYUN X-Google-Original-From: "Yonghyeon PYUN" Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Wed, 19 Aug 2015 17:13:08 +0900 Date: Wed, 19 Aug 2015 17:13:08 +0900 To: Hans Petter Selasky Cc: Rick Macklem , FreeBSD stable , FreeBSD Net , Slawa Olhovchenkov , Christopher Forgeron , Daniel Braniss Subject: Re: ix(intel) vs mlxen(mellanox) 10Gb performance Message-ID: <20150819081308.GC964@michelle.fasterthan.com> Reply-To: pyunyh@gmail.com References: <473274181.23263108.1439814072514.JavaMail.zimbra@uoguelph.ca> <7F892C70-9C04-4468-9514-EDBFE75CF2C6@cs.huji.ac.il> <805850043.24018217.1439848150695.JavaMail.zimbra@uoguelph.ca> <9D8B0503-E8FA-43CA-88F0-01F184F84D9B@cs.huji.ac.il> <1721122651.24481798.1439902381663.JavaMail.zimbra@uoguelph.ca> <55D333D6.5040102@selasky.org> <1325951625.25292515.1439934848268.JavaMail.zimbra@uoguelph.ca> <55D429A4.3010407@selasky.org> <20150819074212.GB964@michelle.fasterthan.com> <55D43590.8050508@selasky.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55D43590.8050508@selasky.org> User-Agent: Mutt/1.4.2.3i 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: Wed, 19 Aug 2015 08:13:21 -0000 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. > > > >>Maybe it can be controlled by some kind of flag, if all the three TSO > >>limits should include the TCP/IP/ethernet headers too. I'm pretty sure > >>we want both versions. > >> > > > >Hmm, I'm afraid it's already complex. Drivers have to tell almost > >the same information to both bus_dma(9) and network stack. > > You're right it's complicated. Not sure if bus_dma can provide an API > for this though. > > --HPS