All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Revert "usb: dwc3: gadget: use allocated/queued reqs for LST bit"
@ 2016-10-03 14:18 ville.syrjala
  2016-10-03 16:08 ` Felipe Balbi
  0 siblings, 1 reply; 16+ messages in thread
From: ville.syrjala @ 2016-10-03 14:18 UTC (permalink / raw)
  To: linux-usb; +Cc: Felipe Balbi, stable, Ville Syrjälä

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

This reverts commit 55a0237f8f47957163125e20ee9260538c5c341c.

commit  55a0237f8f47 ("usb: dwc3: gadget: use allocated/queued reqs for
LST bit") causes my BYT FFRD8 with g_ether to behave poorly. ssh/scp
is very sluggish and can even stall entirely. Revert cures it.

Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/usb/dwc3/gadget.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 122e64df2f4d..7362ff009a3a 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -894,8 +894,7 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep)
 }
 
 static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
-		struct dwc3_request *req, unsigned int trbs_left,
-		unsigned int more_coming)
+		struct dwc3_request *req, unsigned int trbs_left)
 {
 	struct usb_request *request = &req->request;
 	struct scatterlist *sg = request->sg;
@@ -912,8 +911,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
 		dma = sg_dma_address(s);
 
 		if (sg_is_last(s)) {
-			if (usb_endpoint_xfer_int(dep->endpoint.desc) ||
-				!more_coming)
+			if (list_is_last(&req->list, &dep->pending_list))
 				last = true;
 
 			chain = false;
@@ -934,8 +932,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
 }
 
 static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
-		struct dwc3_request *req, unsigned int trbs_left,
-		unsigned int more_coming)
+		struct dwc3_request *req, unsigned int trbs_left)
 {
 	unsigned int	last = false;
 	unsigned int	length;
@@ -948,7 +945,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
 		last = true;
 
 	/* Is this the last request? */
-	if (usb_endpoint_xfer_int(dep->endpoint.desc) || !more_coming)
+	if (list_is_last(&req->list, &dep->pending_list))
 		last = true;
 
 	dwc3_prepare_one_trb(dep, req, dma, length,
@@ -966,7 +963,6 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
 static void dwc3_prepare_trbs(struct dwc3_ep *dep)
 {
 	struct dwc3_request	*req, *n;
-	unsigned int		more_coming;
 	u32			trbs_left;
 
 	BUILD_BUG_ON_NOT_POWER_OF_2(DWC3_TRB_NUM);
@@ -975,15 +971,11 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep)
 	if (!trbs_left)
 		return;
 
-	more_coming = dep->allocated_requests - dep->queued_requests;
-
 	list_for_each_entry_safe(req, n, &dep->pending_list, list) {
 		if (req->request.num_mapped_sgs > 0)
-			dwc3_prepare_one_trb_sg(dep, req, trbs_left--,
-					more_coming);
+			dwc3_prepare_one_trb_sg(dep, req, trbs_left--);
 		else
-			dwc3_prepare_one_trb_linear(dep, req, trbs_left--,
-					more_coming);
+			dwc3_prepare_one_trb_linear(dep, req, trbs_left--);
 
 		if (!trbs_left)
 			return;
-- 
2.7.4


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

end of thread, other threads:[~2016-11-01 11:31 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-03 14:18 [PATCH] Revert "usb: dwc3: gadget: use allocated/queued reqs for LST bit" ville.syrjala
2016-10-03 16:08 ` Felipe Balbi
2016-10-04  7:43   ` Felipe Balbi
2016-10-04  8:38   ` Ville Syrjälä
2016-10-04 12:23     ` Felipe Balbi
2016-10-04 13:20       ` Ville Syrjälä
2016-10-04 14:03         ` Felipe Balbi
2016-10-06  7:36           ` Felipe Balbi
2016-10-06  9:08             ` Ville Syrjälä
2016-10-27 15:40               ` Ville Syrjälä
2016-10-28 10:16                 ` Felipe Balbi
     [not found]                   ` <87pomksrrm.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-10-28 16:33                     ` Ville Syrjälä
2016-10-28 16:33                       ` Ville Syrjälä
2016-10-31 18:51                       ` David Miller
2016-10-31 18:51                         ` David Miller
2016-11-01 11:30                         ` Felipe Balbi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.