[PATCH 4/4] usb: gadget: dummy_hcd: set no_sg_constraint on the host controller
From: Igor Skalkin
Date: Fri Aug 07 2026 - 03:55:57 EST
dummy_hcd copies data in software and has no hardware DMA alignment
requirement. Set no_sg_constraint = 1 so the USB core does not reject
SG URBs whose non-final segments are not a multiple of the endpoint
maxpacket size.
For SuperSpeed bulk endpoints maxpacket is 1024 bytes; usbtest generates
SG lists with varying segment sizes (e.g. 512 bytes) that are valid
transfers but not maxpacket-aligned, causing usb_submit_urb to return
-EINVAL before the URB reaches the host controller.
Assisted-by: OpenCode:claude-sonnet-5
Signed-off-by: Igor Skalkin <igor.skalkin@xxxxxxxxxxxxxxxx>
---
drivers/usb/gadget/udc/dummy_hcd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
index 7597c9e9fa66..2cfb1d035b34 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -2550,6 +2550,7 @@ static int dummy_setup(struct usb_hcd *hcd)
dum = *((void **)dev_get_platdata(hcd->self.controller));
hcd->self.sg_tablesize = ~0;
+ hcd->self.no_sg_constraint = 1;
if (usb_hcd_is_primary_hcd(hcd)) {
dum->hs_hcd = hcd_to_dummy_hcd(hcd);
dum->hs_hcd->dum = dum;
--
2.49.0