summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorNiklas Neronin <niklas.neronin@linux.intel.com>2024-06-26 15:48:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-27 17:08:06 +0300
commitd56b0b2ab142940b06eac56dcb3ab1ab88df38a2 (patch)
treebe5cae1f42436f94ea9af522b2a20dfcb7622dc1 /drivers/usb
parent21b224d7475751a398dfb811e4f987671ef37ade (diff)
downloadlinux-d56b0b2ab142940b06eac56dcb3ab1ab88df38a2.tar.xz
usb: xhci: ensure skipped isoc TDs are returned when isoc ring is stopped
Missed service event tells the driver that the hardware wasn't able to process some queued isoc TDs in their right time slots, and some TDs will be skipped. The driver sets a 'skip' flag to indicate that the next transfer event after this event will point to some future TD instead of the next queued TD. Once the driver receives the next event, it will skip and give back all those hardware skipped TDs. However, should this subsequent event be a stop endpoint which does not point to the next pending TD, the driver fails to return the skipped TDs. Instead, it loops for a period before outputting an erroneous message. Fix this by repositioning the 'stop endpoint' check to follow the isoc skip check, ensuring the skipped TDs are properly returned. Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20240626124835.1023046-16-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/xhci-ring.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 3479c9cb5d33..14898335d193 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2819,19 +2819,6 @@ static int handle_tx_event(struct xhci_hcd *xhci,
/* Is this a TRB in the currently executing TD? */
ep_seg = trb_in_td(xhci, td, ep_trb_dma, false);
- /*
- * Skip the Force Stopped Event. The event_trb(event_dma) of FSE
- * is not in the current TD pointed by ep_ring->dequeue because
- * that the hardware dequeue pointer still at the previous TRB
- * of the current TD. The previous TRB maybe a Link TD or the
- * last TRB of the previous TD. The command completion handle
- * will take care the rest.
- */
- if (!ep_seg && (trb_comp_code == COMP_STOPPED ||
- trb_comp_code == COMP_STOPPED_LENGTH_INVALID)) {
- continue;
- }
-
if (!ep_seg) {
if (ep->skip && usb_endpoint_xfer_isoc(&td->urb->ep->desc)) {
@@ -2840,6 +2827,18 @@ static int handle_tx_event(struct xhci_hcd *xhci,
}
/*
+ * Skip the Force Stopped Event. The 'ep_trb' of FSE is not in the current
+ * TD pointed by 'ep_ring->dequeue' because that the hardware dequeue
+ * pointer still at the previous TRB of the current TD. The previous TRB
+ * maybe a Link TD or the last TRB of the previous TD. The command
+ * completion handle will take care the rest.
+ */
+ if (trb_comp_code == COMP_STOPPED ||
+ trb_comp_code == COMP_STOPPED_LENGTH_INVALID) {
+ return 0;
+ }
+
+ /*
* Some hosts give a spurious success event after a short
* transfer. Ignore it.
*/