From patchwork Sat Dec 1 11:13:22 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: 10707623 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 884D713BF for ; Sat, 1 Dec 2018 11:14:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 766E72E65F for ; Sat, 1 Dec 2018 11:14:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AB252E666; Sat, 1 Dec 2018 11:14:44 +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 800532E65F for ; Sat, 1 Dec 2018 11:14:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726731AbeLAW0J (ORCPT ); Sat, 1 Dec 2018 17:26:09 -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 S1726756AbeLAW0I (ORCPT ); Sat, 1 Dec 2018 17:26:08 -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=pAeWIpde05s6gDOiVtppofyLiUtuO5xWab/uKuFbCb4=; b=MRsjgc6hGQD7k3xIaPxD3AXSJJ3K8Xy3LhhMJJ68Nofmp+EuGK2AIvDvY+nncR47aH1XC18iK/dNIbd+wbh/wW37cczCwu6wZvwag9b2hmOVZFYT/PD0HYXdVDtU4HHOCbtlQRyjD5Pa3VZ7tk2A87zPYAtxxRPEpCliUAypwjk= Received: from DM6PR02CA0022.namprd02.prod.outlook.com (2603:10b6:5:1c::35) 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:46 +0000 Received: from CY1NAM02FT004.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::200) by DM6PR02CA0022.outlook.office365.com (2603:10b6:5:1c::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22 via Frontend Transport; Sat, 1 Dec 2018 11:13:46 +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 CY1NAM02FT004.mail.protection.outlook.com (10.152.74.112) 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-0002W6-HS; 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-Dj; Sat, 01 Dec 2018 03:13:39 -0800 Received: from xsj-pvapsmtp01 (xsj-smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id wB1BDXen015251; Sat, 1 Dec 2018 03:13:34 -0800 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gT3DJ-0001jj-DU; Sat, 01 Dec 2018 03:13:33 -0800 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 96953604E9; Sat, 1 Dec 2018 16:43:32 +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 01/10] usb: gadget: udc: Add timer support for usb requests Date: Sat, 1 Dec 2018 16:43:22 +0530 Message-ID: <1543662811-5194-2-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)(1496009)(376002)(39860400002)(136003)(346002)(396003)(2980300002)(199004)(189003)(8936002)(76176011)(51416003)(446003)(426003)(48376002)(336012)(4744004)(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)(551934003)(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;CY1NAM02FT004;1:vxHfQc15iGxZNxEi7xB4ogz5DeDDKTDALztA+crBwEw53WeeYFzSuyfgtuApAvAZ7Mr1rqtYeVtK3b0bscdRA/1wqLdP//VzJIQAQ5pbD7/C2JPDf7LF9eLjuRb4EjYf MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab7de776-acf3-4c78-50ec-08d6577e0fbc 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:PAahK4VhaIm8X9aXO0D2CNx8ViTCzrYOHEBHPnx8VE37hxzjVJtFnEnqAvotInHw+ThbpKT+H5nSmOaM7LerojNxAD/38YCFzNnfij8taS4ZQGwh7Gc5WrgvXTLJqIM3ChRyn6gD9eiIiwY5pKeVq4eEsi++2Fb+r340yxnCPFJddni3dy14FBm6dOfVa0NE3MjIwow1WGSc4XtQXswoH8C0ky1wBSzDsRD2g9SVEtJb1HvdLUGjKLIWOS8MlLzby347mSzqAYVUOdh/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p2PV1DNa8twptffT6m7YH1HE5eUwPqbq+WwqmkMWIKaM4AWIqbCNOXF1FgGq4um37KtMOw/ylmTP+lPfbvM9CxAhWias7y1wakA8obBRCTw3ROdDiYbi4PQ9rzGVJ6odkKJCXltDlll7YqBK9sW/bxU9g0r92GKbQfSkkdKcE4v0A79ZT9fXgyVZxaBkTHpBQdU 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:gPY0GEG+8a0i3vZGmHQjlBcEiZACKDOlEog2xCmeqzAT1Bj+CQBRnhe98rLLEQS6d9hRXpOwllhxw2rsWechwp0D2lp2wmIyOtHTRNZIHU6/QZjXTi89OCPsD1mptehLb5QvqD0+fDcOMb8DT6UTsxqK0rbyhxijBy0gwKjEno0E5ttJEnUgp3xOTcHvfhiyIcUwOWCZTDgWro1t+ItPQWWI7OLI/PAeXTxxvJBB4hRTJVICwo9SCvE33DjWJZgyl3XpMKP/UjOxJVNuJpch1Q== X-Forefront-PRVS: 087396016C X-Microsoft-Exchange-Diagnostics: 1;CY4PR0201MB3508;23:H5bxasAdlyHpsFWWjYPQC2kD72rl/NaRS/vjdDFQjJg5SzvOa7r2jACZyQURV/5DNPwao4PrFw+SKYErJnzwj/muFLuzKt8eBz4mdwSV1LyiNV/FDjr19z+qW26AgLsa1XVkOasQDA34IDjItTVvNE6WeSH1se260N75VPX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OZBQjOJ2i+cGpJS+Y0ya6R4wSyhQQ+jv7Hx6tNsg0F/3iWw/i/plriwc85D8IAZUJlNJ7cW9ALrrEE/GnDmh73VTLcPHc/S4VGB0T9FvHasfdE=;7:qA5DipwVBGDUCaH+tF++zAKtAEh3zVwtg+BrYd2VcCb9ibLVJDbDR+Wqms3pRS3ElDSBAxEuoQczoyNuS4SqVgJNqatv3V8fCPOK+iVx/o3tBjf3tSNfMs4IHQTkVzDMSxOSArUToveeeusLnh+SSw== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2018 11:13:45.0061 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ab7de776-acf3-4c78-50ec-08d6577e0fbc 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 In some corner cases the gadget controller may get out of sync with host and may get into hang state, thus creating a dealock. For example when bulk streams are enabled for an endpoint, there can be a condition where the gadget controller waits for the host to issue prime transaction and the host controller waits for the gadget to issue ERDY. This condition could create a deadlock. To avoid such potential deadlocks, a timer is started after queuing any request for the endpoint in usb_ep_queue(). The gadget driver is expected to stop the timer if a valid event is found (ex: stream event for stream capable endpoints). If no valid event is found, the timer expires after the programmed timeout value and a timeout callback function registered would be called. This callback function dequeues the request and re-queues it again, doing so makes the controller restart the transfer, thus avoiding deadlocks. This kind of behaviour is observed in dwc3 controller and expected to be generic issue with other controllers supporting bulk streams. Signed-off-by: Anurag Kumar Vulisha --- Changes in v7: 1. Added usb_ep_dequeue() & usb_ep_queue() logic into the timeout handler as suggested by "Felipe Balbi" 2. Created a usb_ep_queue_timeout() & __usb_ep_queue() functions Changes in v6: 1. This patch is newly added in this series to add timer into udc/core.c --- drivers/usb/gadget/udc/core.c | 119 +++++++++++++++++++++++++++++++++++++----- include/linux/usb/gadget.h | 16 ++++++ 2 files changed, 121 insertions(+), 14 deletions(-) diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index 87d6b12..daeb9bf 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -52,6 +52,25 @@ static int udc_bind_to_driver(struct usb_udc *udc, /* ------------------------------------------------------------------------- */ /** + * usb_request_timeout - callback function for endpoint stream timeout timer + * @arg: pointer to struct timer_list + * + * This function gets called only when bulk streams are enabled in the endpoint + * and only after req->req_timeout_timer has expired. This timer gets expired + * only when the gadget controller failed to find a valid stream event for this + * request. On timer expiry, this function dequeues the request and requeues it + * again to restart the transfer. + */ +static void usb_request_timeout(struct timer_list *arg) +{ + struct usb_request *req = from_timer(req, arg, req_timeout_timer); + struct usb_ep *ep = req->ep; + + usb_ep_dequeue(ep, req); + usb_ep_queue_timeout(ep, req, GFP_ATOMIC, req->timeout_ms); +} + +/** * usb_ep_set_maxpacket_limit - set maximum packet size limit for endpoint * @ep:the endpoint being configured * @maxpacket_limit:value of maximum packet size limit @@ -190,6 +209,47 @@ void usb_ep_free_request(struct usb_ep *ep, EXPORT_SYMBOL_GPL(usb_ep_free_request); /** + * __usb_ep_queue - queues (submits) an I/O request to an endpoint. + * @ep:the endpoint associated with the request + * @req:the request being submitted + * @gfp_flags: GFP_* flags to use in case the lower level driver couldn't + * pre-allocate all necessary memory with the request. + * @timeout: The timeout value in msecs used by the usb_request timer. + * + * This should only be called from usb_ep_queue() or usb_ep_queue_timeout(). + * This function queues the requests to the controller driver and starts the + * timer if the timeout value is not zero. + */ +static int __usb_ep_queue(struct usb_ep *ep, struct usb_request *req, + gfp_t gfp_flags, const unsigned int timeout) +{ + int ret = 0; + + if (WARN_ON_ONCE(!ep->enabled && ep->address)) { + ret = -ESHUTDOWN; + goto out; + } + + ret = ep->ops->queue(ep, req, gfp_flags); + + if (timeout != 0) { + timer_setup(&req->req_timeout_timer, usb_request_timeout, 0); + req->req_timeout_timer.expires = jiffies + + msecs_to_jiffies(timeout); + mod_timer(&req->req_timeout_timer, + req->req_timeout_timer.expires); + req->timeout_ms = timeout; + } + + /* Assign the ep to req for future usage */ + req->ep = ep; +out: + trace_usb_ep_queue(ep, req, ret); + + return ret; +} + +/** * usb_ep_queue - queues (submits) an I/O request to an endpoint. * @ep:the endpoint associated with the request * @req:the request being submitted @@ -260,23 +320,45 @@ EXPORT_SYMBOL_GPL(usb_ep_free_request); int usb_ep_queue(struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags) { - int ret = 0; - - if (WARN_ON_ONCE(!ep->enabled && ep->address)) { - ret = -ESHUTDOWN; - goto out; - } - - ret = ep->ops->queue(ep, req, gfp_flags); - -out: - trace_usb_ep_queue(ep, req, ret); - - return ret; + return __usb_ep_queue(ep, req, gfp_flags, 0); } EXPORT_SYMBOL_GPL(usb_ep_queue); /** + * usb_ep_queue_timeout - queues (submits) an I/O request to an endpoint. + * @ep:the endpoint associated with the request + * @req:the request being submitted + * @gfp_flags: GFP_* flags to use in case the lower level driver couldn't + * pre-allocate all necessary memory with the request. + * @timeout: The timeout value used by the timer present in usb_request. + * + * This functions starts the timer for the requests queued to the controller. + * This routine does the same as usb_ep_queue() but takes an extra timeout + * argument which is used for setting the timeout value for the timer. There + * can be some corner case where the endpoint may go out of sync with the host + * and enter into deadlock situation. To avoid such potential deadlocks a timer + * is started at the time of queuing the request. This timer should be stopped + * by the controller driver on valid conditions otherwise the timer gets + * timedout and the handler is called which handles the deadlock. + * + * For example, when streams are enabled the host and gadget can go out sync,the + * gadget may wait until the host issues prime transaction and the host may wait + * until gadget issues a ERDY. This behaviour may create a deadlock situation. + * To avoid such a deadlock, when request is queued to an endpoint, the timer + * present in usb_request is started. If a valid stream event is found the + * gadget driver stops the timer. If no valid stream event is found, the timer + * keeps running until expired and the timeout handler registered to the timer + * usb_request_timeout() gets called, which dequeues the request and requeues + * the request to avoid the deadlock condition. + */ +int usb_ep_queue_timeout(struct usb_ep *ep, struct usb_request *req, + gfp_t gfp_flags, const unsigned int timeout) +{ + return __usb_ep_queue(ep, req, gfp_flags, timeout); +} +EXPORT_SYMBOL_GPL(usb_ep_queue_timeout); + +/** * usb_ep_dequeue - dequeues (cancels, unlinks) an I/O request from an endpoint * @ep:the endpoint associated with the request * @req:the request being canceled @@ -291,6 +373,8 @@ EXPORT_SYMBOL_GPL(usb_ep_queue); * restrictions prevent drivers from supporting configuration changes, * even to configuration zero (a "chapter 9" requirement). * + * If a timer is started in usb_ep_queue(), it would be removed. + * * This routine may be called in interrupt context. */ int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req) @@ -300,6 +384,9 @@ int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req) ret = ep->ops->dequeue(ep, req); trace_usb_ep_dequeue(ep, req, ret); + if (timer_pending(&req->req_timeout_timer)) + del_timer(&req->req_timeout_timer); + return ret; } EXPORT_SYMBOL_GPL(usb_ep_dequeue); @@ -883,7 +970,8 @@ EXPORT_SYMBOL_GPL(usb_gadget_unmap_request); * Context: in_interrupt() * * This is called by device controller drivers in order to return the - * completed request back to the gadget layer. + * completed request back to the gadget layer. If a timer is started + * in usb_ep_queue(), it would be removed. */ void usb_gadget_giveback_request(struct usb_ep *ep, struct usb_request *req) @@ -891,6 +979,9 @@ void usb_gadget_giveback_request(struct usb_ep *ep, if (likely(req->status == 0)) usb_led_activity(USB_LED_EVENT_GADGET); + if (timer_pending(&req->req_timeout_timer)) + del_timer(&req->req_timeout_timer); + trace_usb_gadget_giveback_request(ep, req, 0); req->complete(ep, req); diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index e5cd84a..5b2516b 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -61,6 +61,13 @@ struct usb_ep; * invalidated by the error may first be dequeued. * @context: For use by the completion callback * @list: For use by the gadget driver. + * @req_timeout_timer: Some endpoints may go out of sync with host and + * enter into deadlock. For example, stream capable endpoints may enter + * into deadlock where the host waits on gadget to issue ERDY and gadget + * waits for host to issue prime transaction. To avoid such deadlock this + * timer is used. + * @timeout_ms: timeout value in msecs used by the req_timeout_timer. + * @ep: pointer to the endpoint for which this request is queued. * @status: Reports completion code, zero or a negative errno. * Normally, faults block the transfer queue from advancing until * the completion callback returns. @@ -111,6 +118,9 @@ struct usb_request { struct usb_request *req); void *context; struct list_head list; + unsigned timeout_ms; + struct timer_list req_timeout_timer; + struct usb_ep *ep; int status; unsigned actual; @@ -243,6 +253,8 @@ int usb_ep_disable(struct usb_ep *ep); struct usb_request *usb_ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags); void usb_ep_free_request(struct usb_ep *ep, struct usb_request *req); int usb_ep_queue(struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags); +int usb_ep_queue_timeout(struct usb_ep *ep, struct usb_request *req, + gfp_t gfp_flags, const unsigned int timeout); int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req); int usb_ep_set_halt(struct usb_ep *ep); int usb_ep_clear_halt(struct usb_ep *ep); @@ -266,6 +278,10 @@ static inline void usb_ep_free_request(struct usb_ep *ep, static inline int usb_ep_queue(struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags) { return 0; } +static inline int usb_ep_queue_timeout(struct usb_ep *ep, + struct usb_request *req, gfp_t gfp_flags, + const unsigned int timeout) +{ return 0; } static inline int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req) { return 0; } static inline int usb_ep_set_halt(struct usb_ep *ep) From patchwork Sat Dec 1 11:13:23 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: 10707609 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 77D6514BD for ; Sat, 1 Dec 2018 11:13:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 677C02E63D for ; Sat, 1 Dec 2018 11:13:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 592F32E643; Sat, 1 Dec 2018 11:13:59 +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 5E1032E552 for ; Sat, 1 Dec 2018 11:13:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726906AbeLAW0K (ORCPT ); Sat, 1 Dec 2018 17:26:10 -0500 Received: from mail-eopbgr700084.outbound.protection.outlook.com ([40.107.70.84]:64747 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726726AbeLAW0I (ORCPT ); Sat, 1 Dec 2018 17:26:08 -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=d9ZuiERyxY6/S8X/sgZVSpcVPHDruHemBriWRmnOye8=; b=37KdoiGmJUvCAEkdH6a/TUTSjnR7W8bIJpKVDDYqNIpuQwMtC7meLTRCNRRt+rSJ6a5HNJ9v3LMt2e27nGQT+AXSLOyBzD64bVoRHAosPwVQhfMc5D3jF913vQUXkgXKDOTBKNcirVRWA6F7xxE0XL+zHDxp6N9bmmoOKlLjcIY= Received: from SN4PR0201CA0047.namprd02.prod.outlook.com (2603:10b6:803:2e::33) by BL0PR02MB4324.namprd02.prod.outlook.com (2603:10b6:208:40::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.21; Sat, 1 Dec 2018 11:13:45 +0000 Received: from CY1NAM02FT005.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::205) by SN4PR0201CA0047.outlook.office365.com (2603:10b6:803:2e::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.21 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 CY1NAM02FT005.mail.protection.outlook.com (10.152.74.117) 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:44 +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 1gT3DT-0002W1-SP; Sat, 01 Dec 2018 03:13:43 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gT3DO-0001kp-Ot; Sat, 01 Dec 2018 03:13:38 -0800 Received: from xsj-pvapsmtp01 (mailhub.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id wB1BDYir015255; Sat, 1 Dec 2018 03:13:34 -0800 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gT3DJ-0001jk-Nm; Sat, 01 Dec 2018 03:13:34 -0800 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id E52D160503; Sat, 1 Dec 2018 16:43:32 +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 02/10] usb: gadget: function: tcm: Add timeout for stream capable endpoints Date: Sat, 1 Dec 2018 16:43:23 +0530 Message-ID: <1543662811-5194-3-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)(396003)(136003)(346002)(39860400002)(376002)(2980300002)(199004)(189003)(186003)(50226002)(8676002)(81156014)(106466001)(8936002)(81166006)(110136005)(54906003)(336012)(5660300001)(76176011)(42186006)(316002)(26005)(16586007)(551934003)(356004)(478600001)(6666004)(305945005)(90966002)(106002)(36386004)(51416003)(63266004)(7416002)(486006)(103686004)(476003)(126002)(2616005)(426003)(11346002)(446003)(2171002)(6266002)(107886003)(39060400002)(4326008)(48376002)(2906002)(50466002)(14444005)(47776003)(52956003)(36756003)(107986001)(921003)(83996005)(2101003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:BL0PR02MB4324;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;CY1NAM02FT005;1:LUHWffkwBVXWGm0P4scUkzqdCKbBmsRmkWyL3cxTdb24lrO/gcMQ0mkHHL2I99wovS6hPU+OhV+St3lJgpy6qNc+i0j0onW3rjCtSvsJHArLxxYN0Lj/zR6jM1ZsGUUI MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b528620e-fe38-4945-c401-08d6577e0f50 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4608076)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060);SRVR:BL0PR02MB4324; X-Microsoft-Exchange-Diagnostics: 1;BL0PR02MB4324;3:/+TcCou8keDNZCHbGoXZKzo5RaCiy7TBgEqWu6oM8g8RdliO6oP6/kfJUvEeU1fM6PKzc3KFRABVN/fFGkeWn2e2eMFLwbWktpX8gDkpULZy7I0k2YGDVEx5CrpceM4MysCElrCSSCgALLvjnPYUCGX4SnzxaErsJEh0UG+MRkH6pe3Zx2Km/eGpIUal4KQC4ofN129MHyvNU5MU1fxp9BPGBxpFyPfeYw7CBM5UT1LRd+qPIktN4JfJTOUz+PrEbmweMknfLND/4BGeHNwbyM2K08AGf94nbm6ZZliYSDXy9aieoYhtkq54TwJjWBdySSKgyQWGllukJ9f/F3Rufr+9wTtrsvAljdF1ZYFTVVY=;25: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Vjq/t0DIn16OtDKbD3++JsFtljkRdNPqYTOxyFyzK13pMIwK0/0dAPfzW1tj9JP5qtLmAcpnoa3XwZ 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)(3002001)(10201501046)(93006095)(93004095)(3231454)(999002)(944501475)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BL0PR02MB4324;BCL:0;PCL:0;RULEID:;SRVR:BL0PR02MB4324; X-Microsoft-Exchange-Diagnostics: 1;BL0PR02MB4324;4:KhFbqp/z+fvrHwsqwDzCaZw7nutWf1SAf/mU1p1D7dZiD3Yi8oHLZhQduHxSSMDLLJycWo+Zoo2SYjpcQUvl/K7rWXNubXFlCuO8TnZgMtaQ4T3I40cypmWmIfuldl3OFRrLAST3BTuR8LfUQtEezIBWN4cIe8y5ZMHWHoc385zNge7wDmQqPeidUlbtVQQGoL6BrFARdfc2PL35mHF6Xd+XM5+GypH4hhrP8mkKmyP5TZpIXUqu958JqG0gpSrowV6MGpo/VI+aPtpIEwZOLA== X-Forefront-PRVS: 087396016C X-Microsoft-Exchange-Diagnostics: 1;BL0PR02MB4324;23:/2iJ02CBRdh+uBFtZbTvCAtjcn1Q+DP7jSE/s9KLb/ltzGj/xmTNUteSE9hBUbb2g5VDJDfVFim6vrsVHvRPWnExOsqmORgW2G4JE84dhlyod/fXAHC4KvWnq2b7foX/ifukiNO/X+PJsVUMMRw0ztWHOIZmEsj9AXIGTlxgMJtOL6tAR3iypp16z/PJ+Hf6yzZEen9zRy0RPDfWxoMRV3jiJ1F6lY3vItXsm4CuBnOyj7uO068BbFf31Nh1L8sWjNIKdF3EU+MyuU8Z6Y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bhT49IB0NC5Lf6uQ7ojAPBVp0MwqWYLlbceP8Emor+0TCAlT+Vh1LEX4+Y1Tf/5/ZLWJ0upx2I+PQs5xhmwfi5/5YzZRYv64F2thonpmT09zaVu8LQ== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2018 11:13:44.3325 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b528620e-fe38-4945-c401-08d6577e0f50 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: BL0PR02MB4324 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 When stream transfers are enabled for an endpoint, there can be a condition where the gadget controller waits for the host to issue prime transaction and the host controller waits for the gadget to issue ERDY. This condition could create a deadlock. To avoid such potential deadlocks, use usb_ep_queue_timeout() instead of usb_ep_queue() for stream capable endpoints. The usb_ep_queue_timeout(), after queuing any request starts the timer with STREAM_TIMEOUT_MS timeout value for the stream capable endpoints. The gadget controller driver is expected to stop the timer for every request if a valid stream event is found. If no stream event is found, the timer expires after the STREAM_TIMEOUT_MS value and a callback function registered by udc/core.c is called, which handles the deadlock situation by dequeuing and requeuing the request. This kind of behaviour is observed in dwc3 controller and expected to be generic issue with other controllers supporting bulk streams. Signed-off-by: Anurag Kumar Vulisha --- Changes in v7: 1. This patch is newly added in this series --- drivers/usb/gadget/function/f_tcm.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 106988a..6eaee04 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -27,6 +27,12 @@ #define TPG_INSTANCES 1 +/* + * Timeout value in msecs passed as an argument to usb_ep_queue_timeout() for + * stream capable endpoints + */ +#define STREAM_TIMEOUT_MS 50 + struct tpg_instance { struct usb_function_instance *func_inst; struct usbg_tpg *tpg; @@ -575,7 +581,8 @@ static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req) ret = uasp_prepare_r_request(cmd); if (ret) goto cleanup; - ret = usb_ep_queue(fu->ep_in, stream->req_in, GFP_ATOMIC); + ret = usb_ep_queue_timeout(fu->ep_in, stream->req_in, + GFP_ATOMIC, STREAM_TIMEOUT_MS); if (ret) pr_err("%s(%d) => %d\n", __func__, __LINE__, ret); break; @@ -584,15 +591,16 @@ static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req) ret = usbg_prepare_w_request(cmd, stream->req_out); if (ret) goto cleanup; - ret = usb_ep_queue(fu->ep_out, stream->req_out, GFP_ATOMIC); + ret = usb_ep_queue_timeout(fu->ep_out, stream->req_out, + GFP_ATOMIC, STREAM_TIMEOUT_MS); if (ret) pr_err("%s(%d) => %d\n", __func__, __LINE__, ret); break; case UASP_SEND_STATUS: uasp_prepare_status(cmd); - ret = usb_ep_queue(fu->ep_status, stream->req_status, - GFP_ATOMIC); + ret = usb_ep_queue_timeout(fu->ep_status, stream->req_status, + GFP_ATOMIC, STREAM_TIMEOUT_MS); if (ret) pr_err("%s(%d) => %d\n", __func__, __LINE__, ret); break; @@ -622,7 +630,8 @@ static int uasp_send_status_response(struct usbg_cmd *cmd) stream->req_status->context = cmd; cmd->fu = fu; uasp_prepare_status(cmd); - return usb_ep_queue(fu->ep_status, stream->req_status, GFP_ATOMIC); + return usb_ep_queue_timeout(fu->ep_status, stream->req_status, + GFP_ATOMIC, STREAM_TIMEOUT_MS); } static int uasp_send_read_response(struct usbg_cmd *cmd) @@ -640,7 +649,8 @@ static int uasp_send_read_response(struct usbg_cmd *cmd) ret = uasp_prepare_r_request(cmd); if (ret) goto out; - ret = usb_ep_queue(fu->ep_in, stream->req_in, GFP_ATOMIC); + ret = usb_ep_queue_timeout(fu->ep_in, stream->req_in, + GFP_ATOMIC, STREAM_TIMEOUT_MS); if (ret) { pr_err("%s(%d) => %d\n", __func__, __LINE__, ret); kfree(cmd->data_buf); @@ -686,7 +696,8 @@ static int uasp_send_write_request(struct usbg_cmd *cmd) ret = usbg_prepare_w_request(cmd, stream->req_out); if (ret) goto cleanup; - ret = usb_ep_queue(fu->ep_out, stream->req_out, GFP_ATOMIC); + ret = usb_ep_queue_timeout(fu->ep_out, stream->req_out, + GFP_ATOMIC, STREAM_TIMEOUT_MS); if (ret) pr_err("%s(%d)\n", __func__, __LINE__); From patchwork Sat Dec 1 11:13:24 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: 10707615 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 EC4D314BD for ; Sat, 1 Dec 2018 11:14:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCB192E65F for ; Sat, 1 Dec 2018 11:14:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D02C12E666; Sat, 1 Dec 2018 11:14:13 +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 46F542E65F for ; Sat, 1 Dec 2018 11:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726916AbeLAW0X (ORCPT ); Sat, 1 Dec 2018 17:26:23 -0500 Received: from mail-eopbgr700083.outbound.protection.outlook.com ([40.107.70.83]:52078 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726736AbeLAW0R (ORCPT ); Sat, 1 Dec 2018 17:26:17 -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=9O/fkWXIvShko9wn5oCt8IYeGZavbYH55pp2ZrjJTN0=; b=WA5SlF1tTBOgL2Fz0ChvpeHXHbSkIrIAIuE27TumPysbe+jsr7/l4dVO3U0UI3d86tO9iFCQ9xCGWmv5w2sXP3mxFksh7NJBEXnMV98XexFSeJTq2/LReF+UX9HzJ8/MGpN12HDa9o9S+Yd0s5ZMZ0qBhVkj4zkuNVGCCHU+SrY= Received: from BN6PR02CA0040.namprd02.prod.outlook.com (2603:10b6:404:5f::26) by SN6PR02MB4463.namprd02.prod.outlook.com (2603:10b6:805:a8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sat, 1 Dec 2018 11:13:52 +0000 Received: from CY1NAM02FT049.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::206) by BN6PR02CA0040.outlook.office365.com (2603:10b6:404:5f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22 via Frontend Transport; Sat, 1 Dec 2018 11:13:46 +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 CY1NAM02FT049.mail.protection.outlook.com (10.152.75.83) 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:44 +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 1gT3DT-0002W0-RA; Sat, 01 Dec 2018 03:13:43 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gT3DO-0001kp-NN; Sat, 01 Dec 2018 03:13:38 -0800 Received: from xsj-pvapsmtp01 (mailman.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id wB1BDYMq003401; Sat, 1 Dec 2018 03:13:34 -0800 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gT3DK-0001jm-0H; Sat, 01 Dec 2018 03:13:34 -0800 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 34A1460504; Sat, 1 Dec 2018 16:43:33 +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 03/10] usb: dwc3: gadget: handle stream events Date: Sat, 1 Dec 2018 16:43:24 +0530 Message-ID: <1543662811-5194-4-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)(396003)(136003)(346002)(376002)(39860400002)(2980300002)(189003)(199004)(26005)(186003)(51416003)(478600001)(476003)(126002)(106466001)(90966002)(52956003)(426003)(36386004)(336012)(2906002)(47776003)(7416002)(305945005)(76176011)(11346002)(446003)(486006)(2616005)(63266004)(14444005)(356004)(6666004)(48376002)(107886003)(4326008)(5660300001)(2171002)(110136005)(106002)(81166006)(6266002)(103686004)(54906003)(50226002)(8936002)(36756003)(81156014)(316002)(42186006)(16586007)(8676002)(50466002)(39060400002)(107986001)(921003)(83996005)(2101003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR02MB4463;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CY1NAM02FT049;1:shfDVG207dhnfnamBqKcZBMsSzvGgtwL1kSxXeiV8bgnqUpkAbjHNYCG6630DiI3Onq2ZLTqSVZVnVY4fAcYrdFHZy8P0eLOq4M8jPLj7G1RhqGtoNri1Gj2gnuuLzBb MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 99784bdf-8ccc-4983-bf9d-08d6577e0fa4 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4608076)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060);SRVR:SN6PR02MB4463; X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4463;3:rn5NDDx1eJvnOdh7XYy6o0eTMyRoAV2dDVQNQ+/P2Ff57WJjxXyWc9kqh15ZM/9NH1Z40cK7eeKrjaR722QgXnB4pmAfKEx86AIx5mbQXqcQW1Bh2GjaI0HcLcyEI1hLjAatnRAGq7dzepLznLjRqbWjeatZhLtTNQAXEeAURItlQdKUA/UTwZ79izAPXeC3Dw84InGmsNJqAtgzERtLrYE03vQCgZdthnQzCktQ9GvNUXd/b5g9GnlirOM3D3s4HZ1EIzefc+8OuMfSC0exlji61cpta273coupy0/VZs8WVXs3H5xzPaq89AiNGUkT/KuL53cG8Nf2dtqHIgsrBOZv53m66nJQg/zcmBtG2LI=;25:lgj1yLYozU3J/n2IcAxniJQUneI3cDRj02kP4/pkXv2HvUGOpyZ4ghs5QC4czUWI8mB6/o414laE/yhlLlfyGzTM5SMBeBoGbQkd7sQ4WCqbJtuETo/0xeciK5OwEmpAQBcFTS8yi/uSH28NUFD7uZ/OQilPaTK2ZslQOcp+fUctUASr3sci25tS05v/EfIVodhRXg7NQzhs2x38qpNGoMHFPDo4HO8eMv4ZUUZIiubw+JRtKF3eVWDefsqb6lKMsUpJKkrfAEq5hoqjXpEwaambPBLokP4InIA0v6fmjGxYMsjqAmBmR5BRhkMltPXh4EuPIDlGcK8u3S8qNDTcWA== X-MS-TrafficTypeDiagnostic: SN6PR02MB4463: X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4463;31:qZSk1TPx8V3ieI7CyduLN4gvIGY1ydVKWJqhKH3oKY+gkCXHoAEdYdXQ1Vo6PtblxY2COOhqjVmcgS2rblvREmUWU3DQbVK9d64PIHbEyqM8Owq/nXEZdxXXBhd7/EiZ2dlelkDKp4BTHCRBHhxzUFJ/dWLC953bI03aYLhnImEw8iacW5dbb53tMKR6tHq7kjZFXYvO3dpowPDUJuVYuycmInsJp0l0e4396rfemxY=;20:ulPc2n2a25hNxkVW3ndf8SURU9nijal+qwWbXk0CRZWCc1QLhn/IfYno+EfUBImy8kRQHPz4BcbVuQ9nHUsBYQ73XlNTe3irryYGv/EfSUR7yGIkbkbs0Z7plEZw8wY2fWk4/DY6Yxtl6eofIgEYJrChNcfkFDk3cYWz5tNDejjpcdwOjKooXzoV9JSEEd2CRwbvFF1piji+Z8cIiDJXPuzLMH+Fik08Pgsum/duED8qWZPPiLRSMY3JR2M8i3ixj58QWVjjNfNKdqYNH1wz01fO+nlcvA+UTaE8QQfC7/hRSiXF5U2p7P0/pEEKPrJDRavI2jDD3za+f/kj8ZuEBjmfAsu6nCICn2JxjZIq6wcZEig8m5ZPo//nrswfPF3CSXWpiLDOOWdtyntaBWbb0v+3kL+wtNiEdMbeOG/JND0AZxRgYoOJZAtGNUxrPVPAVMRZb/kS8hd88muO0bp7uYtZpCLbxajmbFPn2mwhCAjryPO6V3iGxPMvUCpDJQmc 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)(5005006)(8121501046)(93006095)(93004095)(3002001)(10201501046)(3231454)(999002)(944501476)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095);SRVR:SN6PR02MB4463;BCL:0;PCL:0;RULEID:;SRVR:SN6PR02MB4463; X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4463;4:/GyUqIC6o2/cQKubZacWH9geX4UbyDmuhcFwXGzEHWnmLVcPVoW0ZQxWcby7jNYfsWQOYZDQAPenCbpFtsbx/MU3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+LMz7jWSbtC/jPlYIlmjp+vio9McRhN0gSjzJpYznyFN+MfhhRh1nggDjikwEF0mtDVMxkGFTUn04/yBqi7S+qIK/FhZ5sB2lnkjbCJTZibheb7kpK4/n5bBc7XzMkmLhBMB/bKiT0QAQ3tzRICuPImJqV4mctfJ2e75fk/3XMY78fyrYFYFCSV2EpCM8Xi2Nudh2A+kS2MvGvU7mR4UOtUDOpoHeRtOBO5nQKT1ELFp2nxxDsWdwdS5h+DwnRFUbo4MnhOI8lUI8ROCNwfG74mVpzhfFB/lLGHwQOEPw==;5:ThtPDR400NsSg0J/jSBOxR942fYilcao9ZnJSB63IDg4utrxbzZSNKt8tKQ33bhsDrecuWGnn5FZYSIsUxwREd5FPD6y3SRyCQybGuZC0Xwk9p4Ug1WAxAu0WwHr/UmqD0NPHFkENNwEoan2fZvtAsUm5oO0hARuS3oUUTlFHrI=;7:g818g84Pdg85Ds+HYi5DbZ8xzyp+mtOxGgWTZ9A3MgXffjJb/2kkHQGAR+HM6GBlZTVr3CUx+9JjD2+znFVYc4YGDQd3QGHRHoFRDbRieWT1SqxNilz0puLmamxJk058NrokceCCjDeXpOZubszwUw== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2018 11:13:44.8985 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 99784bdf-8ccc-4983-bf9d-08d6577e0fa4 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: SN6PR02MB4463 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 When bulk streams are enabled, the udc/core.c starts the timer for every request queued. This timer needs to be deleted by the gadget driver when a valid stream event is found. This is done to avoid the deadlock situation which occurs when streams are enabled. This patch modifies the code to delete the pending timer for the request matching the streamid found in the event. Signed-off-by: Anurag Kumar Vulisha --- Changes in v7: 1. This patch is newly added into this series --- drivers/usb/dwc3/gadget.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 9faad89..319a3ed 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2438,6 +2438,28 @@ static void dwc3_gadget_endpoint_transfer_not_ready(struct dwc3_ep *dep, __dwc3_gadget_start_isoc(dep); } +static void dwc3_endpoint_stream_event(struct dwc3 *dwc, + const struct dwc3_event_depevt *event) +{ + struct dwc3_ep *dep; + struct dwc3_request *req; + u8 epnum = event->endpoint_number; + u8 stream_id; + + dep = dwc->eps[epnum]; + + stream_id = event->parameters; + + /* Check for request matching the streamid and delete the timer */ + list_for_each_entry(req, &dep->started_list, list) { + if (req->request.stream_id == stream_id) { + if (timer_pending(&req->request.req_timeout_timer)) + del_timer(&req->request.req_timeout_timer); + break; + } + } +} + static void dwc3_endpoint_interrupt(struct dwc3 *dwc, const struct dwc3_event_depevt *event) { @@ -2477,6 +2499,9 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, } break; case DWC3_DEPEVT_STREAMEVT: + if (event->status == DEPEVT_STREAMEVT_FOUND) + dwc3_endpoint_stream_event(dwc, event); + case DWC3_DEPEVT_XFERCOMPLETE: case DWC3_DEPEVT_RXTXFIFOEVT: break; From patchwork Sat Dec 1 11:13:25 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: 10707613 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 4271314BD for ; Sat, 1 Dec 2018 11:14:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 311132E552 for ; Sat, 1 Dec 2018 11:14:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2406A2E63D; Sat, 1 Dec 2018 11:14:02 +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 A79102E552 for ; Sat, 1 Dec 2018 11:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726955AbeLAW0R (ORCPT ); Sat, 1 Dec 2018 17:26:17 -0500 Received: from mail-eopbgr820070.outbound.protection.outlook.com ([40.107.82.70]:43268 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726916AbeLAW0L (ORCPT ); Sat, 1 Dec 2018 17:26:11 -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=s+NAHDBLXK0FSRCiZpNIgw+xddPQL9tBl5zBnkSWvjQ=; b=MxJU7Qevkt+yjC7ZwTYwhuOiUUB1RzMcSL23MgYWWgKktCsxCIkyy9BSVssmsbszOAFjfRWWixHw/NAJJmRf6IUbbcI64rtI1w1L071xiJ3CcXB7oJj8atgKK5oo/NfDRmngCeKZWH+2YalDVjT6Zm14YElC4RsTStM2T6J4+88= Received: from BN7PR02CA0036.namprd02.prod.outlook.com (2603:10b6:408:20::49) by DM6PR02MB4460.namprd02.prod.outlook.com (2603:10b6:5:29::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sat, 1 Dec 2018 11:13:51 +0000 Received: from CY1NAM02FT060.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::201) by BN7PR02CA0036.outlook.office365.com (2603:10b6:408:20::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22 via Frontend Transport; Sat, 1 Dec 2018 11:13:45 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) 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.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by CY1NAM02FT060.mail.protection.outlook.com (10.152.74.252) 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:44 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:46471 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1gT3DT-0005oF-Vn; Sat, 01 Dec 2018 03:13:43 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gT3DO-0001kp-SK; Sat, 01 Dec 2018 03:13:38 -0800 Received: from xsj-pvapsmtp01 (smtp3.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id wB1BDYCn015257; Sat, 1 Dec 2018 03:13:34 -0800 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gT3DK-0001jo-7g; Sat, 01 Dec 2018 03:13:34 -0800 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 67D246050B; Sat, 1 Dec 2018 16:43:33 +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 04/10] usb: dwc3: update stream id in depcmd Date: Sat, 1 Dec 2018 16:43:25 +0530 Message-ID: <1543662811-5194-5-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.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(1496009)(376002)(39860400002)(136003)(346002)(396003)(2980300002)(189003)(199004)(186003)(16586007)(39060400002)(48376002)(6266002)(2171002)(50466002)(36386004)(36756003)(107886003)(52956003)(47776003)(2906002)(63266004)(478600001)(106466001)(103686004)(426003)(446003)(476003)(90966002)(106002)(110136005)(486006)(2616005)(14444005)(126002)(51416003)(305945005)(11346002)(54906003)(336012)(4326008)(8936002)(81156014)(26005)(15650500001)(81166006)(5660300001)(6666004)(76176011)(356004)(8676002)(7416002)(316002)(50226002)(42186006)(921003)(107986001)(2101003)(83996005)(5001870100001)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR02MB4460;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CY1NAM02FT060;1:C0rT9JOl4kyQjRYkfW2ex3iiLSn0fZl7ZtsKveR6oS9dZJk2Sfa3tG5mUUUi9GLj6BW8ipxvr/DfRKd0N3SQwIzwGGXW+JaEAWQJITKyj5o0WrZYHylzQky0RQALdyxg MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38be51fd-6654-4a64-4ac8-08d6577e0f5a X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM6PR02MB4460; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4460;3:YuyVEnoKF2r1jMcl/Cxg76Zc/JlIkruYF1WzGs2O8mRNjyFkAJH8xK1t/M4aivVH1vn+eiIkBG7BmJe7H/dkc7PNwfN3pqy1se/W8/pX3HF2JsneDd8TQKa9HEVIrL5LcjWMI3knlO//uuoMPutza1g6a41eDZDMjXf98q4ebfPAWmUfz0cMsYGZbFK7anOM/3SzE8qTQu/0fPPw4hkQfZLf61CBuZoGetzJqQX5p6H7t3Iqmr1+oiV5hCcxqVka3ZKEX2azP7uSJD7fcdz2sJUSzj7nTYJwewq4PnXBAW15IWAxqvhCBFGb22YRk/2HhZ11ecJio3k3Z4AC8k2XOnkCUHFONJUr07fU73ne/us=;25:3WKA3GwVr9fr/p1VmHwyVKjpFPJ/X1SXods6khcSTxI2fskYQq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o6oF3tUv4ux88+1m1nAjkoeLhACDhs609SKT 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)(5005006)(8121501046)(3002001)(93006095)(93004095)(3231454)(999002)(944501475)(52105112)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:DM6PR02MB4460;BCL:0;PCL:0;RULEID:;SRVR:DM6PR02MB4460; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4460;4:nuzFPJDu2L3Kq18P3jYCitmGSbjjf4A1VFO0huyp/rqMwv+jRfZJ9TUFLcDIEIp3hqfqcVYRJiWDT/mjnGQdUTzBOZeiFwyZoVSgf9zChG9He+TyHx0xLF1RIe0NRSlFfMGsZ6iejegSjfssEUThLYAU7VvjgAfZowPyl4CRCAumHRcEv3sAIwwmrouJX2FHxfHHd4Rk8CPkpjbgc46LT2co1EW/R66qydUV8BkJJcoRF+WjHcbNnapbfMly/Z+BxojAGqEC4l0JOQS0cE7HhA== X-Forefront-PRVS: 087396016C X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4460;23:U60V6l4ZlQqCIuDfJhdPTiWcYVrWz+UGBp1Tq3+Aqa4H57idzTGnrsmJUkKWG18YdytgrbmQFuNOSeg+DEH7h/fcP1Xm05hORipwNlNI7FDd1N1JSO/nfDR9lIKsBm/col/WhFX/ronwMMZTM5tdwQATOyOTsZWIqy2zC5haiyjbJctH7ot2JSdn/w0TCd67/qzlAGhld/DTnh3pDn05u9632uYm/mqamiCAOXcaYGMTFLFCHbEp/AWsuRZR7fE9uW/bNOX1DoTTXcuVZKG0ZUxx4x8NHpw7UAHeL+PaJG/1x4RDiZfVz4z/bgfiNSbIWibq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ZpBDv6pi7OwlfwRIDsdEAie7gyfY3CgIsig6Mqm8t/xNZ95Y5C8Wc5s6v+1R0conLB2u85ta26nEeIclabnZSTXYJbdDI2w== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2018 11:13:44.4418 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38be51fd-6654-4a64-4ac8-08d6577e0f5a 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.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB4460 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 For stream capable endpoints, stream id related information needs to be updated into DEPCMD while issuing START TRANSFER. This patch does the same. Signed-off-by: Anurag Kumar Vulisha --- Changes in v7: 1. Reverted to dep->stream_capable from dep->endpoint.stream_capable Changes in v6: 1. Used dep->endpoint.stream_capable instead of dep->stream_capable flag 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 319a3ed..3171c24 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1232,6 +1232,9 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep) params.param1 = lower_32_bits(req->trb_dma); cmd = DWC3_DEPCMD_STARTTRANSFER; + if (dep->stream_capable) + cmd |= DWC3_DEPCMD_PARAM(req->request.stream_id); + if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) cmd |= DWC3_DEPCMD_PARAM(dep->frame_number); } else { From patchwork Sat Dec 1 11:13:26 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: 10707625 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 4DFE813BF for ; Sat, 1 Dec 2018 11:14:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C8B82E65F for ; Sat, 1 Dec 2018 11:14:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FE642E666; Sat, 1 Dec 2018 11:14:50 +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 A12572E65F for ; Sat, 1 Dec 2018 11:14:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726848AbeLAW1B (ORCPT ); Sat, 1 Dec 2018 17:27:01 -0500 Received: from mail-eopbgr700084.outbound.protection.outlook.com ([40.107.70.84]:64747 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726684AbeLAW0J (ORCPT ); Sat, 1 Dec 2018 17:26:09 -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=PAZZpPBI2xYJtIm+BYQ4xb3vKCMWGQ/krb84ZoSfsDE=; b=RFCEFmq3cCWbVAg8uWH3ByYFBcaFmWuljRHoQcOU55Yk8+rDPNI5axZTgz3MGx7L0ZbG9U6aBN+odOPSw2mmc30PL2XdE/1lfcaO/lAAbjZEWKLasLGhSqc18L0nPAmPTdVc4agh23nHuGG+GQuR2iWK4q9BMss05hifUGoTaes= Received: from MWHPR0201CA0026.namprd02.prod.outlook.com (2603:10b6:301:74::39) by BL0PR02MB4324.namprd02.prod.outlook.com (2603:10b6:208:40::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.21; Sat, 1 Dec 2018 11:13:46 +0000 Received: from CY1NAM02FT043.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::205) by MWHPR0201CA0026.outlook.office365.com (2603:10b6:301:74::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_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.100) 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.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by CY1NAM02FT043.mail.protection.outlook.com (10.152.74.182) 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:44 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:46492 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1gT3DU-0005oG-8u; 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-46; Sat, 01 Dec 2018 03:13:39 -0800 Received: from xsj-pvapsmtp01 (maildrop.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id wB1BDY02015263; 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 1gT3DK-0001jr-FK; Sat, 01 Dec 2018 03:13:34 -0800 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 9403C6050D; Sat, 1 Dec 2018 16:43:33 +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 05/10] usb: dwc3: make controller clear transfer resources after complete Date: Sat, 1 Dec 2018 16:43:26 +0530 Message-ID: <1543662811-5194-6-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.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(1496009)(396003)(136003)(346002)(39860400002)(376002)(2980300002)(199004)(189003)(186003)(50226002)(8676002)(81156014)(106466001)(8936002)(81166006)(575784001)(110136005)(54906003)(336012)(5660300001)(76176011)(42186006)(316002)(26005)(16586007)(356004)(478600001)(6666004)(305945005)(90966002)(106002)(36386004)(51416003)(63266004)(7416002)(486006)(103686004)(476003)(126002)(2616005)(426003)(11346002)(446003)(2171002)(6266002)(107886003)(39060400002)(4326008)(48376002)(2906002)(50466002)(47776003)(52956003)(36756003)(107986001)(921003)(83996005)(5001870100001)(2101003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:BL0PR02MB4324;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;LANG:en;PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;CY1NAM02FT043;1:i0H1tIxGY0uBe6syQOiP24+s7xP6o/f3Q74NRIkrolYh/p1bZphrL65mD3loaoEuaE+5KRizEvN+fqziqKne3a3HaKP5rDRBYLHbdUAW6kmFbSmbcktVSnVGBTCyOscW MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eb2d18d2-50a4-4c00-b4a6-08d6577e0f8d X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4608076)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060);SRVR:BL0PR02MB4324; X-Microsoft-Exchange-Diagnostics: 1;BL0PR02MB4324;3:bfBoIYcdk+iShPwQnEM77jmCgH6xV1vAdEJfF5OMXg/Yl2i0vfihRVndUNmDF9obCQFJ/ra20SX7p8+wRGy5I3IhPy9vFdKwXBGKktIjNYnn5aXN11iFI5qrl0+82b0FZjBZEj7kYh5rWMnjV9PEW264fYYwFttwaCTpzDrnFLKQb4PmoCzGSS9F8S4sqn5bwybP+x9glR2j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dZo8CJj4HFdrD3MUjqehiDccFkl5J5jbqQsAlz5dT658/c2fpp0R/faR7LH1ujWeA+dRRUsQz70zjGBhKRV1Z3J3ZDFZ1MudhWL+e9qXT6/773Ube8NW1d6+IMhYPwSnG691wZ2+cCO3XITDxZyzlHIoXLET22zQtcS2pxMFl9sqJ0wwM2ua/NC4VNWGP8TlCANYcHp1nxAnyaa5AkE9+CGjfMQbbFAlwROpOvrHoYcBMyxZ32w8LAif5Twp9Zp+OlERJ 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)(3002001)(10201501046)(93006095)(93004095)(3231454)(999002)(944501475)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BL0PR02MB4324;BCL:0;PCL:0;RULEID:;SRVR:BL0PR02MB4324; X-Microsoft-Exchange-Diagnostics: 1;BL0PR02MB4324;4:BCJ1kJ+jnpgXZbfyhICYUUcrFOVaB5Wz80J5szYvZ8ZX9dy2Zqei9h+rouDO3Fy8mYZi8yUIXIqAKcyTSn/x6BWUjuxkLBHtS9aEWqcEOzMNoLJCnNwlCFQ+FbVb7PNDWorzvMvK4wuwIli3ZgWCBihj0ElXL6KbB0Q/4ownCmelwpI8RdzXGKIOC9dWSAErvLMV8gquF7SfVpQNB5FoULuoLpY7B6xUWfbaA+ChtqVhDHCfQIm553dlSwjux8c7kq0P8sTB+gYO0jNbppn/MA== X-Forefront-PRVS: 087396016C X-Microsoft-Exchange-Diagnostics: 1;BL0PR02MB4324;23:HH91psHoY3P/as9Szmqc4D16ulh6fBdcZnq2q+EMP1fLFq20PdfnGq/nXMt/npDAlUVzQDKSGHx29QLQBgd2EAmFL8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jvgkg==;5:gw4Vha8+CDRu3BO7TlHVuzdI2ghmiqgTypbt/EnCgvYknR7pa6H2JlBgrE0couwkGwllA9KfEpTtViT84VM0E0zr+Ld3Dh1lraX2Io+xg/P79O7fIKtFBOeBa2fTTXhMz4cT6kQspV9wEPxsdiTc7cBVheDRoLqTZj9ZK1Sro64=;7:6VQ3r/mKIoc+2VI3QLkcfcqSh72wwVFSTYq9VwKZyk2H4BLDgYH0w4mcAeThbbeY17e5+J0G4+lFs9/DZc/GkeFEIo48QaB4v9CXarhcyBUgpUYeL2sp8MZgrbRvUU0qGmaJ355g218otj6q9XnB8w== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2018 11:13:44.7475 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eb2d18d2-50a4-4c00-b4a6-08d6577e0f8d 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.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB4324 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 To start transfer with another stream id, controller needs to free previously allocated transfer resource. This will be automatically done by the controller at the time of XferComplete Event. This patch updates the code to issue XferComplete event once all transfers are done by setting LST bit in the ctrl field of the last TRB. Signed-off-by: Anurag Kumar Vulisha --- Changes in v7: 1. Reverted to dep->stream_capable from dep->endpoint.stream_capable Changes in v6: 1. Used dep->endpoint.stream_capable instead of dep->stream_capable flag Changes in v5: 1. None Changes in v4: 1. None Changes in v3: 1. Added the changes suggested by "Thinh Nguyen" Changes in v2: 1. None --- drivers/usb/dwc3/gadget.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 3171c24..3edfc0b 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -579,7 +579,8 @@ static int dwc3_gadget_set_ep_config(struct dwc3_ep *dep, unsigned int action) if (usb_ss_max_streams(comp_desc) && usb_endpoint_xfer_bulk(desc)) { params.param1 |= DWC3_DEPCFG_STREAM_CAPABLE - | DWC3_DEPCFG_STREAM_EVENT_EN; + | DWC3_DEPCFG_STREAM_EVENT_EN + | DWC3_DEPCFG_XFER_COMPLETE_EN; dep->stream_capable = true; } @@ -1005,6 +1006,15 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb, if (chain) trb->ctrl |= DWC3_TRB_CTRL_CHN; + /* + * To issue start transfer on another stream, controller need to free + * previously acquired transfer resource. Setting the LST bit in + * last TRB makes the controller clear transfer resource for that + * endpoint, allowing to start another stream on that endpoint. + */ + else if (dep->stream_capable) + trb->ctrl |= DWC3_TRB_CTRL_LST; + if (usb_endpoint_xfer_bulk(dep->endpoint.desc) && dep->stream_capable) trb->ctrl |= DWC3_TRB_CTRL_SID_SOFN(stream_id); @@ -2276,7 +2286,7 @@ 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) + if (event->status & (DEPEVT_STATUS_IOC | DEPEVT_STATUS_LST)) return 1; return 0; @@ -2487,6 +2497,11 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, } switch (event->endpoint_event) { + case DWC3_DEPEVT_XFERCOMPLETE: + if (!dep->stream_capable) + break; + dep->flags &= ~DWC3_EP_TRANSFER_STARTED; + /* Fall Through */ case DWC3_DEPEVT_XFERINPROGRESS: dwc3_gadget_endpoint_transfer_in_progress(dep, event); break; @@ -2505,7 +2520,6 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, if (event->status == DEPEVT_STREAMEVT_FOUND) dwc3_endpoint_stream_event(dwc, event); - case DWC3_DEPEVT_XFERCOMPLETE: case DWC3_DEPEVT_RXTXFIFOEVT: break; } From patchwork Sat Dec 1 11:13:27 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: 10707621 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 28B1D14BD for ; Sat, 1 Dec 2018 11:14:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 154602E65F for ; Sat, 1 Dec 2018 11:14:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0722F2E666; Sat, 1 Dec 2018 11:14:39 +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 8922F2E65F for ; Sat, 1 Dec 2018 11:14:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726885AbeLAW0J (ORCPT ); Sat, 1 Dec 2018 17:26:09 -0500 Received: from mail-eopbgr710068.outbound.protection.outlook.com ([40.107.71.68]:18184 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726747AbeLAW0I (ORCPT ); Sat, 1 Dec 2018 17:26:08 -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=ahctcdk8rvmwpdhLPaVOMaEEMZfojjuUc4y5mbAl6kM=; b=V22XnMp45u+azvqFn6coTakE3wKlfu/hDFrRcKBl3NyyvdbZELLNPdrEwTxx6ZcVVHk1WIr45L/Hp9EyNZTtZ44OmkeMXtfYuLdaYBFIowogSoGXwCqTuRiKoz3nhKp7gJj3tzUmxYP6RLyJVsW2eTMpbX4oT3cb0pVDrFvtOu0= Received: from CY4PR02CA0026.namprd02.prod.outlook.com (2603:10b6:903:117::12) by DM5PR0201MB3510.namprd02.prod.outlook.com (2603:10b6:4:77::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.19; Sat, 1 Dec 2018 11:13:46 +0000 Received: from CY1NAM02FT039.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::205) by CY4PR02CA0026.outlook.office365.com (2603:10b6:903:117::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.21 via Frontend Transport; Sat, 1 Dec 2018 11:13:46 +0000 Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by CY1NAM02FT039.mail.protection.outlook.com (10.152.75.140) 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]:46520 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1gT3DU-0005oI-Kf; 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-H5; Sat, 01 Dec 2018 03:13:39 -0800 Received: from xsj-pvapsmtp01 (smtp2.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id wB1BDYjb015261; 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 1gT3DK-0001js-Id; Sat, 01 Dec 2018 03:13:34 -0800 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id C09B6604D5; Sat, 1 Dec 2018 16:43:33 +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 06/10] usb: dwc3: don't issue no-op trb for stream capable endpoints Date: Sat, 1 Dec 2018 16:43:27 +0530 Message-ID: <1543662811-5194-7-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.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(376002)(136003)(396003)(39860400002)(2980300002)(3923003)(199004)(189003)(5660300001)(90966002)(36386004)(7416002)(478600001)(42186006)(103686004)(16586007)(106002)(316002)(2171002)(6266002)(48376002)(50466002)(305945005)(39060400002)(63266004)(2906002)(4326008)(486006)(126002)(6666004)(2616005)(356004)(476003)(446003)(426003)(11346002)(336012)(106466001)(107886003)(36756003)(51416003)(26005)(6346003)(186003)(47776003)(81166006)(54906003)(50226002)(14444005)(575784001)(8936002)(110136005)(8676002)(52956003)(81156014)(76176011)(107986001)(921003)(5001870100001)(1121003)(2101003)(83996005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR0201MB3510;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;LANG:en;PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;CY1NAM02FT039;1:5rpPmfYddxvi1Wsw+KSjrznPSD4VzxE65bfrgQ1R5hKXaq/tksDfAqtQ7qchpfa8ndKLdqsHYvEZ33xHDYEWeDA9i6hUu5qWCZ5IHea5QFHT66/wEgls5jKjbsRg3nlk MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: da52f029-1170-4163-76e3-08d6577e0fbf X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM5PR0201MB3510; X-Microsoft-Exchange-Diagnostics: 1;DM5PR0201MB3510;3:ZMkVcli3AX1SZLTv/tn3KnLsLfK2xOIw5RmCSoMrum540FGD4yvgogr98D00vDNa4oEG+gFStFUpuKKuPFOKN36JQbv3zQ23rA250q3y2PArQN4MNSdGh8Mnl2cKVLl9Ywf7IUGx5FKQrobEsE8B2e/X56PLvGrc0uN7zGH7mNa49907EXPhzNHh9Y4GA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ULH9yBGBg7fzuqSOj1DcNy6SHzZzsylR8O6ZQCXcQsj30htz0lWQd2zfLIF+PrtefveKVi/p9eAQPhLQvWHkNGVEcWt38cgG+36GHQ+HAYCzwg3MOh5MEVwPM94cnmCdE5mGTX47KAnSkmSS3ofXwsbX6AfHFWEWIUbNNxP/f0PCyFEf1sAkfEhYcwzjV2OLYHWTnnJvlfp3WCBz2GfiVn4yIZtSXkV9ojQCZdwRTfhMi//ddhLTXaXsotwgbc 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)(5005006)(8121501046)(93006095)(93004095)(3002001)(10201501046)(3231454)(999002)(944501475)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:DM5PR0201MB3510;BCL:0;PCL:0;RULEID:;SRVR:DM5PR0201MB3510; X-Microsoft-Exchange-Diagnostics: 1;DM5PR0201MB3510;4:lfH3/7Lakq33LS979gX3zKN5f+niZ9TuDIDwBFCYmXwbWxbHME3gLIX6HxenVs0czOofrqOgPCf03XHvt1Gq0I0C2IYrptfCyT95aDIb+WJuafccVnB5CnH8nPtrKheLAU0VEqrEpPIRwf6gbBCDFaTad3IGxWOpC66S8HzvIeUzEdo1HKFM8y8DSFt+tmH/Limo+qRoP22xy2sPqj0zbazMr+8k8MMG01KuNPMJ6ikDbNfOwhy/5SbOHO3PugfpzuxOvfC03ZetInB9ReMEQA== X-Forefront-PRVS: 087396016C X-Microsoft-Exchange-Diagnostics: 1;DM5PR0201MB3510;23:m6MwN0BZrRA7TQfHFMe+syTf0agKjaC5KMHMGH++W8dfOQUo+BrGdZMl6qwWZEQ2H2YhIMp4aBD+2czL1UJ/ZuS4WgA+8JHVwankk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eYHks48Yxd+sEI3iGehy4h9QWtoYngwbA==;5:SZOjj8osJQYGBy32M5flGQWkf5JMR6C6U6OSmy3hfpD73DR8e8C6627lkcW7pM7OGF/ddOGITc+2z6oXAPznXwQkbkIW7M5pldbMBYpPpEHMrAmmzxN+E/dvSuqsCy/0ec8UF7Fx64wrH1S1WAMLpu9t1HUFk1TBNP+Pc3WM/44=;7:0d5xIaGzBekHlvj3spZmYKjFpNh+tsh8lWYzrAam71E13+0+M6kKKS4hEOWgZpn5hO4QY24lgnFYNXpOzDDDlftcSHlI69e66uG/M4VbzKSpOnvm8xQfGIDrtFXej6UTRlnfrErjknVpFocPs/UVZQ== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2018 11:13:45.1049 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da52f029-1170-4163-76e3-08d6577e0fbf 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.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0201MB3510 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 stream capable endpoints require stream id to be given when issuing START TRANSFER. While issuing no-op trb the stream id is not yet known, so don't issue no-op trb's on stream capable endpoints. Signed-off-by: Anurag Kumar Vulisha --- Changes in v7: 1. Reverted to dep->stream_capable from dep->endpoint.stream_capable Changes in v6: 1. Replaced dep->stream_capable with dep->endpoint.stream_capable 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 3edfc0b..78c9bc6 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -673,7 +673,7 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action) * Issue StartTransfer here with no-op TRB so we can always rely on No * Response Update Transfer command. */ - if (usb_endpoint_xfer_bulk(desc) || + if ((usb_endpoint_xfer_bulk(desc) && !dep->stream_capable) || usb_endpoint_xfer_int(desc)) { struct dwc3_gadget_ep_cmd_params params; struct dwc3_trb *trb; From patchwork Sat Dec 1 11:13:28 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: 10707617 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 D40C113BF for ; Sat, 1 Dec 2018 11:14:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2D3F2E65F for ; Sat, 1 Dec 2018 11:14:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B69BC2E666; Sat, 1 Dec 2018 11:14:25 +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 D76132E65F for ; Sat, 1 Dec 2018 11:14:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726950AbeLAW0b (ORCPT ); Sat, 1 Dec 2018 17:26:31 -0500 Received: from mail-eopbgr780080.outbound.protection.outlook.com ([40.107.78.80]:42176 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726909AbeLAW0L (ORCPT ); Sat, 1 Dec 2018 17:26:11 -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=9l7RDY0jb/bNTwK1A9iSd2ZDibGvt4+OPlRPcHRwtEk=; b=0hyE3CfsRQJI3BAyC4ZZFdIfZ4Y19Q8swtfzytADZ4jhpy/+ROKWfNK4VnygU/tVwUR/yhXIpBoN1DleWYMT8qJOZ6kYcL6a0wBvAhyQZR+Su/eVD8t5zVW73j1me16AXHR/HzIyd9hBBarBEknIGpme2nJY0PJ1WRVUpXsY2O8= Received: from SN4PR0201CA0046.namprd02.prod.outlook.com (2603:10b6:803:2e::32) by SN6PR02MB4334.namprd02.prod.outlook.com (2603:10b6:805:a4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Sat, 1 Dec 2018 11:13:45 +0000 Received: from SN1NAM02FT047.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::209) by SN4PR0201CA0046.outlook.office365.com (2603:10b6:803:2e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1382.22 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 SN1NAM02FT047.mail.protection.outlook.com (10.152.72.201) 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:44 +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-0002W5-FZ; 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-CD; Sat, 01 Dec 2018 03:13:39 -0800 Received: from xsj-pvapsmtp01 (xsj-mail.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id wB1BDZCY003405; 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 1gT3DK-0001k0-PU; Sat, 01 Dec 2018 03:13:35 -0800 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id ED5586050E; Sat, 1 Dec 2018 16:43:33 +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 07/10] usb: dwc3: check for requests in started list for stream capable endpoints Date: Sat, 1 Dec 2018 16:43:28 +0530 Message-ID: <1543662811-5194-8-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)(1496009)(396003)(136003)(39850400004)(376002)(346002)(2980300002)(199004)(189003)(51416003)(356004)(186003)(478600001)(6666004)(2906002)(48376002)(476003)(305945005)(486006)(50226002)(2616005)(126002)(36386004)(26005)(8676002)(426003)(446003)(4326008)(11346002)(316002)(42186006)(107886003)(106466001)(36756003)(54906003)(81156014)(336012)(39060400002)(16586007)(106002)(90966002)(8936002)(110136005)(81166006)(63266004)(7416002)(76176011)(575784001)(103686004)(2171002)(5660300001)(14444005)(6266002)(47776003)(52956003)(50466002)(107986001)(921003)(83996005)(2101003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR02MB4334;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;SN1NAM02FT047;1:xExEvVXWj/CQCsbwA0rrO/mv6E1zjHy27PK6+abi5ONjv6wktY/llhYo95yO4tYZ+2dot8t/HpcTVlSJznqLcpkuMKSDojIdxuvqNX67w53xUbrnSJLtBlHlGW933lzJ MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b929a3b-36e7-4232-821b-08d6577e0f78 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:SN6PR02MB4334; X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4334;3:OmZ0HFzF8+Lqwy1PY7z//DpTJ6lWEHDYxntvsT0ZGvDrRMwSdggp8imOf/s4V/LOx3buGG5vMpHAPhqTjXJ0MPB2T3L9t3RDhGps8IR5mxYij071ok4ZGgJWwz0WxX7LqyC1tmqwoWD/Thw2tJTYbO/XNpk2Cnkpr+yPI89CJLe7QjwWPeqpv1u992b88OUg2Wb8e4Ejb/mEIfZKaMR5aPQvZCJjJVFgs5uJ8NTJoa4p1N1idDk4R0lEqZiHQdqK/kpFChN1oY+6QQYuMO2t+in6jZ62Wl/AWe5TzihNinSFdOgUHK+aqNu6Cpg9uwg80GOJHF/KJiSk1g1Ksww2hXHqfkhfDjyJIvNV5xjjK70=;25:JderzwMqXGxfZEQckPdJyjRRG+U8te/axtjMH+jK+A51K/o4FbDHSyFuttqEwDi1UroEPwGQNY5EsiXY5Ve4PbqE4SFNTnOkcmDiMnEGRk+/7vfPDmx5PqIYvbExgCPHaA+Q56HcGgldEL3pfqNiESBAZnpKPHj+R118oXrVASy/vxR2kTfKwgY49uUS999UjpYheaytrxqc5gMAmf0/hjW6bqg/26H/tpS0b0jq9PqNZdbwKLma9coomv9Nayj6vCHiPQLTclkkssH9zWp5mWTVkE5H3iaRUYpifrC3kok7daaxQACH+QeUQN2ACf727pJWiES2RR7L2eg4X+JWQQ== X-MS-TrafficTypeDiagnostic: SN6PR02MB4334: X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4334;31:Y6RCxFPCYEk8IFzONvVRudD08E6qNg5I2IC/85xGWKAScDYGcw1ouLIUPgnkAGOiCrnslKEyobA5WyQ8QYO6WnTJFZ9FId7OHendaZ8shAU/fH2J+vJqUiVizZL815OICi6t0Z9SmGIkXQpYNrajHvJ+DochUC637nWXc51CRge6mU7oRTX1o5yU/YraZbCq5FPURrtH0A0P7lMv9XlJy5T2RSKe8ISwenfZqkWaP6U=;20:p/68svC6Fd2zoX6dEyskd+nHIFBof2XJrK+DazFTdmjKt+4gz/IWJs/AAXyptCLapDnB0bqiB7Lr5dUr6epmfvYgp+LlfRqNF20od2hR4L7LiKxNB8DjqufoWba5si40H78Fh0DKGVPJNBZYKyWd9GltF+lbm81mqKMyc3VX2omVW/YAYPf8gb8uXrhW/Cf60uANJAA5guZqEd2ZsToFhev2stcI2EP1ag6TTdSMbWe42r8MVNyd+16GkkkfQv6lcNSURdWA9WTVW5IAC8k6u/cTnhvhAuzGqKffTb5Uq1EJ73JyWFd4ZdAAOHkRGkPcfiHkoJSMIw1Q6Syl6b68XB9WMbMA+gzsju8ueIGGkQHza+zi0z5i2Y39mSyF/DOJWAKgP96E68Ti5yIIOri0A71sx9P+LYA7rjFiF7Ygj/mrV9iDsIs/LbmDy4q9NXf87tzgoitjF7bn81DfZFjL1B/I/BZoumeSTZ0xHyaF64pkKQTZfcww6AzQPShI7p7i 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)(3002001)(3231454)(999002)(944501475)(52105112)(93006095)(93004095)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:SN6PR02MB4334;BCL:0;PCL:0;RULEID:;SRVR:SN6PR02MB4334; X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4334;4:AfbyxyqsOOzdCabu+sN/yEWdhG+BXgU+zAFbGgx5Z1AHwifM84UVuRckoziZ6TmRLTMaNaXysMPigC7eiBMRMjqUgIQUtV4qHyTOAvrZevrTrEG61hn29p7u2RQ4d1U1DvgY2lqDAnKmn7vIfUDsDB+dKIXioMwZhVQMSK9JyKHyUmtBP9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aDMOXtDqnqirH0DeHwbz6TpslPrXsGJUWJmVyUoPTJtARdlLZALZt9KezeJ9ZKUUqX9Khwiyi52+8Di3dH2U2rcKWOZREX6ULkZoeNH4jDS8x2qyxkgSQqAJ4zn4vzvKpm2FoUNWTHOnpsh9o8Lo1tzD/tvwX9PWYyHQVZWl96/7CjnxfZkF1B8KOG9+iaNhVY8nDYK0nEIGqTHexb765/nBWN+9J4Y7/VPuNw2kw==;5:K6+QzRUN/I5IgiQke+7V86ng1C3/jYxfZckVRua1Od8nLSpqJQqqOT1Epra/2svjRgGeEOfZqcIT0sdvjYeUBwpwarHwWeYzekLTucFtX13CR+lQCe1FP2F7OEy7fkOD8LEeMyx6EPBLgabeg/Jy4CjFxwlGoeQne3S4Glg7ovY=;7:nM2B5wL4/8odFWwP9u7SjMy3fadZcIHfdUiGKgV+NOU+jiUW83j8nfA8omKQCEP7zao4pyjP40TuJxe9+oH8t4S0mZkVaPrdQyfBgkzWYua1tcbgnRdb9svjjGPlvZgwypo861jlnCiMk4M+weDJtA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2018 11:13:44.9367 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b929a3b-36e7-4232-821b-08d6577e0f78 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: SN6PR02MB4334 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 For stream capable endpoints, uas layer can queue mulpile requests on single ep with different stream ids. So, there can be multiple pending requests waiting to be transferred. This patch changes the code to check for any pending requests waiting to be transferred on ep started_list and calls __dwc3_gadget_kick_transfer() if any. Signed-off-by: Anurag Kumar Vulisha --- Changes in v7: 1. Reverted to dep->stream_capable from dep->endpoint.stream_caapable Changes in v6: 1. Replaced dep->stream_capable with dep->endpoint.stream_caapable 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 78c9bc6..d0de7dc 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2413,6 +2413,9 @@ static void dwc3_gadget_endpoint_transfer_in_progress(struct dwc3_ep *dep, dwc3_gadget_ep_cleanup_completed_requests(dep, event, status); + if (dep->stream_capable && !list_empty(&dep->started_list)) + __dwc3_gadget_kick_transfer(dep); + if (stop) { dwc3_stop_active_transfer(dep, true); dep->flags = DWC3_EP_ENABLED; From patchwork Sat Dec 1 11:13:29 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: 10707607 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 95C3214BD for ; Sat, 1 Dec 2018 11:13:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 775872E552 for ; Sat, 1 Dec 2018 11:13:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 647AA2E63D; Sat, 1 Dec 2018 11:13:52 +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 AFF522E552 for ; Sat, 1 Dec 2018 11:13:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726776AbeLAW0H (ORCPT ); Sat, 1 Dec 2018 17:26:07 -0500 Received: from mail-eopbgr750059.outbound.protection.outlook.com ([40.107.75.59]:22888 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726731AbeLAW0H (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=ibZ3ce3mIxteL+0e/bpAIX4Gwfd/RYi3ylv6pYFjtgs=; b=yY1M4Pr9W0islWCMHPhAv4WJMY01zhWV0LpX74K2bYv5SyNmDldmi3G42rM15yy/k/9j3uer4VMxMQ4oTe6JpB1Dw+1kioaUHEcxVGqiXaBgr+O2qfCyhONykrmLeZm+UzEpJNVMS799TPJVlbpsW4CgMWCwLoCZAf3sRg1DQRE= Received: from BN7PR02CA0030.namprd02.prod.outlook.com (2603:10b6:408:20::43) by DM6PR02MB4460.namprd02.prod.outlook.com (2603:10b6:5:29::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sat, 1 Dec 2018 11:13:46 +0000 Received: from CY1NAM02FT028.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::206) by BN7PR02CA0030.outlook.office365.com (2603:10b6:408:20::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.21 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 CY1NAM02FT028.mail.protection.outlook.com (10.152.75.132) 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:44 +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-0002W3-4M; 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-0u; Sat, 01 Dec 2018 03:13:39 -0800 Received: from xsj-pvapsmtp01 (xsj-pvapsmtp01.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id wB1BDZZH015271; 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 1gT3DK-0001k2-UK; Sat, 01 Dec 2018 03:13:35 -0800 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 25B1B604E9; 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 08/10] usb: dwc3: Correct the logic for checking TRB full in __dwc3_prepare_one_trb() Date: Sat, 1 Dec 2018 16:43:29 +0530 Message-ID: <1543662811-5194-9-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)(189003)(199004)(186003)(16586007)(39060400002)(48376002)(6266002)(2171002)(50466002)(36386004)(36756003)(107886003)(575784001)(52956003)(47776003)(2906002)(63266004)(478600001)(106466001)(103686004)(426003)(446003)(476003)(90966002)(106002)(110136005)(486006)(2616005)(126002)(51416003)(305945005)(11346002)(54906003)(336012)(4326008)(8936002)(81156014)(26005)(81166006)(5660300001)(6666004)(76176011)(356004)(8676002)(7416002)(316002)(50226002)(42186006)(921003)(107986001)(2101003)(83996005)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR02MB4460;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CY1NAM02FT028;1:HuGqZvMyNqmzOjNeE+0ElgDIfs6aMS5EmRWWeLDGLZrLbI68oAD77aSVSdRMesg3uc2vLm50+nO0mBkNziWvAVWny0BvAcHyz3TmHjvEBURRVFgl8UCqOW4cOdTeytjD MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6e84573f-a05c-448a-3d20-08d6577e0f7f X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM6PR02MB4460; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4460;3:llEF+tpe5tyjphXSeAczjxYlgqs20AV3Al6+ONox/Fv5VlkL1n8ew7z6lWOTHESxsyTyg29xzNSExFYP/qaIys6USC5u1+vcs8Ey7pg3Twk3iKapfWBj9NJMXuW/1EKyI6+hYGASr9BGNSTah0NP6xqp5aJWJW0Ex8mo1t/TvIPk449r+FwaYYAfkKfHRQvso8pA8plLgcvftJx9urywrxAzpSb8zVmnWx42zD6Ez2KD5Tg5ybCXKTBNvjJ1J5QjG5edL8/1IZYUSKIQaYeHFpECPW0y+ztYwaP5j8VrzB+GI3Dq2TxmoKs6gJH0bxlDfQWuAPKazlenidzVhux7iVFytsrTxTB3IGz29FGUrK4=;25:sEqZJQcabZQmg/Sd/pormwPx+1JX3Ll+Io9vy4tXMGaasXMpkPlJoK+FwekZ7ZFtEay8WnuLIJJ7Y/2Xcj/XVGUA47EL2S7VAMLsOAZ6AUw9SNeDFtiSQq0F+UXeI02HtjoOrfPwb6gm4sQavrdfQU1LABLjL+5fBM7kfzXGhrTSdjJ2W7AaQwKnKLXys02l01gxwuH4bEzMdTWYRD5J54FRbmqjkWoCWVKtXWpTltQ+7y1QRxBf2yVL29R6tMgcO9A4Krb4OmW4o2kw1BQYhWeqMu68QqH3plEBipBPxljDZW+7OZbDxHy0hWw9XNIuy7wI0QAO5u1yktcCFwPyYg== X-MS-TrafficTypeDiagnostic: DM6PR02MB4460: X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4460;31:uKcLiyrSfXRu9P8jhFUnoNDjgcjnh3utdV/uFWSpcPlKH5mxrgqeFKeiDsqPDcJPOQdP+mB++cct7NI0TLtGVN47XEHiXK2rLjKXNiVz1469Q7Ftnt+A7wg446QC/Mv4/b/g80/mj24CsFnmJOF5ImCwth9E6cpbBJm6NrtxM1g4ySOMBOeRNqYpSgTznZQX00Lgm/eG0bnYsVQ8c/3yqY51c3PiFborUv5ZIA9oVkc=;20:sgaa9uGZNf6Tye6z83G796L+kundH3Aw9h+6uoNxWQJZdIajdzoRbCECHLhI8RZpW1/e0c5ias3SmVXdQY8znLtZWmhckVkSK7B8CSR/+ptIvIC10eZoPo0SxcN8574Xiol134M/tb+dGgzn/9Yvkt2nQ8f5v/qmhkpGfW8feerqnP00XJvO0BA2J+KdyWZJlaUCTH26SaZpUPszFasl7gL/hbtQGaFwl1EVFbRiT17iZIbu4RjisiZlC8Xyj/+Gx9R03cmBE+jEs+vZFuhtwA/ABTM0Zsv/8oJIdwY4jh0n9FkSSViGdWaN2HFRl0afOOz46HQk95klhDkSdV6QXPzfMn75gHPqB57DNvhPJCuji/tqNvAKYjvyTdA5FWV0GcPJZ7VClFPmOAj61TA13eiRbDaB8ozJ/h/EYkZwF/qcHp4LbPwFekbUWDy7oqcD0pXObHQ7uzosV8UfTSak67oQBa9nyfr/EzAq80TWNcybyLruwA2I7GNQkGdC2S4H 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)(5005006)(8121501046)(3002001)(93006095)(93004095)(3231454)(999002)(944501475)(52105112)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:DM6PR02MB4460;BCL:0;PCL:0;RULEID:;S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B0JGN1gip/HRbFg7ICfsqG6nnEaPJpjoZnAYtj57xAiWyz7vUYQ7KoNH7PV192WLLttnpOpmng+PNPn96pA3M4YLURs6nGxAVMiV+GvDZhRwVkn7hyhle5P+bwozYNCEirUZQzWL4eVcD7SWAPgp6v5rT9AFkztNZmTN/Jk5BBOJmHyThFeF+WM2ZoXbgLgNRxqOjeDgT4HozkImfB0M5ZCQg5eyPikPNTuijAghjOqbWaBmGJSLE+CWx4V3n9ZVgV80n/DPvcPFJTNtJ4LP/B0gKpVT6li8hYMKhPS7d3pL9phZupvPv3MQg1yxrCQbS4nF8mip5Ys/PHVZFNmSCVWEdV8dKmifdXoiGKgjwW8ZQjplVPixt07RAlYU/WQHzJElB300ybQmK92DAHOU6UbaEl0NP9qxqu8zQo/zwJ7hZpgbA7/YCYQ==;5:v5sFN2GsNWx14u4EA3fK5NsU0j36D86OlVK27R/jJAeKWvTVoKhCpUId1FeOXMTdx5iM8zNht/xmU7x4N+Rd5Z73IkZLqVckIi3SShpdk++dG2MV9jnzTdOVtbS+j/exgHJhePE03M53v9Gi+f+8jFQampVKZMP4J22akoBTExI=;7:T02ohJzhscejZNN95iGQ6g0rRLw8RTLGAUWfVUJ6+8zdbypeXj1cVYDyRa2xPa1JQQcBtSaxE2Swrutm/+nC3fPEH9fQ5lVRjvaFD3hmmWNmootS9rboKU7pzmQMPBZmHlbi66klJKGd5MOfB14vdA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2018 11:13:44.6371 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e84573f-a05c-448a-3d20-08d6577e0f7f 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: DM6PR02MB4460 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 Availability of TRB's is calculated using dwc3_calc_trbs_left(), which determines total available TRB's based on the HWO bit set in a TRB. In the present code, __dwc3_prepare_one_trb() is called with a TRB which needs to be prepared for transfer. This __dwc3_prepare_one_trb() calls dwc3_calc_trbs_left() to determine total available TRBs and set IOC bit if the total available TRBs are zero. Since the present working TRB (which is passed as an argument to __dwc3_prepare_one_trb() ) doesn't yet have the HWO bit set before calling dwc3_calc_trbs_left(), there are chances that dwc3_calc_trbs_left() wrongly calculates this present working TRB as free(since the HWO bit is not yet set) and returns the total available TRBs as greater than zero (including the present working TRB). This could be a problem. This patch corrects the above mentioned problem in __dwc3_prepare_one_trb() by increementing the dep->trb_enqueue at the last (after preparing the TRB) instead of increementing at the start and setting the IOC bit only if the total available TRBs returned by dwc3_calc_trbs_left() is 1 . Since we are increementing the dep->trb_enqueue at the last, the present working TRB is also considered as available by dwc3_calc_trbs_left() and non zero value is returned . So, according to the modified logic, when the total available TRBs is equal to 1 that means the total available TRBs in the pool are 0. 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. Corrected the commit message as suggested by "Thinh Nguyen" Changes in v3: 1. Corrected the logic for setting HWO bit as suggested by "Thinh Nguyen" Changes in v2: 1. Changed the commit message --- drivers/usb/dwc3/gadget.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index d0de7dc..9ddc9fd 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -920,8 +920,6 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb, struct usb_gadget *gadget = &dwc->gadget; enum usb_device_speed speed = gadget->speed; - dwc3_ep_inc_enq(dep); - trb->size = DWC3_TRB_SIZE_LENGTH(length); trb->bpl = lower_32_bits(dma); trb->bph = upper_32_bits(dma); @@ -1000,7 +998,7 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb, } if ((!no_interrupt && !chain) || - (dwc3_calc_trbs_left(dep) == 0)) + (dwc3_calc_trbs_left(dep) == 1)) trb->ctrl |= DWC3_TRB_CTRL_IOC; if (chain) @@ -1020,6 +1018,8 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb, trb->ctrl |= DWC3_TRB_CTRL_HWO; + dwc3_ep_inc_enq(dep); + trace_dwc3_prepare_trb(dep, trb); } 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+xfdTZaeMmS3TQKVMn3BlisakXv5gYncNyhmksX/vAM9UcktfcK25X/6VA04UQyFtvDDba192p4jkN5iUAZxMrL1Y+R3vx/FY9aYCY=;25:UAAbXcKcdkHODBjIZ/aGM7E3dVzzVz09ZhEaesiIm0vk1iVA5SKmipVDHOCq1PYW8alNihckS/503LM10xeoXXX0Fg3dc33/uMO1riE0a8TwmQjZ0xS33lgMMg9TLEvm5I61u8ZoH8g5QTJKNIV682gmySg/fylOcyXQ1m7EFaIj7WrJWjukHAussgE4+L9rLcWR65H2dp3YLLMNHmhIOJR8OhbHWTJUcwyUd8jFlJzHhtYQeQunlMiQiyL2QB8a8S4DuA65gUITyCoKUZSDHzTOiMYmvWIZhOiCZ+fbGFbWtauPBxNGJ3nuqOqkswspje8giulwbU1c3xIbUf2Dzg== X-MS-TrafficTypeDiagnostic: CY4PR0201MB3508: X-Microsoft-Exchange-Diagnostics: 1;CY4PR0201MB3508;31:nFevXvRlQzyTjyolCWlb3eV2rKpkwZTA/Uf3jmIMcuWvCiWBb8jOM/8Oh1hmT3N3tL62IX63eLDblyG/UznYFJgQC5H3HxVFYYWyuywEJlyQTwiNkhA6Nn/ohYLhgSrw3V8LC+cNy7sPrvP1ZTaie3kBEbJQVLzB02Z5jF7a6687+8gB5in1xG2GNvRu+zimbJT2WiaS0UH8EqiX00zziqkpel0FUEKag5BqbgLVaiM=;20:iNBkPH9cyD9B0r2b4s3l0lC3m2TLqNpd1Lr2fiKGTPpEoEUeg80buap3PS+tWJtJT4ZJKlOtEweaHMuyzeM4uVhNzDdtdfgjjtYpdMe4WvkgS+Q210tO96+J/maBy3Z2CJ0slUyHelUILsgNv3/PeuZrVacU7w6xJtLfK5MhRSnaE050nNC825U7cha0mnVdrTY39gKR7q5TE8QA5+lD9Q3VCF8ZJ7We7r7A3TB3ErBKrgfEAZf6vYzdd0hQdmfsRMcAz3D3kxFqx3Npk7QjceDxD81KIRD3cqdz2RXW+BCkwSw64CkHdCcayt8i+ul7/q9bJg3PMQzyE8ag1l6GeybkSG0c47HMcAmuo22AMROhZylYuvClOL0AiqKq+/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+c2Y0gDD9vueaYrCPk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/fn41oFAGmKmlj8ZsGBoiVmoos1H2Q4wEaL/XQ1A07aN735xq8ivLPqver/KY6AWqZtgzz10weQfPddm+gq0FkCSIP/aL39CqJwobDs8ZRz3d2R5hwmSThri8ISvbcjzntgQQXpLjkrzrKuKLBQcOvyyjf5pxG7xYm4IthV9gzSSK41CFputPS9evEmmh20R2ZiNO6AzXj9SRjCJ7byB0I/w/zZxGG4mS1KGN51f8y8BhAUkr3k03zV/m02aPSY30mvAJ4w190pnkrdKMDa1HVAfjxVKqhTF1jVYVr6HvenmGZJdxnRUsVm1KHZZKHrPeHew==;5:GPZ5gCI+YVK2isFFFJbXWipBSJ+id6Nq8sdY56BwiyDR6u2sVVHb43UoTrd10HlPEfoT22SQR8dZMPfS+ywHQVK1XxbUFZD7CepEcAdPUdPSNGSt0GaB9qgjVCUECzR77u97lHHJmH1zX3r297l+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; From patchwork Sat Dec 1 11:13:31 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: 10707611 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 9D17613BF for ; Sat, 1 Dec 2018 11:13:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C27A2E552 for ; Sat, 1 Dec 2018 11:13:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F8672E63D; Sat, 1 Dec 2018 11:13:59 +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 9A01B2E62D for ; Sat, 1 Dec 2018 11:13:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726948AbeLAW0L (ORCPT ); Sat, 1 Dec 2018 17:26:11 -0500 Received: from mail-eopbgr770045.outbound.protection.outlook.com ([40.107.77.45]:19088 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726736AbeLAW0K (ORCPT ); Sat, 1 Dec 2018 17:26:10 -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=Rp77tRHbshE6gM70tc1rZJIZpkgzi9aInGfLWErF23A=; b=PI2GcbS4jmKyNBeH/kJw5oOt5TlApB/jN4PwN4ltukur4ToXo9E2urMX7LKraYXMlURbHo8P/BpmS5RNkf3NSZAEW8YUlW4v3xzq7WxkI1KGxphxmN/PBIxAZFlEI/+motCNZfpp0FsDAkgbnhO0qfU3BXui4T7bJCPI+qxS8FI= Received: from CY4PR02CA0005.namprd02.prod.outlook.com (2603:10b6:903:18::15) by DM6PR02MB4331.namprd02.prod.outlook.com (2603:10b6:5:2a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.21; Sat, 1 Dec 2018 11:13:45 +0000 Received: from BL2NAM02FT029.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::206) by CY4PR02CA0005.outlook.office365.com (2603:10b6:903:18::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_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.100) 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.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by BL2NAM02FT029.mail.protection.outlook.com (10.152.77.100) 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]:46504 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1gT3DU-0005oH-E8; 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-Ah; Sat, 01 Dec 2018 03:13:39 -0800 Received: from xsj-pvapsmtp01 (mailman.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id wB1BDZU5003409; Sat, 1 Dec 2018 03:13:36 -0800 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gT3DL-0001kG-IV; Sat, 01 Dec 2018 03:13:35 -0800 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id C0B8660504; 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 10/10] usb: dwc3: Check MISSED ISOC bit only for ISOC endpoints Date: Sat, 1 Dec 2018 16:43:31 +0530 Message-ID: <1543662811-5194-11-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.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(979002)(376002)(136003)(346002)(39860400002)(396003)(2980300002)(199004)(189003)(26005)(336012)(81166006)(186003)(81156014)(14444005)(36386004)(51416003)(76176011)(16586007)(110136005)(42186006)(316002)(356004)(106002)(54906003)(7416002)(478600001)(50466002)(39060400002)(4326008)(2171002)(6266002)(6666004)(48376002)(107886003)(36756003)(50226002)(106466001)(486006)(8936002)(426003)(11346002)(5660300001)(126002)(2616005)(476003)(63266004)(446003)(2906002)(52956003)(103686004)(90966002)(217873002)(47776003)(305945005)(8676002)(107986001)(921003)(2101003)(83996005)(1121003)(5001870100001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR02MB4331;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BL2NAM02FT029;1:Db++AxeXhQcH0cupZqho2HhaYAjR5/d0aghGK4BYxJhQFIHmLSmf0X+0jiE1PO7cLXUpfLI6mIHCP5yx/cW1a0raVzMoSenTdreQOdDXlkXri0RP967MhUfDL6N/fxcJ MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c4b00f2e-f29f-42c0-a6f3-08d6577e0f32 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4608076)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060);SRVR:DM6PR02MB4331; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4331;3:yazhDoI9qJsaGwnQmnYSljAknEfE2hihJ0EVaSEtOfyUDoAr/gMBRHYJyM74CPHbah72HXfUMu2dznwktbg15O/jzN5skkKpPvJ8+LQg+NyMjdaLdYl9YK2yS44rXW1YLGzBnGv+AX0Wp0kYPVoaazpd34+wPrFwTllM2C+34CLca6BBL3Y3SjWUZLLAfCCYsFpdXSCpTiYwh/b7Y4xILw+amw0LN8w8PPUvaWlNlrGF9uylwuwrBN1EpnwQ2byAs/9aNc39Uliiub1UW8C0EFOgeXQD8QutXkInfziF7FS/Bh53Qd7eVYu00OYKR57N+GbdZCIocVYmqTDU13U7RVbvJAdRyoW3GXwmW1qs/Pg=;25:wQvPxBkuWcbWm6AgpU+dH7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yD7z6/wUmQr28WB3zvdwT4naOIfZ7w81f8yXru6YP4j5zvub0Hvj4fik8RfOpP 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)(5005006)(8121501046)(3231454)(999002)(944501410)(52105112)(93006095)(93004095)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:DM6PR02MB4331;BCL:0;PCL:0;RULEID:;SRVR:DM6PR02MB4331; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4331;4:+ypRKYPPScr9Gvl5aIBIWKIYkMee5nHikqiFP1q5Uy21gFHN+Yo6KLnjEYDHl8sbEkr0o8fHCM+wi1IkuNEvJE7LPeRLVeRFNXffU728cJV2IyDyF3hFB7v3incMy6iKPX2HRrsfjoHMiuMNprfxBk9hIFwfTHrTUpjQYU9Lx1lETKO+4fyB8p6ZG/epvjEfsC+FLs66Jme+Vf+ZHvv/bdBLuvDG8wttdlP0g5YiWOL00aIoi4PbmqN10Yk8+sEC+3ZGEPsDV5kddp7dflYsjA== X-Forefront-PRVS: 087396016C X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4331;23:WyYcb1DX8xynkqGdyM7wcK1Rtw55LZiObnhMcC3AjBRd5KiD0NPxrWvGZXbxB7Mktw29GUA9CzueEP8JZ3dPGuf6nH/POmdhsIZSKgH3MibU/i3ynRg/ENoD39yOYPm+4+OBv2ztw3gyeB/+M1D6BIGQdggQFNkY0+Gm3XuObyutVHW76Vf6GVRUUKLUsQi1ZLjZoxLuZw5olI17RN2VubmGfip2EzN2yh9Kh5KvRJtmapwUipSMpp7c6+TxhCyiTgT2gStJAJs8EzG32ork4jqKbtzAJko6z9Y/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W+A8e8pEoWcEV3J8waN3ZyXgm3y2l2H1gO77lP/xH3/Ek3ZXntjQhKURXCCaFLnQ4Q=;7:Df1OSdnx4a8uFPwvXRtmj8ExuIMqndhG25ZBOB0GZTlC3yscpk8CQahP7wpyhI23QbjO4ACAyhM642bdNDFYYmFgO5oLdenfXxTp9Gn1JOo7KcPylI+aO76jLDIcN+YZvPI1ml8NZEzHPXtZN4mj4w== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2018 11:13:45.0258 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c4b00f2e-f29f-42c0-a6f3-08d6577e0f32 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.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB4331 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 When streaming is enabled on BULK endpoints and LST bit is set observed MISSED ISOC bit set in event->status for BULK ep. Since this bit is only valid for isocronous endpoints, changed the code to check for isocrnous endpoints when MISSED ISOC bit is set. 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 216179e..5d5c572 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2409,7 +2409,8 @@ static void dwc3_gadget_endpoint_transfer_in_progress(struct dwc3_ep *dep, if (event->status & DEPEVT_STATUS_BUSERR) status = -ECONNRESET; - if (event->status & DEPEVT_STATUS_MISSED_ISOC) { + if ((event->status & DEPEVT_STATUS_MISSED_ISOC) && + usb_endpoint_xfer_isoc(dep->endpoint.desc)) { status = -EXDEV; if (list_empty(&dep->started_list))