From patchwork Sat Oct 13 13:14:48 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: 10640145 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 C1C24933 for ; Sat, 13 Oct 2018 13:16:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD9812AF4D for ; Sat, 13 Oct 2018 13:16:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E2432AF52; Sat, 13 Oct 2018 13:16:18 +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 B94E22AF4D for ; Sat, 13 Oct 2018 13:16:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726990AbeJMUxR (ORCPT ); Sat, 13 Oct 2018 16:53:17 -0400 Received: from mail-eopbgr680048.outbound.protection.outlook.com ([40.107.68.48]:5096 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726292AbeJMUwg (ORCPT ); Sat, 13 Oct 2018 16:52:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X8gXjybF9RNvKBv2HMFTL/dscQJuoX30GOc5BO55GWo=; b=ImJwcrbsDPv2LDCmGU6Y/iDDc8dN/EMqTBQIzzdB1JmvQ2KoGbkwGBbqT71QIFlag7+vVNUhZTOSvdRlTilgYHxDGb08taR1P8WDDcnif0Sher90zE0A30Tuz8enX0/ZpBk3jONehv/dRm+hFt930OcmJmUBfMHgxLEIXTvDTEU= Received: from BYAPR02CA0014.namprd02.prod.outlook.com (2603:10b6:a02:ee::27) by DM6PR02MB4457.namprd02.prod.outlook.com (2603:10b6:5:29::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Sat, 13 Oct 2018 13:15:22 +0000 Received: from SN1NAM02FT015.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::203) by BYAPR02CA0014.outlook.office365.com (2603:10b6:a02:ee::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1228.24 via Frontend Transport; Sat, 13 Oct 2018 13:15:21 +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 SN1NAM02FT015.mail.protection.outlook.com (10.152.72.109) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1250.11 via Frontend Transport; Sat, 13 Oct 2018 13:15:20 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJlH-00068g-Bt; Sat, 13 Oct 2018 06:15:19 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gBJlC-0007wb-7S; Sat, 13 Oct 2018 06:15:14 -0700 Received: from xsj-pvapsmtp01 (smtp3.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w9DDF4om026380; Sat, 13 Oct 2018 06:15:05 -0700 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJl2-0007np-7E; Sat, 13 Oct 2018 06:15:04 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id A3413604A3; Sat, 13 Oct 2018 18:45:02 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH V6 01/10] usb: gadget: udc: Add timer for stream capable endpoints Date: Sat, 13 Oct 2018 18:44:48 +0530 Message-ID: <1539436498-24892-2-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(346002)(376002)(396003)(39860400002)(2980300002)(438002)(199004)(189003)(76176011)(48376002)(51416003)(81166006)(14444005)(356004)(106002)(5660300001)(36756003)(54906003)(42186006)(81156014)(486006)(36386004)(107886003)(426003)(90966002)(2616005)(39060400002)(110136005)(2906002)(16586007)(316002)(11346002)(446003)(7416002)(6666004)(8676002)(551934003)(476003)(126002)(2171002)(6266002)(52956003)(50226002)(4326008)(63266004)(336012)(186003)(106466001)(305945005)(8936002)(50466002)(47776003)(478600001)(103686004)(26005)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR02MB4457;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;SN1NAM02FT015;1:i7ah8hMV0WwQBtuTolNJUxggNtgZd4M59kgS8KKtHBYVEipTl+s9dR7m07rkjbhfY3ijpkO0RlyKrr/uSJGg/Mz0LY1tjFRVkus7WqmYkagzt9T7sTG7da18N4RN7tIN MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8222ea8-ae99-47e6-70fa-08d6310dedba X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM6PR02MB4457; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4457;3:JnZAAFzkaUC+aBnj+Rm25O7F4GYkOu6prW1GNgff/5QMkfytI7SUACdMXuXvP3mL1T7dqmC3TbAF2kOUg8BMtGv+SNE3CfjN3UJXDboJoTmtIeYH8htQ+gq0Sw7/ZjkIJzEgM0VMnd5sMUI0/b4cHXalVPz4FME3woOPNE9VWsqy13vNXAAwQLNHh4RFpzLOjxqTGvN4t9aBZWFBWnOToQpxXuEHykpKZPjUiRcjE1c1Uq1u0omoLlQHriSvylQSfmH33xrYk+2rltSNlkkcqDhfY7N7K0nAnfLczgU8MDiXspXYdDsv3RAT9YBQNHcH+EOQgzumu43UjiFwepO3N9oQlxbcG/GAocws84GtokI=;25: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cZ8rAPbDC6ZibvpEaLqW8nmm+JzfBgVu70TCRN/uEoU31OwXlcr2huVumzXmBVJdJPWTdpSv+QCMoLRxcTgl+ZpQs1UzI X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93004095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699051);SRVR:DM6PR02MB4457;BCL:0;PCL:0;RULEID:;SRVR:DM6PR02MB4457; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4457;4:8by50OofMJWDwUJVWiK5ICHVtHBMzpXqBHqQuv6RFuJWMo7tdDl2xcQkmduNw++hGioM5vmxo0korxUhN8ZwIWOghcp5oquciBZXKCRWVqMXATejFRbo8bZSBXtRuZpmIqnCYJo0HpzNkQBNvNAAQ0G8Efc+OnpTheUNqb88IyF/YB/8CKQqtEP9XgKoAE2L81MhPfgqnjeFR+RrDju8Bl9xZk3zvD97hegyNVwuDAKW4wsehwvhjS8HEEweizCCNX5VEXFApHILXz34TpaU+rGmw5hM9w8v1yAzrHuJovlO+pZSnY1AxxxwiCSrF5c4 X-Forefront-PRVS: 082465FB26 X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4457;23:5knaq0NKJuLy7JUy+DXGTEEz7roq2p30XIL5fn+n6Ow5328zUJ+cmOvxQspJyuDuDaeK1HO0SHABjh3xoLr6suW5AgWhIt0ppJQF9cVc1xc1q0DqjNaZzr/Rx/pt2FSArh8EGWdtSgWDKa4gJjxvIU74jIejA/QsyKiFc5E8n+sOhBn/qaILNYyW2K0ESBly0FzvKADwjH9ECmEP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zWpI0ULS1lg1vYybDseDzqFsqeiVjdFUALzOP3JMdsWu4tcbOMcd0tqmu4uL832nbWkJ6pKMlIXzycKIHxlIu2WWupTCM4cSWr8iUR0gJ8BrletmymvkK/UFtTs+n9FUGow7gsiFUI6AFpj540/ybJyXBX42kVDgAer6m3c6Qw28yXTYzFha+8MffcbEyw41zDx+g29XSo2/9a8WqI1PNcF0Hfc+5woO SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2018 13:15:20.0695 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8222ea8-ae99-47e6-70fa-08d6310dedba X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB4457 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 stream capable endpoint in usb_ep_queue(). The gadget driver is expected to stop the timer 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 gadget driver to endpoint ops->stream_timeout API would be called, so that the gadget driver can handle this situation. This kind of behaviour is observed in dwc3 controller and expected to be generic issue with other controllers supporting bulk streams also. Signed-off-by: Anurag Kumar Vulisha --- 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 | 71 ++++++++++++++++++++++++++++++++++++++++++- include/linux/usb/gadget.h | 12 ++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index af88b48..41cc23b 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -52,6 +52,24 @@ static int udc_bind_to_driver(struct usb_udc *udc, /* ------------------------------------------------------------------------- */ /** + * usb_ep_stream_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 ep->stream_timeout_timer has expired. The timer gets expired + * only when the gadget controller failed to find a valid stream event for this + * endpoint. On timer expiry, this function calls the endpoint-specific timeout + * handler registered to endpoint ops->stream_timeout API. + */ +static void usb_ep_stream_timeout(struct timer_list *arg) +{ + struct usb_ep *ep = from_timer(ep, arg, stream_timeout_timer); + + if (ep->stream_capable && ep->ops->stream_timeout) + ep->ops->stream_timeout(ep); +} + +/** * 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 @@ -87,6 +105,18 @@ EXPORT_SYMBOL_GPL(usb_ep_set_maxpacket_limit); * configurable, with more generic names like "ep-a". (remember that for * USB, "in" means "towards the USB master".) * + * When bulk streams are enabled (stream_capable == true), a timer is setup + * by this function, which would be started at the time of queuing the request + * in usb_ep_queue(). This is because, when streams are enabled the host and + * gadget can go out sync, the gadget may wait until the host issues a prime + * transaction and the host may wait until gadget issues a ERDY. This behaviour + * may create a deadlock. To avoid such a deadlock, the timer is started after + * submitting the request in usb_ep_queue(). If a valid stream event is + * generated, the gadget driver stops the timer. If no valid stream event is + * found, the timer gets expired and usb_ep_stream_timeout() function which is + * registered as a callback to stream_timeout_timer is called. This callback + * function handles the deadlock. + * * This routine must be called in process context. * * returns zero, or a negative error code. @@ -102,6 +132,10 @@ int usb_ep_enable(struct usb_ep *ep) if (ret) goto out; + if (ep->stream_capable) + timer_setup(&ep->stream_timeout_timer, + usb_ep_stream_timeout, 0); + ep->enabled = true; out: @@ -121,6 +155,9 @@ EXPORT_SYMBOL_GPL(usb_ep_enable); * gadget drivers must call usb_ep_enable() again before queueing * requests to the endpoint. * + * For stream capable endpoints, the timer which was started in usb_ep_enable() + * would be removed. + * * This routine must be called in process context. * * returns zero, or a negative error code. @@ -132,6 +169,9 @@ int usb_ep_disable(struct usb_ep *ep) if (!ep->enabled) goto out; + if (ep->stream_capable && timer_pending(&ep->stream_timeout_timer)) + del_timer(&ep->stream_timeout_timer); + ret = ep->ops->disable(ep); if (ret) goto out; @@ -245,6 +285,18 @@ EXPORT_SYMBOL_GPL(usb_ep_free_request); * Note that @req's ->complete() callback must never be called from * within usb_ep_queue() as that can create deadlock situations. * + * For stream capable endpoints (stream_capable == true), a timer which was + * setup by usb_ep_enable() is started in this function to avoid deadlock. + * 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. To avoid + * such a deadlock, when endpoint is bulk stream capable, the timer is started + * after submitting the request. If a valid stream event is generated by the + * gadget controller, the gadget driver stops the timer. If no valid stream + * event is found, the timer keeps running until expired after STREAM_TIMEOUT_MS + * value and the stream timeout function - usb_ep_stream_timeout() gets + * called, which takes necessary action to avoid the deadlock condition. + * * This routine may be called in interrupt context. * * Returns zero, or a negative error code. Endpoints that are not enabled @@ -269,6 +321,13 @@ int usb_ep_queue(struct usb_ep *ep, ret = ep->ops->queue(ep, req, gfp_flags); + if (ep->stream_capable) { + ep->stream_timeout_timer.expires = jiffies + + msecs_to_jiffies(STREAM_TIMEOUT_MS); + mod_timer(&ep->stream_timeout_timer, + ep->stream_timeout_timer.expires); + } + out: trace_usb_ep_queue(ep, req, ret); @@ -291,6 +350,9 @@ EXPORT_SYMBOL_GPL(usb_ep_queue); * restrictions prevent drivers from supporting configuration changes, * even to configuration zero (a "chapter 9" requirement). * + * For stream capable endpoints, the timer which was started in usb_ep_queue() + * 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 +362,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 (ep->stream_capable && timer_pending(&ep->stream_timeout_timer)) + del_timer(&ep->stream_timeout_timer); + return ret; } EXPORT_SYMBOL_GPL(usb_ep_dequeue); @@ -878,7 +943,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. For stream capable endpoints, + * the timer which was started in usb_ep_queue() would be removed. */ void usb_gadget_giveback_request(struct usb_ep *ep, struct usb_request *req) @@ -886,6 +952,9 @@ void usb_gadget_giveback_request(struct usb_ep *ep, if (likely(req->status == 0)) usb_led_activity(USB_LED_EVENT_GADGET); + if (ep->stream_capable && timer_pending(&ep->stream_timeout_timer)) + del_timer(&ep->stream_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..2ebaef0 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -144,6 +144,7 @@ struct usb_ep_ops { int (*fifo_status) (struct usb_ep *ep); void (*fifo_flush) (struct usb_ep *ep); + void (*stream_timeout) (struct usb_ep *ep); }; /** @@ -184,6 +185,11 @@ struct usb_ep_caps { .dir_out = !!(_dir & USB_EP_CAPS_DIR_OUT), \ } +/* + * Timeout value in msecs used by stream_timeout_timer when streams are enabled + */ +#define STREAM_TIMEOUT_MS 50 + /** * struct usb_ep - device side representation of USB endpoint * @name:identifier for the endpoint, such as "ep-a" or "ep9in-bulk" @@ -191,6 +197,7 @@ struct usb_ep_caps { * @ep_list:the gadget's ep_list holds all of its endpoints * @caps:The structure describing types and directions supported by endoint. * @enabled: The current endpoint enabled/disabled state. + * @stream_capable: Set to true when ep supports bulk streams. * @claimed: True if this endpoint is claimed by a function. * @maxpacket:The maximum packet size used on this endpoint. The initial * value can sometimes be reduced (hardware allowing), according to @@ -209,6 +216,9 @@ struct usb_ep_caps { * enabled and remains valid until the endpoint is disabled. * @comp_desc: In case of SuperSpeed support, this is the endpoint companion * descriptor that is used to configure the endpoint + * @stream_timeout_timer: timeout timer used by bulk streams to avoid deadlock + * where host waits for the gadget to issue ERDY and gadget waits for host + * to issue prime transaction. * * the bus controller driver lists all the general purpose endpoints in * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, @@ -224,12 +234,14 @@ struct usb_ep { struct usb_ep_caps caps; bool claimed; bool enabled; + bool stream_capable; unsigned maxpacket:16; unsigned maxpacket_limit:16; unsigned max_streams:16; unsigned mult:2; unsigned maxburst:5; u8 address; + struct timer_list stream_timeout_timer; const struct usb_endpoint_descriptor *desc; const struct usb_ss_ep_comp_descriptor *comp_desc; }; From patchwork Sat Oct 13 13:14:49 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: 10640141 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 41CDF933 for ; Sat, 13 Oct 2018 13:15:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D2ED2AF4D for ; Sat, 13 Oct 2018 13:15:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E50C2AF52; Sat, 13 Oct 2018 13:15: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 96C302AF4D for ; Sat, 13 Oct 2018 13:15:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726911AbeJMUwm (ORCPT ); Sat, 13 Oct 2018 16:52:42 -0400 Received: from mail-eopbgr690048.outbound.protection.outlook.com ([40.107.69.48]:6146 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726399AbeJMUwj (ORCPT ); Sat, 13 Oct 2018 16:52:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MHrVLkNN0xdPfRpHRQ+2pGAHilJKSlasnaYCxqr8070=; b=WlHHN3OU1ft6TDEHHQQ2BuzNSFz5lrTFBRjuMKhJk/E+8cBMXQaqsSfqTq2hFCtI6NHDk+FInmHuhR1Zh1hL4SfiCEmPknPSmS+2cisKHJwulDaBHA2LUtotAhFsa+LbbyaGwI57aOCsW565OHuhSH83aCDGe1piViiwWv27wek= Received: from BN7PR02CA0028.namprd02.prod.outlook.com (2603:10b6:408:20::41) 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.1228.21; Sat, 13 Oct 2018 13:15:27 +0000 Received: from CY1NAM02FT027.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::204) by BN7PR02CA0028.outlook.office365.com (2603:10b6:408:20::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1228.23 via Frontend Transport; Sat, 13 Oct 2018 13:15:26 +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 CY1NAM02FT027.mail.protection.outlook.com (10.152.75.159) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1250.11 via Frontend Transport; Sat, 13 Oct 2018 13:15:20 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:58073 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1gBJlH-0001Gh-Lg; Sat, 13 Oct 2018 06:15:19 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gBJlC-0007wb-Eo; Sat, 13 Oct 2018 06:15:14 -0700 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 w9DDF5bs019356; Sat, 13 Oct 2018 06:15:05 -0700 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJl2-0007oM-QO; Sat, 13 Oct 2018 06:15:05 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id CC47960503; Sat, 13 Oct 2018 18:45:03 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH V6 02/10] usb: dwc3: gadget: Add stream timeout handler for avoiding deadlock Date: Sat, 13 Oct 2018 18:44:49 +0530 Message-ID: <1539436498-24892-3-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(376002)(136003)(39860400002)(346002)(2980300002)(438002)(189003)(199004)(50226002)(76176011)(26005)(186003)(305945005)(6346003)(106002)(16586007)(54906003)(110136005)(81166006)(81156014)(8936002)(51416003)(8676002)(478600001)(107886003)(103686004)(4326008)(42186006)(50466002)(39060400002)(316002)(48376002)(2906002)(336012)(7416002)(47776003)(2616005)(446003)(476003)(11346002)(126002)(486006)(426003)(6666004)(356004)(63266004)(2171002)(6266002)(106466001)(36386004)(90966002)(52956003)(5660300001)(14444005)(36756003)(107986001)(5001870100001);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;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CY1NAM02FT027;1:yMa9+HZQ7gIbeVYXpOkoohNk4cE4QvLNnjYQHsV6/D+YowuoLBe73XzrHGMv4yGaDNc8a5ixkeliHB+5TMuLboPliFcpLqfoTMHMQLzAYSaJzDPFmu0hD0tLPe/WD+ri MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b15cb990-65d2-417b-7f03-08d6310deff4 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM5PR0201MB3510; X-Microsoft-Exchange-Diagnostics: 1;DM5PR0201MB3510;3:QBY0kpSulyhMctRUT5v86Uw3Chli+sFO1PQ4VK6UMCb9ALthP9bslIzvqhUkXOuf7E729Q4D3AeROk+fAxMjr0Koxos3SmnSoPwJk2Vqib7bR+ozgGLp9q7aoVwZ3UKMa6Pa+AhGCYYEnDwOk3R6fWNdBBSF4sfWWM/6XIHYsrBFdNBF3X+02X6iOLeRtWclfS2MLRWcEzylDTlY5AmrhRIoHdWL/Vz35cfd3nzBE5janlq67yFlDOsoUyIoTAvwG/l+Fc3dgmKujIS4aS+IiPtHe7v2RmXyFPmlIVRQM2pjpcS1sN/juVZljAF3M+rXsq5vCHYFX5hh3j7CcpYsBdr+uWb8tNmfSAXkN+70TgM=;25:HJVhs6SCP5XjZqxTQndY99sLPA98cFUhXSGQCCeNO1qdivqD4jODjcc0fAMuod7061Ncte8UvEy09jPQJoVHhaOc2SU4Wz4VeQh30z8mf5fe0cWK/+zj9ZdcLtlS9SI4/DKvZAkx+QgqiQZ+XPwlNvwGyMwyEk8DYfdc2x/OcLQ+MtVOJLTWmGPteUjBgx3WRdsRuZOWqretUB/nbFOtMy45qdumGhqSPrQCE8035lN9LDH2ycdo3J+ccOZyVuI8/rp9so8S0NFCUu3nxSba9GulYT17f/1fXnWiWlPm9ZQOwvxFND8MHSWD92F1X0x4R2TKW50slCmiPqdWGY3clQ== X-MS-TrafficTypeDiagnostic: DM5PR0201MB3510: X-Microsoft-Exchange-Diagnostics: 1;DM5PR0201MB3510;31:UaqzEro/Jypv1ihz4zpbfuhw3Nwxxeca2gGKk6FsPCq3Ky+5arRkScpE8dNkVEkm0POCZCBBXOkcwKWRdzzTwa+jq9uYLMujnH+Kcb9HM2WKb14P5b5oUPLRmPylJdINvcPNNeKVz0q2TWJ2Q+xnxa43zBzmoFj8gvxG4/USaivUnP5xQSTe8/UpQ2CzzrG1ttF5OVr7L8z+sBHtuhtV8edEPkzNTfXNL9EppjNI9Z0=;20:T5uJ4V81mggbdHLxz8nN+5SRtIm11IHcttF56HAktraS2BXYTiMoGkEz5OBRLrkKA0yp4OOQ+NeosZfPQ0gSy43ABgnQYuCR5VKnShCswshMwAc0+jBCi+CEalaC2O2m+pH3IaUsvgdvpYEOnoBaCfHLhZMccDYKTKMHtFyr8PnksNzIt/wxROfWUPCtis06OC1sS1VBwqe1t/CODhljJ9r1Z1gVE67ZAIIbUJXwNbhpvwrw0J842/CblS7uBeshideZzneMWzhm2KUn2Qo8XItxoeKyxBGsURKLb5msw4WQueRBuaZP3Pvd27sg/C4NT/LBmLwR2MvA6gqHxeFcqR5nVp++bL4rwi1qvaWR4EyAGgLbyO0bpdIsHU/7UmOQP0Q3B4p4D0/S9ZQkTWBZEinDERoXYUQEL0jVMcOA6Qr+7UQFcA5HRE3JevGWU42Zh99nCQ+utO4IM1x8snMHL2IAndijvM/PwPLfDQulwxVMFyEtBd9d+iTliW7ZdxuD X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93004095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(201708071742011)(7699051)(76991067);SRVR:DM5PR0201MB3510;BCL:0;PCL:0;RULEID:;SRVR:DM5PR0201MB3510; X-Microsoft-Exchange-Diagnostics: 1;DM5PR0201MB3510;4:OgYfVw7WRsobZ3GnBd0krkiCYD85H8qRewrfkPC8mEIeqJULUlSXr4mvx4X/K5/BqYMoq0rpe7mZyzZL+J7QcpaozQ7HO/ah/9KPsOzfKYfMkb16tbQ8MgkwBnY8Drzf8M/PVw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iSvrZ19B78O5XQsYji+o07kCHKmDYbaSB1g2qV/8/OkMlvOeVQ9iS6kvoeI9avQuHW0PHHri+jian6xK3Tw+ULgGQ5tIDAacng03wEoo2m56dqwxgNjKKZFXHyF9GMx6GX5NC4Qj+esx9w/D+xESD2OsUdhq2xiWko75YisrEu1VO0OlYITIPAeVx6UJgC+yX95PPTT2YINm2ywaACnogqKsEy42aMYkDa7bkFXG50cycDhstMmfLiaVTcvs8BU/Vi5ewMeLPw/e7THswYPcG1CQ==;5:kPEg64e8qlf/j/nV7gJ1qa4dfD/S4qdv4lHiootOd2DozkHLCH1EFA/8R1FWq4dPLgyftgprwmiJLwKi5PxbekaB+ooDGgZeJiksKiLR6rlWAvFEIUyESJ8sqVzYzZk4PAHKkuhCa0hGlhY2QorMGnHigEbiLcHhEQcbvbggkSs=;7:iDXUE4gOndd49ZFqBcIc2ma9Q9+h2Qu9rbXHdc4Nzwxd3yhQIwwjSr3hJcgy/i/KTxxW0uHJVQ4+KDIfaWNgT7WUFHiG9SbGrqvaTynJ2w2qpAb3L2XZNynqtQ9+qXhgRCRXEl7bVyg2K+MKNidorh+QYsNovYNAWqyH2Z66JBCwEBNubJH4L23VLpAVUmCFL3VV6jB578xtnDnvNB0Wu5XR620knGp64GSXV0/Mi4q9XnkNhzOTGO6XMZN0QYpt SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2018 13:15:20.5241 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b15cb990-65d2-417b-7f03-08d6310deff4 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 According to dwc3 databook when streams are enabled, it may be possible for the host and gadget to become out of sync, where gadget may wait for host to issue prime transcation and host may wait for gadget to issue ERDY. To avoid such potential deadlock conditions, a timer is implemented in udc/core.c and which is started after queuing a valid request in usb_ep_queue(). This timer would be stopped by the gadget driver when a valid stream event is found, otherwise the timer gets expired after STREAM_TIMEOUT_MS value and stream_timeout_function() which is registered as a callback function to usb_ep->ops->stream_timeout is called by udc core. As a part of recovery mechanism, the stream_timeout_function() stops the active transfer on the endpoint and starts the transfer again on the endpoint. Doing so, will reset the stream into ready state and ERDY is sent to the host, thus the deadlock is avoided. Signed-off-by: Anurag Kumar Vulisha --- Changes in v6: 1. This patch is newly added in this series --- drivers/usb/dwc3/gadget.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 032ea7d..aab2970 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -573,6 +573,7 @@ static int dwc3_gadget_set_ep_config(struct dwc3_ep *dep, unsigned int action) params.param1 |= DWC3_DEPCFG_STREAM_CAPABLE | DWC3_DEPCFG_STREAM_EVENT_EN; dep->stream_capable = true; + dep->endpoint.stream_capable = true; } if (!usb_endpoint_xfer_control(desc)) @@ -1535,6 +1536,18 @@ static int dwc3_gadget_ep_set_wedge(struct usb_ep *ep) return ret; } +static void stream_timeout_function(struct usb_ep *ep) +{ + struct dwc3_ep *dep = to_dwc3_ep(ep); + struct dwc3 *dwc = dep->dwc; + unsigned long flags; + + spin_lock_irqsave(&dwc->lock, flags); + dwc3_stop_active_transfer(dep, true); + __dwc3_gadget_kick_transfer(dep); + spin_unlock_irqrestore(&dwc->lock, flags); +} + /* -------------------------------------------------------------------------- */ static struct usb_endpoint_descriptor dwc3_gadget_ep0_desc = { @@ -1563,6 +1576,7 @@ static const struct usb_ep_ops dwc3_gadget_ep_ops = { .dequeue = dwc3_gadget_ep_dequeue, .set_halt = dwc3_gadget_ep_set_halt, .set_wedge = dwc3_gadget_ep_set_wedge, + .stream_timeout = stream_timeout_function, }; /* -------------------------------------------------------------------------- */ @@ -2469,6 +2483,10 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, } break; case DWC3_DEPEVT_STREAMEVT: + if ((event->status == DEPEVT_STREAMEVT_FOUND) && + timer_pending(&dep->endpoint.stream_timeout_timer)) + del_timer(&dep->endpoint.stream_timeout_timer); + case DWC3_DEPEVT_XFERCOMPLETE: case DWC3_DEPEVT_RXTXFIFOEVT: break; From patchwork Sat Oct 13 13:14:50 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: 10640139 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 A4A1014BD for ; Sat, 13 Oct 2018 13:15:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92BC22AF4D for ; Sat, 13 Oct 2018 13:15:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 871382AF52; Sat, 13 Oct 2018 13:15:45 +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 0F54C2AF4D for ; Sat, 13 Oct 2018 13:15:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726946AbeJMUwm (ORCPT ); Sat, 13 Oct 2018 16:52:42 -0400 Received: from mail-co1nam03on0079.outbound.protection.outlook.com ([104.47.40.79]:32064 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726665AbeJMUwk (ORCPT ); Sat, 13 Oct 2018 16:52:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Vpe+u00Akh/j9YaOXqfe0G3VGR0+1M5xNzVwZcS7hXg=; b=Ih4E2PDR50Yw4D8uSsB6IkuEPn79DZtbzmkOoGSQUrX6mv8ENLJwWaO5rmoeGicfJL7ZRY4YBf2aXmfUXPLre2rmZVXknO9oOM6L0m+9a0O6ujbgkCsf4rYX7IMNy260r3/yvpqSXwh7AWknJmTYO7fVqs+3+lc1m/BNuOCbIzU= Received: from MWHPR0201CA0015.namprd02.prod.outlook.com (2603:10b6:301:74::28) by DM5PR0201MB3512.namprd02.prod.outlook.com (2603:10b6:4:77::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.22; Sat, 13 Oct 2018 13:15:26 +0000 Received: from BL2NAM02FT019.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::202) by MWHPR0201CA0015.outlook.office365.com (2603:10b6:301:74::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1228.24 via Frontend Transport; Sat, 13 Oct 2018 13:15:25 +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 BL2NAM02FT019.mail.protection.outlook.com (10.152.77.166) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1250.11 via Frontend Transport; Sat, 13 Oct 2018 13:15:20 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:58070 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1gBJlH-0001Gg-Kg; Sat, 13 Oct 2018 06:15:19 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gBJlC-0007wb-H8; Sat, 13 Oct 2018 06:15:14 -0700 Received: from xsj-pvapsmtp01 (xsj-smtp1.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w9DDF6Ds026410; Sat, 13 Oct 2018 06:15:06 -0700 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJl4-0007om-6T; Sat, 13 Oct 2018 06:15:06 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 60037604E9; Sat, 13 Oct 2018 18:45:04 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH V6 03/10] usb: dwc3: gadget: Remove references to dep->stream_capable Date: Sat, 13 Oct 2018 18:44:50 +0530 Message-ID: <1539436498-24892-4-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(1496009)(396003)(136003)(376002)(346002)(39850400004)(2980300002)(438002)(199004)(189003)(54906003)(305945005)(106466001)(2906002)(52956003)(478600001)(186003)(50226002)(63266004)(50466002)(107886003)(90966002)(48376002)(126002)(51416003)(81166006)(81156014)(110136005)(7416002)(2616005)(446003)(26005)(76176011)(476003)(336012)(106002)(42186006)(36756003)(47776003)(316002)(8676002)(426003)(5660300001)(11346002)(8936002)(486006)(16586007)(4326008)(356004)(14444005)(6266002)(2171002)(39060400002)(36386004)(103686004)(6666004)(107986001)(5001870100001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR0201MB3512;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;BL2NAM02FT019;1:CBB209aCcQCB8acWOMyJ2Yjc04t4pe/cq4D3Y0EBXddodoGSYQL+dBh2tKxP9iMj95JZPhG4uJdBMfmGTtxVFNgvKMXBnk9meaAFHwkSqodo+nssrw4TOsQW6j5ujBRy MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 239adc25-523f-4263-96f2-08d6310df00b X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM5PR0201MB3512; X-Microsoft-Exchange-Diagnostics: 1;DM5PR0201MB3512;3:ETw44/1YrlBKAGiqlmjrR1KyXpB2AvVb8OlbkwgbYdtlpjQFH8+ibXOPTEm6uoHOq0GjABhgDcde0/RMKLtvhdNijsWKF6aqMYFGnZLNh1bRHJLPP3td28FajCPKaw/t6QPLQZddF6rXeX6pJ8lq2Q965NjuaqSlNjkKkKk23O0R1Lb0p/72gKa51ikiwhcTbpSGJjLSZjWyFoJgFdjsxI+0EJWl9wnhJfASvRLDRNS/LZVBahHHp4e7sJ4sGpiAFZBU8EcvdqP5BY4nrP6oHm4um46SaoQoc2YetFd10Sxe+lFBBUf4danzqI49kmjOAb04gNq21JWcMIAEpzv5a9tV1CQ0MVfRoJcxCT6B+zs=;25:vb4z5x9+3ynfIl1/EAJkUzSHZWRIzFVy7NQkM5HnBSJHlbImxVG2G98Mjak6FNdz7A6OIPvWV5N10U9ixjybXydeHuJIjbC96aianlnV21ZyN5hmw2tnRJgGtXnRYTuv1jDDfWVBBd8LjNmdyN2hsYy7A3DrYKdHQ1X5ZtE7TkdcLqSLUv4gfdYW9XNjCASAe6/ydDpx7OUA+r6wNtcjI4CWuVLF3AOHj7WZj+/rJkB3g9vKFTTNQVub2OwUfrEa4ebFWk02DXrFzU0W7T33g4fym9ODDj8RTE3TWn92tjlBbypBKfK87hFE8AlvH9sXMHMf5R0foD3K14AzAZ5K2g== X-MS-TrafficTypeDiagnostic: DM5PR0201MB3512: X-Microsoft-Exchange-Diagnostics: 1;DM5PR0201MB3512;31:iKLvj02evThjugjaxbEBfkkMZ4ybkEdsGJpetu8r9UShkCFtwtzrWjO3phATAJaeNSwdOlY6km4zIl/yTKNkGrnuMvHMymvFNJqMLOkS+Bye+Jo+eVm/Y2oNLKt6hP5eF5nyGx586wiTV/+W+dU8vmxpk6F1WlxIFm7D32Tz6I6NJ+epxpdHSYx3gcvXLMWwpWg6q0xv4rLJ0du9wSf9SvslIilqThPouYaZVOPF2bo=;20:EdTx0yfDlPekSLUl/ilma/YUS6OnY6AwkUhVpoWLkhK3Bq5rNLIxuvIEhQQqI/N1Edw6OoCvm+N8Jw8vwyta4pOI5VipwnvbtRPg1DsjUi+SwobqcJ5HPDWIRKsHeAe04btGavRGLYX4OGY8Vu6mikrdvmGpE33Gxw6TP5q5jfgxKx2K87pxNMD5EK4lrItfSUNnRTdZ0m8ehYkWZuS7AOxbzyrhkG8+wLHePfen2htZLyXx02Kb2TF/24r7ekR4wfqCMeIGFB2/uX+3OqbYjXMivz3w+s50dTgnSOfdeY6NC8/cGHPhzxjQ0+WK31+4CL/CJ38GNgFfCksJDv5Mlz5AgN2Eejz6BIVnz2S9fOMSW6JjncudlDDriFNjXwf7YnPhYpOAHkcfvnQ6h+f8y6UMwC62enq7Q7Dr9lWvMLcVLxIqH3Bg+P++i2pPqdzf8IA6Vx7r8BWoI4xZCaboR2bjlH/PuHSg3mhoeykxkBPl+P+zuZhHhyT3PqCwn7g9 X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93004095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991067);SRVR:DM5PR0201MB3512;BCL:0;PCL:0;RULEID:;SRVR:DM5PR0201MB3512; X-Microsoft-Exchange-Diagnostics: 1;DM5PR0201MB3512;4:CoRXvH7e1bsebN0hkkA5ENR91eOLeUjgYsw890DA2uOg96Gn+uiSRiwnrhTtuyq75CacIhdaGjqCziLBB9YcQIbPN6gYxJw124oreDxUhLr9Y127Crh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3rbnT43gG/YBQxIxCn5OK/O0o5VJW7ZGV6mk90hLRzKkaAcMpvCsoO1oT+RK2knfJZRUDQQ8EGiHpTeXk0jk+otknWO2B142RtL+3YTdtRyOJmOj96/qSbzuTUs5IFWMyzJKSG6GP+82qtAyFeNaqQwZLspIYA3ObLnV3+42c2+DNZPOGmOanzBWuOx7EZaqvpdrT3XZ4rSSkU8ZPMKGi6Ws8rMp/CFbuYC70E6FzAUgVU+QqVvTv3A8R5ZhTKg1Ea7OSEvItp4+cCakY0EZNn7sD/Q5yFAFt1uXfjzHkBchi4kuW/VIj12+EvaTteVlQ49H5M2S+ayBhspm7WZprescOEA==;5:dSmcz6GRJGPCwJ+FcgrBmCQ8xLCtS9/sKKWLk+ll37SgbAzoA9K5IIj2dOdWeYySjPluNkZiLM2zqlbF2x9P/X9KGW6v6QQF6LTJx8oEIeLrdCoN4YS1FoHbu9ApaFhVafHs8eFq8YZYmYX8fPjMbQ8iyiPGPFiXu9teCt498/Y=;7:/9WfjkwpjKd2NoE7EtaoTH7jm0M3JW5pC3zlOxw9ZrpJOIr7DkFgMj9SukSltaSU5a8EeViktQ3ir0v7T5nWxuf8U99jKdie+6jLZakeT6HVlC/x+NMPzHxt6a69/zXXWeD3ra7Qq0xCBNH2AAfiQUnxpcwE1Rt+bFjHDPD9BEp3Fh7EGsYc+KdzdC6grai8rlYHDa59AhjQ/lVY8c9ZnFO8iYjsvH7adAWnMUhv4KDA4JsGqVgKa616Ak40KPhS SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2018 13:15:20.5973 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 239adc25-523f-4263-96f2-08d6310df00b 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: DM5PR0201MB3512 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 As a part of adding stream timeout timer for stream capable endpoints stream_capable flag is added into struct usb_ep. Replace the usage of dep->stream_capable in with usb_ep->stream_capable. Signed-off-by: Anurag Kumar Vulisha --- Changes in v6: 1. This patch is newly added in this series --- drivers/usb/dwc3/core.h | 2 -- drivers/usb/dwc3/gadget.c | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 5bfb625..89a2ee6 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -655,7 +655,6 @@ struct dwc3_event_buffer { * @interval: the interval on which the ISOC transfer is started * @name: a human readable name e.g. ep1out-bulk * @direction: true for TX, false for RX - * @stream_capable: true when streams are enabled */ struct dwc3_ep { struct usb_ep endpoint; @@ -704,7 +703,6 @@ struct dwc3_ep { char name[20]; unsigned direction:1; - unsigned stream_capable:1; }; enum dwc3_phy { diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index aab2970..ac752d4 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -572,7 +572,6 @@ 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; - dep->stream_capable = true; dep->endpoint.stream_capable = true; } @@ -740,7 +739,7 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) reg &= ~DWC3_DALEPENA_EP(dep->number); dwc3_writel(dwc->regs, DWC3_DALEPENA, reg); - dep->stream_capable = false; + dep->endpoint.stream_capable = false; dep->type = 0; dep->flags &= DWC3_EP_END_TRANSFER_PENDING; @@ -998,7 +997,8 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb, if (chain) trb->ctrl |= DWC3_TRB_CTRL_CHN; - if (usb_endpoint_xfer_bulk(dep->endpoint.desc) && dep->stream_capable) + if (usb_endpoint_xfer_bulk(dep->endpoint.desc) && + dep->endpoint.stream_capable) trb->ctrl |= DWC3_TRB_CTRL_SID_SOFN(stream_id); trb->ctrl |= DWC3_TRB_CTRL_HWO; From patchwork Sat Oct 13 13:14:51 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: 10640147 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 5D7B5933 for ; Sat, 13 Oct 2018 13:16:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 498632AF4D for ; Sat, 13 Oct 2018 13:16:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39F682AF52; Sat, 13 Oct 2018 13:16:26 +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 BE3622AF4D for ; Sat, 13 Oct 2018 13:16:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727033AbeJMUxX (ORCPT ); Sat, 13 Oct 2018 16:53:23 -0400 Received: from mail-cys01nam02on0069.outbound.protection.outlook.com ([104.47.37.69]:5499 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726163AbeJMUwg (ORCPT ); Sat, 13 Oct 2018 16:52:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gUia5U3ROtz4lzd//jjoLkJi7nK2C1vC2RyizlVreSQ=; b=orOV7ADZgRyCArwhHQK/hmPTvxh0D7YAqb64PshpaXFj4MlS94w8qCuvXQdkjMn6ZzgoFDG//m+QNq2cvirkJ4IsJBDkgb2bN1ltaxENDILKDs3lo+2piYLG102USjoQB6nkrzNpx0/t+M6rZLgH2zbsIv1XXHsXlvYEdW0mcDM= Received: from SN4PR0201CA0044.namprd02.prod.outlook.com (2603:10b6:803:2e::30) by SN4PR0201MB3520.namprd02.prod.outlook.com (2603:10b6:803:44::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Sat, 13 Oct 2018 13:15:20 +0000 Received: from BL2NAM02FT025.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::208) by SN4PR0201CA0044.outlook.office365.com (2603:10b6:803:2e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1228.23 via Frontend Transport; Sat, 13 Oct 2018 13:15:20 +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 BL2NAM02FT025.mail.protection.outlook.com (10.152.77.151) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1250.11 via Frontend Transport; Sat, 13 Oct 2018 13:15:20 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJlH-00068i-Ic; Sat, 13 Oct 2018 06:15:19 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gBJlC-0007wb-D9; Sat, 13 Oct 2018 06:15:14 -0700 Received: from xsj-pvapsmtp01 (smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w9DDF6WH019364; Sat, 13 Oct 2018 06:15:06 -0700 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJl3-0007pN-RJ; Sat, 13 Oct 2018 06:15:06 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id C5F3660504; Sat, 13 Oct 2018 18:45:04 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH V6 04/10] usb: dwc3: update stream id in depcmd Date: Sat, 13 Oct 2018 18:44:51 +0530 Message-ID: <1539436498-24892-5-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(39860400002)(136003)(2980300002)(438002)(199004)(189003)(106466001)(47776003)(52956003)(90966002)(2171002)(6266002)(54906003)(486006)(126002)(110136005)(186003)(356004)(26005)(476003)(14444005)(2616005)(6666004)(15650500001)(76176011)(446003)(51416003)(107886003)(11346002)(103686004)(8676002)(39060400002)(81166006)(2906002)(81156014)(42186006)(63266004)(478600001)(336012)(36756003)(36386004)(316002)(106002)(305945005)(4326008)(7416002)(50226002)(50466002)(16586007)(5660300001)(48376002)(8936002)(426003)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN4PR0201MB3520;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BL2NAM02FT025;1:GDASXcRUZFjPYbdTd8E6D4tM6CETGDwcdU6i6G/h+gwIC/c/RUBm/7IY0C6gXNPr8Rtdss7KS5pMU33p/k0MMEzOZdpZjAvfRRAcpUIci9oZoeDbz1H9cR4cZsTig3Ac MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c1af2d9-3baa-401c-7684-08d6310ded2c X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:SN4PR0201MB3520; X-Microsoft-Exchange-Diagnostics: 1;SN4PR0201MB3520;3:rM5SQ46k1LqgNxeo61qK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zj+xG+VufszcqWh7UmC0snjZ1I2y00wzPk6j8HhokZcQQD/62Te0AHmA7921SdgDlTCqAt7rXrqma1mnA04TeJSe68Q8yYhLffDe7jxcaQfqfEUkAlFmOl88d881eXffl/7Mq+UlN+w+4dI4TyoxZcrpFPGoaKp5HJSf/l7cBs02xjI55J4T/htRBpHFR8Jepeij0EdZaEKVFCv1tSMCmBTNY2hHQPSYlbI5yY36DT2L6qIsP9bmoxpqq3zm859SqZ8y40WpLuXefjIkBSLYLp/Rm1/LRTrOy6/psrDQyRTwnDBh6SDsnmt10nlKJNSFYnbOTe9OMIiymZdvjQeH2BP2R2+PrvPPaqju0/LZ4g/scbPSCdjlboicVgoOOpmurKlsII/ppUJrVjFeWS3PiTsuZL34EM2xsgxSRz X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93004095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991067);SRVR:SN4PR0201MB3520;BCL:0;PCL:0;RULEID:;SRVR:SN4PR0201MB3520; X-Microsoft-Exchange-Diagnostics: 1;SN4PR0201MB3520;4:2PyySzZssR2RpfbDvp5HP/6vIOOMQYtBIbxBC1RGiNURK8RteWFVeD7MsjNAJaNK6YabMbRyQFK5nDOspr//dNdOjOa1aDWUOcPzEpUh/Ksbr/ppGx2yA1bNjkdPv4UrYukHX6myXCN4iOycLbRQ1RHWK832V2cttAsXfkPCYaPMfhPkc1hK9FDcGELhWaLD9AM5ztjlsQAZaBCMmhnfPkel4ld4Gh5ZH9hi0G3if2WZlWcC8xsiYO21qfI3/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avP9ZN3HB8RpZ2hTv5rdqOm+A3PrVmqyShvamslgpFtJd4H4Zt/ZDS1dLkQOkyWnLtAtoCEI0z0e4++29S6jA5F2S5kuBcSLpKZ85hYZVmBN/JZPyWWGKy6k1JY8fU+MuiOx/4l0cF2O6qBWw==;5:VCTQfwz379mpZkoN3OTr6TlM5gMtgM8URFFRnEHG0fKxEcuVYFqy/xFWlZmgXCIrqOvexWU6cqvsg6sq/UrgGcNoXAtICpHO4N4UD5GJ5dkS68qYhtXAVYvPE5uqy4ukhOI2EoiyH6YiOdfJbl0shW+bH8IkswJCTDw6k0xIm1k=;7:kUHX3g30vUeq+9jMV6o3I1L8wjkaAkHfDTno7eWkPSbhIJWCSmxfMs0cwUkRtLcbocUJVkAxiWQA+mmyhP6p0kouYlTcvSwPGOXxBX3EFGS1q3MsGieHkktGfTFTgK++l2TkP8UGsO+fLi8srUHrNGd5HpHElSKZqv+LWru7BSwDmfT3Mp6qUq6nSrvmqT2IjighUs0HW5EFy0E/bS+NeYvRXoV9A+UHkNvtgGsE5da4IllA00RrU2xATxEvRdHA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2018 13:15:20.1078 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c1af2d9-3baa-401c-7684-08d6310ded2c 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: SN4PR0201MB3520 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 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 ac752d4..862ec5a 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1225,6 +1225,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->endpoint.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 Oct 13 13:14:52 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: 10640135 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 7DB93933 for ; Sat, 13 Oct 2018 13:15:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6AC7A2AF4D for ; Sat, 13 Oct 2018 13:15:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E7A82AF52; Sat, 13 Oct 2018 13:15:40 +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 CAAFB2AF4D for ; Sat, 13 Oct 2018 13:15:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726723AbeJMUwg (ORCPT ); Sat, 13 Oct 2018 16:52:36 -0400 Received: from mail-bn3nam01on0055.outbound.protection.outlook.com ([104.47.33.55]:16423 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726399AbeJMUwe (ORCPT ); Sat, 13 Oct 2018 16:52:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kgATM7XGbplgbuwG34JbP2Ejn/5gltqNAqxxY4XzxoA=; b=N9jhhi3LcOTBsAK4C1Vb7fWu78EW+0VqLLpINMpvNezkb6nYsdPUhPHcHS67gSVX5LUgNepjzi+Ay8SWYmKuow2Syt5LO6v+mVGNdT4uctH0Q+GP+vwYodVeaCX3m3ka8Swk58LSh2c6mcpXxbV0kgdFjcIW51U7RNxVT6d7ck0= Received: from MWHPR02CA0015.namprd02.prod.outlook.com (2603:10b6:300:4b::25) by SN6PR02MB4461.namprd02.prod.outlook.com (2603:10b6:805:a8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Sat, 13 Oct 2018 13:15:25 +0000 Received: from SN1NAM02FT025.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::203) by MWHPR02CA0015.outlook.office365.com (2603:10b6:300:4b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1228.24 via Frontend Transport; Sat, 13 Oct 2018 13:15:25 +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 SN1NAM02FT025.mail.protection.outlook.com (10.152.72.87) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1250.11 via Frontend Transport; Sat, 13 Oct 2018 13:15:20 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:58079 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1gBJlH-0001Gi-Qo; Sat, 13 Oct 2018 06:15:19 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gBJlC-0007wb-Is; Sat, 13 Oct 2018 06:15:14 -0700 Received: from xsj-pvapsmtp01 (smtp2.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w9DDF6J6026418; Sat, 13 Oct 2018 06:15:06 -0700 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJl4-0007q1-71; Sat, 13 Oct 2018 06:15:06 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 41193604D5; Sat, 13 Oct 2018 18:45:05 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH V6 05/10] usb: dwc3: make controller clear transfer resources after complete Date: Sat, 13 Oct 2018 18:44:52 +0530 Message-ID: <1539436498-24892-6-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(396003)(376002)(39860400002)(136003)(2980300002)(438002)(199004)(189003)(107886003)(47776003)(186003)(336012)(26005)(36756003)(426003)(446003)(81166006)(81156014)(8676002)(356004)(52956003)(106002)(103686004)(6666004)(14444005)(39060400002)(476003)(126002)(486006)(4326008)(11346002)(76176011)(2616005)(51416003)(478600001)(90966002)(106466001)(305945005)(6266002)(2171002)(54906003)(5660300001)(42186006)(16586007)(50226002)(63266004)(7416002)(110136005)(316002)(8936002)(2906002)(48376002)(50466002)(36386004)(107986001)(5001870100001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR02MB4461;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;SN1NAM02FT025;1:rHOAoFNFGR2Dxvl/9U8SqqXXazIF43MFsKx6ClbyvfeLxJIN0LwN6VWwr1WYhbSo87WdKqIXsRfEGGNue2xWQl+wQ77B5k/aLueJ789rMsVq32saM7q4OG0Tsu85ZFJa MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 060e57a2-5294-4f45-1b13-08d6310deff8 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:SN6PR02MB4461; X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4461;3:cHorNF5mX2fho87PgVFK+FpcLiCRsDIfMhsjgw+YLGRpmQZ01eC7pks2wWNrPPu5IJI1k/hrel8bnUE+ULccfy1VeTKmMfvEq646u2kaZknCcuj4hGQfh0erCf+G77/7pL6+qSRpZbcCLWPAKnDN/r9GNA03V32zaCrijWwl/EIzr7oJnIbr45hljavThmObUVqhhfGxyxy3rIt5eH9zjqWXDWY2RkU2Rn2889+VatvEoSTJSKglv+r6FVGNER/YHpyY7En1AVINoPCVJP03+rWIL9UIDcF+6Y3h6O7vdCHPgnsWGLK38YCj6HIo3J5/aR6VWPTSM0+znCtUEs4Y7YTmOEGUIrgBfBTMdREo0ME=;25:Vjkd6ZX/fj7jboBDxxxA/ukoWv1lGV6SzJA3WOOrmUqgGIcJT0PGdheldbFNDcfAH+DUYMSojx2r4MXuGhQtKux3zPvlOz/mwEVaQFuLUz4XL5w2eo0qtb69V4g6m3zmvp6QYtsJejp+EUlXvTBlKtV42Fjup56Q1GAxS7yFDeeBLAKwHgnRquhD5riG/Ct8S2/ZjFU3Q44CsEQzM51N4bHo857Bjn/jcG9QQTticlHE3AleQTdnI/Cwc2+Wy+7TXayHasdP5VV+/JizUD5hGznCGhBY0e5lxKIKjqXFWmXrOtens0sYfAcD8X4I6ef16VrrSXvChPfhxm4+6dBLPA== X-MS-TrafficTypeDiagnostic: SN6PR02MB4461: X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4461;31:vuvuGV9dYiDp5CfXQWiTQs2G5rhdHsXBFH4tZP4MbjgzySAagVM0TJffL+sP0e7KqW8jTJGos9WH7csC12Nt+i/XkfzSpcKrZ5uaAYRV5OCy5sgRRERuyfM42F24piTB5C+vL794VEPsiYlXpzvYrrJOaiVGlCQedJ+RmyTfwbJppBGsdVLB5InOGFHIPraLq6NDNhALMjJVakXi/zZfJ363rIwhPdeiXrSzG9CidVc=;20:kKqiNtEaPOJgTIXJOCixMqpbOOI6LmEwH5Q07kgphp1KScPDwKGDb1QznFwRoh+yaxhcjOAoMZx3jineoWPFY9jAkzBc94IF2MuGmynST4sILe0cG+KHg7+dPWlG+CVhUb6FfxX18f3H5EPCfdl+Qhi0/pAwNIvm0H6PG6Rjc2MB2dIkUeqxoAM3L6XVrpisb85elQHcw6B2hLV1q6MBc3IKu6ZZN0wGNfnMU8ricWY479BT1xQez3ElfK5ZqYveqN/ovkCtjK9snC4p/JpaH8jSbm9LXl4/0OHJBE9f0Wk1lmh3fsh7njco/x4y3esPmT/Nqz65JTgtgpo8Nw11xckpj3DQhgH7wqHCHknGtcu1GJ/V/lWT9V/W0sA5rDXI1a4IwEOn/gVmjaEgw9TjUK0j7PQnW9jYPgJtgP9bX+mPZQBSncRjdIv9fX8MZMFu9fPn95inm3PdW50qa0/6PaxaZ6tYui9K3XppxdVxnCk2upvCdqFsrrxtqoKCKAxh X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93004095)(10201501046)(3231355)(944501410)(52105095)(3002001)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051);SRVR:SN6PR02MB4461;BCL:0;PCL:0;RULEID:;SRVR:SN6PR02MB4461; X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4461;4:SlS101YTOo/n32PU4fAgCLCHVVk7zfzWalPyrbgEfHCroNToWGxc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OMz3jn69ZjXUGXXkrpy1aUa+is3Bu2sxK2vT/2YHa2qHtRqdZx5xMCV7/hpJNYF6S3qGBAIx2K0AYWOzTLYsiFK8ZXtSxCCuIPiYgQt6Zyvi4WhBHuqPvPPBNvMCypI8Wer5ZuBPTiiWwMBTwTJha0AN4DhTUJU5U7WcA8qKY0HbxeczmnIHmrMbORUQfIz/3l17qLhD5KajsvqLKQAK3XbO24/RFVRnr2RFUGJGoT2PbYXX/3fkxrk8IjxyR9Ved/134R7Ly7nXF7ehLFj56DudOu4Ib4Lupwn5N4KjXoZXpoAkyyzFdrC1u1xh9+jngt9AIfs2Kw2Zaj9/F4g==;5:GDeoIXdrcVifDojkP7Fjli12E617S7YMR2GpwPptPO/dYCi6ucJibJ/RGIK9NUdRcdXZOwtwdk6v86qQKEzQSKJlhkB7tt4NJ3tuNUYpzXlaLGsoWpMRW2Z52CA9zgap6GKS1yGT3/JCJ5Ehu21IwNynHP+3YFCupOg/jFLu5wM=;7:Cm7wJFhvfZd1kN5Ng+8ulRUpSSDe/BRfpppHerkT/SdcYSlDoV5o61fawk65+btDtXoLlEFyzMxYR1p939Kr/Q7chkHciIoDLgmIS6R0ofZqTkK5N98yE/TyZfa+C44ITDILK207M6BJyZgh9HisZy0V58cxqpBkXIbaARjvkcBSQ4IxqU1DWgo6/mHK6ijhx313AfMW4uAlUpkQe0JYYSbpePE5mL+wU25x3K0jI7q4FjADCCAwOuA/81Y6xNoD SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2018 13:15:20.5635 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 060e57a2-5294-4f45-1b13-08d6310deff8 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: SN6PR02MB4461 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 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 | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 862ec5a..b58cd69 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -571,7 +571,9 @@ 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->endpoint.stream_capable = true; } @@ -997,6 +999,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->endpoint.stream_capable) + trb->ctrl |= DWC3_TRB_CTRL_LST; + if (usb_endpoint_xfer_bulk(dep->endpoint.desc) && dep->endpoint.stream_capable) trb->ctrl |= DWC3_TRB_CTRL_SID_SOFN(stream_id); @@ -2282,7 +2293,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; @@ -2471,6 +2482,11 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, } switch (event->endpoint_event) { + case DWC3_DEPEVT_XFERCOMPLETE: + if (!dep->endpoint.stream_capable) + break; + dep->flags &= ~DWC3_EP_TRANSFER_STARTED; + /* Fall Through */ case DWC3_DEPEVT_XFERINPROGRESS: dwc3_gadget_endpoint_transfer_in_progress(dep, event); break; @@ -2490,7 +2506,6 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, timer_pending(&dep->endpoint.stream_timeout_timer)) del_timer(&dep->endpoint.stream_timeout_timer); - case DWC3_DEPEVT_XFERCOMPLETE: case DWC3_DEPEVT_RXTXFIFOEVT: break; } From patchwork Sat Oct 13 13:14:53 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: 10640153 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 399D8933 for ; Sat, 13 Oct 2018 13:16:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2790E2AF4D for ; Sat, 13 Oct 2018 13:16:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B9C22AF52; Sat, 13 Oct 2018 13:16:36 +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 A07BB2AF4D for ; Sat, 13 Oct 2018 13:16:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726281AbeJMUxf (ORCPT ); Sat, 13 Oct 2018 16:53:35 -0400 Received: from mail-eopbgr710063.outbound.protection.outlook.com ([40.107.71.63]:61856 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726435AbeJMUwf (ORCPT ); Sat, 13 Oct 2018 16:52:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7xC3i4tFAZYp5SuHdCA6jdFy7vAxhexr2KMvmNwamw4=; b=iCGSzshzxkBJ0+ByDl0B1qze4IDxOWhtuWYdoHM/tzRWQPLQD2mNtSTpmNa3dE0WHSOfLwO22cs0mzFKiv2LVWeH7klKB5j0H+43b6bWqdRK4OrI52chb6nFOOsRoilrmbCH/bbe+9rapYxWWoSirO/UU0d1gLGnO1FFdWop7Sw= Received: from SN4PR0201CA0037.namprd02.prod.outlook.com (2603:10b6:803:2e::23) by DM6PR02MB4332.namprd02.prod.outlook.com (2603:10b6:5:2a::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.21; Sat, 13 Oct 2018 13:15:26 +0000 Received: from BL2NAM02FT044.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::208) by SN4PR0201CA0037.outlook.office365.com (2603:10b6:803:2e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1228.21 via Frontend Transport; Sat, 13 Oct 2018 13:15:26 +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 BL2NAM02FT044.mail.protection.outlook.com (10.152.77.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1250.11 via Frontend Transport; Sat, 13 Oct 2018 13:15:21 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:58108 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1gBJlI-0001Gk-Ar; Sat, 13 Oct 2018 06:15:20 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gBJlD-0007wb-5I; Sat, 13 Oct 2018 06:15:15 -0700 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 w9DDF7Ec019390; Sat, 13 Oct 2018 06:15:08 -0700 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJl5-0007qa-G3; Sat, 13 Oct 2018 06:15:07 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id AFC9060503; Sat, 13 Oct 2018 18:45:05 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH V6 06/10] usb: dwc3: don't issue no-op trb for stream capable endpoints Date: Sat, 13 Oct 2018 18:44:53 +0530 Message-ID: <1539436498-24892-7-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(346002)(396003)(39860400002)(136003)(2980300002)(438002)(189003)(199004)(3923003)(90966002)(50466002)(14444005)(36756003)(8936002)(356004)(6666004)(50226002)(426003)(39060400002)(6266002)(47776003)(52956003)(63266004)(26005)(81156014)(81166006)(336012)(2906002)(36386004)(48376002)(478600001)(107886003)(5660300001)(54906003)(8676002)(305945005)(110136005)(51416003)(7416002)(42186006)(16586007)(316002)(486006)(103686004)(4326008)(186003)(76176011)(126002)(476003)(11346002)(2171002)(446003)(106002)(106466001)(2616005)(107986001)(5001870100001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR02MB4332;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;LANG:en;PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;BL2NAM02FT044;1:j2axupm1bNywoDniqKsTxgkppQibJIqaueeF1aTmlDRrDarkK2Fpp2KD8/3iHBqqTsC9gx1Bu/O9k5uTDcY9iQvKgxox5UTiloA3CYlBvDXUvemuZmNVZbtv62WqYTiB MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81db89c1-82d4-45aa-506f-08d6310df04e X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM6PR02MB4332; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4332;3:7iiykng5WmXSzBE8XrerUKCtNAwg+sg8xtXW3lVAaZ/0C2JbUdswDg7NtwjCNqBTbNQiDeiMSpbsZzawOOXH6aCqWs5/VB6XAYjsSFCSvHwY0OW8RJtetfEn0nHBS867wNekPiOIvFm6s12VjpYbEaZ1Cd1hXxDtE+JMcO9liOnzVfjsDeum1IRg8Ty+uyvXv7ZVM1Ulm7fWhfoNiiJSUob8bqiuEVb2gWD+9yHIDqe23l9pTm1nFpLLo91SeszXTFYOl8HjmqaPg7fGrHEFcR2IIkipaTiFc17UiwyE+qCpCuFwi/9uqMDdAiG2xsK3KFY5UKV/pjTEh+lGat1bwLBpXGsRONS1FyEto5ytmTM=;25:ocXTyje2qjXv81AT8CS3FtdbywD687m/EV8NM+clzwsSD55cmVtD6soAH0VjixGRW8hLiGPRMCSD9oG3ipsZ4rOmNVcHniSQ19KAl1xZp2SRqva7XF+shec/DCICroe3xn8RIQcRxrvBHZfNzH+DTaycp8QVf4eIcu46TALHVnBbZKLqFoK5RR1r2VYCT25GFZt/SMks+85e3jEOzRzlUokfJ2miXodQZ4gNpzr6yVxplffpFAN6RfqQLVrFBB7dT7/sMawRPX2bGR0TSoIUKEQPJ73v2DG19EtxL//S258QHA5MpJS0HfM+zx2IqzQpXHUI/VRpWSzKD3Y2PsnVWg== X-MS-TrafficTypeDiagnostic: DM6PR02MB4332: X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4332;31:ku4Qim1/ZZ1mfF26cHN+3ByZ1k73Gxf9EbI+YYRxlqbfX0uNszzERcllr01xvURiUJtXSZNULxymkmy1xVu7HrN9TJjxM39s/gltzCqpnmDy7jfFFNQ2nmZvCRgnUDRpbJNT/LnNw5g41d+PP3gkPNHQ/gQTgxIGvRr2YU1LAC+t+bYOtZJY/AK89FtckkjK2FzbKrThicVaLsWVzGzerudHx7vc9mtOPGAI0QE5KbU=;20:sRz0pB6gu+eT5frwMwPvFSNddeferEDFx+7Debw2wcyzbhFRGfT6UkpX/h8QT94L4R2ZQE4oQ4pw6hs0MJkOUy89UVm2Yutx4LMvw1jg9eYlOkrNdsRnqPdjlpM2kQUXaBTJORAcv5AWQtvk3B543JFTaw+Gf4kGuMUX6TFQReCKPJF2dcCHAVQKUhbuQuey5GSAp59gTMnXipwOdedZwWACjwR2tNSrjpr8JEpCfvRXG8rjTqrhgEJqLuUfVVZNf65IxaSiQiCtt8bMiPd3TQ13HSlpdyZ/r8n7pFgu3A1OKn+53EHgCsdfLnW2micm90pytpDEXrXO5EqCemyWgM1JurXQXCrTXc2F2otItPXo2jzxtmHGi7q2y9zJZNmBtQqBVzhaQbTZ01syuK6ZflsP0cNkhSOubSzh33WZGLVnxz+LHTIgp//wDh1mRmYvbBnJeNuEceCPh67kFzwnpCUnfrj/Cj3+yDekd0lg6XeeOUrfJfFkzeHbyn18t1Do X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231355)(944501410)(52105095)(93006095)(93004095)(3002001)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991067);SRVR:DM6PR02MB4332;BCL:0;PCL:0;RULEID:;SRVR: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XsS1FXNQIebIyxrL7YxR4nzEm+gzF1x3OKU5iIpS3zkATnPVJvcJ+sGoCCpK1MnL7vNLgRKHVen3hccO/4tdvhqpEAt55Ha4GHlxflL0xaDyEb1D1qDJMuC5pOOInYF1Y10YbW7ort/J39oZFLUtlpLn28RSPDRG3BjH9wdSHFlpp8zHeRKLlb0BJznCCRLajjkQSB14fi6nlHTxqpR+wNcwiE0q3OEYWFZ5twMFDLl7eocCF2ufLEJ/kUZgjzMbob8I8LKwUYcSru1K1KcCed2LZbpD0ld4FTsWA9kNjWOkFaNLi+dOSckW6Z9cowYh7IgvjJOtuEGvR6L7CvUy7Q4qg02F3NMkQtsXkztHKk0G8fzTGRQ35HftAjJ1tGSp/SC1mWV874fzz+q93bKt0rrQwVRqcULEuTN9dv5V+2o/2tFwU9vbTP0aMgHOGzalzfZqQICxuRNMIdc09QZGyw==;5:HbOd1Z8NxunIAb1VHC95lee7+6BclCwUr/NWcs36XlgYH1pJ7GemZB0pJV024xhzPUhlr0jfALt1lxxqyVfpiX0i8lHzcAAtNZ7B90i819Qv3mNsjyj/On+ceW9O8pVmYg1z50sRos3eq0++8jE7qCDoQUoBPCFi1urGeT65je0=;7:+H7noihPXJOpXlCnjd1FLu84ZaXcWdLyd2GKx7ZBqchG4Dt1EWg+J9MiLyRk2oTfSvpCNB+OnhSplPBQYDyorkWRTLtVD1OpFGEmX+YvS2+UrewzjYr3sI3EETenZhn7NtpWId1FbUhwvjkb0dar5JAIs0z22Uo70CADf+Q4zai1II0vhIXCEky3ehxleOUQtqmO6HXjhzjfKSoO0i13S8yaUqWSHxZMbZs5qkRARBxjariXleqLhzvb8tkNL3N1 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2018 13:15:21.0953 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81db89c1-82d4-45aa-506f-08d6310df04e 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: DM6PR02MB4332 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 --- Chnages 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 b58cd69..89df030 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -666,7 +666,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->endpoint.stream_capable) || usb_endpoint_xfer_int(desc)) { struct dwc3_gadget_ep_cmd_params params; struct dwc3_trb *trb; From patchwork Sat Oct 13 13:14:54 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: 10640133 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 DD8AA14BD for ; Sat, 13 Oct 2018 13:15:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C49B72AF4D for ; Sat, 13 Oct 2018 13:15:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B53762AF52; Sat, 13 Oct 2018 13:15:28 +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 467DA2AF4D for ; Sat, 13 Oct 2018 13:15:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726299AbeJMUwb (ORCPT ); Sat, 13 Oct 2018 16:52:31 -0400 Received: from mail-eopbgr700046.outbound.protection.outlook.com ([40.107.70.46]:44640 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726163AbeJMUwb (ORCPT ); Sat, 13 Oct 2018 16:52:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LGCPHH8BOrHAfn823CUTbAEsL/kukbfu6KfzTAYKgCo=; b=3lojVacmGTfORpdZHm7X8QrzzFss1rS888uIwfCy1Ibi8OpIFOmjSLt1uf3anH6aIH142L+NeJpUx9UOsXijLc1J6wPR4cQI+BEF+SMdmSr/Vb9xS2KBoL8AIzb18Ets4HKt5tSQgivj54bTssLS6zFcuPzIf/D5TMlfHo7lVmI= Received: from BL0PR02CA0065.namprd02.prod.outlook.com (2603:10b6:207:3d::42) by CY4PR0201MB3507.namprd02.prod.outlook.com (2603:10b6:910:95::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.23; Sat, 13 Oct 2018 13:15:21 +0000 Received: from SN1NAM02FT053.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::201) by BL0PR02CA0065.outlook.office365.com (2603:10b6:207:3d::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1228.26 via Frontend Transport; Sat, 13 Oct 2018 13:15:20 +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 SN1NAM02FT053.mail.protection.outlook.com (10.152.72.102) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1250.11 via Frontend Transport; Sat, 13 Oct 2018 13:15:19 +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 1gBJlH-00068h-ED; Sat, 13 Oct 2018 06:15:19 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gBJlC-0007wb-9p; Sat, 13 Oct 2018 06:15:14 -0700 Received: from xsj-pvapsmtp01 (mailhub.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w9DDF7d4026424; Sat, 13 Oct 2018 06:15:07 -0700 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJl4-0007pN-M0; Sat, 13 Oct 2018 06:15:06 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 3B0C860508; Sat, 13 Oct 2018 18:45:06 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH V6 07/10] usb: dwc3: check for requests in started list for stream capable endpoints Date: Sat, 13 Oct 2018 18:44:54 +0530 Message-ID: <1539436498-24892-8-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(136003)(346002)(396003)(376002)(2980300002)(438002)(189003)(199004)(14444005)(7416002)(106466001)(81156014)(50226002)(36756003)(81166006)(8676002)(51416003)(8936002)(26005)(106002)(50466002)(4326008)(316002)(54906003)(42186006)(48376002)(52956003)(76176011)(110136005)(5660300001)(107886003)(103686004)(6266002)(2906002)(486006)(47776003)(39060400002)(446003)(305945005)(16586007)(356004)(2616005)(11346002)(336012)(126002)(478600001)(36386004)(476003)(426003)(63266004)(186003)(2171002)(90966002)(6666004)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR0201MB3507;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;SN1NAM02FT053;1:GfU81bdja2Mua0dqPyDhG/yhJewCf1FOeyynetAPqpyNILDycQf38j7A2i/H3KulQivpwNhW7yQyRd5XHkMsM73XAG+dFw1EFj2c31XC34iA4dDDqmNjhR1gfUzZiSSw MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44d13b36-79bc-4063-5489-08d6310ded34 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4608076)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060);SRVR:CY4PR0201MB3507; X-Microsoft-Exchange-Diagnostics: 1;CY4PR0201MB3507;3:zu8xqoJysTAzjBySvJ8Ydz9zqyqm3WQP9MIBqXcwjJI4yRQXzQruG9Uk51RKIliIfdnFafGECf40yidlcFRcBGVvMVlEEH3yuGEoiQhmMnh49lzM4Ac83Www7K4PAIJTmGKnzJ/88BxajbOSekt3cJZgqIDE8zgYWWocEvP0pC6KEcadBMXpftDDlzFbQmh1uF+zxJ2fX0EuWrYB4h0BnhunXSygR3MQr9WYA+5tTw0A7ZeElJkSKWBkYuIjs4fybfG8+Fmcpe63y2FqL+YnUqXbrS+4tXINta5ICuBVtn1st+Bs2NNyULCcE51NtvhXmjxJKHRhiudlj9SFWIp7D8rkSL64SYfyRmYQ5upyE2I=;25:HiOzLponeRfX790ImVwzMtCAgJ9lEuV4Ic+IzLGw/DgeWthvAc5yDVHgd7b9VWSZiUF+1YxGqi+cJTDjXKTmckaBYWV4y6R8jo7aMcrIm2xeNUqsHBJGi2KapeBZ1PIS8noZ2OkyWpmQk43Y3yrzGjr2fkwflgkAwzawLGHck5CdHIKvqe6OvtnitEav6R2e32nx6Nu9mNT0zksf2VY+RjsXA/mYNpeo/uG4yOc5BvfMyCPVjUL7N9ICa+ZRGWNsL5IXflAZMre21gYwu4WLlWbfyWw/ExYJdIYNvMr86KsBxWLISbD5UK89Ici0SRHkI854I7LjvTTT3AqoihX+iw== X-MS-TrafficTypeDiagnostic: CY4PR0201MB3507: X-Microsoft-Exchange-Diagnostics: 1;CY4PR0201MB3507;31:sjwka1h4TVBWiDb4UyDs/FQmMI20eKlA4JKWXlWsG4a/bjLtFnAP2rO7KEEDaOJNC/ZRxOkzh2kFvRCPvAvd8Z2zZZUR6ZfQ7GQdLITjtKPQhA32LL8boBM+5TXStwCxnf5drWm6r2/My8anJD8Pco7odUODzvshkmCCWXcpYLvCrQTflmR2cHsDvg2v3caVqiWHFLoHxfKxG6YYuD9bpDFgOWlnd7cKyHLn5hKMnBg=;20:OluK4odb7fCqwpa31/PTJWvKKqkH19Pk/YYedWiATANVYPatW237XcRg8pMwU2zziNrVHaEWk5EKhgEGHNVW4o4LRmmNzV0NCco2xx3cNjFy02DVI07uJ7ezEZ08cQ4BoT3OfB8beI0WANoX1xmbk0qv7g9uHw4QcM8SqrbP5O5SLahtn9y5NxiAaTHI6uZUnEZITyA8ptwPcZEk6gyvplunhttWjNzeOpx0cb+rNBsN2yv74MtFDFslFF7NIoi78DUE929CiUlH4SwqHhRUerBUjpaktw4zZJSsFXzWhmEoTrJrWyR6UNQ4BJjOSYriGxX4t86QGvdqVdx7HDsYUZAmvAwqjjE4vOvel9HwI6YaTE75qSRuObfq5ZKMCjC/W8SEE/XsCtvqyV0MYaFVswLlV3EGHgKeFClwF2df1Q+M+WoMTd5RLeRtQJR4yt15M5Ms00EnujBXg86+G1k3iebDEsJC8CYct1ONH+UcBFY3IeSdKWqoqWXyjVb7q6Jr X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93004095)(10201501046)(3231355)(944501410)(52105095)(3002001)(6055026)(149066)(150057)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(201708071742011)(7699051);SRVR:CY4PR0201MB3507;BCL:0;PCL:0;RULEID:;SRVR:CY4PR0201MB3507; X-Microsoft-Exchange-Diagnostics: 1;CY4PR0201MB3507;4:JeiETRyqoFejO+OAxVYc0vlXnQo1rcLMror8mBTlxOUEwOZ1jZbIiszSM1ekhXVovEcC5XeSet03lEpeuekmzrLcIlZp4kNCF/x3W7fHmj+ZlKSwHnFkiqj5PI5VRtNWrns621XpoUEzQFtJr1qKhz0DLxr5biNXnA8l0SJ5DntjWC4fUbpKMh3H2YDChRloE+QvMtuZmVEsT2a6yM7h4/kKZo4fiFX0sdWytlL0oXaBsU89ta1/ZA6KF0o3CBoKy0/0l8t1bqMxSAjJn5nS0VfillNc4lLTDLEzlzV+l+jpyQ3FAg4+qXPDqv0CXWvT X-Forefront-PRVS: 082465FB26 X-Microsoft-Exchange-Diagnostics: 1;CY4PR0201MB3507;23:2zqZZ6nflcGO7IRH40xAVf4V3Tkt9TSBOOQMiChUcXIJkStUe7YqFOqDR1mJ0zMV/WGS8J6+pUGMxGx9ozvjdH+xTraDDHah14j/l5Ejp1yeqXikEwxxZIv9uMvQx3eZyKMe9u1nA0r3SXwIxzE9fGtTbuyrPPxHp/fg5f8yKXRG9rroCJseqqf+u1omBTpyZtobRDMYO2JTPrumSoUqKd73+7ItHWiU7hG02I4i0ggg3SrwDY8JXzENVX50ZQwuFIvhg5exEM8Ru8CBRxBWgKuIMqplDRbPYZWcYUfRKMYERCrYDj4nkM0yMESkJ7ew9uVFLyq4TIP6OQCVVWEQ5c2RWMr5A+cHLclfcCeDxqWuduvhHCCzNeCf0WzCMQ/gEyyFWVBlWfKpAw+1JoWbtM6DKryupgE5x6ONfdyfuO2JnIQhGWVPkC1Yd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pamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2018 13:15:19.8781 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44d13b36-79bc-4063-5489-08d6310ded34 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: CY4PR0201MB3507 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 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 89df030..9bf1688 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2420,6 +2420,9 @@ static void dwc3_gadget_endpoint_transfer_in_progress(struct dwc3_ep *dep, dwc3_gadget_ep_cleanup_completed_requests(dep, event, status); + if (dep->endpoint.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 Oct 13 13:14:56 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: 10640151 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 5993314BD for ; Sat, 13 Oct 2018 13:16:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4884E2AF4D for ; Sat, 13 Oct 2018 13:16:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BF2C2AF52; Sat, 13 Oct 2018 13:16:31 +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 B75A12AF4D for ; Sat, 13 Oct 2018 13:16:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726668AbeJMUwf (ORCPT ); Sat, 13 Oct 2018 16:52:35 -0400 Received: from mail-co1nam03on0079.outbound.protection.outlook.com ([104.47.40.79]:32064 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726400AbeJMUwe (ORCPT ); Sat, 13 Oct 2018 16:52:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pwO0gynIuiSeFOqpYikhwO8EgXv+TT0af0sAaaSb6Vs=; b=Vi2kpIHiE5iG23zjjEd+ONUdF/xoUiboTawwSLQbVwBwKirbJtEsJCOOnqgFjb7NJItSU1p+E5cJ0At1Uk3YqGdJvj7ooxRL8pyxx2ztjjePlKOIDjvPSXqg70/Y3amZthZ8VvaxOnxHon1MmQzTEH8McM5Hse5vr73lWwppTWw= Received: from BL0PR02CA0023.namprd02.prod.outlook.com (2603:10b6:207:3c::36) by DM5PR0201MB3512.namprd02.prod.outlook.com (2603:10b6:4:77::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.22; Sat, 13 Oct 2018 13:15:25 +0000 Received: from CY1NAM02FT038.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::207) by BL0PR02CA0023.outlook.office365.com (2603:10b6:207:3c::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1228.26 via Frontend Transport; Sat, 13 Oct 2018 13:15:25 +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 CY1NAM02FT038.mail.protection.outlook.com (10.152.74.217) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1250.11 via Frontend Transport; Sat, 13 Oct 2018 13:15:19 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:58009 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1gBJlH-0001Ge-0K; Sat, 13 Oct 2018 06:15:19 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gBJlB-0007wb-SO; Sat, 13 Oct 2018 06:15:13 -0700 Received: from xsj-pvapsmtp01 (smtp2.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w9DDF8xa026442; Sat, 13 Oct 2018 06:15:08 -0700 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJl5-0007q1-GF; Sat, 13 Oct 2018 06:15:08 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 12D85604D5; Sat, 13 Oct 2018 18:45:07 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH V6 08/10] usb: dwc3: Correct the logic for checking TRB full in __dwc3_prepare_one_trb() Date: Sat, 13 Oct 2018 18:44:56 +0530 Message-ID: <1539436498-24892-10-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(136003)(376002)(346002)(39850400004)(2980300002)(438002)(199004)(189003)(54906003)(305945005)(106466001)(2906002)(52956003)(478600001)(186003)(50226002)(63266004)(50466002)(107886003)(90966002)(48376002)(126002)(15760500003)(51416003)(81166006)(81156014)(110136005)(7416002)(2616005)(446003)(26005)(76176011)(476003)(336012)(106002)(42186006)(36756003)(47776003)(316002)(8676002)(426003)(5660300001)(11346002)(8936002)(486006)(16586007)(4326008)(356004)(6266002)(2171002)(39060400002)(36386004)(103686004)(6666004)(107986001)(5001870100001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR0201MB3512;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;CY1NAM02FT038;1:gTn47iWUBe2pY5X+1koJGyA6ysW9Nh+r3eapkHjcFMuX4aB8Kyp38oekvmkYRtXEZOqinTpJ5bnaU1rtqQUGZ89ga7IHnS1s4epG7EslGh6v1Vt8Qjmokd68347nvcjD MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 274fe942-6c7a-4cc9-9c0c-08d6310def97 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM5PR0201MB3512; X-Microsoft-Exchange-Diagnostics: 1;DM5PR0201MB3512;3:kIMf0MWGPpV6AnAWls6Oh4/w9xoxeh0TiTD5Mkq4aT1uunkzj3jqqJLwN5MQ1DwNH9jpYnUE7odoYyyRJ/rofnW6ZzXl6dxk6kq6VhsGNcn2CwVyMyooXiYIVWRjz9f/BOnEMN6XFsdYJUf9fhbxRltMamIVWXu8qRBn67Pr91vHYsK51m0lZPb+Uef2af81VRsEsbr1tdycWqreIMI6kERFz9JeKUZM+Pg/j+TmSOLieAcG4LGPPz2LnUytn2+KENzLUKjKtXC6XIxLFOsTvqTB2iw/jHeD4p/scjJKuAQuzz/teed3edi0Av5m7xfdNzFuwZF6NL2GvrsZPt/9qiW99YoPyAYPnRD2hTiNrxU=;25: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OjwCmsGHEFb8VKATc7DiBxCM3Iv6etDTsn478hdSIT2O6OLSnvzb1PThU4H2eQzyGphRIpNDaQhteQ X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93004095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991067);SRVR:DM5PR0201MB3512;BCL:0;PCL:0;RULEID:;SRVR:DM5PR0201MB3512; X-Microsoft-Exchange-Diagnostics: 1;DM5PR0201MB3512;4:lBJGcjT9Ell1nYyZsHLfiZHS6RgrcM5ciUhgCbMkaz2NVEb2Rr6Hvb8iy2/FcnTsWKfKMzjXmmHVyTXBFLVibvdoVDl/1bPOyIQ3x4iAMQykxOFZSJO4pxd6+ledYdaYNrIuXT5tps9mNHv8XoMGCcwAy+FlHv4q6MT0phD3bAF8P26hg3Fw18oasLkI0z4odUXb1HWq4bs7KZCBbGVewgsbcIAMxsPGB90H7XbXD0737ec8htMQIALIZr1uKVA7pv7lLQino0fskw8OSzXGCHFJYp6k2n0MWTTvZQPmsVLBnpeBoxUVz9HxkkbBDhl+ X-Forefront-PRVS: 082465FB26 X-Microsoft-Exchange-Diagnostics: 1;DM5PR0201MB3512;23:jJen2c36xrqy/ACByEKZRfZ4wKO/cFFg6wFm1j80xrUp3UPz0ZSfV/Zr42oFERa98a+QWPPTRrLDoidWDdQo/Svvi2hPLcaSOpiP3xjwThnufszT43Wzgoz/2ZWeCAOmtUytJ34rAysLwZtcUF6FX2/PUFeH4QAow6wxsV+JTIScJzlCIjvdfNC3IKHSpNHt6M5pSav0JxuO7GReokL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AkGRxLg/JlBA2lK4rkjAsA2zg7fYOucdBIKZ0jJsLCbwSgUwhtbpMVX02t1V8ijUl4PLIrC/WymtDXf0nJG7Ge7ED+o74R4Hp1eQoGJLhjA1H6SmR9Ug9I95FnAZzC7YITPFQSunPvwPe5GS61KZnpRdHS7ZzDesXn4atxA5D1lU6T0IfhGwe5BI5/PiJmbLdDR9kkT37VzKJOXyLdzHVX9oLkK/WiDHKjh8xDqczo SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2018 13:15:19.8989 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 274fe942-6c7a-4cc9-9c0c-08d6310def97 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: DM5PR0201MB3512 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 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 9bf1688..2d4b184 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -913,8 +913,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); @@ -993,7 +991,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) @@ -1014,6 +1012,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 Oct 13 13:14:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anurag Kumar Vulisha X-Patchwork-Id: 10640137 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0B3214BD for ; Sat, 13 Oct 2018 13:15:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD9672AF4D for ; Sat, 13 Oct 2018 13:15:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A16C82AF52; Sat, 13 Oct 2018 13:15:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 224572AF4D for ; Sat, 13 Oct 2018 13:15:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726967AbeJMUwn (ORCPT ); Sat, 13 Oct 2018 16:52:43 -0400 Received: from mail-eopbgr680048.outbound.protection.outlook.com ([40.107.68.48]:5096 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726727AbeJMUwj (ORCPT ); Sat, 13 Oct 2018 16:52:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SgdqNPTXSxEY8wz3p0JzQNIuIptOvujNPrI80mICSGE=; b=ojM9JpSHvebVrxjfY5N2bLa70/LoKHOf4SbK+KgeFsmYvO0azHk6VmxYrnmlmIAUchVZx6wRV8egin989KJ8t/YRZshNAsN+Y/L40YEeu1NMsvtjBZqG1IK8y5dxVdJjozHo0IJc89GZSs6IR54+LvpBgWMwSHNJTjA+fOcbIyw= Received: from SN4PR0201CA0008.namprd02.prod.outlook.com (2603:10b6:803:2b::18) by DM6PR02MB4457.namprd02.prod.outlook.com (2603:10b6:5:29::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Sat, 13 Oct 2018 13:15:25 +0000 Received: from BL2NAM02FT008.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::200) by SN4PR0201CA0008.outlook.office365.com (2603:10b6:803:2b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1228.23 via Frontend Transport; Sat, 13 Oct 2018 13:15:25 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT008.mail.protection.outlook.com (10.152.76.162) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1250.11 via Frontend Transport; Sat, 13 Oct 2018 13:15:20 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJlG-00068f-VH; Sat, 13 Oct 2018 06:15:18 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gBJlB-0007wb-Qq; Sat, 13 Oct 2018 06:15:13 -0700 Received: from xsj-pvapsmtp01 (maildrop.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w9DDF8aN026446; Sat, 13 Oct 2018 06:15:08 -0700 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJl6-0007pN-0L; Sat, 13 Oct 2018 06:15:08 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 8ED2460504; Sat, 13 Oct 2018 18:45:07 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH V6 09/10] usb: dwc3: Check for IOC/LST bit in both event->status and TRB->ctrl fields Date: Sat, 13 Oct 2018 18:44:57 +0530 Message-ID: <1539436498-24892-11-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(1496009)(136003)(346002)(376002)(396003)(39860400002)(2980300002)(438002)(199004)(189003)(76176011)(48376002)(51416003)(81166006)(14444005)(356004)(106002)(5660300001)(36756003)(54906003)(42186006)(81156014)(486006)(36386004)(107886003)(426003)(90966002)(2616005)(39060400002)(110136005)(2906002)(16586007)(316002)(11346002)(446003)(7416002)(6666004)(8676002)(476003)(126002)(2171002)(6266002)(52956003)(50226002)(4326008)(63266004)(336012)(186003)(106466001)(305945005)(8936002)(50466002)(47776003)(478600001)(103686004)(26005)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR02MB4457;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BL2NAM02FT008;1:DCgLg/HVtQoswAIzKPRuVI8hx9yo+CJWEIjRAXEPTGdaqt1OYZYcIFuOaHup99kW42+6VqAIO7+Vnfh/f794/TvRZ5YvpqY4O0U58E+VqqStyvR2XJci5wHxC9oZprZJ MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 678dc487-2c32-43f7-6cd9-08d6310defd4 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM6PR02MB4457; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4457;3:DN8pmOE96x9iI+oxVB3nnmIHP2e9m6wxQ+t887NttbZ9AU1DaHh2UP60RnuPafGXNMPQkqY7Znfz/Tw9t0ZMp2rUqswnKbUyepqIIN77djNC+UiYRmfngmYErqDAnN6d8O9HO7WLjwhlxSwxa8EICfXrSNKfRN+4a+zoI5l8PKhSPExO8+XzR3m/Uoqrp8CeBrfK6nl0d+Er8fabh8qdMNJw+gLtrRGKcO+Dgqrv/vuGUbg6xiHOCRcZiE+mRM2CL2PIZt2Jx3CSCI/8FRQsGjhtDxbhKn7t9XO/1iOclTcd625nHT2XUoTI3I6vSO/WnnDb3QoKfWrVDm91JcPCZnjSovN5FpmSvLgszDwGeLQ=;25:A2ue5GQ5cf0RgRR2qrJ6TlZ4YvYwX+dyMa+YuwTk+6mFwv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q/8YhOzRcrSUGO6VLo4/nXaK9Bs0Jgp9XWcucvBIyaEUQ3 X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93004095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699051);SRVR:DM6PR02MB4457;BCL:0;PCL:0;RULEID:;SRVR:DM6PR02MB4457; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4457;4:YzgBF81j4uN2xI95u2edefvXiFiApIKEdv/BRQwvhjL1z5g+A4Zgp0lqVuRy2rp5H3UD6+0DBeGnjqzDy8a4Ztt7676Wv1IGpoCvbAWsaIgh72hsX8oAPMKcDeGocrXDqh0csntEi7NO/JwQb7gUD5bVBBrj0SB0inB3b8pIUO0NHDq+J6EJD6S0iA//fIdAt4Z3Z/OoVZRP01BjfYY/3tGwOU4WqyTAo1/vPt3DwdUTul5UVrKvJ3S8qjje2XuFeCa0sMvVp6iqpXbVY0KFLDAyaIzhLLvkilAAii+6b3dRk9DU0LitRuMZsT13RT3r X-Forefront-PRVS: 082465FB26 X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB4457;23:Ziy5LqhJvf9glAx26hx6Nev4qsHJqrQIH85loXgWCpXpJsnQDefhYBq1x3ffaD6/omTHngpncLdHjh8LeDjBfXNSEkdP4k2X6JCvEbNRe5IqUNnFw5sKZ36CQakfRpBRspEYfQ2FmE+oi0Tqeop+ySNI7Ky887kIq82aHurN3Feo5zcz4IukUVB8zeJp6drXYx5yiMWKTU7eLOI/n23awrGSNC/H4unuOvW7D3MenMKoW1v3p1ils7G37S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wCCLfDRmMlfxQ4HqLGQR/AaOrmMEACE8hpnjto7xCaoq6hIgBZfvGP8mSnD+R09C7sHxN07mEN9tt11fvCsrBuKkevi9WxPd2tWUZXcX8PA2xqHr4qlcY28NJgLrk1LJfN0sj0olsNf/8siY862sRm6J4keioQ4ZSUt6PLhyE+ubxNKYo6hSS+OPT+D1f SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2018 13:15:20.2983 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 678dc487-2c32-43f7-6cd9-08d6310defd4 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB4457 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The present code in dwc3_gadget_ep_reclaim_completed_trb() will check for IOC/LST bit in the event->status and returns if IOC/LST bit is set. This logic doesn't work if multiple TRBs are queued per request and the IOC/LST bit is set on the last TRB of that request. Consider an example where a queued request has multiple queued TRBs and IOC/LST bit is set only for the last TRB. In this case, the Core generates XferComplete/XferInProgress events only for the last TRB (since IOC/LST are set only for the last TRB). As per the logic in dwc3_gadget_ep_reclaim_completed_trb() event->status is checked for IOC/LST bit and returns on the first TRB. This makes the remaining TRBs left unhandled. To aviod this, changed the code to check for IOC/LST bits in both event->status & TRB->ctrl. This patch does the same. Signed-off-by: Anurag Kumar Vulisha Reviewed-by: Thinh Nguyen Tested-By: Tejas Joglekar --- Changes in v6: 1. None Changes in v5: 1. None Changes in v4: 1. None Changes in v3: 1. None Changes in v2: 1. None --- drivers/usb/dwc3/gadget.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 2d4b184..f54de80 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2293,7 +2293,12 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep, if (event->status & DEPEVT_STATUS_SHORT && !chain) return 1; - if (event->status & (DEPEVT_STATUS_IOC | DEPEVT_STATUS_LST)) + if ((event->status & DEPEVT_STATUS_IOC) && + (trb->ctrl & DWC3_TRB_CTRL_IOC)) + return 1; + + if ((event->status & DEPEVT_STATUS_LST) && + (trb->ctrl & DWC3_TRB_CTRL_LST)) return 1; return 0; From patchwork Sat Oct 13 13:14:58 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: 10640143 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 ACAEC933 for ; Sat, 13 Oct 2018 13:16:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B8852AF4D for ; Sat, 13 Oct 2018 13:16:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8EA662AF52; Sat, 13 Oct 2018 13:16:00 +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 1EC6F2AF4D for ; Sat, 13 Oct 2018 13:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726861AbeJMUwi (ORCPT ); Sat, 13 Oct 2018 16:52:38 -0400 Received: from mail-cys01nam02on0054.outbound.protection.outlook.com ([104.47.37.54]:4848 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726663AbeJMUwh (ORCPT ); Sat, 13 Oct 2018 16:52:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=acO2AGPMrFZvyMYZscgXE09LCT6kDLNIW3xqPZ+zvi4=; b=3Cdn1DMFMtWfJzq0KgQ5kWpn+ImQXOoAC7ND6ruVosQKINTeHjoNlFOUsLiNBehtitFzi/W2wVR3GC2qYPHzlvqIlIQuoH4Hp3gYANRUA3bbrNnRqojmRM5rHI6G8QqrgFxDNfOr6kPFboG1HWWxxWvNLvkXmLmbI1RhTk7tObE= Received: from MWHPR02CA0046.namprd02.prod.outlook.com (2603:10b6:301:60::35) by BYAPR02MB4326.namprd02.prod.outlook.com (2603:10b6:a03:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.28; Sat, 13 Oct 2018 13:15:26 +0000 Received: from BL2NAM02FT037.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::200) by MWHPR02CA0046.outlook.office365.com (2603:10b6:301:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1228.24 via Frontend Transport; Sat, 13 Oct 2018 13:15:26 +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 BL2NAM02FT037.mail.protection.outlook.com (10.152.77.11) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1250.11 via Frontend Transport; Sat, 13 Oct 2018 13:15:21 +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 1gBJlI-00068j-51; Sat, 13 Oct 2018 06:15:20 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gBJlD-0007wb-08; Sat, 13 Oct 2018 06:15:15 -0700 Received: from xsj-pvapsmtp01 (mailhost.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w9DDF8k4019394; Sat, 13 Oct 2018 06:15:09 -0700 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gBJl6-0007om-GQ; Sat, 13 Oct 2018 06:15:08 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 13DA6604E9; Sat, 13 Oct 2018 18:45:08 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH V6 10/10] usb: dwc3: Check MISSED ISOC bit only for ISOC endpoints Date: Sat, 13 Oct 2018 18:44:58 +0530 Message-ID: <1539436498-24892-12-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1539436498-24892-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(396003)(346002)(376002)(39860400002)(2980300002)(438002)(189003)(199004)(426003)(2906002)(5660300001)(486006)(2616005)(7416002)(446003)(11346002)(51416003)(126002)(76176011)(336012)(36386004)(90966002)(305945005)(26005)(476003)(52956003)(110136005)(2171002)(54906003)(103686004)(4326008)(47776003)(186003)(8936002)(6266002)(50226002)(8676002)(217873002)(106002)(81156014)(106466001)(39060400002)(16586007)(316002)(6666004)(478600001)(48376002)(63266004)(42186006)(107886003)(36756003)(81166006)(50466002)(14444005)(356004)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR02MB4326;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;BL2NAM02FT037;1:dfqRNQPSQsmEU5KUloyrcybCtaqrc7INDkveLJpwTMWjeIe87b80/hmri8QPB8bmlPZ+rSwQ2hNAV27UfO0KijTXJMX/Ref5cZ5oswTgCZp3n19gpcpD4os5WOgLBX9x MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c9332a06-2324-4830-4adc-08d6310df051 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:BYAPR02MB4326; X-Microsoft-Exchange-Diagnostics: 1;BYAPR02MB4326;3:CupKHAbTcfDYxxwBdveGDqKexEKLjTv+ZJFwP7TZGpSIpzLNONepvaaGjnx+MjyBwwOLS6MeaneT09zxydC83lXYDUMQfpvY0jOl/lh8j4paBrf+UEOdcQ/cAkMhsxC63PeRhRlR1VsVs7WQofzQgPols9mIxC5ObiC7/jtWddhsMmp9uZDdEwHyOvdyJTuRF2RxMXQPmFRnOkRDh2juGkVwKi+wyvdzSP7NuxzAOu7v9Ua4G6VecC+L/6fwXKSkVm9XoD58btijQirszgLObWMzzRjCHTIzYaqVsY6DNonk784KJxTKaJApxW6/SRnfSqE1z1jTLTGDu5KFOqSFeskywrNIwopdYMEv8zyWLyA=;25:uE5yMzoLm96650wd/wWjWFCn6GEUpYT3sjkLVKa3d/yuDVX9EMUdZyM6dfatL3hLB7w4a2HngG1NPJh90cY86C90AZIERsrPbo+t5SPcxhNsynottiVbW11agVdr805j68dhghme554lgcYdVVUEs1CWM1tRuTPZLQ/4P0aNeckhRRolBdP2IFBauoKvfHwgTqu/Dhpw3Dnx8TIT8Y/TKROOWyLFJDY4lLqdD/K1HRRbSJ/go9wM3mVAfa902nTdjNbjNeLT4IX+NCXXFugCxI8HQjb+JyOIOPJm8WaiAAUlQIbTRcxkR5eDdkKgF7G5n6PWL684ZQ6aAa9f+SAlDA== X-MS-TrafficTypeDiagnostic: BYAPR02MB4326: X-Microsoft-Exchange-Diagnostics: 1;BYAPR02MB4326;31:LNCQ1CB7z6HUJqrwyJrSPI0kCVvDwLZbDt8stjaB08sAFP5m+nhVh8o3LSq6phWXcoeBrrbhEzQvfCbqCOh+Lw6P4PLigTQzI6MYWzOL4Uposcu1kmnEMldAp8cTo3InYDe5fM6QJ88kdhkLG1a1fpReEdM/EvyPpEXVgnOTUhmb91h2x9Cj/fBCV1a0uhVEK0/VQu3nl8rmQcszu56+ezOHKP6Nqget5gD8OwX5n+o=;20:sE7Job6LB1Ip4l+x0nYnvTXVzjW4eV0/l7FOc1PdVyCAjS0IT7ztfz4OnfI2V0dmKaxJP7pTI1pf7qCszP0g/lFlnf1j/QbzntSvASKCYa2m1j/8dXvgR1V5/D4+NMSjrX3lPD4pTRxyQrrGEKU5j8TigbdA+nZ8RdAUFazYvi6BIJFxOfi5Gr3d/8gDh5HdGHWu2tXGLHPUbrMWOEwzPNrKW2glyURUaVKTJ/pQ+qS9tVnU/B1o51qgnksA2u0nmr5d8uvdIXZQtYjPazTPHzbq839vRo2UbB4jAqCFDYtz+X4IJoc3dyj+E5fQSsGzZwZX1TGXDeGy/lKpTZ327KrfSpf0xAY5NjWJ0t+T7eABGiI8XjqM8F8RS48MwS8Sp7eq6udR97iq+XYYYQt/EaCabQbH7gSXH1gKlpWEhFkZ0tF3BBGeJ10hqr49d+izh7ytiW4yTCUV22wOAhLRMaTm6QVbpNGBn9VDFXnmistxXgZ3JdyK9MU/PXt32bip X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93004095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051);SRVR:BYAPR02MB4326;BCL:0;PCL:0;RULEID:;SRVR:BYAPR02MB4326; X-Microsoft-Exchange-Diagnostics: 1;BYAPR02MB4326;4:8pCmYraSOW5PmokLdbgRp1gQ4HuIYNN2vwXGtxlNe1arq4P50JmSG4bfPxrtsPEqrHdDiTdfUzeyvRdSyV3uBrU9obHg5IHisNyEBluEwVKiGNcjsOImK5k3q2GpMlWtuYClWegv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FFrAC8usMn1NmZDuDH0vOW100nFAXD1rjpZEOOJBabh6xGeO55h4jl1vffXZWERhx2vt31XY+4tou1xBO2fgoz2UMWxQXZpxSht5lcgIDKcFm/vswDu3lsF3pvcplHmkw4No012QxBHoQiU5mf54Zfw3uOG4A4xoLcEkfedDKOzsVeEMLh/tLZ500klL1m7DDl+WoFemOtDwJG9sZHBHLOzDw+HaZhqSpAkRq3NmCGWtpABpKL8//wbsdw==;5:jvSIbFCXhH3k/x2715+a6RpYKtJ5W8aVBelxgtWMgWUWNJfl5miPJE3UYrOJP6Ca1tzwGCkbr7LFoXs1wOWDyvqNLHQGwKW7v4I09Su6qpX6KsqnG3F07K6GaS9IkrYUfEe6qQ7MWPYCGySvmBZhZJuJDfoSx9gjipnD1Sj2jk8=;7:AAaAAnhZE6PKFKfMA3HAnv0zopFO9yqguDgAgANmQ7bGZSwJixEnshJqgGIbsi9Xr31+JaF7S4Cpu9uvU9/fzecIH0zmpdOc/ZM2dXmIDR1IarSvFtZs1CeTrWD5HB+PSZY/IJPd5gzwZzsxKzpe5qvcrkRAODuaV/ks/7KV2qOt9kjwgEWjA2/Y67dkpvkY/esALj2ikHBjuFfo2XRnlDT74QsLa1PrVFfKtS7EI1GLLnZxQs8jsOZZg9TLt6BL SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2018 13:15:21.1007 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c9332a06-2324-4830-4adc-08d6310df051 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: BYAPR02MB4326 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 --- Chnages 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 f54de80..5bc37dd 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2416,7 +2416,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))