From patchwork Thu Nov 8 02:47:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 10673389 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 0712614BD for ; Thu, 8 Nov 2018 02:47:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E32B42BCAD for ; Thu, 8 Nov 2018 02:47:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D27742BF84; Thu, 8 Nov 2018 02:47:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 61C5A2BCAD for ; Thu, 8 Nov 2018 02:47:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728701AbeKHMU0 (ORCPT ); Thu, 8 Nov 2018 07:20:26 -0500 Received: from smtprelay.synopsys.com ([198.182.47.9]:40382 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728556AbeKHMU0 (ORCPT ); Thu, 8 Nov 2018 07:20:26 -0500 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id C40D624E0A2E; Wed, 7 Nov 2018 18:47:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1541645231; bh=EKp1O31tL5t0poixbC0R/bRFnr9m8iGAgXmXGpF7hNg=; h=Date:From:Subject:To:CC:From; b=Pf9H0gh5+uy9nhra3k2XASeJit2JAF0YzMCGaBPnSOk+3nlSVJBc4xncYZhMNsKu3 gkqhyov7S/1MzNTx66S4psP/OLiYfd5+se3z9OEne0Z2vMcTscS9YPh4UwwE/pSboQ debc0Nfkl8hsiscqTTTiOikD1i5bIpIJlcgHHe8ow1oVlQZhLoILiC+xLE54nBqBPO AgvfYJehvslFiy8J/GW8/1n03klPf+bIPhomommSSqS4D6+cgKue/1mbSymtTxk3x2 Fi0W6Z4BEvnw4ibjp6EILgsIBKudqd4gibs1611ODjrKjjSEcolIS+LgYHJ8JhUoKE Qvpe8y38uqq/w== Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2.internal.synopsys.com [10.12.239.237]) by mailhost.synopsys.com (Postfix) with ESMTP id 984B53AA6; Wed, 7 Nov 2018 18:47:11 -0800 (PST) Received: from US01WEHTC1.internal.synopsys.com (10.12.239.236) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 18:47:11 -0800 Received: from te-lab16 (10.13.184.20) by us01wehtc1.internal.synopsys.com (10.12.239.236) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 18:47:10 -0800 Received: by te-lab16 (sSMTP sendmail emulation); Wed, 07 Nov 2018 18:47:10 -0800 Date: Wed, 7 Nov 2018 18:47:10 -0800 Message-ID: <58c23ee62fabb5753ce9ea7fc1e93743a5b7781c.1541645048.git.thinhn@synopsys.com> From: Thinh Nguyen Subject: [PATCH v2 1/2] usb: gadget: Add start_frame to usb_request To: Felipe Balbi , Greg Kroah-Hartman , CC: Thinh Nguyen MIME-Version: 1.0 X-Originating-IP: [10.13.184.20] 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 Similar to URB's start_frame, add a field start_frame to the usb_request to report the scheduled (micro)frame number of an isochronous transfer. This option is useful for debugging purposes. Signed-off-by: Thinh Nguyen --- Change in v2: - None include/linux/usb/gadget.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index e5cd84a0f84a..ed9dbbce55ee 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -50,6 +50,7 @@ struct usb_ep; * @short_not_ok: When reading data, makes short packets be * treated as errors (queue stops advancing till cleanup). * @dma_mapped: Indicates if request has been mapped to DMA (internal) + * @start_frame: the reported (micro)frame of the scheduled isoc transfer * @complete: Function called when request completes, so this request and * its buffer may be re-used. The function will always be called with * interrupts disabled, and it must not sleep. @@ -107,6 +108,8 @@ struct usb_request { unsigned short_not_ok:1; unsigned dma_mapped:1; + int start_frame; /* ISO ONLY */ + void (*complete)(struct usb_ep *ep, struct usb_request *req); void *context; From patchwork Thu Nov 8 02:47:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 10673391 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 8DA5B14BD for ; Thu, 8 Nov 2018 02:47:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D9DF2BCAD for ; Thu, 8 Nov 2018 02:47:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6ED952BF84; Thu, 8 Nov 2018 02:47:19 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 0ED4A2BCAD for ; Thu, 8 Nov 2018 02:47:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728703AbeKHMUd (ORCPT ); Thu, 8 Nov 2018 07:20:33 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:32868 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728556AbeKHMUc (ORCPT ); Thu, 8 Nov 2018 07:20:32 -0500 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 3483210C0817; Wed, 7 Nov 2018 18:47:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1541645238; bh=vWynKbKWCmx6pgWNjMAF+vpmfht2AEALDBUch+txaFg=; h=Date:In-Reply-To:References:From:Subject:To:CC:From; b=ThGO8WQbQPHoLtXODbhvMUUde7RRJ8U8wq5nu1oLL2ChI5g5Zd/vRfO3ZjwAuZL9F WfJA+mS6C5/Y6eH1DHDlZj1D7ndD7dBlataMO2fEknHTp8VDdaOkdyL+6Z6IjL4GIn qAd+UdTWHm8lzCtT6bABZewFvVg6YbYVmEqYfawDV8LfOuNyWvEgUKdYjmxvoNeGee Ft7HFk2bWslF62/9MIj40kbCDkOdBN6yronE9KYYRLcObytXYLxbAI3ibRYs+iBQJM LeD3nmSzamqv6NCU3wBgfH2CZSZ91+oCKIp2IlQbFWBHdcN0a5bMko0J3/8RQ5Hl+w 8HXptSJS3PY/w== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id 23A255642; Wed, 7 Nov 2018 18:47:18 -0800 (PST) Received: from US01WEHTC1.internal.synopsys.com (10.12.239.236) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 18:47:17 -0800 Received: from te-lab16 (10.13.184.20) by us01wehtc1.internal.synopsys.com (10.12.239.236) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 18:47:16 -0800 Received: by te-lab16 (sSMTP sendmail emulation); Wed, 07 Nov 2018 18:47:16 -0800 Date: Wed, 7 Nov 2018 18:47:16 -0800 Message-ID: <84f7883818b412fcb42b6705d4d6ad14adfd0eb9.1541645048.git.thinhn@synopsys.com> In-Reply-To: <58c23ee62fabb5753ce9ea7fc1e93743a5b7781c.1541645048.git.thinhn@synopsys.com> References: <58c23ee62fabb5753ce9ea7fc1e93743a5b7781c.1541645048.git.thinhn@synopsys.com> From: Thinh Nguyen Subject: [PATCH v2 2/2] usb: dwc3: gadget: Report isoc scheduled frame number To: Felipe Balbi , Greg Kroah-Hartman , CC: John Youn , Thinh Nguyen MIME-Version: 1.0 X-Originating-IP: [10.13.184.20] 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 Report the scheduled frame number of an isochronous request. Signed-off-by: Thinh Nguyen --- Change in v2: - Capture frame number at request cleanup drivers/usb/dwc3/gadget.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 679c12e14522..5e5e799699de 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2345,6 +2345,10 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, req->request.actual = req->request.length - req->remaining; + /* Report scheduled frame number for isoc transfers */ + if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) + req->request.start_frame = dep->frame_number; + if (!dwc3_gadget_ep_request_completed(req) && req->num_pending_sgs) { __dwc3_gadget_kick_transfer(dep);