This patchseries makes sure we follow the td fragmentation constraints
in xhci 4.11.7.1 for bulk tranfers.

The specs say that:
"constraints must be imposed to ensure that the hardware gate count and
validation requirements are minimized for xHC implementations"

The constraint we need to conform to is to make sure the payload data is
packet aligned in the last trb we queue to a segment before a link trb
moves us to the next segment.

In most usecases the payload data is packet aligned, but cases where
scatterlists with several small enrtries are used may hit this issue.

Running "testusb -a -t 7 -s 2048 -v 41 -c 5000" was able to hang the host
after minutes of testing because of unaligned payload data.
After applying this series testusb ran without issues for 4 days.

usb-eth network adapters can potentially hit this issue.

This solution tries to align the data by splitting the trb at a packet
boundary, if that is not possible then a bounce buffer is used.
Initially the plan was to try to insert a link trb mid segment and mid TD
to fulfill the constraints before resorting to a bounce buffer, but
it turned out it requires a lot of driver rewrite. That is an option
that can be implemented later after driver cleanup.

The first 4 patches are more generic cleanups and reworks needed for
the two last patches that actually makes sure data is aligned.

changes since v1:
  cleanup code comments used during development.

Mathias Nyman (6):
  xhci: rename ep_ring variable in queue_bulk_tx(), no functional change
  xhci: properly prepare zero packet TD after normal bulk TD.
  xhci: use boolean to indicate last trb in td remainder calculation
  xhci: don't rely on precalculated value of needed trbs in the enqueue
    loop
  xhci: align the last trb before link if it is easily splittable.
  xhci: TD-fragment, align the unsplittable case with a bounce buffer

 drivers/usb/host/xhci-mem.c  |  74 +++++++-----
 drivers/usb/host/xhci-ring.c | 263 +++++++++++++++++++++++++++++--------------
 drivers/usb/host/xhci.c      |   5 +-
 drivers/usb/host/xhci.h      |  11 +-
 4 files changed, 236 insertions(+), 117 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to