Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10625676rwp; Fri, 21 Jul 2023 02:10:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlHm4AytC3nChTcLvb1KINMRzgrO6xlWQ9zjSPR+634oBuCJO6tFCp+YhwocPPznLiGcq5CY X-Received: by 2002:a05:6402:1283:b0:51a:3159:53c7 with SMTP id w3-20020a056402128300b0051a315953c7mr1022034edv.30.1689930641875; Fri, 21 Jul 2023 02:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689930641; cv=none; d=google.com; s=arc-20160816; b=epiLC9nLsFU2+Uga13ksYfjs5cLta9PP3iqj7xkuSs64UnJFzyQZ2SEOHzmjK5deyr UHq81kxXDtFbr4JecmaW6k53gV1mzqBM9EpS2DrNhAC5+g6fqM3dt+OMGHHy0lV8yxNT GCoybu7m2MRi1Gxv+eckRNGJMKF+qybUP0yoXv/abrLBWRvFuadjw3+JNJ+UOpELxGbj YU36hQi7ftn3GtQIrZEwOYdnvaeGmwSuLzVqX5fJ/WaUq3bpWICaR6jJVQ7Lxkji14XD SnKIGVTq3bmkIdC+VBm75bHP1KuX+Fwne74MxBfUpyA/Jw4gpiYknuR5LrUe6w1zk6sY OI/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ZlqTZIG9kHsQHMtUxAgAHwbfnHjC2uhmMAQbCVu+9Ag=; fh=Wg0BpsE0hPD224Peo/9nern1WqckwEDxDMlDM9dXddI=; b=Kgejo+G6XgCfqTX1y59Ntr33/wihkmgjNSGGxJkfUv5DM9UvEj7QCWabVj/wsdfFH/ TGV2tMbPWR5QqCD21OKvN/42oSXOoWd6WAP4/FAJE6DZYJ1FC4KvB6MfY0Twai58uUOx IwTreb8MBZVHp2C4eni3ndSZSL0V+XTvGUNoinO2X2CShczq6dcQWB01S1YlpiMqHiOR JteZNGlyiUazxL7mOpik21OwR+eQMiXvExUGtNI6arxDA1htAgMKXWZ9884BKOEyLLFl xZNWDZ6zSVo04ANIAg6VEHXaqbDM96QTWjkTNh6vkWq3R4czvPdpNHl1p48RxDnpGFR9 3V6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=lIeE8TrE; 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=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n12-20020a056402060c00b0051e0c5c1e93si2081285edv.538.2023.07.21.02.10.15; Fri, 21 Jul 2023 02:10:41 -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; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=lIeE8TrE; 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=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230291AbjGUIxk (ORCPT + 99 others); Fri, 21 Jul 2023 04:53:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbjGUIxi (ORCPT ); Fri, 21 Jul 2023 04:53:38 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19E9A2D75; Fri, 21 Jul 2023 01:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZlqTZIG9kHsQHMtUxAgAHwbfnHjC2uhmMAQbCVu+9Ag=; b=lIeE8TrEWNhg1gyfmICGnGY59T Frxa2q3pNEjhTYAvaoLrkMS/6FuAsAmFbgIbCiabFxilUoDgyvxJWiqCrVrRejGRwHwv1KN+x4pWp jns56XqqukyZDI6kXRpGIpRkaDLhE9J5nJUMWC+qly5DoU0LL2L647bo1Nj/6TwcUTXdGE2fbMBw/ 0mY+xDCTQm7gZn0CAZ+ezWX5i0bJnMdaXk/OY5sOSJu8OBi/PIjVBYYE9iSoEXG9SF8XlJihbDmao mIaZd1HA/OPivMeGgYgTca3nhPUNNLlZt3XIPW1fD65qeVhUfnFWloUb/geq3ucyKsIfphggITlqn eTO0LlUQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:57498) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qMltG-0003W5-1T; Fri, 21 Jul 2023 09:53:34 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qMltF-0005zK-PE; Fri, 21 Jul 2023 09:53:33 +0100 Date: Fri, 21 Jul 2023 09:53:33 +0100 From: "Russell King (Oracle)" To: Raju Lakkaraju Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org, bryan.whitehead@microchip.com, andrew@lunn.ch, UNGLinuxDriver@microchip.com Subject: Re: [PATCH net-next 6/7] net: lan743x: Add support to ethtool phylink get and set settings Message-ID: References: <20230721060019.2737-1-Raju.Lakkaraju@microchip.com> <20230721060019.2737-7-Raju.Lakkaraju@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230721060019.2737-7-Raju.Lakkaraju@microchip.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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, Jul 21, 2023 at 11:30:18AM +0530, Raju Lakkaraju wrote: > Add support to ethtool phylink get/set settings for the network interface via > ethtool like speed, duplex etc. > > Signed-off-by: Raju Lakkaraju > --- > .../net/ethernet/microchip/lan743x_ethtool.c | 34 +++++++++++++++++-- > 1 file changed, 32 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c > index 2db5949b4c7e..3004863bebf8 100644 > --- a/drivers/net/ethernet/microchip/lan743x_ethtool.c > +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c > @@ -1134,6 +1134,36 @@ static int lan743x_ethtool_set_eee(struct net_device *netdev, > return phy_ethtool_set_eee(phydev, eee); > } > > +static int lan743x_ethtool_set_link_ksettings(struct net_device *netdev, > + const struct ethtool_link_ksettings *cmd) > +{ > + struct lan743x_adapter *adapter = netdev_priv(netdev); > + int ret; > + > + if (adapter->phylink) { > + ret = lan743x_lsd_update(cmd->base.speed, cmd->base.duplex, > + cmd->base.master_slave_state); > + if (ret < 0) > + return ret; > + > + adapter->sgmii_lsd = ret; I guess this is how you are hacking SGMII to do what you want - using the ethtool master_slave_state to control whether SGMII is operating as a "host" or a "PHY", and I would say it's a hack to make stuff work the way you want it to, so you can run SGMII over a DAC cable at speeds such as 100M. I really don't see what the point of that is. In any case, doing this is buggy. You update state, and then call into phylink. What if phylink returns an error? You've updated the state which may take effect if the link goes up/down but maybe the settings were rejected by phylink. Sorry, but no, this to me is a gross hack. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!