Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9239376imu; Wed, 5 Dec 2018 01:09:33 -0800 (PST) X-Google-Smtp-Source: AFSGD/XM/YwJmts/ZhdxJhdZOJ1vY36kxeRXjDCvsTreaO6mSCUyDry2hMxc0t/+HnQ8ZqRoHPxI X-Received: by 2002:a63:a002:: with SMTP id r2mr19382693pge.212.1544000973268; Wed, 05 Dec 2018 01:09:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544000973; cv=none; d=google.com; s=arc-20160816; b=mFzhu4OJVuUyFClcyhPDm0zBQattjt5Zx4/uAo7Mt+zfK9oqAUzF9PNPyHBh4qCXON fC8DZcdAZ3acdlpfUPbkvmV+rk5f7NpH3OHyvNUfIC6IP/R3uidYq6v0L4xvHKvIekS/ iRvqZI41J8A4sow+VIaTP6DbHPgG6NhbWoMnOR/3OmvgkF2Pp0utUJYj/5zJdBV45tdI Ql117wUvRjcefh9sUdVDbvpcfPzSaH3K0dRvtaSYOecz8/0x7UYY7eAWq+Qp8axljfc4 Mdk58HI2tCklLusNgCrwPVUNA34WDkCQfrahkFEvTZArGMnEeSkTOKnLDWliRUiyglb8 egtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=pkscEK4dOXd4tuiNMDPjGNXcw86uTglWHo118TO3SSc=; b=jjYh7AfFwVzb3Mx4nNmmZWmLKVGL3z5uOAqAwOUMxDASCJHSHCEiXwMPrdrMQi/kdW LA5u+BPDNR7yx1xLlCsP8Oq/e7F7nTIiD0ncB7ib6DXraY//wZlyxWEp4dnXzFEQifcb JVeYwersngpjiuBc4wYVcoqLS/iufOPwJqGiS2IE6QO5JEShukH9g/c2abVMyevrf799 qJ1qoe5eiGAmUh9+0c6To+44aRjXuqsE03sUQJUS97sJSYx1s7pT748rTHW703LKCZja rJuFNOgaK49hPx3iXuOYJFuc4HHoGRigfltye5nPcg4PtjnHEXzS06ZdVFW4NZ3YdkZs 9KGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si17088671pgm.112.2018.12.05.01.09.17; Wed, 05 Dec 2018 01:09:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727437AbeLEJHz (ORCPT + 99 others); Wed, 5 Dec 2018 04:07:55 -0500 Received: from mga04.intel.com ([192.55.52.120]:36561 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbeLEJHy (ORCPT ); Wed, 5 Dec 2018 04:07:54 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Dec 2018 01:07:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,317,1539673200"; d="asc'?scan'208";a="98790905" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.72.175]) by orsmga008.jf.intel.com with ESMTP; 05 Dec 2018 01:07:48 -0800 From: Felipe Balbi To: Anurag Kumar Vulisha , Greg Kroah-Hartman , Shuah Khan , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros , Manu Gautam , martin.petersen@oracle.com, Bart Van Assche , Mike Christie , Matthew Wilcox , Colin Ian King Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, v.anuragkumar@gmail.com, Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: Re: [PATCH v7 09/10] usb: dwc3: Check for IOC/LST bit in both event->status and TRB->ctrl fields In-Reply-To: <1543662811-5194-10-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1543662811-5194-1-git-send-email-anurag.kumar.vulisha@xilinx.com> <1543662811-5194-10-git-send-email-anurag.kumar.vulisha@xilinx.com> Date: Wed, 05 Dec 2018 11:07:44 +0200 Message-ID: <875zw82vfj.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Anurag Kumar Vulisha writes: > The present code in dwc3_gadget_ep_reclaim_completed_trb() will check > for IOC/LST bit in the event->status and returns if IOC/LST bit is > set. This logic doesn't work if multiple TRBs are queued per > request and the IOC/LST bit is set on the last TRB of that request. > Consider an example where a queued request has multiple queued TRBs > and IOC/LST bit is set only for the last TRB. In this case, the Core > generates XferComplete/XferInProgress events only for the last TRB > (since IOC/LST are set only for the last TRB). As per the logic in > dwc3_gadget_ep_reclaim_completed_trb() event->status is checked for > IOC/LST bit and returns on the first TRB. This makes the remaining > TRBs left unhandled. > To aviod this, changed the code to check for IOC/LST bits in both > event->status & TRB->ctrl. This patch does the same. > > Signed-off-by: Anurag Kumar Vulisha > Reviewed-by: Thinh Nguyen > Tested-by: Tejas Joglekar > --- > Changes in v7: > 1. None > > Changes in v6: > 1. None > > Changes in v5: > 1. None > > Changes in v4: > 1. None > > Changes in v3: > 1. None > > Changes in v2: > 1. None > --- > drivers/usb/dwc3/gadget.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > index 9ddc9fd..216179e 100644 > --- a/drivers/usb/dwc3/gadget.c > +++ b/drivers/usb/dwc3/gadget.c > @@ -2286,7 +2286,12 @@ static int dwc3_gadget_ep_reclaim_completed_trb(st= ruct dwc3_ep *dep, > if (event->status & DEPEVT_STATUS_SHORT && !chain) > return 1; >=20=20 > - if (event->status & (DEPEVT_STATUS_IOC | DEPEVT_STATUS_LST)) > + if ((event->status & DEPEVT_STATUS_IOC) && > + (trb->ctrl & DWC3_TRB_CTRL_IOC)) > + return 1; this shouldn't be necessary. According to databook, event->status contains the bits from the completed TRB. Which means that event->status & IOC will always be equal to trb->ctrl & IOC. Can you further describe the situation here? Perhaps share tracepoints exposing the problem? =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlwHlWAACgkQzL64meEa mQakLRAAqLqa9Raf/ti7hr+qpgDb7bHAKYuQi2oABRqiuFbCLvYMa6XQh3TIvPAJ v3LYl1SoTMLNXHk96TmIojQvIrtC2tKuiYAr7No6YRTD9NXMsw/wJ8Wwrqq+nTxv xwJwR+Obvlc/ApRDa3peVvEGrJwByug54mMUb2JE8jUNI2AXOJVx5XiaYYjGXr8A XcrKGmwsSLrEROlh9GqLYqrwhRXo8ilPqbGoJdTQBoxwzbfK2+4xwjdAWlOBixz8 l6/LX2SxgOHlgdN/l0rBoRWqJjZEDmlCkB30knpD9RTGMTiYDBg0SOtRGa9XvRR3 xCWdsi867+Rkx8qXheYnHdwjkDdBH94+APVwgqdzJk3I9suO7S2HpXkTwU+xCExe YfhsCxkL1jaXrtDUn8UXR4Fs5WLmo3yz2V4uDZ7zNK5gEGok64nJPX7ERuUJcHkk NNV13UkQVymTfIPrR7/YznfNy+uMXGF3f+HivRmC9JvAt5wv6YExdSHZjkRH1T5T ztuDiWWX6NZOp93N7hbqpON0L0XpIq7OE/l/uzN574iP1aa1B89zb0J2rOEyNU+l xW+MprZiJx4kyFr8KqdDS1u17MDbvMbu4lq4wtDxAqsIehIaXbLDWuWZAVRUY2hK WxdMJW+NN8jCM4ser1FDBvouNQcTMiKRuPR6/Txm5mKHutGtnI8= =k4JX -----END PGP SIGNATURE----- --=-=-=--