linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: gadget: Fix ISO transfer performance
@ 2017-04-21 12:58 Roger Quadros
  2017-05-17  7:44 ` Roger Quadros
  0 siblings, 1 reply; 3+ messages in thread
From: Roger Quadros @ 2017-04-21 12:58 UTC (permalink / raw)
  To: balbi; +Cc: nsekhar, linux-usb, linux-kernel, Roger Quadros

Commit 08a36b543803 ("usb: dwc3: gadget: simplify __dwc3_gadget_ep_queue()")
caused a small change in the way ISO transfer is handled in the case
when XferInProgress event happens on Isoc EP with an active transfer.
This caused a performance degradation of 50%. e.g. using g_webcam on DUT
and luvcview on host the video frame rate dropped from 16fps to 8fps
@high-speed.

Make the ISO transfer handling equivalent to that prior to that commit
to get back the original ISO performance numbers.

Fixes: 08a36b543803 ("usb: dwc3: gadget: simplify __dwc3_gadget_ep_queue()")
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/dwc3/gadget.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 0d75158..8f71ccc 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1245,14 +1245,24 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
 				__dwc3_gadget_start_isoc(dwc, dep, cur_uf);
 				dep->flags &= ~DWC3_EP_PENDING_REQUEST;
 			}
+			return 0;
 		}
-		return 0;
+
+		if ((dep->flags & DWC3_EP_BUSY) &&
+		    !(dep->flags & DWC3_EP_MISSED_ISOC)) {
+			WARN_ON_ONCE(!dep->resource_index);
+			ret = __dwc3_gadget_kick_transfer(dep,
+							  dep->resource_index);
+		}
+
+		goto out;
 	}
 
 	if (!dwc3_calc_trbs_left(dep))
 		return 0;
 
 	ret = __dwc3_gadget_kick_transfer(dep, 0);
+out:
 	if (ret == -EBUSY)
 		ret = 0;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: dwc3: gadget: Fix ISO transfer performance
  2017-04-21 12:58 [PATCH] usb: dwc3: gadget: Fix ISO transfer performance Roger Quadros
@ 2017-05-17  7:44 ` Roger Quadros
  2017-05-17  7:48   ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: Roger Quadros @ 2017-05-17  7:44 UTC (permalink / raw)
  To: balbi; +Cc: nsekhar, linux-usb, linux-kernel

Hi Felipe,

On 21/04/17 15:58, Roger Quadros wrote:
> Commit 08a36b543803 ("usb: dwc3: gadget: simplify __dwc3_gadget_ep_queue()")
> caused a small change in the way ISO transfer is handled in the case
> when XferInProgress event happens on Isoc EP with an active transfer.
> This caused a performance degradation of 50%. e.g. using g_webcam on DUT
> and luvcview on host the video frame rate dropped from 16fps to 8fps
> @high-speed.
> 
> Make the ISO transfer handling equivalent to that prior to that commit
> to get back the original ISO performance numbers.
> 
> Fixes: 08a36b543803 ("usb: dwc3: gadget: simplify __dwc3_gadget_ep_queue()")
> Signed-off-by: Roger Quadros <rogerq@ti.com>

Any comments?

> ---
>  drivers/usb/dwc3/gadget.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 0d75158..8f71ccc 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1245,14 +1245,24 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
>  				__dwc3_gadget_start_isoc(dwc, dep, cur_uf);
>  				dep->flags &= ~DWC3_EP_PENDING_REQUEST;
>  			}
> +			return 0;
>  		}
> -		return 0;
> +
> +		if ((dep->flags & DWC3_EP_BUSY) &&
> +		    !(dep->flags & DWC3_EP_MISSED_ISOC)) {
> +			WARN_ON_ONCE(!dep->resource_index);
> +			ret = __dwc3_gadget_kick_transfer(dep,
> +							  dep->resource_index);
> +		}
> +
> +		goto out;
>  	}
>  
>  	if (!dwc3_calc_trbs_left(dep))
>  		return 0;
>  
>  	ret = __dwc3_gadget_kick_transfer(dep, 0);
> +out:
>  	if (ret == -EBUSY)
>  		ret = 0;
>  
> 

-- 
cheers,
-roger

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: dwc3: gadget: Fix ISO transfer performance
  2017-05-17  7:44 ` Roger Quadros
@ 2017-05-17  7:48   ` Felipe Balbi
  0 siblings, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2017-05-17  7:48 UTC (permalink / raw)
  To: Roger Quadros; +Cc: nsekhar, linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 824 bytes --]


Hi,

Roger Quadros <rogerq@ti.com> writes:
> On 21/04/17 15:58, Roger Quadros wrote:
>> Commit 08a36b543803 ("usb: dwc3: gadget: simplify __dwc3_gadget_ep_queue()")
>> caused a small change in the way ISO transfer is handled in the case
>> when XferInProgress event happens on Isoc EP with an active transfer.
>> This caused a performance degradation of 50%. e.g. using g_webcam on DUT
>> and luvcview on host the video frame rate dropped from 16fps to 8fps
>> @high-speed.
>> 
>> Make the ISO transfer handling equivalent to that prior to that commit
>> to get back the original ISO performance numbers.
>> 
>> Fixes: 08a36b543803 ("usb: dwc3: gadget: simplify __dwc3_gadget_ep_queue()")
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>
> Any comments?

pull request coming shortly ;-)

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-17  7:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-21 12:58 [PATCH] usb: dwc3: gadget: Fix ISO transfer performance Roger Quadros
2017-05-17  7:44 ` Roger Quadros
2017-05-17  7:48   ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).