Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2671918rwe; Sun, 28 Aug 2022 19:12:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR6xI85uLkWoQ7nBgi8ocrnBzv54FbF3W5ifd6Sm0rlgSsbqzcexjtlL5YhCPvGftMWJpZG4 X-Received: by 2002:a17:902:a70e:b0:172:c859:dcc1 with SMTP id w14-20020a170902a70e00b00172c859dcc1mr14652055plq.121.1661739150748; Sun, 28 Aug 2022 19:12:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661739150; cv=none; d=google.com; s=arc-20160816; b=D19Tc4YPDq8sZZ6//S4+fQpU2DMTVRfGbIX3fG6L9+E+7bVPeNkLX3IA24D8GIhZrW fXs8TFA8oLt2SI/pEuDKKddpng0LJQyLEAZ8grM4cMWyKsPI5gvlJgubFgcp+hlMibj6 JQmGj+idIsSwaHpKven+pjmglRKNbw/DtSAbXSzdz99vDEUBbfyaiY3m/hqHkyWVCBP1 OVxVROdDxU9wJi0dB96kgmyieY796hHttJlBilZASG66HTAZTNfURMI23DtFUxRa8IA3 gXXr8CRAeyelT1xFNx04HL0jT8VUfQurhLgJ7CbVJj5Hmeq1ZgTtCAZboKdyLMbWQKuo jfnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AJnCRs04+uOLAajSd1g/71lXsxe29IO/gqTi1+tdsgs=; b=wTP9qruOkes6+SzAv1S0uX6OPJH9Hf0B6QA549KzB6mRQnaV8nYlHPKwgJL8MTAw5O sDebbYWyIGfTf3b7nsJnvSQk86mWAdNR2bYrbEd8QNaGRizRbTptQEES6YhROzell/Am 8nKt8MD6e5Yuss3u+w2/WhPfvyDMTb8FCNbwaUZ1TsKrcx7hx38hwih3U8P4inlaw7Yr CW3pPiPLDrOLzfBFynSzF6VhuBEnLB09ab5hRqkU5oJT/fAluMnY1CLjKZP7qV0jJS+0 BNXpJPAuwi1z30uQFU7GfiBCZhprVJiNLwETll2OEvJ46Q5LMm7IY40JpRZtb/Op3zVk H2Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=giTuMv1u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f9-20020a17090274c900b0016ed8e1897bsi7301287plt.554.2022.08.28.19.12.20; Sun, 28 Aug 2022 19:12:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=giTuMv1u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229644AbiH2B5t (ORCPT + 99 others); Sun, 28 Aug 2022 21:57:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbiH2B5s (ORCPT ); Sun, 28 Aug 2022 21:57:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0179313DEA; Sun, 28 Aug 2022 18:57:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8E71360F3C; Mon, 29 Aug 2022 01:57:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53884C433D6; Mon, 29 Aug 2022 01:57:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661738267; bh=z4Bsz7dg3CXBuuS7BKupLqvnSwB7N9ZMKDxr/arv4F4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=giTuMv1usF4fqZ0UCoaw/l+51imegL7fu0L+qgl0Uw9nVgv31FhzET0MTmonXUN/L 4sbqIzOv4S5rnPbJY4dZpV3EpmUJ9RdrwlSChpreOuc3TQeVFTiUYeb2mxsJE8IkXx wB3AGXTP3Jte0ORqL9Lt6JSA/BBmQfYQUyd4yVyuvf9zFFKsbXR+l4XE/jQxEM4yNc jp4h4+pwETT2QzUs5DU/FoNxxnWe9kzH/xgjphwN6Oxjq2zd01ba4x89lNXvdnlQ17 i53DQaJUrEvFuKSWB/WxKa2eD+hfT6b71PaC8yXU7yDRh4ACpW4POsqjLsQhfadNia UrWVIZZXTOKQw== Date: Mon, 29 Aug 2022 09:57:41 +0800 From: Peter Chen To: Pawel Laszczak Cc: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, felipe.balbi@linux.intel.com, rogerq@kernel.org, a-govindraju@ti.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] usb: cdns3: fix incorrect handling TRB_SMM flag for ISOC transfer Message-ID: <20220829015741.GA32096@nchen-desktop> References: <20220825062207.5824-1-pawell@cadence.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220825062207.5824-1-pawell@cadence.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22-08-25 08:22:07, Pawel Laszczak wrote: > 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") > cc: > Signed-off-by: Pawel Laszczak Acked-by: Peter Chen > --- > drivers/usb/cdns3/cdns3-gadget.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c > index fa8263951e63..a6618a922c61 100644 > --- a/drivers/usb/cdns3/cdns3-gadget.c > +++ b/drivers/usb/cdns3/cdns3-gadget.c > @@ -1529,7 +1529,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); > -- > 2.25.1 > -- Thanks, Peter Chen