From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCC26C636D4 for ; Fri, 17 Feb 2023 11:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229771AbjBQLsL (ORCPT ); Fri, 17 Feb 2023 06:48:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbjBQLsK (ORCPT ); Fri, 17 Feb 2023 06:48:10 -0500 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 7C2192B091 for ; Fri, 17 Feb 2023 03:48:09 -0800 (PST) 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=rRfbwa4XGp1tB6EPgcjhncfswhgNIHFHYRTBx0Qtpc0=; b=FOp9H52adHrlhPfhqSxpKvo/J1 HU0cdqHynhYvgmiuZOTDCYtLuwg4+ep7Bedxctnag+vR8omE7xGDJeCXZjP0Z9FnyL6R63yeKwDIa i2Kz8oVMfLR+CjnUAFJLbAb2780eJ6CR8/h0Q6qbXp6BsWmB7knLD578fB34CSMpdZrFmQfoAVAWa NB7PHM6bf4UUV+Z+ncgk1i5g1dwtEeKw+OonCVtQh5PSw1hMBeqE+57KdrRZpVJX5PiAI1FQMSsLd ha/bTSR+YQFHF28Solc0C4BbAyDnUgWd/1ZRfHFqvpYieX5T3bf80u7ZamgR5m4UCfFIm7F2+pbFN ZprlPP5g==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:33382) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pSzDh-0000sh-9H; Fri, 17 Feb 2023 11:48:05 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pSzDd-0006lq-OO; Fri, 17 Feb 2023 11:48:01 +0000 Date: Fri, 17 Feb 2023 11:48:01 +0000 From: "Russell King (Oracle)" To: Andrew Lunn Cc: netdev , Florian Fainelli , Vladimir Oltean , Sean Wang , Landen Chao , DENG Qingfang , Matthias Brugger , AngeloGioacchino Del Regno , Doug Berger , Broadcom internal kernel review list , Wei Fang , Shenwei Wang , Clark Wang , NXP Linux Team , UNGLinuxDriver@microchip.com, Byungho An , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Heiner Kallweit , Woojung Huh , Oleksij Rempel Subject: Re: [PATCH RFC 12/18] net: dsa: mt7530: Call phylib for set_eee and get_eee Message-ID: References: <20230217034230.1249661-1-andrew@lunn.ch> <20230217034230.1249661-13-andrew@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230217034230.1249661-13-andrew@lunn.ch> Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Feb 17, 2023 at 04:42:24AM +0100, Andrew Lunn wrote: > phylib should be called in order to manage the EEE settings in the > PHY, and to return EEE status such are supported link modes, and what > the link peer supports. > > Signed-off-by: Andrew Lunn > --- > drivers/net/dsa/mt7530.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > index 214450378978..a472353f14f8 100644 > --- a/drivers/net/dsa/mt7530.c > +++ b/drivers/net/dsa/mt7530.c > @@ -3124,10 +3124,13 @@ static int mt753x_get_mac_eee(struct dsa_switch *ds, int port, > { > struct mt7530_priv *priv = ds->priv; > u32 eeecr = mt7530_read(priv, MT7530_PMEEECR_P(port)); > + struct dsa_port *dp = dsa_to_port(ds, port); > > e->tx_lpi_enabled = !(eeecr & LPI_MODE_EN); > e->tx_lpi_timer = GET_LPI_THRESH(eeecr); > > + if (dp->slave->phydev) > + return phy_ethtool_get_eee(dp->slave->phydev, e); Given that DSA makes use of phylink, is there a reason why we can't use the phylink wrappers here (which may allow for future EEE improvements, e.g. moving the gating of EEE with the TX LPI enable) ? > @@ -3146,6 +3150,8 @@ static int mt753x_set_mac_eee(struct dsa_switch *ds, int port, > set |= LPI_MODE_EN; > mt7530_rmw(priv, MT7530_PMEEECR_P(port), mask, set); > > + if (dp->slave->phydev) > + return phy_ethtool_set_eee(dp->slave->phydev, e); > return 0; Is this the correct place to do the set_eee operation - I mean, the register state has been altered (and it looks like it may enable LPI irrespective of the negotiated state) but what concerns me is that phy_ethtool_set_eee() can fail, and we return failure to userspace yet we've modified register state. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!