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

From: Thinh Nguyen
Date: Fri Aug 18 2023 - 16:47:26 EST


On Fri, Aug 18, 2023, Thinh Nguyen wrote:
> >
> > Right. The difficulty doesn't involve the communication between the HCD
> > and the UDC hardware; it involves the communication between the UDC
> > driver and the gadget driver. Somehow they need to synchronize so that
> > when the gadget driver queues a usb_request, the UDC driver can tell
> > whether the request was meant for the earlier aborted control transfer
> > or the new active one. This can matter if the gadget driver has a
> > separate control thread (a work routine or a kthread, for example) that
> > could be queuing requests while the ->setup() callback is running.
> >
>
> Perhaps this can be improved and enforced from the core. At the moment,
> it should not be a problem for gadget driver with dwc3 driver (with a
> minor fix due to missing check).
>

Perhaps I'm too quick to respond to overlook what you've said. I've only
thinking about the UDC driver sequence and not the gadget driver
handling the givebacks. Yes if the gadget driver has a separate control
thread, that may be problematic.

BR,
Thinh