usb: dwc3: Set number of TRBs to 1 for endless request

When USB is disconnected we dont reset the num_trbs field of a
request before giving it back to the respective function. When
this request is re-used it will have an incorrect num_trb value.

For f_qdss HW path we use 1 endless request and allocate 1 TRB to
accommodate this request. This request is freed only during an USB
composition switch. Doing an USB plug-out/plug-in during an active
bam2bam session would result in erroneously incrementing the num_trbs
value when the transfer is resumed. When this request is dequeued
during a qdss_close we would increment dequeue pointer in accordance
with this incorrect num_trbs value. This leads to dequeue pointer
going beyond enqueue pointer and thus the subsequent ep_queue fails
due to this mismatch. Fix this by always setting the num_trb field
to 1 for requests going through qdss HW path.

Change-Id: Ibddad6c8fdd67b42d12752ae3ead73d20110c290
Signed-off-by: Elson Roy Serrao <eserrao@codeaurora.org>
This commit is contained in:
Elson Roy Serrao 2021-02-25 18:39:55 -08:00
commit 9a3360e2f0

View file

@ -975,7 +975,7 @@ static int __dwc3_msm_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
memset(trb, 0, sizeof(*trb));
req->trb = trb;
req->num_trbs++;
req->num_trbs = 1;
trb->bph = DBM_TRB_BIT | DBM_TRB_DMA | DBM_TRB_EP_NUM(dep->number);
trb->size = DWC3_TRB_SIZE_LENGTH(req->request.length);
trb->ctrl = DWC3_TRBCTL_NORMAL | DWC3_TRB_CTRL_HWO |