linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* usb: dwc3: gadget: decrease the queued_requests in removal
@ 2017-12-25  3:41 Lipengcheng
  0 siblings, 0 replies; 2+ messages in thread
From: Lipengcheng @ 2017-12-25  3:41 UTC (permalink / raw)
  To: balbi@kernel.org
  Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, Lipengcheng

In removal requests, it is necessary to make the corresponding trb
disable state (HWO = 1) and dep->queued_requests a corresponding reduction.
It is better to use a alone funtion to disable trb (HWO = 0).

Signed-off-by: Pengcheng Li <lpc.li@hisilicon.com>
---
drivers/usb/dwc3/gadget.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 1e6c42e..273b51d 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -707,6 +707,36 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep)
    while (!list_empty(&dep->started_list)) {
        req = next_request(&dep->started_list);

+       if (req->trb) {
+           if (req->num_pending_sgs) {
+               struct dwc3_trb *trb;
+               int i = 0;
+
+               for (i = 0; i < req->num_pending_sgs; i++) {
+                   trb = req->trb + i;
+                   trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
+                   dwc3_ep_inc_deq(dep);
+               }
+
+               if (req->unaligned || req->zero) {
+                   trb = req->trb + req->num_pending_sgs + 1;
+                   trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
+                   dwc3_ep_inc_deq(dep);
+               }
+           } else {
+               struct dwc3_trb *trb = req->trb;
+
+               trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
+               dwc3_ep_inc_deq(dep);
+
+               if (req->unaligned || req->zero) {
+                   trb = req->trb + 1;
+                   trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
+                   dwc3_ep_inc_deq(dep);
+               }
+           }
+       }
+       dep->queued_requests--;
        dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
    }


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

* usb: dwc3: gadget: decrease the queued_requests in removal
@ 2018-01-08 11:52 Felipe Balbi
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2018-01-08 11:52 UTC (permalink / raw)
  To: Lipengcheng
  Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

Hi,

Lipengcheng <lpc.li@hisilicon.com> writes:
> In removal requests, it is necessary to make the corresponding trb
> disable state (HWO = 1) and dep->queued_requests a corresponding reduction.
> It is better to use a alone funtion to disable trb (HWO = 0).

this shouldn't be necessary. What problem are you facing? what happens?
Where are the tracepoint logs? Which kernel are you using? did you try
mainline?

> Signed-off-by: Pengcheng Li <lpc.li@hisilicon.com>
> ---
> drivers/usb/dwc3/gadget.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 1e6c42e..273b51d 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -707,6 +707,36 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep)
>     while (!list_empty(&dep->started_list)) {

why all these underscore characters? Are you sending html emails?

>         req = next_request(&dep->started_list);
>
> +       if (req->trb) {
> +           if (req->num_pending_sgs) {
> +               struct dwc3_trb *trb;
> +               int i = 0;
> +
> +               for (i = 0; i < req->num_pending_sgs; i++) {
> +                   trb = req->trb + i;
> +                   trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
> +                   dwc3_ep_inc_deq(dep);
> +               }
> +
> +               if (req->unaligned || req->zero) {
> +                   trb = req->trb + req->num_pending_sgs + 1;
> +                   trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
> +                   dwc3_ep_inc_deq(dep);
> +               }
> +           } else {
> +               struct dwc3_trb *trb = req->trb;
> +
> +               trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
> +               dwc3_ep_inc_deq(dep);
> +
> +               if (req->unaligned || req->zero) {
> +                   trb = req->trb + 1;
> +                   trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
> +                   dwc3_ep_inc_deq(dep);
> +               }
> +           }
> +       }
> +       dep->queued_requests--;
>         dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
>     }

you have a lot to fix here.

-- 
balbi

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

end of thread, other threads:[~2018-01-08 11:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-08 11:52 usb: dwc3: gadget: decrease the queued_requests in removal Felipe Balbi
  -- strict thread matches above, loose matches on Subject: below --
2017-12-25  3:41 Lipengcheng

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).