From patchwork Sat Dec 1 11:13:30 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: 10707627 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 21F3114BD for ; Sat, 1 Dec 2018 11:14:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11D7E2E65F for ; Sat, 1 Dec 2018 11:14:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0611A2E666; Sat, 1 Dec 2018 11:14:55 +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 7BF7B2E65F for ; Sat, 1 Dec 2018 11:14:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726825AbeLAW0H (ORCPT ); Sat, 1 Dec 2018 17:26:07 -0500 Received: from mail-eopbgr790081.outbound.protection.outlook.com ([40.107.79.81]:18388 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726684AbeLAW0H (ORCPT ); Sat, 1 Dec 2018 17:26:07 -0500 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=RthYfyL+Wv/A3PuUiQjo6hxjcZxZ2Ezat6Ijp11YREA=; b=B+VpVtObMThG1awMt3BCoqAkT7QDz6/ndl5GefuOL26y+CGV4MC2sn4EC6PJ2t9mX934ve14caY9kKfFeGYQU3IOJAg4ESHro6SbxvyR6wnogNb/hW/ASVSOBp0rT1B929IJvk9G0sMn35dg7h+BQ0YZKAuqX0IQOh5ftxsncQ0= Received: from MWHPR0201CA0055.namprd02.prod.outlook.com (2603:10b6:301:73::32) by CY4PR0201MB3508.namprd02.prod.outlook.com (2603:10b6:910:95::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.16; Sat, 1 Dec 2018 11:13:45 +0000 Received: from BL2NAM02FT003.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::203) by MWHPR0201CA0055.outlook.office365.com (2603:10b6:301:73::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1382.18 via Frontend Transport; Sat, 1 Dec 2018 11:13:45 +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 BL2NAM02FT003.mail.protection.outlook.com (10.152.76.204) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1382.18 via Frontend Transport; Sat, 1 Dec 2018 11:13:45 +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 1gT3DU-0002W4-Ch; Sat, 01 Dec 2018 03:13:44 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gT3DP-0001kp-96; Sat, 01 Dec 2018 03:13:39 -0800 Received: from xsj-pvapsmtp01 (xsj-smtp1.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id wB1BDZNw015269; Sat, 1 Dec 2018 03:13:35 -0800 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gT3DL-0001k5-3f; Sat, 01 Dec 2018 03:13:35 -0800 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 5089160503; Sat, 1 Dec 2018 16:43:34 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Shuah Khan , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros , Manu Gautam , , Bart Van Assche , Mike Christie , Matthew Wilcox , Colin Ian King CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH v7 09/10] usb: dwc3: Check for IOC/LST bit in both event->status and TRB->ctrl fields Date: Sat, 1 Dec 2018 16:43:30 +0530 Message-ID: <1543662811-5194-10-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1543662811-5194-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1543662811-5194-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)(376002)(39860400002)(136003)(346002)(396003)(2980300002)(199004)(189003)(8936002)(76176011)(51416003)(446003)(426003)(48376002)(336012)(106002)(356004)(6666004)(47776003)(16586007)(316002)(110136005)(54906003)(42186006)(36386004)(50466002)(14444005)(8676002)(486006)(2906002)(103686004)(39060400002)(36756003)(4326008)(106466001)(5660300001)(186003)(81166006)(81156014)(26005)(90966002)(478600001)(52956003)(50226002)(11346002)(63266004)(476003)(126002)(2616005)(7416002)(107886003)(6266002)(2171002)(305945005)(107986001)(921003)(1121003)(83996005)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR0201MB3508;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BL2NAM02FT003;1:w7b5PvGNRqsiJ2TczozfyaFFkbWubZTkHN+H52qJwg/JXkNasc8YZLO24jtV8ettnpOFhwz6ImWzU/N0xVK0FsMrFBR5NPFoHaga5bn2bZXBqUL8igJkpIh1clysVzwK MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 858c1e0f-079b-4145-59f0-08d6577e0f47 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4608076)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060);SRVR:CY4PR0201MB3508; X-Microsoft-Exchange-Diagnostics: 1;CY4PR0201MB3508;3:vFjOCd2aQ2aF2UW3Q9SlukxuBJpYFwoo+YphGCSHk2c8hnCM7EL4iUKB35nkvgwvzvmoh5A0P+ntUAMYzF897iqu0+050uGqSm2YcPmspqk+1RgcKuVJbSquzeKs56Djjln3DK3Mw1pFdAnFXLF/oE6+Q8Ew4c/8/sSYtZlJZF/pkDPb/HhwaVqXPmnnGD2HzpZYCcMBxALdzIrPAZrc2mT95Ggjqs1UaKqxzv41/kub4rscmjhdd5J8S2TWVaRd2lI6k+xfdT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yE8ag1l6GeybkSG0c47HMcAmuo22AMROhZylYuvClOL0AiqKq+/QUE53RcQDhiAh7PvqCLIUuebx7VT20phSWxVcCC3KEHOnDWtkpyHfAiQ6YV9sk1zC8iDJXEN/77VeDF/A5l4c4VW1e38asyexcmlJyxKqtXxg+Fmtl9a3TbPPFFfW/qf04 X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93004095)(3231454)(999002)(944501476)(52105112)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:CY4PR0201MB3508;BCL:0;PCL:0;RULEID:;SRVR:CY4PR0201MB3508; X-Microsoft-Exchange-Diagnostics: 1;CY4PR0201MB3508;4:6OXr+esmj+0bFxwVPPMzPahCKtkjF2Rnx7+c2Y0gDD9vueaYrCPkW56TaBhwNLjnNboXi0lLMLyHxQ0PiLbMcRWRjVhk0O3iWXA1bFdnBotQYm0e0dAhcS5PIprvDVPbOT/FWkLUHWIgjWgCWtvoVuwqHzd9SCVX4fSzdEzLevCSE3vd5GG9wei+kaeNibdTKARqwPipWTMZAWgLjZOxLsnm7j/i0gqt1s4q7vSGElcRTPVCDfIljJL6SqWr6a2n6TA7xEpPVEigAqCeKNCKEg== X-Forefront-PRVS: 087396016C X-Microsoft-Exchange-Diagnostics: 1;CY4PR0201MB3508;23:WbD3YXeyivFdC5ebgehUjl56eIhRFzVOqye+6PuePoVn+QlEyNVGRUVde/58wrTW7cd9qsU35hjvCoxcl8/iHgrZSjc5kzFyjZSkLuSZhXW5adfDWv0hgEjLuSCQgAO6HoA8frcrAx8F0o9SurAd9pU5VdDoJlWIO1gYzYYbfhmfNMwU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1zX3r297l+b9Yx0B2AUThR2EL7+DJHoG4=;7:K1+d0Ssc6g2oGY0oDw8dQcsBF4+9ZYfj6fhXcMczlgHqoutej09/5TkQ6WQ3FPPMumz/WNtA3hgGrg9D0HMgZGlrp2ajyA6kTj2rFSXYxZoLQ1CA5t7EjG4QxxpY7T37EyjeAMignl8pYHFMcfSuZQ== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2018 11:13:45.0833 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 858c1e0f-079b-4145-59f0-08d6577e0f47 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: CY4PR0201MB3508 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 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(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;