From patchwork Fri Sep 28 11:27:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zeng Tao X-Patchwork-Id: 147756 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp214108lji; Thu, 27 Sep 2018 20:24:57 -0700 (PDT) X-Google-Smtp-Source: ACcGV63ioce4ccSdzFFl/fGB9SPY3D8L5J3xedLQ2lf6S1aw0O2Fm/bvTE113igontxpTNPZreN8 X-Received: by 2002:a62:4bc6:: with SMTP id d67-v6mr14507474pfj.175.1538105097549; Thu, 27 Sep 2018 20:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538105097; cv=none; d=google.com; s=arc-20160816; b=z04LUNFth1oBQT0/nLWJ9P8QeQNuUQJPemlWcXCnumKFBC4X6M+ljBUoVrlocTfkqW 7bSCARG8Y2eqo9nlsIVEKZKGLW61NlVPUgVFg8jo+YRPBL7mpdI5gEDT3lraVotlQKET mkUURpW0/3Rc5zEmLwcy7etkj6HqjrCFQlF8WUoFQVjpTYyvTHsPBVtNhM2G9TXUKE4K sBSjBfRmMZsnNQ3UPHC6otcnmjCUNQLtXZezhV3fa/p5jBUOd2n20PAMtQY1sFA50xXi ImU/OihMIPUFozou5gS+5HXoeQjICgTWhjaSQy5P7ABIi1BBFJ0/fm3h0FyzuCrozxzB DUAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=zcNstgjD5XHkqdPjgmeggUlZ94nrVgFgDIEbPSYszl4=; b=ccZjj315QE9hGqW57CJYfFEDXNrmLqkyidn+a99qxO97wY4wh/626MyuQ915mXRweM vjw1WbvWeuffHxuix4Rs6efZae7F1wtPqjomSRfjBfTMHmUf/lD0PxqPO9RLgvuwy/dS B8GZ0arTPEc/Aie0IcfLniesdiI4z091WbAAPa7itCcEf7VPYlhWhlYrUVIS2zMF3q1Y JXMtNZTlWQIFg7M2QYyeVhq43AKmFKfIHELAv8edaqY68pa10Vg9dYGZZ3Db9xQnKSLn HV9M4k9Zn9nNZeyfoAlGSyb3kG7S7+kGsUb+8xzvBaQVu6SSIvgnt0VT+I89f36AmolG gKcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8-v6si3688870pgk.351.2018.09.27.20.24.57; Thu, 27 Sep 2018 20:24:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728694AbeI1JqV (ORCPT + 32 others); Fri, 28 Sep 2018 05:46:21 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13139 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726060AbeI1JqU (ORCPT ); Fri, 28 Sep 2018 05:46:20 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 52E5471CDDA82; Fri, 28 Sep 2018 11:24:42 +0800 (CST) Received: from dessert.huawei.com (10.69.192.158) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.399.0; Fri, 28 Sep 2018 11:24:36 +0800 From: Zeng Tao To: , , , , , , , CC: , Jonathan Corbet , "Thomas Gleixner" , Ingo Molnar , Bjorn Helgaas , Kai-Heng Feng , "Thymo van Beers" , Jiri Kosina , "Konrad Rzeszutek Wilk" , Frederic Weisbecker , David Rientjes , , , Subject: [PATCH] usb: hub: try old enumeration scheme first for high speed devices Date: Fri, 28 Sep 2018 19:27:52 +0800 Message-ID: <1538134077-14542-1-git-send-email-prime.zeng@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.69.192.158] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new scheme is required just to support legacy low and full-speed devices. For high speed devices, it will slower the enumeration speed. So in this patch we try the "old" enumeration scheme first for high speed devices, and this is what Windows does since Windows 8. Signed-off-by: Zeng Tao Acked-by: Alan Stern Reviewed-by: Roger Quadros --- Documentation/admin-guide/kernel-parameters.txt | 3 ++- drivers/usb/core/hub.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 92eb1f4..151c527 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4610,7 +4610,8 @@ usbcore.old_scheme_first= [USB] Start with the old device initialization - scheme (default 0 = off). + scheme, applies only to low and full-speed devices + (default 0 = off). usbcore.usbfs_memory_mb= [USB] Memory limit (in MB) for buffers allocated by diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 462ce49..fb4e6bb 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2660,11 +2660,13 @@ static bool use_new_scheme(struct usb_device *udev, int retry, { int old_scheme_first_port = port_dev->quirks & USB_PORT_QUIRK_OLD_SCHEME; + int quick_enumeration = (udev->speed == USB_SPEED_HIGH); if (udev->speed >= USB_SPEED_SUPER) return false; - return USE_NEW_SCHEME(retry, old_scheme_first_port || old_scheme_first); + return USE_NEW_SCHEME(retry, old_scheme_first_port || old_scheme_first + || quick_enumeration); } /* Is a USB 3.0 port in the Inactive or Compliance Mode state?