From patchwork Sat Oct 13 13:14:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anurag Kumar Vulisha X-Patchwork-Id: 10640137 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0B3214BD for ; Sat, 13 Oct 2018 13:15:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD9672AF4D for ; Sat, 13 Oct 2018 13:15:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A16C82AF52; Sat, 13 Oct 2018 13:15:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 224572AF4D for ; Sat, 13 Oct 2018 13:15:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726967AbeJMUwn (ORCPT ); Sat, 13 Oct 2018 16:52:43 -0400 Received: from mail-eopbgr680048.outbound.protection.outlook.com ([40.107.68.48]:5096 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726727AbeJMUwj (ORCPT ); Sat, 13 Oct 2018 16:52:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SgdqNPTXSxEY8wz3p0JzQNIuIptOvujNPrI80mICSGE=; b=ojM9JpSHvebVrxjfY5N2bLa70/LoKHOf4SbK+KgeFsmYvO0azHk6VmxYrnmlmIAUchVZx6wRV8egin989KJ8t/YRZshNAsN+Y/L40YEeu1NMsvtjBZqG1IK8y5dxVdJjozHo0IJc89GZSs6IR54+LvpBgWMwSHNJTjA+fOcbIyw= Received: from SN4PR0201CA0008.namprd02.prod.outlook.com (2603:10b6:803:2b::18) by DM6PR02MB4457.namprd02.prod.outlook.com (2603:10b6:5:29::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Sat, 13 Oct 2018 13:15:25 +0000 Received: from BL2NAM02FT008.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::200) by SN4PR0201CA0008.outlook.office365.com (2603:10b6:803:2b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1228.23 via Frontend Transport; Sat, 13 Oct 2018 13:15:25 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT008.mail.protection.outlook.com (10.152.76.162) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1250.11 via Frontend Transport; Sat, 13 Oct 2018 13:15:20 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJlG-00068f-VH; Sat, 13 Oct 2018 06:15:18 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gBJlB-0007wb-Qq; Sat, 13 Oct 2018 06:15:13 -0700 Received: from xsj-pvapsmtp01 (maildrop.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w9DDF8aN026446; Sat, 13 Oct 2018 06:15:08 -0700 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJl6-0007pN-0L; Sat, 13 Oct 2018 06:15:08 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 8ED2460504; Sat, 13 Oct 2018 18:45:07 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH V6 09/10] usb: dwc3: Check for IOC/LST bit in both event->status and TRB->ctrl fields Date: Sat, 13 Oct 2018 18:44:57 +0530 Message-ID: <1539436498-24892-11-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(1496009)(136003)(346002)(376002)(396003)(39860400002)(2980300002)(438002)(199004)(189003)(76176011)(48376002)(51416003)(81166006)(14444005)(356004)(106002)(5660300001)(36756003)(54906003)(42186006)(81156014)(486006)(36386004)(107886003)(426003)(90966002)(2616005)(39060400002)(110136005)(2906002)(16586007)(316002)(11346002)(446003)(7416002)(6666004)(8676002)(476003)(126002)(2171002)(6266002)(52956003)(50226002)(4326008)(63266004)(336012)(186003)(106466001)(305945005)(8936002)(50466002)(47776003)(478600001)(103686004)(26005)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR02MB4457;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BL2NAM02FT008;1:DCgLg/HVtQoswAIzKPRuVI8hx9yo+CJWEIjRAXEPTGdaqt1OYZYcIFuOaHup99kW42+6VqAIO7+Vnfh/f794/TvRZ5YvpqY4O0U58E+VqqStyvR2XJci5wHxC9oZprZJ MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 678dc487-2c32-43f7-6cd9-08d6310defd4 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM6PR02MB4457; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4457;3:DN8pmOE96x9iI+oxVB3nnmIHP2e9m6wxQ+t887NttbZ9AU1DaHh2UP60RnuPafGXNMPQkqY7Znfz/Tw9t0ZMp2rUqswnKbUyepqIIN77djNC+UiYRmfngmYErqDAnN6d8O9HO7WLjwhlxSwxa8EICfXrSNKfRN+4a+zoI5l8PKhSPExO8+XzR3m/Uoqrp8CeBrfK6nl0d+Er8fabh8qdMNJw+gLtrRGKcO+Dgqrv/vuGUbg6xiHOCRcZiE+mRM2CL2PIZt2Jx3CSCI/8FRQsGjhtDxbhKn7t9XO/1iOclTcd625nHT2XUoTI3I6vSO/WnnDb3QoKfWrVDm91JcPCZn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e4InWiaoZXcw8HYNNSOuLFJ39TqYNCdlI9KNntCk0W8PsUFBQ5KA6Nvx2wZoqmyW3EYbg9p4Q/8YhOzRcrSUGO6VLo4/nXaK9Bs0Jgp9XWcucvBIyaEUQ3 X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93004095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699051);SRVR:DM6PR02MB4457;BCL:0;PCL:0;RULEID:;SRVR:DM6PR02MB4457; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4457;4:YzgBF81j4uN2xI95u2edefvXiFiApIKEdv/BRQwvhjL1z5g+A4Zgp0lqVuRy2rp5H3UD6+0DBeGnjqzDy8a4Ztt7676Wv1IGpoCvbAWsaIgh72hsX8oAPMKcDeGocrXDqh0csntEi7NO/JwQb7gUD5bVBBrj0SB0inB3b8pIUO0NHDq+J6EJD6S0iA//fIdAt4Z3Z/OoVZRP01BjfYY/3tGwOU4WqyTAo1/vPt3DwdUTul5UVrKvJ3S8qjje2XuFeCa0sMvVp6iqpXbVY0KFLDAyaIzhLLvkilAAii+6b3dRk9DU0LitRuMZsT13RT3r X-Forefront-PRVS: 082465FB26 X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4457;23:Ziy5LqhJvf9glAx26hx6Nev4qsHJqrQIH85loXgWCpXpJsnQDefhYBq1x3ffaD6/omTHngpncLdHjh8LeDjBfXNSEkdP4k2X6JCvEbNRe5IqUNnFw5sKZ36CQakfRpBRspEYfQ2FmE+oi0Tqeop+ySNI7Ky887kIq82aHurN3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CVP48Kg=;7:E60t5cgmClROtP4014p9FDM1g+4fJPB5wcHhTQMzFQVMEcoUbjPpsUSUV0XGlV/rhwuwCCLfDRmMlfxQ4HqLGQR/AaOrmMEACE8hpnjto7xCaoq6hIgBZfvGP8mSnD+R09C7sHxN07mEN9tt11fvCsrBuKkevi9WxPd2tWUZXcX8PA2xqHr4qlcY28NJgLrk1LJfN0sj0olsNf/8siY862sRm6J4keioQ4ZSUt6PLhyE+ubxNKYo6hSS+OPT+D1f SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2018 13:15:20.2983 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 678dc487-2c32-43f7-6cd9-08d6310defd4 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB4457 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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 2d4b184..f54de80 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2293,7 +2293,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; + + if ((event->status & DEPEVT_STATUS_LST) && + (trb->ctrl & DWC3_TRB_CTRL_LST)) return 1; return 0;