xhci: use linked list for transfers
commit94b037f2a451b3dc855f9f2c346e5049a361bd55
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 27 Sep 2016 08:32:48 +0000 (27 10:32 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 12 Oct 2016 10:37:31 +0000 (12 12:37 +0200)
tree393fd9925b78a355d507cbf194fa5538f2d217c2
parent7512b13dd7f77c3e93a5b856eddf78378bddcc7f
xhci: use linked list for transfers

xhci has a fixed number of 24 (TD_QUEUE) XHCITransfer structs per
endpoint, which turns out to be a problem for usb3 devices with 32 (or
more) bulk streams.  xhci re-checks the trb rings on every finished
transfer to make sure it'll pick up any pending work.  But that scheme
breaks in case the first transfer of a ring can't be started because we
ran out of XHCITransfer structs already.

So remove static XHCITransfer array from XHCIEPContext.  Use a linked
list instead, and allocate/free XHCITransfer as needed.  Add helper
functions to allocate & initialize and to cleanup & release
XHCITransfer structs.  That also simplifies trb management, we never
have to realloc XHCITransfer->trbs because we don't reuse XHCITransfer
structs any more.

New dynamic limit for in-flight xhci transfers per endpoint is
number-of-streams + 16.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1474965172-30321-5-git-send-email-kraxel@redhat.com
hw/usb/hcd-xhci.c