Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de845b8c authored by Manu Gautam's avatar Manu Gautam
Browse files

usb: dwc3: gadget: Ring IPA GSI doorbell with next HWO TRB



IPA GSI doorbell needs to be rung with the next TRB that
USB hardware is going to process (not the completed one).
However, software rings doorbell with the completed TRB
(HWO=0). This causes IPA to be always off by 1 TRB when
transfer is completed, resulting in high ping RTT (round
trip time.
Fix this doorbell handling logic in USB software by
ringing doorbell with (n+1) TRB if 'n'th TRB got completed.

Change-Id: I0aaf8691bf6e9ab7eae5b304d6c925934922be30
Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
parent 6ae0f106
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -2735,17 +2735,15 @@ static void dwc3_gsi_ep_transfer_complete(struct dwc3 *dwc, struct dwc3_ep *dep)
	struct dwc3_trb *trb;
	dma_addr_t offset;

	trb = &dep->trb_pool[dep->trb_dequeue];
	while (trb->ctrl & DWC3_TRBCTL_LINK_TRB) {
	/*
	 * Doorbell needs to be rung with the next TRB that is going to be
	 * processed by hardware.
	 * So, if 'n'th TRB got completed then ring doorbell with (n+1) TRB.
	 */
	dwc3_ep_inc_trb(dep, &dep->trb_dequeue);
	trb = &dep->trb_pool[dep->trb_dequeue];
	}

	if (!(trb->ctrl & DWC3_TRB_CTRL_HWO)) {
	offset = dwc3_trb_dma_offset(dep, trb);
	usb_gsi_ep_op(ep, (void *)&offset, GSI_EP_OP_UPDATE_DB);
		dwc3_ep_inc_trb(dep, &dep->trb_dequeue);
	}
}

static void dwc3_endpoint_transfer_complete(struct dwc3 *dwc,