]> git.baikalelectronics.ru Git - kernel.git/commit
usb: xhci: Link TRB must not occur within a USB payload burst
authorDavid Laight <David.Laight@ACULAB.COM>
Mon, 11 Nov 2013 12:26:54 +0000 (12:26 +0000)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Mon, 2 Dec 2013 19:57:10 +0000 (11:57 -0800)
commit1a12bd45e30778db6ec0ca16ce0a71bb96ed4503
treeee95416c3efb1f75ab4bd43ed2560a23c97739d3
parentd06cd2c6dc3bd5f0ce3f2092cd8dc06e7369162c
usb: xhci: Link TRB must not occur within a USB payload burst

Section 4.11.7.1 of rev 1.0 of the xhci specification states that a link TRB
can only occur at a boundary between underlying USB frames (512 bytes for
high speed devices).

If this isn't done the USB frames aren't formatted correctly and, for example,
the USB3 ethernet ax88179_178a card will stop sending (while still receiving)
when running a netperf tcp transmit test with (say) and 8k buffer.

This should be a candidate for stable, the ax88179_178a driver defaults to
gso and tso enabled so it passes a lot of fragmented skb to the USB stack.

Notes from Sarah:

Discussion: http://marc.info/?l=linux-usb&m=138384509604981&w=2

This patch fixes a long-standing xHCI driver bug that was revealed by a
change in 3.12 in the usb-net driver.  Commit
2af590676cb24fadf9e3381c649152e9771b9e86 "USBNET: support DMA SG" added
support to use bulk endpoint scatter-gather (urb->sg).  Only the USB
ethernet drivers trigger this bug, because the mass storage driver sends
sg list entries in page-sized chunks.

This patch only fixes the issue for bulk endpoint scatter-gather.  The
problem will still occur for periodic endpoints, because hosts will
interpret no-op transfers as a request to skip a service interval, which
is not what we want.

Luckily, the USB core isn't set up for scatter-gather on isochronous
endpoints, and no USB drivers use scatter-gather for interrupt
endpoints.  Document this known limitation so that developers won't try
to use urb->sg for interrupt endpoints until this issue is fixed.  The
more comprehensive fix would be to allow link TRBs in the middle of the
endpoint ring and revert this patch, but that fix would touch too much
code to be allowed in for stable.

This patch should be backported to kernels as old as 3.12, that contain
the commit 2af590676cb24fadf9e3381c649152e9771b9e86 "USBNET: support DMA
SG".  Without this patch, the USB network device gets wedged, and stops
sending packets.  Mark Lord confirms this patch fixes the regression:

http://marc.info/?l=linux-netdev&m=138487107625966&w=2

Signed-off-by: David Laight <david.laight@aculab.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Tested-by: Mark Lord <mlord@pobox.com>
Cc: stable@vger.kernel.org
drivers/usb/host/xhci-ring.c
include/linux/usb.h