Skip to contentSkip to conversation

usb: dwc3: gadget: Fix ISO transfer performance

PATCH In review Roger Quadros 2 participants 3 messages Apr 21, 2017 – May 17, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc3: gadget: Fix ISO transfer performance

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()")
---
 drivers/usb/dwc3/gadget.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +11 -1
index 0d75158..8f71ccc 100644
@@ -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;
 
Signature · 1 line
2.7.4
#1 lore raw

Hi Felipe,

Quoted 7 lines · 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.

Quoted 5 lines

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()")

Any comments?

Quoted 35 lines
---
 drivers/usb/dwc3/gadget.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +11 -1
index 0d75158..8f71ccc 100644
@@ -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;
 
Signature · 2 lines
cheers,
-roger
#2 lore raw

Hi,

Quoted 8 lines · Roger Quadros
Quoted 7 lines · 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.

Quoted 7 lines
Quoted 5 lines

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()")

Any comments?

pull request coming shortly ;-)

Signature · 1 line
balbi