tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Support for USBD_FORCE_SHORT_XFER for xhci



Hi,

I've done recent work on urtwn that fixes transfers when the device is used 
with xhci.

It turns out the root of the problem was a lack of support in the xhci stack 
for the flag USBD_FORCE_SHORT_XFER.


There is some previous artwork for ehci/uhci/ohci that has special handling 
for this particuar flag.

Attached is my attempt at fixing this - this would also make possible for me to 
revert the last 2 commits to urtwn as I would no longer have to send zero 
lengh xfers in the driver.

Thoughts?


Best regards and TIA,

Nat
diff -r b3936ad349df sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c	Thu Aug 21 03:06:52 2025 +0000
+++ b/sys/dev/usb/xhci.c	Fri Aug 22 23:08:51 2025 +1000
@@ -4794,6 +4794,13 @@ xhci_device_bulk_start(struct usbd_xfer 
 	    XHCI_TRB_3_IOC_BIT;
 	xhci_xfer_put_trb(xx, i++, parameter, status, control);
 
+	if (!isread && (xfer->ux_flags & USBD_FORCE_SHORT_XFER)) {
+		status = XHCI_TRB_2_IRQ_SET(0) |
+		    XHCI_TRB_2_TDSZ_SET(0) |
+		    XHCI_TRB_2_BYTES_SET(0);
+		xhci_xfer_put_trb(xx, i++, parameter, status, control);
+	}
+
 	if (!polling)
 		mutex_enter(&tr->xr_lock);
 	xhci_ring_put_xfer(sc, tr, xx, i);


Home | Main Index | Thread Index | Old Index