Skip to content

Commit 118694c

Browse files
Felipe Balbinsekhar
authored andcommitted
usb: dwc3: gadget: start requests as soon as they come
In an attempt to make dwc3 slightly faster, let's start usb_requests as soon as they come as that will let us avoid a XFER_NOT_READY event and save a little bit of time. Signed-off-by: Felipe Balbi <[email protected]> Signed-off-by: Sekhar Nori <[email protected]>
1 parent 5c82d5f commit 118694c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

drivers/usb/dwc3/gadget.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,22 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
10721072

10731073
list_add_tail(&req->list, &dep->request_list);
10741074

1075+
/*
1076+
* If there are no pending requests and the endpoint isn't already
1077+
* busy, we will just start the request straight away.
1078+
*
1079+
* This will save one IRQ (XFER_NOT_READY) and possibly make it a
1080+
* little bit faster.
1081+
*/
1082+
if (!usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
1083+
!(dep->flags & DWC3_EP_BUSY)) {
1084+
ret = __dwc3_gadget_kick_transfer(dep, 0, true);
1085+
if (ret && ret != -EBUSY)
1086+
dev_dbg(dwc->dev, "%s: failed to kick transfers\n",
1087+
dep->name);
1088+
return ret;
1089+
}
1090+
10751091
/*
10761092
* There are a few special cases:
10771093
*

0 commit comments

Comments
 (0)