Received: by 2002:ac8:71d8:0:b0:40f:fb00:664b with SMTP id i24csp199694qtp; Fri, 4 Aug 2023 08:24:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdcLT5kGdWbxURqXAmVHOxXiuh2OdTKCiMwKLEZAa1oeD0zCMZS7TSvpoaBRldEZjg4/JD X-Received: by 2002:a05:6a20:3d09:b0:12e:73bb:cbb6 with SMTP id y9-20020a056a203d0900b0012e73bbcbb6mr2517043pzi.14.1691162690290; Fri, 04 Aug 2023 08:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691162690; cv=none; d=google.com; s=arc-20160816; b=01ZuAObYtPrJcs/he/jLVENwAmTRK1ZnEYUhtd4DxHALD+8zUhV+3hPT8adOTJQKYh L3hvuMYht9vKn8bmNY1gYPmnjzGS3Toto9u0Qp7hvM1nGpIXQklIUVxMC5YiYfvM8Esc cFL2325SKNZbnbQwPy4LgT+xLp9tJw8xrr96bgpGQ4asxlxLL7uL8y2DbVu7RZTRFHUC XUZ81jdpvdQkfQKgbadIxrRxvOOrVuKuEmN+voMLgyG51jTU25wz0lhe2f5WgDMhLglE 99d8x6wmvsvlQPPhurdXvuAJ/z3ENcFqdZjPUeYqOvtz2fWBSZngZGVHoINXgNKPGEv1 pJXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=l+QtpCMTaabFoppGK/r5iEd/1OhtSkeFkvOkfMMcvfs=; fh=BioDEcnUiWybOwhSpx4SK32/3iOjIsXWhUpHDcyDUY4=; b=cBrEa96uvI/8+J8CTkqKwdEzzPIlUhpKBbTV/aj+3T4+mSTlq8GkwpzadkN14atv6F eCIFntVPQoLH10U+ABwEeR0P0N2DXxaFkGYblp7PSMqYLOoql8E1Kcc+liaIZoGh8umk b84bHloRvsCueCh2i5DDcIvak4Qkv+Qt7SbRbsqhuLY9L+qeCf/RNCZg3xUQ6QpZhcQQ 3S072snpjsxO8yEKYaEl0jMbMxxZ6hdN0Kem6mz/8yxXYzIDsv1eo1W1PEIxcWDUTaFb ZGJoQ76QnvnQJXxDy5WYO7p4RcSvHbSfz7pCZYbwHzvmxZZZ7JLwFQbtFirV2VOGXeso xCfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb14-20020a056a004c8e00b006874e6f72basi1865633pfb.157.2023.08.04.08.24.33; Fri, 04 Aug 2023 08:24:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231722AbjHDOzy (ORCPT + 99 others); Fri, 4 Aug 2023 10:55:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231856AbjHDOzx (ORCPT ); Fri, 4 Aug 2023 10:55:53 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 76CA549D6 for ; Fri, 4 Aug 2023 07:55:50 -0700 (PDT) Received: (qmail 34198 invoked by uid 1000); 4 Aug 2023 10:55:49 -0400 Date: Fri, 4 Aug 2023 10:55:49 -0400 From: Alan Stern To: Dingyan Li <18500469033@163.com> Cc: Hans de Goede , Greg KH , Xiaofan Chen , Oliver Neukum , Tormod Volden , sebastian.reichel@collabora.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Re: Re: [PATCH] USB: add usbfs ioctl to get specific superspeedplus rates Message-ID: References: <2a82ba01-38dd-fad9-98b9-ac8591107921@redhat.com> <151a5748.3e99.189ba07b110.Coremail.18500469033@163.com> <51926ee6-ee81-4543-a1f7-338e65a26670@rowland.harvard.edu> <67b68375.80b5.189bc2653e9.Coremail.18500469033@163.com> <5ccfaa7e.3180.189bec2b80e.Coremail.18500469033@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5ccfaa7e.3180.189bec2b80e.Coremail.18500469033@163.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 04, 2023 at 12:16:19PM +0800, Dingyan Li wrote: > > At 2023-08-04 01:56:03, "Alan Stern" wrote: > >On Fri, Aug 04, 2023 at 12:06:15AM +0800, Dingyan Li wrote: > >> So after usb_device_speed is extended with Gen2x1, Gen1x2 and Gen2x2, > >> it feels that enum usb_ssp_rate becomes useless. Is it okay to just delete it? > >> I'm asking this since it is also used in several other source files so the fix may > >> not be as trivial as it looks. > > > >As long as the file is being used by other source files, don't delete > >it. If you want to fix up all those other places and then delete the > >file, that's fine. But of course, it would have to be a separate set of > >patches. > > > >It will also be necessary to audit the places in the kernel that > >currently use usb_device_speed. Some of them may need to be extended to > >handle the new entries properly. (Including, obviously, the parts of > >the code that store the device's speed in the first place.) > > > > >Alan Stern > > Another issue is that USB_SPEED_SUPER_PLUS has been widely used in > so many files to execute conditional banches. Once we extend and store device's > speed with new values in the first place, we might need to check all places where > USB_SPEED_SUPER_PLUS is used in case of any regression. Certainly. That's part of auditing all the current users of usb_device_speed. > I think maybe we can try to remove the dependency on enum usb_device_speed > in usbfs and define a separate set of speed values similar to previous design > at https://www.spinics.net/lists/linux-usb/msg157709.html > By this way, in usbfs we get more freedom to determine how to explain > usb_device_speed and usb_ssp_rate, without the risk of breaking anything > elsewhere. > > For example, define an USBDEVFS_SPEED_SUPER_PLUS to indicate > USB_SPEED_SUPER_PLUS with ssp rates GEN_UNKNOWN, GEN_2x1 and > GEN_1x2. They all stand for 10Gbps and we don't need to tell one from > another, similar to how it works in sysfs. Then define an > USBDEVFS_SPEED_SUPER_PLUS_BY2(maybe there is a more proper name) > to indicate USB_SPEED_SUPER_PLUS with ssp rate GEN_2x2, which stands > for 20Gbps. You can't really do that. The values returned by the USBDEVFS_GET_SPEED ioctl are the ones defined in include/uapi/linux/usb/ch9.h. They are USB_SPEED_UNKNOWN, etc., not USBDEVFS_SPEED_UNKNOWN, etc. The only way to extend them is by adding new entries to enum usb_device_speed. For example, you must not do anything that would break a user program which does something like this: #include #include ... enum usb_device_speed s; s = ioctl(fd, USBDEVFS_GET_SPEED); if (s == USB_SPEED_HIGH) ... Alan Stern