From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: Ben Hutchings <bhutchings@solarflare.com>,
Alan Stern <stern@rowland.harvard.edu>,
netdev@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: xhci: Link TRB must not occur with a USB payload burst.
Date: Tue, 19 Nov 2013 14:58:22 -0800 [thread overview]
Message-ID: <20131119225822.GA9611@xanatos> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B7430@saturn3.aculab.com>
On Mon, Nov 18, 2013 at 03:41:00PM -0000, David Laight wrote:
>
>
> > -----Original Message-----
> > From: Ben Hutchings [mailto:bhutchings@solarflare.com]
> > Sent: 18 November 2013 15:03
> > To: David Laight
> > Cc: Alan Stern; Sarah Sharp; netdev@vger.kernel.org; linux-usb@vger.kernel.org
> > Subject: Re: [PATCH] usb: xhci: Link TRB must not occur with a USB payload burst.
> >
> > On Mon, 2013-11-18 at 09:48 +0000, David Laight wrote:
> > > > > But the minimum fragment size is (probably) 4k.
> > > > > For the network stack an OUT transfer might have a lot (and I mean lots)
> > > > > of fragments (there may be constraints, and linearising the skb is a option).
> > > > [...]
> > > >
> > > > The maximum number of fragments in the skb is going to be 17 (including
> > > > the 'head' area). (I'm ignoring NETIF_F_FRAGLIST which is not normally
> > > > supported by physical device drivers.)
> > > >
> > > > I don't know how many fragments that can end up as, at the USB level.
> > >
> > > If you assume that every fragment crosses a 64k boundary that would be 34.
> > > OTOH I've not seen a fragment of a 64k TSO send crossing a 32k
> > > boundary, and I think the 'head' area is constrained to be part of
> > > a single (4k or larger) page.
> >
> > I don't know that it's possible at the moment, but I wouldn't recommend
> > relying on that.
>
> The xhci (USB3) hardware supports SG, but a non-obvious alignment restriction
> applies at the end of a ring segment. In effect this means that the number of
> fragments mustn't exceed the size of the ring segment.
> It would make the xchi driver simpler if excessively fragmented requests
> could just be bounced.
> Since ring entries are 16 bytes there isn't much reason to not use a 4k
> 'page' for a ring and have (almost) 256 ring slots.
> (The code currently uses multiple ring segments with 63 usable slots.)
>
> Looks like skb are constrained enough that a sensible limit can be applied.
>
> The other likely generator of fragmented requests is the mass storage code.
> Most likely for dd(1) with a large block size.
The xHCI driver can limit the number of sg-list entries through
hcd->self.sg_tablesize. It's currently set to ~0, which is "however
many entries you want. You could set that to the number of TRBs in a
segment (minus one for the link TRB).
The usb-storage and uas drivers currently use sg_tablesize. Could the
network stack be taught to use sg_tablesize as well?
(Also, usb-storage aligns the block sizes to 512K, which explains why
we've never had an issue with TD fragments with that driver.)
Sarah Sharp
next prev parent reply other threads:[~2013-11-19 22:58 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-07 17:20 [PATCH] usb: xhci: Link TRB must not occur with a USB payload burst David Laight
2013-11-08 0:18 ` Sarah Sharp
2013-11-08 10:47 ` David Laight
2013-11-08 16:45 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1311081119510.1162-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-11-08 17:39 ` David Laight
2013-11-08 18:12 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1311081303460.1162-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-11-11 17:12 ` David Laight
[not found] ` <AE90C24D6B3A694183C094C60CF0A2F6026B73FE-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2013-11-11 20:34 ` Alan Stern
2013-11-12 9:43 ` David Laight
[not found] ` <AE90C24D6B3A694183C094C60CF0A2F6026B73FF-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2013-11-12 16:08 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1311121051090.1200-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-11-12 16:50 ` David Laight
2013-11-12 19:00 ` Alan Stern
2013-11-13 9:28 ` David Laight
[not found] ` <AE90C24D6B3A694183C094C60CF0A2F6026B740B-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2013-11-13 16:20 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1311131113090.1424-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-11-13 16:58 ` David Laight
[not found] ` <AE90C24D6B3A694183C094C60CF0A2F6026B741A-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2013-11-16 1:38 ` Ben Hutchings
[not found] ` <1384565904.29151.66.camel-/LGg1Z1CJKQ+9kgCwbf1HqK4ta4zdZpAajtMo4Cw6ucAvxtiuMwx3w@public.gmane.org>
2013-11-18 9:48 ` David Laight
2013-11-18 15:03 ` Ben Hutchings
[not found] ` <1384787003.10077.34.camel-nDn/Rdv9kqW9Jme8/bJn5UCKIB8iOfG2tUK59QYPAWc@public.gmane.org>
2013-11-18 15:41 ` David Laight
2013-11-19 22:58 ` Sarah Sharp [this message]
2013-11-20 3:09 ` Alan Stern
2013-11-20 9:36 ` David Laight
2013-11-20 15:03 ` Eric Dumazet
[not found] ` <1384959827.8604.141.camel-XN9IlZ5yJG9HTL0Zs8A6p/gx64E7kk8eUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
2013-11-20 15:54 ` David Laight
[not found] ` <AE90C24D6B3A694183C094C60CF0A2F6026B7437-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2013-11-20 16:06 ` Sarah Sharp
2013-11-20 17:02 ` David Laight
2013-11-20 17:16 ` David Laight
[not found] ` <AE90C24D6B3A694183C094C60CF0A2F6026B743D-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2013-11-20 18:39 ` Sarah Sharp
2013-11-20 21:11 ` Paul Zimmerman
2013-11-21 9:53 ` David Laight
2013-11-20 9:46 ` David Laight
[not found] ` <AE90C24D6B3A694183C094C60CF0A2F6026B7438-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2013-11-20 16:26 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1311201121350.1826-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-11-20 17:08 ` David Laight
2013-11-20 16:50 ` Sarah Sharp
[not found] ` <Pine.LNX.4.44L0.1311111525480.17105-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-11-12 17:15 ` Sarah Sharp
2013-11-12 17:33 ` David Laight
2013-11-12 19:22 ` Alan Stern
2013-11-13 9:45 ` David Laight
[not found] ` <AE90C24D6B3A694183C094C60CF0A2F6026B740C-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2013-11-13 16:27 ` Alan Stern
2013-11-08 11:07 ` David Laight
[not found] ` <AE90C24D6B3A694183C094C60CF0A2F6026B73F1-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2013-11-12 17:15 ` Sarah Sharp
2013-11-12 17:28 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131119225822.GA9611@xanatos \
--to=sarah.a.sharp@linux.intel.com \
--cc=David.Laight@ACULAB.COM \
--cc=bhutchings@solarflare.com \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).