aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2014-01-31 14:26:25 -0500
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2014-02-07 17:30:02 -0500
commit247bf557273dd775505fb9240d2d152f4f20d304 (patch)
tree8267766a55be13cfb27422e8af20502d13df04f6 /drivers/usb/host
parent03b56329f9bb5a1cb73d7dc659d529a9a9bf3acc (diff)
xhci 1.0: Limit arbitrarily-aligned scatter gather.
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@linux.intel.com> Tested-by: Mark Lord <mlord@pobox.com> Cc: David Laight <David.Laight@ACULAB.COM> Cc: Bjørn Mork <bjorn@mork.no> Cc: Freddy Xin <freddy@asix.com.tw> Cc: Ming Lei <ming.lei@canonical.com> Cc: stable@vger.kernel.org # 3.12
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/xhci.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 3712359d18ba..86a2e834fdff 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4733,9 +4733,6 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
4733 /* Limit the block layer scatter-gather lists to half a segment. */ 4733 /* Limit the block layer scatter-gather lists to half a segment. */
4734 hcd->self.sg_tablesize = TRBS_PER_SEGMENT / 2; 4734 hcd->self.sg_tablesize = TRBS_PER_SEGMENT / 2;
4735 4735
4736 /* support to build packet from discontinuous buffers */
4737 hcd->self.no_sg_constraint = 1;
4738
4739 /* XHCI controllers don't stop the ep queue on short packets :| */ 4736 /* XHCI controllers don't stop the ep queue on short packets :| */
4740 hcd->self.no_stop_on_short = 1; 4737 hcd->self.no_stop_on_short = 1;
4741 4738
@@ -4760,6 +4757,14 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
4760 /* xHCI private pointer was set in xhci_pci_probe for the second 4757 /* xHCI private pointer was set in xhci_pci_probe for the second
4761 * registered roothub. 4758 * registered roothub.
4762 */ 4759 */
4760 xhci = hcd_to_xhci(hcd);
4761 /*
4762 * Support arbitrarily aligned sg-list entries on hosts without
4763 * TD fragment rules (which are currently unsupported).
4764 */
4765 if (xhci->hci_version < 0x100)
4766 hcd->self.no_sg_constraint = 1;
4767
4763 return 0; 4768 return 0;
4764 } 4769 }
4765 4770
@@ -4788,6 +4793,9 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
4788 if (xhci->hci_version > 0x96) 4793 if (xhci->hci_version > 0x96)
4789 xhci->quirks |= XHCI_SPURIOUS_SUCCESS; 4794 xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
4790 4795
4796 if (xhci->hci_version < 0x100)
4797 hcd->self.no_sg_constraint = 1;
4798
4791 /* Make sure the HC is halted. */ 4799 /* Make sure the HC is halted. */
4792 retval = xhci_halt(xhci); 4800 retval = xhci_halt(xhci);
4793 if (retval) 4801 if (retval)