diff mbox series

[v4,6/8] usb: dwc3: check for requests in started list for stream capable endpoints

Message ID 1536418986-16609-7-git-send-email-anurag.kumar.vulisha@xilinx.com (mailing list archive)
State New, archived
Headers show
Series usb: dwc3: Fix broken BULK stream support to dwc3 gadget driver | expand

Commit Message

Anurag Kumar Vulisha Sept. 8, 2018, 3:03 p.m. UTC
For stream capable endpoints, uas layer can queue mulpile requests on
single ep with different stream ids. So, there can be multiple pending
requests waiting to be transferred. This patch changes the code to check
for any pending requests waiting to be transferred on ep started_list and
calls __dwc3_gadget_kick_transfer() if any.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Reviewed-by: Thinh Nguyen <thinhn@synopsys.com>
---
 Changes in v4:
	1. None

 Changes in v3:
	1. None

 Changes in v2:
	1. None
---
 drivers/usb/dwc3/gadget.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Thinh Nguyen Sept. 10, 2018, 8:13 p.m. UTC | #1
Hi Anurag,

On 9/8/2018 8:03 AM, Anurag Kumar Vulisha wrote:
> For stream capable endpoints, uas layer can queue mulpile requests on
> single ep with different stream ids. So, there can be multiple pending
> requests waiting to be transferred. This patch changes the code to check
> for any pending requests waiting to be transferred on ep started_list and
> calls __dwc3_gadget_kick_transfer() if any.

Whenever a function driver queues a request, then
__dwc3_gadget_kick_transfer() will be called right? What case exactly is
this for? Scatter gathering? If so, then we probably need further
explanation. (e.g. Why wait to call __dwc3_gadget_kick_transfer() on
XferComplete event rather than sending a START_TRANSFER command for
every prepared TRB whenever we do __dwc3_gadget_kick_transfer()?).

Thanks,
Thinh

>
> Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
> Reviewed-by: Thinh Nguyen <thinhn@synopsys.com>
> ---
>  Changes in v4:
> 	1. None
>
>  Changes in v3:
> 	1. None
>
>  Changes in v2:
> 	1. None
> ---
>  drivers/usb/dwc3/gadget.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 97bfdf0..c50cad8 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2433,6 +2433,9 @@ static void dwc3_gadget_endpoint_transfer_in_progress(struct dwc3_ep *dep,
>  
>  	dwc3_gadget_ep_cleanup_completed_requests(dep, event, status);
>  
> +	if (dep->stream_capable && !list_empty(&dep->started_list))
> +		__dwc3_gadget_kick_transfer(dep);
> +
>  	if (stop) {
>  		dwc3_stop_active_transfer(dep, true);
>  		dep->flags = DWC3_EP_ENABLED;
Thinh Nguyen Sept. 10, 2018, 10:50 p.m. UTC | #2
Hi,

On 9/10/2018 1:13 PM, Thinh Nguyen wrote:
> Hi Anurag,
>
> On 9/8/2018 8:03 AM, Anurag Kumar Vulisha wrote:
>> For stream capable endpoints, uas layer can queue mulpile requests on
>> single ep with different stream ids. So, there can be multiple pending
>> requests waiting to be transferred. This patch changes the code to check
>> for any pending requests waiting to be transferred on ep started_list and
>> calls __dwc3_gadget_kick_transfer() if any.
> Whenever a function driver queues a request, then
> __dwc3_gadget_kick_transfer() will be called right? What case exactly is
> this for? Scatter gathering? If so, then we probably need further
> explanation. (e.g. Why wait to call __dwc3_gadget_kick_transfer() on
> XferComplete event rather than sending a START_TRANSFER command for
> every prepared TRB whenever we do __dwc3_gadget_kick_transfer()?).

Please ignore my question.  We only do 1 transfer per stream id at a
time. That's fine.

Thanks,
Thinh
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 97bfdf0..c50cad8 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2433,6 +2433,9 @@  static void dwc3_gadget_endpoint_transfer_in_progress(struct dwc3_ep *dep,
 
 	dwc3_gadget_ep_cleanup_completed_requests(dep, event, status);
 
+	if (dep->stream_capable && !list_empty(&dep->started_list))
+		__dwc3_gadget_kick_transfer(dep);
+
 	if (stop) {
 		dwc3_stop_active_transfer(dep, true);
 		dep->flags = DWC3_EP_ENABLED;