Skip to contentSkip to conversation

usb: xhci: do not abort on non-zero residual length with COMP_SUCCESS

PATCH New Sumit Singh Dhami 1 participant 1 message Nov 4

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: xhci: do not abort on non-zero residual length with COMP_SUCCESS

From: Aswin Murugan <[email protected]>

Some xHCI controllers report COMP_SUCCESS with a non-zero residual length for chained multi-TRB transfers. This can occur with large bulk IN transfers used by USB Ethernet adapters such as ax88179_eth, when a transfer crosses the 64 KiB boundary and is split across multiple TRBs.

Replace the fatal BUG_ON() with a debug message and handle the transfer like a short transfer. The actual transfer length is already calculated from the residual length reported by the hardware, so this avoids crashing U-Boot while preserving the received data length.

---
 drivers/usb/host/xhci-ring.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +8 -1
index 6f5c4ec97b6..bd88544977d 100644
@@ -601,7 +601,14 @@ static void record_transfer_result(struct usb_device *udev,
 
 	switch (GET_COMP_CODE(le32_to_cpu(event->trans_event.transfer_len))) {
 	case COMP_SUCCESS:
-		BUG_ON(udev->act_len != length);
+		/*
+		 * Some controllers report COMP_SUCCESS with a non-zero residual for
+		 * chained transfers. Treat this as a short transfer since act_len
+		 * already accounts for the reported residual by the hardware.
+		 */
+		if (udev->act_len != length)
+			debug("%s: COMP_SUCCESS with residual (act_len=%d, length=%d)\n",
+			      __func__, udev->act_len, length);
 		/* fallthrough */
 	case COMP_SHORT_TX:
 		udev->status = 0;

base-commit: 3973f3c4d24df75ca90d7c0a9f03e5e5c9b48f32

Signature · 2 lines
Best regards
Sumit Singh Dhami