Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp909761rwi; Thu, 20 Oct 2022 06:41:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qVclfqSiUPtVYOuRzfWpiOTVQ3D2HAL54e292wqKA/a9vKsWbc74RMRMtd+6Euf9DPdUu X-Received: by 2002:a17:907:7fa5:b0:791:9a5f:101a with SMTP id qk37-20020a1709077fa500b007919a5f101amr11025780ejc.453.1666273278698; Thu, 20 Oct 2022 06:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666273278; cv=none; d=google.com; s=arc-20160816; b=JVu/RZEY4mXU3DAXzLClTG6mG3tjswgex1Trh/2Iy5EPxQ0rFbAgya1M0WoeCP9IXk 5iy3jQj/TbAE4FXJnJ95Cgv5jdWuRAI2GnBHP3E3D75kCORwEGckJQYP2iF3xKt/Faku 9UaHSqn6GjuIgwQkI/tMTnMwWKaj6PHsP5P2qRkSBz8tBQUMDXuF0jzsd/U9sqDfPhdF KHCgIIT2sVLlK5AwoJbMW2/asryVQpBW1rSIa0F6Qzty7rxx2pQ2ufTzy+xk+NCdYtOm 58E2sMafEZJC0AgFl6GsDCd60JdvHOmTRt3yPoBPu2yXHdhYiL4XdsRk5uHPbj30TIQk WCoQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=x0cmaFDlFySoypX6Aosgzirjx+H43xi36x8Ike03WIo=; b=0a9xg4laRgvLUbYhpA5bHKucbFsx8cSoXTFKMQ17Z0O4VXoiGgDuereyYUN/t1b1AJ 15KgjBztgMaluCqekRNoOo/xCTtZubHn6J0Qkdt7MYWXM43P8mxxFb6rYR4/NTV36KNO GcSv7IqUpc5wmodq7ruA9VhRNm/L8x3qNypczkrrVfAfG8USphBByjtGChPa052RZnhw Z/EE1JgK8Lz3g3ziBU5idwoYcYLXjnEA/UB1IiK/p3KfR0pGlMGiqzydWGm5UzjSj6TI UOq2Adi1g313A3BUU/o7QT7yJ17nYDDyg/NF8c7Ll4VwYp3Aajkp92W1aRzcr1QgP7MQ EDMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="j59LDTD/"; 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 ho31-20020a1709070e9f00b0078dcf17c084si19161242ejc.728.2022.10.20.06.40.53; Thu, 20 Oct 2022 06:41:18 -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="j59LDTD/"; 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 S230457AbiJTNVE (ORCPT + 99 others); Thu, 20 Oct 2022 09:21:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbiJTNUy (ORCPT ); Thu, 20 Oct 2022 09:20:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14D0F51A0B; Thu, 20 Oct 2022 06:20:19 -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 ams.source.kernel.org (Postfix) with ESMTPS id 27B74B82648; Thu, 20 Oct 2022 13:20:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A9CFC433D6; Thu, 20 Oct 2022 13:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666272015; bh=Rsn6bw20rlalxQ/SID97AXkpPfvVGG+5j06netqtMyk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=j59LDTD/B7Zaiswj1/PchAfkOEHRbpLbB3ej8uTyuF4x8nxPjkCVDcpYZIGSe+WbC tYZoUNuBOPEssrYxUaCuOKmEsUphZs/87kBa/sHjolGygCZ+BtGkjWrFJT2L68ZHQ5 z5mjihBA2IWYiWYFG4we8OU1ztD3lRT/1jWeAWzr+g+F9GtziARY1vSyRX/xu8Y/pk JJDSjbW6Bkia95/dtwPsuYqpEgdHfrtLH160heyKobnAw4xrDAKbN4Sqm4mxMYVMNs u9ly/5LBRY5g3MlZwIlKrsOeU+/QN00SV6C6AcRpDDhHVvP2JrCnxHaG1STuqvFgKu wpTDeqEBA3Lyw== Date: Thu, 20 Oct 2022 21:20:10 +0800 From: Peter Chen To: Pawel Laszczak Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] usb: cdnsp: fix issue with ZLP - added TD_SIZE = 1 Message-ID: <20221020132010.GA29690@nchen-desktop> References: <1666159637-161135-1-git-send-email-pawell@cadence.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1666159637-161135-1-git-send-email-pawell@cadence.com> X-Spam-Status: No, score=-7.4 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 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-10-19 02:07:17, Pawel Laszczak wrote: > Patch modifies the TD_SIZE in TRB before ZLP TRB. > The TD_SIZE in TRB before ZLP TRB must be set to 1 to force > processing ZLP TRB by controller. > > Cc: > Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver") > Signed-off-by: Pawel Laszczak > --- > drivers/usb/cdns3/cdnsp-ring.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/drivers/usb/cdns3/cdnsp-ring.c b/drivers/usb/cdns3/cdnsp-ring.c > index 794e413800ae..4809d0e894bb 100644 > --- a/drivers/usb/cdns3/cdnsp-ring.c > +++ b/drivers/usb/cdns3/cdnsp-ring.c > @@ -1765,18 +1765,19 @@ static u32 cdnsp_td_remainder(struct cdnsp_device *pdev, > struct cdnsp_request *preq, > bool more_trbs_coming) > { > - u32 maxp, total_packet_count; > - > - /* One TRB with a zero-length data packet. */ > - if (!more_trbs_coming || (transferred == 0 && trb_buff_len == 0) || > - trb_buff_len == td_total_len) > - return 0; > + u32 maxp, total_packet_count, remainder; > > maxp = usb_endpoint_maxp(preq->pep->endpoint.desc); > total_packet_count = DIV_ROUND_UP(td_total_len, maxp); > > /* Queuing functions don't count the current TRB into transferred. */ > - return (total_packet_count - ((transferred + trb_buff_len) / maxp)); > + remainder = (total_packet_count - ((transferred + trb_buff_len) / maxp)); > + > + /* Before ZLP driver needs set TD_SIZE=1. */ > + if (!remainder && more_trbs_coming) > + remainder = 1; Without ZLP, TD_SIZE = 0 for the last TRB. With ZLP, TD_SIZE = 1 for current TRB, and TD_SIZE = 0 for the next TRB (the last zero-length packet) right? Peter > + > + return remainder; > } > > static int cdnsp_align_td(struct cdnsp_device *pdev, > -- > 2.25.1 > -- Thanks, Peter Chen