Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp60616pxf; Tue, 6 Apr 2021 15:01:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3iaPq4G7gPIxTV/Sb7MRkSteQrONGtzbdOTNrnTLpKRkwItLm7hNoBU37eL52gjGcrok2 X-Received: by 2002:a05:6638:35ab:: with SMTP id v43mr293093jal.65.1617746471626; Tue, 06 Apr 2021 15:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617746471; cv=none; d=google.com; s=arc-20160816; b=dEUwXh3yGmFkTLMuZXHyIvYvLYtiz4Lb/7HwkOW0MFZAK59aBOpF20A1YU1ZtZwHsf yLARFCyhh02b/ueyE2PkPrg/+l0C4khfAI4JvI/C43NJrAA8aeQMnOej+M1CaEtM6jmC 0pjdbtlSlvW6szd9VBjgkfuKJ/dVpslKn3lny0OYBBaXSt8fIEfsOIBBP+wKqUaB911E nhkDh3nfQQ/YPUltLTC1Q3nUiFCqArFR8cgA2zBWkXMvJUuO713slS2q/55CRHU1tlLc vMlP9gtehbx+fC/tjGR2m7dSvtk1iaHKwb/WRa0t7W82x+TbdjZdYjXO1Rc6gjlndHzK 7NTw== 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=Ovk8Ill6RYCZLzWJbAKOL5+Y7N2tY/40lwIZl/zAMKg=; b=IQkwRbVDYoJsNzRP7OfIZoMlAqcb2eHBgzllDg1/UC6Dhn21XBT0Muh94Csq81ZdNl pPVLEGuCs1u9UwKYLKEiWdXPXkDTQWwsTDLKnWp09p+bnz/oKO6rG8qToHpeYlIRG4d0 u74TqCkyIki4c7PpeVdsauNXmVA7M+tr13ovRveXzdGQS+jl4y+AXYUP/C6frAdnppc5 ISmB2uP40Q0rZGtd/OgrIuFhgIWZIEiBlBG5UQgFvP+eKWWjQBCJIML5T5m8kDVSu210 luw3d1jAs+C8NW5lem1pRj579Kqp4CdImM1554utO1iQVxK+hvQBFk+S2sZHDC+lMj+r Ej6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si18537805iod.10.2021.04.06.15.00.58; Tue, 06 Apr 2021 15:01:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344262AbhDFNAp (ORCPT + 99 others); Tue, 6 Apr 2021 09:00:45 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:35734 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237885AbhDFNAo (ORCPT ); Tue, 6 Apr 2021 09:00:44 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1lTlJU-00F7Go-B3; Tue, 06 Apr 2021 15:00:12 +0200 Date: Tue, 6 Apr 2021 15:00:12 +0200 From: Andrew Lunn To: Grant Grundler Cc: Oliver Neukum , Jakub Kicinski , Roland Dreier , nic_swsd , netdev , "David S . Miller" , LKML Subject: Re: [PATCH net-next v4 0/4] usbnet: speed reporting for devices without MDIO Message-ID: References: <20210405231344.1403025-1-grundler@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > Speed: 2500Mb/s and Duplex: Half is very unlikely. You really only > > ever see 10 Half and occasionally 100 Half. Anything above that will > > be full duplex. > > > > It is probably best to admit the truth and use DUPLEX_UNKNOWN. > > Agreed. I didn't notice this "lie" until I was writing the commit > message and wasn't sure off-hand how to fix it. Decided a follow on > patch could fix it up once this series lands. > > You are right that DUPLEX_UNKNOWN is the safest (and usually correct) default. > Additionally, if RX and TX speed are equal, I am willing to assume > this is DUPLEX_FULL. Is this same interface used by WiFi? Ethernet does not support different rates in each direction. So if RX and TX are different, i would actually say something is broken. 10 Half is still doing 10Mbps in each direction, it just cannot do both at the same time. WiFi can have asymmetric speeds. > I can propose something like this in a patch: > > grundler <1637>git diff > diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c > index 86eb1d107433..a7ad9a0fb6ae 100644 > --- a/drivers/net/usb/usbnet.c > +++ b/drivers/net/usb/usbnet.c > @@ -978,6 +978,11 @@ int usbnet_get_link_ksettings_internal(struct > net_device *net, > else > cmd->base.speed = SPEED_UNKNOWN; > > + if (dev->rx_speed == dev->tx_speed) > + cmd->base.duplex = DUPLEX_FULL; > + else > + cmd->base.duplex =DUPLEX_UNKNOWN; > + > return 0; > } > EXPORT_SYMBOL_GPL(usbnet_get_link_ksettings_internal); So i would say this is wrong. I would just set DUPLEX_UNKNOWN and be done. > I can send this out later once this series lands or you are welcome to > post this with additional checks if you like. Yes, this discussion should not prevent this patchset from being merged. > If we want to assume autoneg is always on (regardless of which type of > media cdc_ncm/cdc_ether are talking to), we could set both supported > and advertising to AUTO and lp_advertising to UNKNOWN. I pretty much agree autoneg has to be on. If it is not, and it is using a forced speed, there would need to be an additional API to set what it is forced to. There could be such proprietary calls, but the generic cdc_ncm/cdc_ether won't support them. But i also don't know how setting autoneg actually helps the user. Everybody just assumes it is supported. If you really know auto-neg is not supported and you can reliably indicate that autoneg is not supported, that would be useful. But i expect most users want to know if their USB 2.0 device is just doing 100Mbps, or if their USB 3.0 device can do 2.5G. For that, you need to see what is actually supported. Andrew