[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2e956314-b3e1-5c0e-104a-7416cf81f3ba@synopsys.com>
Date: Thu, 15 Apr 2021 18:02:23 +0000
From: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To: Wesley Cheng <wcheng@...eaurora.org>,
Felipe Balbi <balbi@...nel.org>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
CC: "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"jackp@...eaurora.org" <jackp@...eaurora.org>
Subject: Re: [PATCH] usb: dwc3: gadget: Avoid canceling current request for
queuing error
Wesley Cheng wrote:
>
>
> On 4/14/2021 11:26 PM, Felipe Balbi wrote:
>> Wesley Cheng <wcheng@...eaurora.org> writes:
>>
>>> If an error is received when issuing a start or update transfer
>>> command, the error handler will stop all active requests (including
>>> the current USB request), and call dwc3_gadget_giveback() to notify
>>> function drivers of the requests which have been stopped. Avoid
>>> having to cancel the current request which is trying to be queued, as
>>> the function driver will handle the EP queue error accordingly.
>>> Simply unmap the request as it was done before, and allow previously
>>> started transfers to be cleaned up.
>>>
>>> Signed-off-by: Wesley Cheng <wcheng@...eaurora.org>
>>> ---
>>> drivers/usb/dwc3/gadget.c | 5 +++++
>>> 1 file changed, 5 insertions(+)
>>>
>>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
>>> index e1b04c97..4200775 100644
>>> --- a/drivers/usb/dwc3/gadget.c
>>> +++ b/drivers/usb/dwc3/gadget.c
>>> @@ -1399,6 +1399,11 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)
>>> if (ret == -EAGAIN)
>>> return ret;
>>>
>>> + /* Avoid canceling current request, as it has not been started */
>>> + if (req->trb)
>>> + memset(req->trb, 0, sizeof(struct dwc3_trb));
>>
>> we don't need a full memset. I think ensuring HWO bit is zero is enough.
>>
> Hi Felipe,
>
> Thanks for the input/review, will make this change to just clear the HWO.
>
Make sure to increment the dequeue pointer also. I think you can use
dwc3_gadget_ep_skip_trbs().
BR,
Thinh
Powered by blists - more mailing lists