Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3303591imu; Sun, 9 Dec 2018 23:01:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/XL7iJ+Flyg+rIVNJZEFlrz2sZmGej+6uX8HNyIso9mJ9v6ZCcLz/Fx8e9oASeeBA81NCVV X-Received: by 2002:a17:902:27e6:: with SMTP id i35mr10895646plg.222.1544425297212; Sun, 09 Dec 2018 23:01:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544425297; cv=none; d=google.com; s=arc-20160816; b=jXcSsVrtqi3/yjpxbwaI3OZ5VhEp4g944JrxBmJ50MFRp/q/3BkClYJRqxNrPaA/xq dMP1EQJBF994y+XoPz61w+tdbCGANiu+IiqfKBtlnevDspuDAxZ99Sq3M6te5nsaSQhf eIAOtEk3Gg4DYmKkiIRXlqHgHrsOdJVjCwqDaJzcXCz8PpaiRKqo1yCmRcJuw+RZRKFw C2S5Qkp3EeRhVyDoNJnyNza62PnFYHrMpDIUq7yjYeTIGH5aGuISb/f+VdLFJFI0q5oN 8kmMQpmXcwxxogqMSuSHjBKZD/7CFFVpyiTBcv6uhc086KhZ00XxE/Xo6mVJtC83OD2A LLKw== 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=JBdgUHrJ78mcibWnsW8z39n4gdmyKsZOzlbmg/Mg+3A=; b=t6es5/k98sYPtgVcipFUolIC8R3WC79hdWi1Ctu4iXDYI4DvoHQ9UZSYD7o+YW5Lga edv1lHboj2ZfHOp53Z3qyWSk3qj/HCuCdVhKqXM6mkEk7/CkGVx9rI/ffXzFKDKrZAmE 0g8OSdBUp6TS8GwPReYI1nV8LzJqo8xoVTtawXP7+zJBHY6/cfjKmCAwkmz5ekwEXrCh /LmKWVBA5fAxuS/F3FZH7iSP+K7+ZAQ23NS8CMB4P6W3Daql1BYvCSG3PgGlk7km/lyb sgcMMTMXHPauHsK6g90lwIgB0PqDnvcULMJV3dey7MstwUFzRtiW3/pUucZnxI9sk9g5 ubhA== 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 t3si9194276plo.69.2018.12.09.23.01.20; Sun, 09 Dec 2018 23:01:37 -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 S1726550AbeLJGyb (ORCPT + 99 others); Mon, 10 Dec 2018 01:54:31 -0500 Received: from mga02.intel.com ([134.134.136.20]:47638 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726292AbeLJGya (ORCPT ); Mon, 10 Dec 2018 01:54:30 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Dec 2018 22:54:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,337,1539673200"; d="asc'?scan'208";a="302470539" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.72.175]) by fmsmga005.fm.intel.com with ESMTP; 09 Dec 2018 22:54:25 -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 Subject: RE: [PATCH v7 09/10] usb: dwc3: Check for IOC/LST bit in both event->status and TRB->ctrl fields In-Reply-To: References: <1543662811-5194-1-git-send-email-anurag.kumar.vulisha@xilinx.com> <1543662811-5194-10-git-send-email-anurag.kumar.vulisha@xilinx.com> <875zw82vfj.fsf@linux.intel.com> <874lbpx3vg.fsf@linux.intel.com> Date: Mon, 10 Dec 2018 08:54:13 +0200 Message-ID: <87pnu927oq.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: > HI Felipe, > >>-----Original Message----- >>From: Felipe Balbi [mailto:balbi@kernel.org] >>Sent: Friday, December 07, 2018 11:42 AM >>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 ; Col= in Ian >>King >>Cc: linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; >>v.anuragkumar@gmail.com; Thinh Nguyen ; Tejas Joglek= ar >>; Ajay Yugalkishore Pandey >>Subject: RE: [PATCH v7 09/10] usb: dwc3: Check for IOC/LST bit in both ev= ent->status >>and TRB->ctrl fields >> >> >>Hi, >> >>Anurag Kumar Vulisha writes: >>>>> @@ -2286,7 +2286,12 @@ static int >>>>dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep, >>>>> if (event->status & DEPEVT_STATUS_SHORT && !chain) >>>>> return 1; >>>>> >>>>> - 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. >>>> >>> Thanks for reviewing this patch. Lets consider an example where a >>> request has num_sgs > 0 and each sg is mapped to a TRB and the last >>> TRB has the IOC bit set. Once the controller is done with the >>> transfer, it generates XferInProgress for the last TRB (since IOC bit >>> is set). As a part of trb reclaim process >>> dwc3_gadget_ep_reclaim_trb_sg() calls >>> dwc3_gadget_ep_reclaim_completed_trb() for req->num_sgs times. Since >>> the event already has the IOC bit set, the loop is exited from the >>> loop at the very first TRB and the remaining TRBs (mapped to the sglist= ) are left >>unhandled. >>> To avoid this we modified the code to exit only if both TRB & event >>> has the IOC bit set. >> >>Seems like IOC case should just test for chain flag as well: >> > > Okay. Along with this logic the code for updating chain bit should also b= e modified I guess. not really > Since the IOC bit is also set when there are not enough TRBs available, t= he code should be > modified to not set DWC3_TRB_CTRL_CHN bit when the IOC bit is set. I will= update below > changes along with your suggestions and resend the patches. no. Actually I don't think we're allowed to split a scatter/gather like that. I did that quite a while ago, but I don't think we're allowed to do so. What we should do, in that case, is not even queue that request until we have enough for all members of the scatter/gather. But that's a separate patch, anyway. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlwODZcACgkQzL64meEa mQZaSRAAyNq2TKRZPznYqR/04p9Aip5KW/VtDfvM217J4J67CMszeRiJ131FHbeX 43JRSgZ2ThO2MSvIAhMDld50AmVfyh/5Um9lrYBWk2NZijYazNYb1rGO2dQoOoRI VR0SO9dEbjHpWx1Wq971KdHX9zYmqFvcWlwgvVxf2wItBOBwhPw3vQcNkCgq/tEc A6+Hr+JAZdsARTopcQfJSxYluyT/6xYLzzI5dC9jztUkZb45gfU6aV2L0OHHbEBK 5xCWPrW1qZIYI1AGi075Sli9XfsPogut4YZ5vATHb5+PQDLMB9W3h82HF+GH7azL EClmX5EPdd7VyPUPaFEPaP2Yra8uVEeuRe/VyS8He0Kndq/kMJIuFTAYRSycYnRL 0DaWpnVA7MLaHBDcUdQeNXtXR1O+V90igNjOhXuAqaWuJ/TJdkEWNsJrmN15vDHu GJrhRq09H3myDkUfUurLJfU7Zx5Lqi7ylhIF7Jbrb/jCAm3MNeAusm2rY5Zfo1m5 uzNER9fdltlzPspE/57APXlQIbCEKftapyOFdwxGwNPpIgzpBBWwbNG3oOfI1VsR 1keznt8hxZQuAXNDJNbzgiw5IsZQSI/dcxmC+Son/h1Fpv985ht7ytkRsSaoBLXZ K59+Q3T25qT5HvmEE7ESJMCxFvcBKSny4qF6XHBCiIL7TNUIbAY= =FGqq -----END PGP SIGNATURE----- --=-=-=--