This is a note to let you know that I've just added the patch titled xhci 1.0: Limit arbitrarily-aligned scatter gather. to the 3.13-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xhci-1.0-limit-arbitrarily-aligned-scatter-gather.patch and it can be found in the queue-3.13 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 247bf557273dd775505fb9240d2d152f4f20d304 Mon Sep 17 00:00:00 2001 From: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx> Date: Fri, 31 Jan 2014 11:26:25 -0800 Subject: xhci 1.0: Limit arbitrarily-aligned scatter gather. From: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx> commit 247bf557273dd775505fb9240d2d152f4f20d304 upstream. xHCI 1.0 hosts have a set of requirements on how to align transfer buffers on the endpoint rings called "TD fragment" rules. When the ax88179_178a driver added support for scatter gather in 3.12, with commit 804fad45411b48233b48003e33a78f290d227c8 "USBNET: ax88179_178a: enable tso if usb host supports sg dma", it broke the device under xHCI 1.0 hosts. Under certain network loads, the device would see an unexpected short packet from the host, which would cause the device to stop sending ethernet packets, even through USB packets would still be sent. Commit 35773dac5f86 "usb: xhci: Link TRB must not occur within a USB payload burst" attempted to fix this. It was a quick hack to partially implement the TD fragment rules. However, it caused regressions in the usb-storage layer and userspace USB drivers using libusb. The patches to attempt to fix this are too far reaching into the USB core, and we really need to implement the TD fragment rules correctly in the xHCI driver, instead of continuing to wallpaper over the issues. Disable arbitrarily-aligned scatter-gather in the xHCI driver for 1.0 hosts. Only the ax88179_178a driver checks the no_sg_constraint flag, so don't set it for 1.0 hosts. This should not impact usb-storage or usbfs behavior, since they pass down max packet sized aligned sg-list entries (512 for USB 2.0 and 1024 for USB 3.0). Signed-off-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx> Tested-by: Mark Lord <mlord@xxxxxxxxx> Cc: David Laight <David.Laight@xxxxxxxxxx> Cc: Bjørn Mork <bjorn@xxxxxxx> Cc: Freddy Xin <freddy@xxxxxxxxxxx> Cc: Ming Lei <ming.lei@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/usb/host/xhci.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4719,9 +4719,6 @@ int xhci_gen_setup(struct usb_hcd *hcd, /* Limit the block layer scatter-gather lists to half a segment. */ hcd->self.sg_tablesize = TRBS_PER_SEGMENT / 2; - /* support to build packet from discontinuous buffers */ - hcd->self.no_sg_constraint = 1; - /* XHCI controllers don't stop the ep queue on short packets :| */ hcd->self.no_stop_on_short = 1; @@ -4746,6 +4743,14 @@ int xhci_gen_setup(struct usb_hcd *hcd, /* xHCI private pointer was set in xhci_pci_probe for the second * registered roothub. */ + xhci = hcd_to_xhci(hcd); + /* + * Support arbitrarily aligned sg-list entries on hosts without + * TD fragment rules (which are currently unsupported). + */ + if (xhci->hci_version < 0x100) + hcd->self.no_sg_constraint = 1; + return 0; } @@ -4772,6 +4777,9 @@ int xhci_gen_setup(struct usb_hcd *hcd, if (xhci->hci_version > 0x96) xhci->quirks |= XHCI_SPURIOUS_SUCCESS; + if (xhci->hci_version < 0x100) + hcd->self.no_sg_constraint = 1; + /* Make sure the HC is halted. */ retval = xhci_halt(xhci); if (retval) Patches currently in stable-queue which might be from sarah.a.sharp@xxxxxxxxxxxxxxx are queue-3.13/revert-xhci-avoid-infinite-loop-when-sg-urb-requires-too-many-trbs.patch queue-3.13/revert-xhci-set-scatter-gather-limit-to-avoid-failed-block-writes.patch queue-3.13/revert-usb-xhci-link-trb-must-not-occur-within-a-usb-payload-burst.patch queue-3.13/xhci-1.0-limit-arbitrarily-aligned-scatter-gather.patch queue-3.13/revert-usbcore-set-lpm_capable-field-for-lpm-capable-root-hubs.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html