JianyuWang0623 opened a new pull request, #21513:
URL: https://github.com/apache/nuttx/pull/21513

   ## Summary
   
   usbdev_fs sized every bulk request to exactly one maxpacket, so a stream 
paid one request completion and one resubmit per packet and stayed near 10MB/s 
on a high-speed link. Add CONFIG_USBDEV_FS_BULK_REQLEN to size each endpoint's 
request buffers as a multiple of the packet size; reads and writes move up to 
that many bytes per request. The default 0 keeps one maxpacket per request.
   
   ## Impact
   
   - BULK_REQLEN=0 (default): request size is unchanged.
   - BULK_REQLEN>0: every usbdev_fs endpoint, ep0 included, allocates its 
requests at that size, e.g. 4 x 16KiB per endpoint with 4 requests.
   
   ## Testing
   
   Host: Linux x86_64, AOSP fastboot, USB 2.0 high-speed port.
   
   ### High-speed device
   
   Target: out-of-tree Cortex-M board with a USB 2.0 high-speed device 
controller, fastbootd (apps system/fastboot) over USBADB/usbdev_fs, 
CONFIG_USBADB_NRDREQS=4. Only CONFIG_USBDEV_FS_BULK_REQLEN differs between the 
two images (0 vs 16384).
   
   Download only: `flash:` stubbed to answer OKAY without writing, so the host 
"Sending" time is the USB download time. Rate = image size / Sending. One 
warm-up run, then 3 runs per size.
   
   CONFIG_SYSTEM_FASTBOOTD_DOWNLOAD_MAX=40960:
   
   | Image | BULK_REQLEN=0 Sending (s) | MB/s | BULK_REQLEN=16384 Sending (s) | 
MB/s |
   |---|---|---|---|---|
   | 1MiB | 0.087 / 0.091 / 0.091 | 11.7 | 0.055 / 0.054 / 0.054 | 19.3 |
   | 8MiB | 0.717 / 0.692 / 0.694 | 12.0 | 0.421 / 0.447 / 0.432 | 19.4 |
   | 32MiB | 3.057 / 3.079 / 3.370 | 10.6 | 1.505 / 1.769 / 1.411 | 21.5 |
   
   CONFIG_SYSTEM_FASTBOOTD_DOWNLOAD_MAX=262144:
   
   | Image | BULK_REQLEN=0 Sending (s) | MB/s | BULK_REQLEN=16384 Sending (s) | 
MB/s |
   |---|---|---|---|---|
   | 1MiB | 0.088 / 0.088 / 0.092 | 11.7 | 0.032 / 0.031 / 0.032 | 33.1 |
   | 8MiB | 0.701 / 0.692 / 0.700 | 12.0 | 0.237 / 0.237 / 0.243 | 35.1 |
   | 32MiB | 2.784 / 2.779 / 2.742 | 12.1 | 0.965 / 0.924 / 0.944 | 35.5 |
   
   Full flash, 32MiB random image, DOWNLOAD_MAX=262144 (131 sparse segments), 
fastbootd writing to eMMC in parallel with the next download, images alternated 
in one session:
   
   | BULK_REQLEN | Sending (s) | Total (s) | End-to-end |
   |---|---|---|---|
   | 0 | 2.875 / 2.880 / 2.846 | 2.954 / 2.961 / 2.923 | 10.8 MB/s |
   | 16384 | 0.996 / 0.981 / 1.031 | 1.410 / 1.396 / 1.417 | 22.6 MB/s |
   
   Image read back after flashing; sha256 matched.
   
   ### Full-speed device
   
   Target: lckfb-szpi-esp32s3:fastboot_usb (ESP32-S3 OTG, full speed only, 
64-byte bulk packets), DOWNLOAD_MAX=40960. Host: pyusb fastboot client, 
`download:` of 32KiB, 5 runs each, data checked by flash + hexdump.
   
   | Build | OUT MB/s | Data check |
   |---|---|---|
   | master | 0.767 | 5/5 OK |
   | this PR, BULK_REQLEN=0 | 0.765 | 5/5 OK |
   | this PR, BULK_REQLEN=16384 | 0.765 | 5/5 OK |
   
   No change on full speed: the 12Mbit/s link, not per-request overhead, is the 
limit there.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to