• David Laight's avatar
    usb: xhci: Link TRB must not occur within a USB payload burst · 35773dac
    David Laight authored
    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
    638c5115 "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 638c5115 "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=2Signed-off-by: default avatarDavid Laight <david.laight@aculab.com>
    Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
    Tested-by: default avatarMark Lord <mlord@pobox.com>
    Cc: stable@vger.kernel.org
    35773dac
xhci-ring.c 127 KB