Re: dwc3: unusual handling of setup requests with wLength == 0

From: Thinh Nguyen
Date: Tue Aug 22 2023 - 22:15:00 EST


On Sun, Aug 20, 2023, Alan Stern wrote:
> On Sat, Aug 19, 2023 at 12:06:53AM +0000, Thinh Nguyen wrote:
> > On Fri, Aug 18, 2023, Alan Stern wrote:
> > > Actually I agree with you. When a new SETUP packet arrives before the
> > > old control transfer has finished, the UDC driver should cancel all
> > > pending requests and then invoke the ->setup() callback. (I don't think
> > > there is a standard error code for the cancelled requests; net2280 seems
> > > to use -EPROTO whereas dummy-hcd seems to use -EOVERFLOW.)
> >
> > Those are very odd choice of error codes for cancelled request. Even
> > though the gadget side doesn't have very defined error codes, I try to
> > follow the equivalent doc from the host side
> > (driver-api/usb/error-codes.rst), which is -ECONNRESET.
> >
> > Whenever I see -EPROTO, I associate that to a specific host error:
> > transaction error. For -EOVERFLOW, I think of babble errors.
>
> Do you have a suggestion for an error code that all the UDCs should use
> in this situation? -ECONNRESET is currently being used for requests
> that were cancelled by usb_ep_dequeue(). Would -EREMOTEIO be more
> suitable for requests attached to an aborted control transfer?
>

That works. It would be great if we can document the usb error codes for
gadget side and keep them consistent across UDC drivers. I think there
are only a few common errors:

* Request aborted
* Request dequeued
* STALL
* Data dropped (isoc only)

Any other?

Thanks,
Thinh