Thinh Nguyen wrote: > Hi, > > Michael Grzeschik wrote: >> From: Michael Olbrich <m.olbrich@xxxxxxxxxxxxxx> >> >> Currently __dwc3_gadget_start_isoc must be called very shortly after >> XferNotReady. Otherwise the frame number is outdated and start transfer >> will fail, even with several retries. > Did you try with the recent update for isoc? (e.i., after 5 > START_TRANSFER failures, the driver will issue END_TRANSFER to retry on > the next XferNotReady event) > > Let me know if you still run into issues with that. Just want to clarify, I like this solution. I'm just curious how it behaves on your test setup with the current implementation. > >> DSTS provides the lower 14 bit of the frame number. Use it in combination >> with the frame number provided by XferNotReady to guess the current frame >> number. This will succeed unless more than one 14 rollover has happened >> since XferNotReady. >> >> Start transfer might still fail if the frame number is increased >> immediately after DSTS is read. So retries are still needed. >> Don't drop the current request if this happens. This way it is not lost and >> can be used immediately to try again with the next frame number. >> >> With this change, __dwc3_gadget_start_isoc is still not successfully in all >> cases bit it increases the acceptable delay after XferNotReady >> significantly. >> >> Signed-off-by: Michael Olbrich <m.olbrich@xxxxxxxxxxxxxx> >> Signed-off-by: Michael Tretter <m.tretter@xxxxxxxxxxxxxx> >> Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx> >> >> --- >> v1 -> v2: - removed last_frame_number from struct >> - included rollover variable >> >> drivers/usb/dwc3/gadget.c | 37 +++++++++++++++++++++++++------------ >> 1 file changed, 25 insertions(+), 12 deletions(-) >> >> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c >> index 421a0f73110a40b..0962ddd7fbf6ae6 100644 >> --- a/drivers/usb/dwc3/gadget.c >> +++ b/drivers/usb/dwc3/gadget.c >> @@ -1276,7 +1276,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep) >> >> static void dwc3_gadget_ep_cleanup_cancelled_requests(struct dwc3_ep *dep); >> >> -static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep) >> +static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, bool keep_req) > Any reason to have keep_req? With the recent changes, if > dwc3_send_gadget_ep_cmd() returns -EAGAIN, then the controller driver > won't give back the request. > BR, Thinh