Repository navigation
Conversation
…is free Every completed OUT transfer is restarted with a buffer from the class pool. When the pool is empty at that moment, as when the host sends at full rate while frames wait for the IN endpoint, the restart failed and the OUT endpoint was never armed again: the host could no longer send on any channel until the device was enumerated again. Defer the restart instead, and restart the transfer from a work item as soon as a buffer is returned to the pool. Signed-off-by: Giuseppe Fabiano <gfabiano40@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every completed OUT transfer is restarted with a buffer from the class pool. When the pool is empty at that moment, as when the host sends at full rate while frames wait for the IN endpoint, the restart fails and the OUT endpoint is never armed again: the host can no longer send on any channel until the device is enumerated again.
This defers the restart instead. The OUT endpoint is flagged as pending, the pool gets a destroy callback, and once a buffer is returned to it a work item restarts the pending transfer. Whichever path clears the flag (the request handler retrying the allocation, or the work item) restarts the transfer, so the endpoint is never enqueued twice.
Tested on an ESP32-S3 (udc_dwc2) with two gs_usb channels at full load in both directions: without the change the log shows
failed to restart OUT transfer for ep 0x01 (err -12)and the host stops sending until the device is reconnected; with it, transmission resumes on both channels every time. Built with and withoutCONFIG_USBD_GS_USB_COMPATIBILITY_MODE.