Skip to contentSkip to conversation

usb: dwc2: Set max xfer length to speed up R/W

PATCH New Cheng Lu 2 participants 3 messages Mar 24, 2021 USB

lore
Share & tools
lore

Cheng Lu

author
#0 lore raw

PATCH 1/1 usb: dwc2: Set max xfer length to speed up R/W

Set transfer length to the maximum (65535 * 512) Bytes of SCSI READ(10) and WRITE(10) commands, while default transfer length is (20 * 512) Bytes

---

 drivers/usb/host/dwc2.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/usb/host/dwc2.c +7 -0
index f1d13b1c1d..936d7ceb5f 100644
@@ -1456,10 +1456,17 @@ static int dwc2_usb_remove(struct udevice *dev)
 	return 0;
 }
 
+static int dwc2_get_max_xfer_size(struct udevice *dev, size_t *size)
+{
+	*size = SIZE_MAX;
+	return 0;
+}
+
 struct dm_usb_ops dwc2_usb_ops = {
 	.control = dwc2_submit_control_msg,
 	.bulk = dwc2_submit_bulk_msg,
 	.interrupt = dwc2_submit_int_msg,
+	.get_max_xfer_size  = dwc2_get_max_xfer_size,
 };
 
 static const struct udevice_id dwc2_usb_ids[] = {
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 usb: dwc2: Set max xfer length to speed up R/W

Quoted 3 lines · Cheng Lu

Set transfer length to the maximum (65535 * 512) Bytes of SCSI READ(10) and WRITE(10) commands, while default transfer length is (20 * 512) Bytes

Please have a look at these four patches, increasing the transfer length would make some odd USB pen drives fail:

7d6fd7f0ba7 ("usb: storage: Limit transfer size to 120 kiB") da3d1c499fb ("usb: storage: Only clear READY flag on error") 02b0e1a36c5 ("usb: ehci-hcd: Keep async schedule running") 31232de07ef ("usb: Keep async schedule running only across mass storage xfers")

Use the async schedule to avoid stopping the controller after every transfer and thus keep the throughput high, while avoiding very long transfers which might break odd USB pen drives.

author
#2 lore raw

PATCH 1/1 usb: dwc2: Set max xfer length to speed up R/W

Ok, I will check.

Quoted 18 lines · Marek Vasut
Quoted 3 lines · Cheng Lu

Set transfer length to the maximum (65535 * 512) Bytes of SCSI READ(10) and WRITE(10) commands, while default transfer length is (20 * 512) Bytes

Please have a look at these four patches, increasing the transfer length would make some odd USB pen drives fail:

7d6fd7f0ba7 ("usb: storage: Limit transfer size to 120 kiB") da3d1c499fb ("usb: storage: Only clear READY flag on error") 02b0e1a36c5 ("usb: ehci-hcd: Keep async schedule running") 31232de07ef ("usb: Keep async schedule running only across mass storage xfers")

Use the async schedule to avoid stopping the controller after every transfer and thus keep the throughput high, while avoiding very long transfers which might break odd USB pen drives.