From patchwork Mon Aug 20 10:04:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zeng Tao X-Patchwork-Id: 144543 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3411550ljj; Sun, 19 Aug 2018 19:01:18 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzxCLd8OyuX1GTZ2VWRjQ/LvGuN4bpm9rEogpdqBWP1gdAqWLrIr05W/v84mrXB2OQ52UbO X-Received: by 2002:a63:190e:: with SMTP id z14-v6mr4875666pgl.302.1534730478166; Sun, 19 Aug 2018 19:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534730478; cv=none; d=google.com; s=arc-20160816; b=dYF94uEcVgjScV8f5fGSlY18fmbxV3pztAZG+4UVaewLxUqcdyBVnquwUcWJkX1l1i HjBYn8JcyU/IoMotpBCeh9mHzn8R8gR4ZvI6cvcs447R8qY1jyp2ijjMvGIHmzifgwHk kRCY1chjSZ78x143WL3ez8aXksAsTN/sMZlLUsuqUB3SKWriSVNjbUH/45+9Wn9RlRZD 2nWudzVOEgM3grZXmcHdJZZDBf+cSqQdbmRRIEfcRFCXPibUw6mGyDNeFnDhGbrXS1vq nawcE4gs2Nd6xqHydd/3e0ge8t1eGSrMUJ5QhrG+GYBqhzioLd5Tl5IVKHOtEUr5P9iK yfGQ== 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:arc-authentication-results; bh=XkQKreXFoofupxyLvNO9Vz/QbWbTQKdNEd5cukz2IZc=; b=J5kMkjS8RvD0Qc6RXB5z7BLDWsVm5MTOzQpbvsZ+8U4Xlx8MNin8HBa7J4S0stikvW XBuogsodjsPA+EW4GE9Qg5Efh68jcNaL2lgF1LsaaWxjOUunKKBoyNoiEvJl8eLVTdrx LI0EfdYIxDqsicjFS2xoH/CS2cd6f5gZtGSFIhw0gQmjFLAkh3UGMzPiGYmh5vbTD0kU q9tAdNz/YaLcTMYvtYnvCVzsVgcFTfGzJw4h8Ef17k/rdsYf0noiACxCTrVHw2GyshJV rG35B4m3pm3tlfnSoDlQq+Rhx3kaIAn2t7M3G5c6dk7kR5qIrWxJOTmwhZLr180etZoT Gidg== 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 r84-v6si8911496pfj.355.2018.08.19.19.01.17; Sun, 19 Aug 2018 19:01:18 -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 S1726274AbeHTFOw (ORCPT + 32 others); Mon, 20 Aug 2018 01:14:52 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:43351 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725805AbeHTFOv (ORCPT ); Mon, 20 Aug 2018 01:14:51 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E25339D6B7804; Mon, 20 Aug 2018 10:01:10 +0800 (CST) Received: from dessert.huawei.com (10.69.192.158) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Mon, 20 Aug 2018 10:01:02 +0800 From: Zeng Tao To: , , , , , , , CC: , Jonathan Corbet , "Thomas Gleixner" , Ingo Molnar , "Rafael J. Wysocki" , Marc Zyngier , Kai-Heng Feng , Thymo van Beers , Frederic Weisbecker , "Konrad Rzeszutek Wilk" , David Rientjes , Mike Looijmans , , , Subject: [PATCH v3] usb: hub: try old enumeration scheme first for high speed devices Date: Mon, 20 Aug 2018 18:04:39 +0800 Message-ID: <1534759484-44744-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 --- Changes in v2: 1. As suggested by Alan, mention in the commit log that this change is follow what the Window does. 2. As suggested by Roger, update the kernel-parameter description. Changes in v3: 1. Remove the blank line suggested by Alan. 2. Tag applied. Acked-by: Alan Stern Signed-off-by: Zeng Tao --- 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 533ff5c..95db23c 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4453,7 +4453,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 1fb2668..003fac0 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?