From patchwork Tue Feb 12 08:57:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 10807543 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 601CF6C2 for ; Tue, 12 Feb 2019 08:57:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F2A82989F for ; Tue, 12 Feb 2019 08:57:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 428102A922; Tue, 12 Feb 2019 08:57:33 +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 AFC8E2989F for ; Tue, 12 Feb 2019 08:57:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728655AbfBLI5c (ORCPT ); Tue, 12 Feb 2019 03:57:32 -0500 Received: from mail-eopbgr40043.outbound.protection.outlook.com ([40.107.4.43]:27522 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728496AbfBLI5b (ORCPT ); Tue, 12 Feb 2019 03:57:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i893J/m305tNHeq9zfESgqzlyuiY+dN0yj9ICvdRfLw=; b=OznIVN/jLEeRLo/nGRmUhYeWpIDzrqh63+npzDYoOR0KTvYF9GaawGa/UaqiN5pfIHhkexpVpW2be29G9b9CCwc9l5OZGMuo7lX6pgIiQ/03wQEFDj9MXzEECvb4yC/aVIF7CvSBsap0QxeIHAOqW51YqmTGdxxPaNI6AVDWGKQ= Received: from VI1PR04MB5327.eurprd04.prod.outlook.com (20.177.52.16) by VI1PR04MB4287.eurprd04.prod.outlook.com (52.134.31.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.17; Tue, 12 Feb 2019 08:57:28 +0000 Received: from VI1PR04MB5327.eurprd04.prod.outlook.com ([fe80::790f:a219:bcbd:6fd2]) by VI1PR04MB5327.eurprd04.prod.outlook.com ([fe80::790f:a219:bcbd:6fd2%3]) with mapi id 15.20.1622.016; Tue, 12 Feb 2019 08:57:28 +0000 From: Peter Chen To: "gregkh@linuxfoundation.org" , "stern@rowland.harvard.edu" CC: "linux-usb@vger.kernel.org" , dl-linux-imx , Peter Chen , Pawel Laszczak Subject: [PATCH 1/1] usb: misc: usbtest: add super-speed isoc support Thread-Topic: [PATCH 1/1] usb: misc: usbtest: add super-speed isoc support Thread-Index: AQHUwrD6kG30JUwqLUykAHcsydzTkA== Date: Tue, 12 Feb 2019 08:57:27 +0000 Message-ID: <20190212085505.26593-1-peter.chen@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.14.1 x-clientproxiedby: HK2PR06CA0021.apcprd06.prod.outlook.com (2603:1096:202:2e::33) To VI1PR04MB5327.eurprd04.prod.outlook.com (2603:10a6:803:60::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peter.chen@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR04MB4287;6:lKOWISkaYZJaI9vpqZEYOgssVL4Af9tJ0Ld14PKgG3l48yyGnpoPrryY7mhY0QlzWnU4la5i78E14UA8nwp56B9h6wFUB+0CSLyj6VeK63j0bkyzQbMWRD2am8tHv6OrBUuWnefhmrkzBQtF53sfi8GDeRJOsgW4/rudDQY9+6V9CxSm0WCxiFJDvAdtv+cpZ5icome8EOVPmOYdm3UZ6HxcIcSfMv4I99E42ZA93gV5PT1QzY3Fi6OskfO+6j7D/DfiYI4TUJRc2EI6tWlsn2ePZ0iHJrvLGqPjhNE0yl17bFQY+aPKbC0zc6VlEhgZlz4RTe5hHznEUCxBkHRAxyoGlGyZ6UAucrsclYPkpVOelR8I7G7jaXbzyBC9NHPuYdE55ry8ESeooLd/6Khz9NYTygajthRjDu7L3J4IOGNqpFNNAGieKI7DSTWuKp8456PZ0Yp9cK3y3Mc+ybFp6A==;5:zonjkXCGpgnWyhijkoq56RRSLRnzB/ybO3/WzSILmrLO05zBDl8+1cD33+8yrCarVoC1EvjUlY+yJtGvET0rjnNbnocSsr0gv1XPFDaReWvA6mkiqa+k/s6Rqkk3RpF4w/Oy1QuBiPSxweXBL814Min4Kwlz4jHspBA3Nif3gZjTl3boysLdbJgrdGUOHJ14/566TWD/xIXKN9iAejnA2A==;7:j7G+DQhnCuIJdpMtN2//VtAO03XYO7duGDWHI9q1/vqByKKUwhS13bN27p9lnMwDEhuu98dHJiadvhk5dSB0Ji1gM2sckxvhArd8Pf2HqGnFw/cty8gFBTzgB/y/T7YtHXQ8doz2Xye9X5+GiMSV1A== x-ms-office365-filtering-correlation-id: 31d4828c-7745-433f-dba8-08d690c81d31 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB4287; x-ms-traffictypediagnostic: VI1PR04MB4287: x-microsoft-antispam-prvs: x-forefront-prvs: 0946DC87A1 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(366004)(136003)(376002)(396003)(39860400002)(189003)(199004)(2171002)(8936002)(2616005)(6486002)(66066001)(54906003)(110136005)(316002)(486006)(478600001)(68736007)(14454004)(1076003)(50226002)(2501003)(476003)(6512007)(8676002)(81156014)(81166006)(2906002)(305945005)(7736002)(6436002)(256004)(386003)(4326008)(71200400001)(6506007)(71190400001)(99286004)(25786009)(3846002)(6116002)(52116002)(44832011)(186003)(86362001)(106356001)(53936002)(36756003)(97736004)(102836004)(26005)(105586002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4287;H:VI1PR04MB5327.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 3SIkuoAS5GyzUH2hnqYEjqnmWn1+M1X6twwfZBfMerm6EyArJvNS2frTrP3J/LWOCp0ccgjMnNxWBw3gU7UuVOsm6arO4kooDjYzoy1ICpHEFlgE3Fjzx/HiGDEUA8yZiBVE76mQD3P+TMptVtWgdmgLXwLzkh2PJXXp83EFG2KaShZaCS9efBvXsvzOIy1+IEF1rc69rTnq0jB0JiN1uN8gZJW3QMkNEraQKYM8xadX8Nc3uAn0Yr9E+7K0WPBK2Y/ZtW1crRSKswN/0loY7Lox5AwmvDJw+t7j9nfPVRE9OyqUi8e4mpwTMzX80xDL8N6i1i9u7ANVZ2igCC+D4ntcltIDde4J6G4MnIpo/8tvA0de0U55oySSpp57MakxFvdNjFOqLY7dix7s+VteE0P4Hh3zyD/PWzMoB7xTfrs= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31d4828c-7745-433f-dba8-08d690c81d31 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Feb 2019 08:57:25.5824 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4287 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 calculation of packet number within microframe is different between high-speed and super-speed endpoint, we add support for super-speed in this patch. Cc: Pawel Laszczak Signed-off-by: Peter Chen --- drivers/usb/misc/usbtest.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index c7f82310e73e..98ada1a3425c 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -347,6 +347,14 @@ static unsigned get_maxpacket(struct usb_device *udev, int pipe) return le16_to_cpup(&ep->desc.wMaxPacketSize); } +static int ss_isoc_get_packet_num(struct usb_device *udev, int pipe) +{ + struct usb_host_endpoint *ep = usb_pipe_endpoint(udev, pipe); + + return USB_SS_MULT(ep->ss_ep_comp.bmAttributes) + * (1 + ep->ss_ep_comp.bMaxBurst); +} + static void simple_fill_buf(struct urb *urb) { unsigned i; @@ -1976,8 +1984,13 @@ static struct urb *iso_alloc_urb( if (bytes < 0 || !desc) return NULL; + maxp = usb_endpoint_maxp(desc); - maxp *= usb_endpoint_maxp_mult(desc); + if (udev->speed >= USB_SPEED_SUPER) + maxp *= ss_isoc_get_packet_num(udev, pipe); + else + maxp *= usb_endpoint_maxp_mult(desc); + packets = DIV_ROUND_UP(bytes, maxp); urb = usb_alloc_urb(packets, GFP_KERNEL); @@ -2065,17 +2078,24 @@ test_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param, packets *= param->iterations; if (context.is_iso) { + int transaction_num; + + if (udev->speed >= USB_SPEED_SUPER) + transaction_num = ss_isoc_get_packet_num(udev, pipe); + else + transaction_num = usb_endpoint_maxp_mult(desc); + dev_info(&dev->intf->dev, "iso period %d %sframes, wMaxPacket %d, transactions: %d\n", 1 << (desc->bInterval - 1), - (udev->speed == USB_SPEED_HIGH) ? "micro" : "", + (udev->speed >= USB_SPEED_HIGH) ? "micro" : "", usb_endpoint_maxp(desc), - usb_endpoint_maxp_mult(desc)); + transaction_num); dev_info(&dev->intf->dev, "total %lu msec (%lu packets)\n", (packets * (1 << (desc->bInterval - 1))) - / ((udev->speed == USB_SPEED_HIGH) ? 8 : 1), + / ((udev->speed >= USB_SPEED_HIGH) ? 8 : 1), packets); }