Skip to contentSkip to conversation

patch "usb: cdns3: fix incorrect handling TRB_SMM flag for ISOC transfer" added to usb-linus

PATCH [email protected] 1 participant 1 message Aug 30, 2022

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

usb: cdns3: fix incorrect handling TRB_SMM flag for ISOC transfer

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From d5dcc33677d7415c5f23b3c052f9e80cbab9ea4e Mon Sep 17 00:00:00 2001
From: Pawel Laszczak <[email protected]>
Date: Thu, 25 Aug 2022 08:22:07 +0200
Subject: usb: cdns3: fix incorrect handling TRB_SMM flag for ISOC transfer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The TRB_SMM flag indicates that DMA has completed the TD service with this TRB. Usually it’s a last TRB in TD. In case of ISOC transfer for bInterval > 1 each ISOC transfer contains more than one TD associated with usb request (one TD per ITP). In such case the TRB_SMM flag will be set in every TD and driver will recognize the end of transfer after processing the first TD with TRB_SMM. In result driver stops updating request->actual and returns incorrect actual length.
To fix this issue driver additionally must check TRB_CHAIN which is not used for isochronous transfers.

Fixes 249f0a25e8be ("usb: cdns3: gadget: handle sg list use case at completion correctly")
---
 drivers/usb/cdns3/cdns3-gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/cdns3/cdns3-gadget.c +2 -1
index d21b69997e75..4f11c311acaf 100644
@@ -1530,7 +1530,8 @@ static void cdns3_transfer_completed(struct cdns3_device *priv_dev,
 						TRB_LEN(le32_to_cpu(trb->length));
 
 				if (priv_req->num_of_trb > 1 &&
-					le32_to_cpu(trb->control) & TRB_SMM)
+					le32_to_cpu(trb->control) & TRB_SMM &&
+					le32_to_cpu(trb->control) & TRB_CHAIN)
 					transfer_end = true;
 
 				cdns3_ep_inc_deq(priv_ep);
Signature · 1 line
2.37.2