From patchwork Tue Jan 7 16:28:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929309 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 489CE1F4E45 for ; Tue, 7 Jan 2025 16:28:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267327; cv=none; b=usIyn0xUplbWfB3RKya9yDXK1WNNbCJuHdkXy/nOxq4fJLc3HOZM2yBqJDT+qSQvNuCUaa06Tsi5WO1d8Eafbt142bkWxzeaJMLhJyxXwbOab5lMml0D2JWiVGINuH/4orsb+sd0q1xrXTYL3K2M4cDBtQVU0qxZSF972u8nQBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267327; c=relaxed/simple; bh=O4MlM9GRQ4VMmTJ+BrHpXuZ1spwI+aMOhgg3ziv4GMY=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=icg2+K3+VtB0tIL20JKCcb2Jkut3xZUBFGZerHFb7oXW7pwcbvJC/SmUx3xdnZ76huqchFWfA1VRy3l0OpPvnV8vSse6Zh5BxOpB3pAl+9c0LCUqen8hP+OlRqBQL4iuIlAf+YSarmKbgyfSG9Saja/4k6XYsCb0rA9sfP/Ac4U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=e6EJzdYz; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="e6EJzdYz" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=CT43NNJbVwdfAfypfZGQdJlroOFKN88S2LgKWnUbjeQ=; b=e6EJzdYz+0XEXOiTNoCBaEjosb jL7sqlVEZwnuiz200R35bre/yBGiRv/seyh2Jgdy/Xv/Poh6E3rqnyVobE/FfkGesEJ15kzJL/A0u 7U1mO7IjwcSIPeJpktqShxEht9AMXHY3Nqx7t3R5e8+C85mEMMMaP0pSzizzJ7b52U4DV8oD1rt29 wwkbiNKjGMVcVqrkrA+FIlml/501+bQYo3yeyWEpTuKnU0fEN30NUt5EZpUL7Y4lhNEE/3COV365Z LGCQnewx29KAO18+hPc6AkTwrN6DdhaKdhD/k6M/Bj5k7u64eMikVMPSKkO9krXvTGvCTtL4UQNRm tW14n48g==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:53834 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCRX-0007kp-0W; Tue, 07 Jan 2025 16:28:35 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCRU-007Y2z-5b; Tue, 07 Jan 2025 16:28:32 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 01/18] net: phy: add configuration of rx clock stop mode Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:28:32 +0000 X-Patchwork-Delegate: kuba@kernel.org Add a function to allow configuration of the PCS's clock stop enable bit, used to configure whether the xMII receive clock can be stopped during LPI mode. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/phy/phy.c | 27 ++++++++++++++++++++++----- include/linux/phy.h | 1 + 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index e4b04cdaa995..a4b9fcc2503a 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1640,6 +1640,27 @@ void phy_mac_interrupt(struct phy_device *phydev) } EXPORT_SYMBOL(phy_mac_interrupt); +/** + * phy_eee_rx_clock_stop() - configure PHY receive clock in LPI + * @phydev: target phy_device struct + * @clk_stop_enable: flag to indicate whether the clock can be stopped + * + * Configure whether the PHY can disable its receive clock during LPI mode, + * See IEEE 802.3 sections 22.2.2.2, 35.2.2.10, and 45.2.3.1.4. + * + * Returns: 0 or negative error. + */ +int phy_eee_rx_clock_stop(struct phy_device *phydev, bool clk_stop_enable) +{ + /* Configure the PHY to stop receiving xMII + * clock while it is signaling LPI. + */ + return phy_modify_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1, + MDIO_PCS_CTRL1_CLKSTOP_EN, + clk_stop_enable ? MDIO_PCS_CTRL1_CLKSTOP_EN : 0); +} +EXPORT_SYMBOL_GPL(phy_eee_rx_clock_stop); + /** * phy_init_eee - init and check the EEE feature * @phydev: target phy_device struct @@ -1664,11 +1685,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) return -EPROTONOSUPPORT; if (clk_stop_enable) - /* Configure the PHY to stop receiving xMII - * clock while it is signaling LPI. - */ - ret = phy_set_bits_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1, - MDIO_PCS_CTRL1_CLKSTOP_EN); + ret = phy_eee_rx_clock_stop(phydev, true); return ret < 0 ? ret : 0; } diff --git a/include/linux/phy.h b/include/linux/phy.h index 5bc71d59910c..4875465653ca 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -2096,6 +2096,7 @@ int phy_unregister_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask); int phy_unregister_fixup_for_id(const char *bus_id); int phy_unregister_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask); +int phy_eee_rx_clock_stop(struct phy_device *phydev, bool clk_stop_enable); int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable); int phy_get_eee_err(struct phy_device *phydev); int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_keee *data); From patchwork Tue Jan 7 16:28:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929310 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79F4E1F4E22 for ; Tue, 7 Jan 2025 16:28:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267333; cv=none; b=tlN48V3NGbRGhI0Xo9kCDIOzAaGztA2A6oYSaa9faGALAL3KLlcajD9+WIknhe+LRiktp9QQIgo8JMvlUh56tGAZXJwMbZOmyxOKlcBTkQivw2AFgSnbstMVzGVDBbpovZHEfuCwOv8dVGxUBWpX7IvkQ6Zse/ZNmEimckeKRYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267333; c=relaxed/simple; bh=lv3pYfcJlkaA83svlLqJsyQ5NrGIkEE9ihP2bwmThT0=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=Oq8Ss1d0sFidEhlh5nGu9HyuWHBZ/c5Yaqd/Egad/o6MceSdbI4TZZ6twOQOhVetV+diz8tF1ohftEWhKis495erTVSON5dexj2UmmkrGZ9fDTkqjTwKeTD7L8AUxzdsTkHA6u7Hm5/j2rZNohGm5syJibdJd0gZeHQ1M0sd5dE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=CErZwv53; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="CErZwv53" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=wTucdxBsyxS+cOkxhWYe5qi3kbnYyn1rZzQUdPRV6AU=; b=CErZwv53EbAfcUTro+IQZdt8OF z+jMwdnNkj1P1h8pBqsU9vRzWl5rn2rijHV188jigSDfKTj25vI7b32TtCKIouG72OdVGBrUhkRW7 gYDEkRxO2vKJ30sZiFKhPsnLSqpqCx6/5B4jLI000P37jKtct3ffwOzCqkFb/W6EcxVcE3+LYNkWO Z9WRSoVMNGlHzzX9eA993JNUE+t9c6yZ3D3ojEHLukQ0f7eRE+oV0dm78BGCy8AH0vBqqHumdzwIJ Ov+l6oE5DVMWnaal6H8CQ1QR80Q5qUzcHj507IAghTcjdsvi4lfWt7lvSMQo1tAVgNIYnZq1K7DvB 8pw5Ar9Q==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:41200 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCRc-0007l1-0w; Tue, 07 Jan 2025 16:28:40 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCRZ-007Y35-9N; Tue, 07 Jan 2025 16:28:37 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 02/18] net: stmmac: move tx_lpi_timer tracking to phylib Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:28:37 +0000 X-Patchwork-Delegate: kuba@kernel.org When stmmac_ethtool_op_get_eee() is called, stmmac sets the tx_lpi_timer and tx_lpi_enabled members, and then calls into phylink and thus phylib. phylib overwrites these members. phylib will also cause a link down/link up transition when settings that impact the MAC have been changed. Convert stmmac to use the tx_lpi_timer setting in struct phy_device, updating priv->tx_lpi_timer each time when the link comes up, rather than trying to maintain this user setting itself. We initialise the phylib tx_lpi_timer setting by doing a get_ee-modify-set_eee sequence with the last known priv->tx_lpi_timer value. In order for this to work correctly, we also need this member to be initialised earlier. As stmmac_eee_init() is no longer called outside of stmmac_main.c, make it static. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) Tested-by: Choong Yong Liang --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 14 +------------ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++++++++++++----- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index b8d631e559c0..df386fc948ec 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -406,7 +406,6 @@ int stmmac_dvr_probe(struct device *device, struct plat_stmmacenet_data *plat_dat, struct stmmac_resources *res); void stmmac_disable_eee_mode(struct stmmac_priv *priv); -bool stmmac_eee_init(struct stmmac_priv *priv); int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt); int stmmac_reinit_ringparam(struct net_device *dev, u32 rx_size, u32 tx_size); int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 16b4d8c21c90..0429a99a8114 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -898,7 +898,6 @@ static int stmmac_ethtool_op_get_eee(struct net_device *dev, if (!priv->dma_cap.eee) return -EOPNOTSUPP; - edata->tx_lpi_timer = priv->tx_lpi_timer; edata->tx_lpi_enabled = priv->tx_lpi_enabled; return phylink_ethtool_get_eee(priv->phylink, edata); @@ -908,7 +907,6 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev, struct ethtool_keee *edata) { struct stmmac_priv *priv = netdev_priv(dev); - int ret; if (!priv->dma_cap.eee) return -EOPNOTSUPP; @@ -920,17 +918,7 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev, if (!edata->eee_enabled) stmmac_disable_eee_mode(priv); - ret = phylink_ethtool_set_eee(priv->phylink, edata); - if (ret) - return ret; - - if (edata->eee_enabled && - priv->tx_lpi_timer != edata->tx_lpi_timer) { - priv->tx_lpi_timer = edata->tx_lpi_timer; - stmmac_eee_init(priv); - } - - return 0; + return phylink_ethtool_set_eee(priv->phylink, edata); } static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 2f518ec845ec..ddb79e8880e9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -469,7 +469,7 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t) * can also manage EEE, this function enable the LPI state and start related * timer. */ -bool stmmac_eee_init(struct stmmac_priv *priv) +static bool stmmac_eee_init(struct stmmac_priv *priv) { int eee_tw_timer = priv->eee_tw_timer; @@ -1088,6 +1088,7 @@ static void stmmac_mac_link_up(struct phylink_config *config, priv->eee_active = phy_init_eee(phy, !(priv->plat->flags & STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0; + priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer; priv->eee_enabled = stmmac_eee_init(priv); priv->tx_lpi_enabled = priv->eee_enabled; stmmac_set_eee_pls(priv, priv->hw, true); @@ -1187,6 +1188,16 @@ static int stmmac_init_phy(struct net_device *dev) ret = phylink_fwnode_phy_connect(priv->phylink, fwnode, 0); } + if (ret == 0) { + struct ethtool_keee eee; + + /* Configure phylib's copy of the LPI timer */ + if (phylink_ethtool_get_eee(priv->phylink, &eee)) { + eee.tx_lpi_timer = priv->tx_lpi_timer; + phylink_ethtool_set_eee(priv->phylink, &eee); + } + } + if (!priv->plat->pmt) { struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; @@ -3446,10 +3457,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool ptp_register) priv->eee_tw_timer = STMMAC_DEFAULT_TWT_LS; - /* Convert the timer from msec to usec */ - if (!priv->tx_lpi_timer) - priv->tx_lpi_timer = eee_timer * 1000; - if (priv->use_riwt) { u32 queue; @@ -3916,6 +3923,10 @@ static int __stmmac_open(struct net_device *dev, u32 chan; int ret; + /* Initialise the tx lpi timer, converting from msec to usec */ + if (!priv->tx_lpi_timer) + priv->tx_lpi_timer = eee_timer * 1000; + ret = pm_runtime_resume_and_get(priv->device); if (ret < 0) return ret; From patchwork Tue Jan 7 16:28:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929311 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E70C1F4E3E for ; Tue, 7 Jan 2025 16:28:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267338; cv=none; b=QeuDY2ZcCnG6uuAgtVaJy1uuskN/k7JCGbCWoRNVdnyS0LBFBfClTkP+tHh51gaS3lbLetww2wsIyAJSecXKDNffrdipD9dLULKpsI16/k0y6PBNarzuRH12RnU7/FwaqGgKAbZnaLS0w4w/aX/LgvPTsQZ4p4TvXuPpt6AKgC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267338; c=relaxed/simple; bh=OqtWsIsUylVRL8u4Mol35+WwpHuAeN5tEmi+caSxiZM=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=cVkT35lGi/VcYvJ34MM8eAJAwFcnOYRwMDprbrDX4t+akeChGf03tJtWEZLqmpHgvloFEWZW2BwPZTa+Sjhq6ZvfHz4oTRE8aF8HFadIsi9RxsjsYoKjGgenc1UQMxELp3i7hh2Ccj2G9FPOLi5Vu+k2/CybsvCaVh77Mc6FMaE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=mKSS77Jc; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="mKSS77Jc" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=Hy6dMB/NYlTUoopxS/bUiLuE4+CdWNkcsNTcUQf43qQ=; b=mKSS77Jc6kYVLgXHHtpb3orz5c 4Zo2caR4toi+ZfbhI8FtK4JvKXhWwjItJ6tiKR8Tca9e5bl/eXcrhR6BujbwbfYKWQiFQ89NY0SFk uRZFkgPegdxgjCA1JNviUAmBqRmTcnJBFrApxl1ve2UpgUhcpmEUjkYRXjmtk2DbgawdLsStRKyxz 3g1/7gqO6ziNpvQ15iPrB8oRnR51B3DsAgM4NJzJhLH/jHum+bIRyxVb7SUPp3wmals9wg5WIby2T yqFiU/TGvfRfouYdGpYkt5+AgJ9QhCMVjEjbNrAN1reGKVq6TzD/2QlqKUdwrFsygsZZRx8QdrvFg bCJ2yJlQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:41202 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCRh-0007lI-1j; Tue, 07 Jan 2025 16:28:45 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCRe-007Y3B-Dl; Tue, 07 Jan 2025 16:28:42 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 03/18] net: stmmac: use correct type for tx_lpi_timer Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:28:42 +0000 X-Patchwork-Delegate: kuba@kernel.org The ethtool interface uses u32 for tx_lpi_timer, and so does phylib. Use u32 to store this internally within stmmac rather than "int" which could misinterpret large values. Correct "value" in dwmac4_set_eee_lpi_entry_timer() to use u32 rather than int, which is derived from tx_lpi_timer. Even though this path won't be used with values larger than STMMAC_ET_MAX, this brings consistency of type usage to the stmmac code for this variable. We leave eee_timer unchanged for now, with the assumption that values up to INT_MAX will safely fit in a u32. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 4 ++-- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index c36f90a782c5..9ed8620580a8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -420,10 +420,10 @@ static void dwmac4_set_eee_pls(struct mac_device_info *hw, int link) writel(value, ioaddr + GMAC4_LPI_CTRL_STATUS); } -static void dwmac4_set_eee_lpi_entry_timer(struct mac_device_info *hw, int et) +static void dwmac4_set_eee_lpi_entry_timer(struct mac_device_info *hw, u32 et) { void __iomem *ioaddr = hw->pcsr; - int value = et & STMMAC_ET_MAX; + u32 value = et & STMMAC_ET_MAX; int regval; /* Program LPI entry timer value into register */ diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 2f7295b6c1c5..0f200b72c225 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -363,7 +363,7 @@ struct stmmac_ops { void (*set_eee_mode)(struct mac_device_info *hw, bool en_tx_lpi_clockgating); void (*reset_eee_mode)(struct mac_device_info *hw); - void (*set_eee_lpi_entry_timer)(struct mac_device_info *hw, int et); + void (*set_eee_lpi_entry_timer)(struct mac_device_info *hw, u32 et); void (*set_eee_timer)(struct mac_device_info *hw, int ls, int tw); void (*set_eee_pls)(struct mac_device_info *hw, int link); void (*debug)(struct stmmac_priv *priv, void __iomem *ioaddr, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index df386fc948ec..984e708d019f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -307,7 +307,7 @@ struct stmmac_priv { int lpi_irq; int eee_enabled; int eee_active; - int tx_lpi_timer; + u32 tx_lpi_timer; int tx_lpi_enabled; int eee_tw_timer; bool eee_sw_timer_en; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index ddb79e8880e9..dbe5635398b3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -394,11 +394,11 @@ static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv, u32 queue) static void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en) { - int tx_lpi_timer; + u32 tx_lpi_timer; /* Clear/set the SW EEE timer flag based on LPI ET enablement */ priv->eee_sw_timer_en = en ? 0 : 1; - tx_lpi_timer = en ? priv->tx_lpi_timer : 0; + tx_lpi_timer = en ? priv->tx_lpi_timer : 0; stmmac_set_eee_lpi_timer(priv, priv->hw, tx_lpi_timer); } From patchwork Tue Jan 7 16:28:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929312 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 324BA125B9 for ; Tue, 7 Jan 2025 16:29:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267344; cv=none; b=guAsH4pYQdksbLRj2N0nOiKYmCstCDmHeQ9+eUq/jTpOHUwGXDosMQXVd8z3fE8c7iPOofMX5EKZ66iZrzKpM3ouG0mH1NmohLeF7cidoh0Fgv3WnWqAWu65qzWr87q8kjwPXwRpACqHo0AMTvPe1pqqf+z2kkEugYOwNt49dew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267344; c=relaxed/simple; bh=sbAs2CmxwWEzymxoPNoHVxqKt6sQqnxILJzEDQ+mbRQ=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=W7Y964K4aFSJhdGSyR67c/aZg1ijhzQps53S3vZvwFwLWVAYM9MfCnxKJssac5+p1wtYWVwROz6+wSPxNRmPl71cYkSSBHzt7bTtK4JYOYLWjP0fW6YW2g5KwgGtmHVEVOtPFBT4roCXIPfLS5mjVMsLc2G9wmgsPh/Pyx0yGb0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=00xPUazQ; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="00xPUazQ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=tyoVehIX0KvqvNNqrOunqnbcASeMfHXCgtKkR1jpJa4=; b=00xPUazQdabqN+75wqaVT+hcbs tU+/JJpP0n2WjpG5GSQGEaX9HsUkSIQ4Lz3lsw8Lqx7+zQVOi1+lVGsRpcUEEjaiwN4p8VCsvcKoc GPycaUQWUJXCUJIrAUh3/TGhgxKKWJG4unuMQP/sRr8Zf+TCj6Xw41HJePVpnzP/fsD9lBnZ+6Gcq oMfhXeeIQX4h3gAu0TV51Fv58cjz7SH2NdnLFtaLROXIi2HI1AQarkCXw+zzB02cVcIuDf9aGs/Sx s+LzfliIUWpCOfd4kFL8sa6GjVLhv3gveklU+cjVEqFKDN5Zfciqe0ciWvLaXyIRG85Gz0b8VQg82 o4strbLw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:58282 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCRm-0007lj-2M; Tue, 07 Jan 2025 16:28:50 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCRj-007Y3H-Hm; Tue, 07 Jan 2025 16:28:47 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 04/18] net: stmmac: use unsigned int for eee_timer Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:28:47 +0000 X-Patchwork-Delegate: kuba@kernel.org Since eee_timer is used to initialise priv->tx_lpi_timer, this also should be unsigned to avoid a negative number being interpreted as a very large positive number. Note that this makes the check for negative numbers passed in as a module parameter redundant, and passing a negative number will now produce a large delay rather than the default. Since the default is used without an argument, passing a negative number would be quite obscure. However, if users do, then this will need to be revisited. Signed-off-by: Russell King (Oracle) Reviewed-by: Simon Horman --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index dbe5635398b3..96393e6feda0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -111,8 +111,8 @@ static const u32 default_msg_level = (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFDOWN | NETIF_MSG_TIMER); #define STMMAC_DEFAULT_LPI_TIMER 1000 -static int eee_timer = STMMAC_DEFAULT_LPI_TIMER; -module_param(eee_timer, int, 0644); +static unsigned int eee_timer = STMMAC_DEFAULT_LPI_TIMER; +module_param(eee_timer, uint, 0644); MODULE_PARM_DESC(eee_timer, "LPI tx expiration time in msec"); #define STMMAC_LPI_T(x) (jiffies + usecs_to_jiffies(x)) @@ -194,8 +194,6 @@ static void stmmac_verify_args(void) flow_ctrl = FLOW_OFF; if (unlikely((pause < 0) || (pause > 0xffff))) pause = PAUSE_TIME; - if (eee_timer < 0) - eee_timer = STMMAC_DEFAULT_LPI_TIMER; } static void __stmmac_disable_all_queues(struct stmmac_priv *priv) From patchwork Tue Jan 7 16:28:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929313 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD5651F4729 for ; Tue, 7 Jan 2025 16:29:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267348; cv=none; b=QZZmeqkJqcfFxb68FrAqRFJJMDkTsTOohx+ytoUiPcw+eh4Rw7yphVkB45n4TvMQkOcx7L4CdUwwHDZTSscslvItSRLictm8EA6yMGpDj5mt97hX0WLgZVpH5SWG4kQ8cqRyE4H7W/RqRmTAXgYU4aCVSq5tMxO9f1qw2U1kc2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267348; c=relaxed/simple; bh=20y3Qodfmy8KmZTq02mN8MXq9rQEQ8sLOnnOrTkNRe4=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=BO93LcI1EroUH1qH1kNlLsDY+BbuTDt/ad11EKCjnghKX765dUQ1F+1XpshAgBNWAusnu/DmhKpYHya3njbM8SocaArMN/i/0hPIt1jvq+tWd9QIOyX4XyLpYajGEBJu2zh/7HSeRz9mzxM4CDodWPduyF+Rzje7cn51xTpekHU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=xg9kxxd0; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="xg9kxxd0" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=m7sRj8MyoTLWqspxEn08rVS2H9QlJQS/1BnosoK5uUE=; b=xg9kxxd0sospqxYjcrJa2w6E/X 5y/Nwj/KkPQ/2OFt7FuwkYzuqvvKOLFKPu4ha2jEFOdz0ckKVwN8aNDauUlbaeMArbUmEIjl62hDO sXYM+SlKJKoY8zT0KPfa0EQY64AATcNOSeDK3SyqPMAnAj3HHceR/qmYrNyqAShQRZCNOFbBRFdoz 8XApR5tkq4MOh69sEtRXz0hG6K2Jf1J+TQzBfRMXRYwy28lkdmfUMvfosqEq91sIO3p6R58IbQ1nJ gUPKDkZttQ5m6McsfD+bOrpQ64rzVggOnMH4KIOnaI4zi0YvWB47n1gpJikpxnwFEx6nqRXE5MPeA gSg5B7cQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:58284 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCRr-0007lz-1x; Tue, 07 Jan 2025 16:28:55 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCRo-007Y3N-Kl; Tue, 07 Jan 2025 16:28:52 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 05/18] net: stmmac: make EEE depend on phy->enable_tx_lpi Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:28:52 +0000 X-Patchwork-Delegate: kuba@kernel.org Make stmmac EEE depend on phylib's evaluation of user settings and PHY negotiation, as indicated by phy->enable_tx_lpi. This will ensure when phylib has evaluated that the user has disabled LPI, phy_init_eee() will not be called, and priv->eee_active will be false, causing LPI/EEE to be disabled. This is an interim measure - phy_init_eee() will be removed in a later patch. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 96393e6feda0..3135bfdbee3c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1083,7 +1083,7 @@ static void stmmac_mac_link_up(struct phylink_config *config, stmmac_mac_set(priv, priv->ioaddr, true); if (phy && priv->dma_cap.eee) { - priv->eee_active = + priv->eee_active = phy->enable_tx_lpi && phy_init_eee(phy, !(priv->plat->flags & STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0; priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer; From patchwork Tue Jan 7 16:28:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929314 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E86C1F667C for ; Tue, 7 Jan 2025 16:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267352; cv=none; b=Azkh29dBKGCAkozRpuv6PLWRoKrh5Au0H5PmsAWMH6yjblAi0VZ7VOqhNXdEyUM0AAcjXVwrDu4X5pkCSC1bfQ0XKr+VVMek2YEPXJ4dvvKP+NLAJ5Auole4UA2l+jYnSjM0d6cXTGjnXfVolZtMeKRgx33bXtYYsMiDs26TT8E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267352; c=relaxed/simple; bh=LIUL5fIwGVl2fowfQY1eUowBb+do6gPUCwE9t2tVUCw=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=JoOBypW74GsIRTzhQ14/mxirwr7bFlXXHaoQloRwuaiQlQw2t50Z0iTC4imVA2QYzsTVUaomyQuR/M625SZvow64xoS+zxy9UbCS8jyzmeMt8OkxYWEGkMIqd9X6tTAk8wJ9mghvnC72vMfPsi5cc32PCBYhzhMPtwPA6eHjxSA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=g7LZS4O0; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="g7LZS4O0" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=htW5qn6DvTQCml5FV0+E9wXF615rxk0Wx5RrDokY4q4=; b=g7LZS4O03GoODV7ZMw6IA3/zKa E4/SqypXx8d5THWhxizbJvTu3vtq/sCdhTBYEKCBqeUPKNbHtvLc9s4lBljDKLNhu1Am5eGj1afTN fGSv4A6fTeQPDySGkNcAP0ob3121fj1J0dwufxIQZxgI2ecWh5yXfJ7u/LxZuPArPp2tj8Hu3INhr +N9JXoHkqAbfBDXs3UXJysgXnbY4RVETGqs5gYCCebKri3wZkH4xjy6JPYAueV/B+bwBh2F5rEViQ L4Bcb/uuuswzRiFsDsD7FsjCwx6wUvp2e7hZii1fGblspNK6pTiPs72KDe5Bs+txDAYA0IgAZ9X6i UoBgIYqw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:50278 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCRw-0007mG-2e; Tue, 07 Jan 2025 16:29:00 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCRt-007Y3T-OJ; Tue, 07 Jan 2025 16:28:57 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 06/18] net: stmmac: remove redundant code from ethtool EEE ops Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:28:57 +0000 X-Patchwork-Delegate: kuba@kernel.org Setting edata->tx_lpi_enabled in stmmac_ethtool_op_get_eee() gets overwritten by phylib, so there's no point setting this. In stmmac_ethtool_op_set_eee(), now that stmmac is using the result of phylib's evaluation of EEE, there is no need to handle anything in the ethtool EEE ops other than calling through to the appropriate phylink function, which will pass on to phylib the users request. As stmmac_disable_eee_mode() is now no longer called from outside stmmac_main.c, make it static. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 9 --------- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 984e708d019f..2eee3c5c4d1e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -405,7 +405,6 @@ void stmmac_dvr_remove(struct device *dev); int stmmac_dvr_probe(struct device *device, struct plat_stmmacenet_data *plat_dat, struct stmmac_resources *res); -void stmmac_disable_eee_mode(struct stmmac_priv *priv); int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt); int stmmac_reinit_ringparam(struct net_device *dev, u32 rx_size, u32 tx_size); int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 0429a99a8114..693f59c3c47a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -898,8 +898,6 @@ static int stmmac_ethtool_op_get_eee(struct net_device *dev, if (!priv->dma_cap.eee) return -EOPNOTSUPP; - edata->tx_lpi_enabled = priv->tx_lpi_enabled; - return phylink_ethtool_get_eee(priv->phylink, edata); } @@ -911,13 +909,6 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev, if (!priv->dma_cap.eee) return -EOPNOTSUPP; - if (priv->tx_lpi_enabled != edata->tx_lpi_enabled) - netdev_warn(priv->dev, - "Setting EEE tx-lpi is not supported\n"); - - if (!edata->eee_enabled) - stmmac_disable_eee_mode(priv); - return phylink_ethtool_set_eee(priv->phylink, edata); } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 3135bfdbee3c..1ccfa40ceddd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -432,7 +432,7 @@ static int stmmac_enable_eee_mode(struct stmmac_priv *priv) * Description: this function is to exit and disable EEE in case of * LPI state is true. This is called by the xmit. */ -void stmmac_disable_eee_mode(struct stmmac_priv *priv) +static void stmmac_disable_eee_mode(struct stmmac_priv *priv) { if (!priv->eee_sw_timer_en) { stmmac_lpi_entry_timer_config(priv, 0); From patchwork Tue Jan 7 16:29:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929325 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 399481F76D6 for ; Tue, 7 Jan 2025 16:29:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267360; cv=none; b=tvnt3zEy9Nkk128MVYfLolnRoo4SHxJAxbqUsV39I8CyefUvWplA8Eg3+zVfhl2P09SgSEUUjeU0M8GazfhKhAvK+Fj/KwVOZBxf2uYF38AOR3HOZ0scCDKBVWm6beHx/wgB4eXK2eJFpvZV5ic97Y8ZPJIyw37KVmPUIwQhxwQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267360; c=relaxed/simple; bh=pTZzENkbjWFHkqU2X2CsU0l85sToW3Hr0jMFgamkpXo=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=ksEvJg23WW+/mu7BRV9FkN7KbbxDOTE13NKyfPg90HNOYjWPIuCTjie+8lVzpkvwguXt7/6mp0J3kV3qtj8uUQccLXHZf0E7Y1/fUqDJZnn4t6Sa9Vo15j8g5RHDlFodshCKEAIQPjNqGQLSCj65PtH1IGGrnzjJlBmOAEaGEU0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=u0Sn+IXQ; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="u0Sn+IXQ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=oq60lzgRpWi3eAZ/MUBwnwLL6gwP4hqHvvlrP8GACm8=; b=u0Sn+IXQf9z7nG9lM4bjV2oyUW icGUROETYj2EXYtr9PBQWScNAbTReoUogYziDrbBOI5M6ufaenf9e/1jowWF5xlM4HeJosS3LqpKR KkCoL7+c5lMIzLaTtVbP5owz5pr54B/c8yHoz0F2XlKBh087mnxFo6eNY2Tu0rw12a9A/b0fRPZAj UbXWUIzCy8i9QWdkfA8SiFVLVe2Vi+fpMf/MjBBbRDbTay41K5NQftaL8FxKrrhWgZJLaRvx6iBOY yy5fizyyVGl3+ftTxSnMhfFHMAQeslVOAACWjDcjgXTfEeil+EQLbtKnwRGAv3twzi0UXQOM5rzK6 9NN5bYOw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:50286 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCS1-0007mY-2s; Tue, 07 Jan 2025 16:29:05 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCRy-007Y3Z-Ri; Tue, 07 Jan 2025 16:29:02 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 07/18] net: stmmac: clean up stmmac_disable_eee_mode() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:29:02 +0000 X-Patchwork-Delegate: kuba@kernel.org stmmac_disable_eee_mode() is now only called from stmmac_xmit() when both priv->tx_path_in_lpi_mode and priv->eee_sw_timer_en are true. Therefore: if (!priv->eee_sw_timer_en) in stmmac_disable_eee_mode() will never be true, so this is dead code. Remove it, and rename the function to indicate that it now only deals with software based EEE mode. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 1ccfa40ceddd..be77dd04c8c7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -427,18 +427,13 @@ static int stmmac_enable_eee_mode(struct stmmac_priv *priv) } /** - * stmmac_disable_eee_mode - disable and exit from LPI mode + * stmmac_disable_sw_eee_mode - disable and exit from LPI mode * @priv: driver private structure * Description: this function is to exit and disable EEE in case of * LPI state is true. This is called by the xmit. */ -static void stmmac_disable_eee_mode(struct stmmac_priv *priv) +static void stmmac_disable_sw_eee_mode(struct stmmac_priv *priv) { - if (!priv->eee_sw_timer_en) { - stmmac_lpi_entry_timer_config(priv, 0); - return; - } - stmmac_reset_eee_mode(priv, priv->hw); del_timer_sync(&priv->eee_ctrl_timer); priv->tx_path_in_lpi_mode = false; @@ -4495,7 +4490,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) first_tx = tx_q->cur_tx; if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en) - stmmac_disable_eee_mode(priv); + stmmac_disable_sw_eee_mode(priv); /* Manage oversized TCP frames for GMAC4 device */ if (skb_is_gso(skb) && priv->tso) { From patchwork Tue Jan 7 16:29:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929326 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 246761F7077 for ; Tue, 7 Jan 2025 16:29:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267363; cv=none; b=XJQR2l8l6xDLe4exYhIuirox7xa22fi6TBsLctFlOyvMrjEz4jAEzggcAxA0fJP1RAt5mSr+0U4hRk2+QeOUv0S9J32CM7OUGE//lR2GnXrndsaJg8Tz9dtNI5XCZGhELnZdt2mUtvF364cKqXPXs0iywZrglYM/jrlQtsfw4NU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267363; c=relaxed/simple; bh=AX/R8eIeVv7+dIWC0ZXEsQgp3BTWsKkE02IKY2Dce/4=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=NjptPzG0Nv+WM+U72cOGXgWRVX1nxNJXf/oLSP+/oZszXmb+qybZpgpYuRcVOA70XwubzgsNy1AzvrTmz3op6hwSpe294NYeX0ByflwlH0Bkq+8JsGWIDpQlR8fswS1j1z8LpQUT+My2UEvh6cNtXrrEliD4i10k7t1PvwREp34= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=uCv4ASwR; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="uCv4ASwR" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=5r/JJISMaJlmINK1abzjxiwPeWCf2+xNCCl1rn0zXJo=; b=uCv4ASwRM1kfvJE/xPJGMenZwh 0yJRbjvxFnVqmj/TZMpyLWNJyswBArvffr3WTJ9CEUtGn6ll8DZZPVOyYsbHZklPNRQnKETSFkoqq qF23D67CXpYDgJ0//XOO6FN+ThLR3CjCLOhHe27PIBFoux1rEyWyb9iaui19P6v+vwcXCsMXZEBEv GUgrFcnALEYEaI1OOLf/rJ+8PNR/Rgu6o9npJWHIDNATUkg5skN4YBUifeAo8PUUrjeltfw2gYiMT JVfj+HHO+b2b2pO7b+I2T/FujgdBMBoAHkFDuUK4DypV5SiWe+BGndlcr93gBVlcr1FeWUvcsUTTE /480UkVQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:51132 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCS7-0007mp-03; Tue, 07 Jan 2025 16:29:11 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCS3-007Y3f-Vn; Tue, 07 Jan 2025 16:29:08 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 08/18] net: stmmac: remove priv->tx_lpi_enabled Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:29:07 +0000 X-Patchwork-Delegate: kuba@kernel.org Through using phylib's EEE state, priv->tx_lpi_enabled has become a write-only variable. Remove it. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 2eee3c5c4d1e..507b6ac14289 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -308,7 +308,6 @@ struct stmmac_priv { int eee_enabled; int eee_active; u32 tx_lpi_timer; - int tx_lpi_enabled; int eee_tw_timer; bool eee_sw_timer_en; unsigned int mode; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index be77dd04c8c7..fc80ed101a79 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -968,7 +968,6 @@ static void stmmac_mac_link_down(struct phylink_config *config, stmmac_mac_set(priv, priv->ioaddr, false); priv->eee_active = false; - priv->tx_lpi_enabled = false; priv->eee_enabled = stmmac_eee_init(priv); stmmac_set_eee_pls(priv, priv->hw, false); @@ -1083,7 +1082,6 @@ static void stmmac_mac_link_up(struct phylink_config *config, STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0; priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer; priv->eee_enabled = stmmac_eee_init(priv); - priv->tx_lpi_enabled = priv->eee_enabled; stmmac_set_eee_pls(priv, priv->hw, true); } From patchwork Tue Jan 7 16:29:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929327 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B90F11F868A for ; Tue, 7 Jan 2025 16:29:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267369; cv=none; b=HtDJISqL7Yshm4oRTPwV+ufdtyhH9FkOdxRkVUutmzxsrHpNr8LcjzeIEBMvnBQXY49rW6Twxmk8KuysvWQWGPBPizyJvL5s9EFB4Sgr19YzEZ46kBumNQdVzbKBFPmdYp5u8g2V0OWdgZjNVaIFY6JR4VtCbv/t3/JrIIK5cz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267369; c=relaxed/simple; bh=KOkNxyK+lUNqj+7YDXau7UaJf7/Lm4N0lyvmmDyfGCw=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=LP81uw+SNi9ET8v55YbQLG+sMZmSlmC42MV/eWQ0Gn3V1X1Vbej7mjZtcypAlkfr6cG/YV5H53lS5oqfY+5pTPz1cJaxtrkx4fxeF0Vdk0xJ+R5ciqxg7lkOxOY0nVYz8jLgXYB6wm4WzRImVsHDckcFDU/HegAJq7hmn2ZvI8s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=HMfrrG++; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="HMfrrG++" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=ecrgOpPZJ++e0c3wZgjy52va9WtAhn5oj3/YTdAkwvw=; b=HMfrrG++GHUU8rvUXEPEhQRWlS gatTbS6rXa9MSNTF1488eUMQoOQbtQhJnpx6sXvFPDvzmkGkkYXG/QQDUXZ1/VF22M+8Eimd4ATBN pnWnN0AsEnXP/Z7oRCCtiOrOtSeOpfMCI1Wi53KOWKZSkl7HGplnhGrDGR+AOQ07CYQD/dO94r3aK TOC28ioo5pceGwByoyjzAMfEQKf9XVZaLcln2p/yGrWdYx/NjAXsflMaUgW4O2KOfzZOX3j6LbAs/ XcqDvW3NpQt5gI2vKxG5gQ9lKG4Eqz4uX9RbvD11Te7RsiTRqm0f1RYBhgCP7Zj9U4tZocmkRgnVP SwZH/xHw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:51146 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCSC-0007n6-0h; Tue, 07 Jan 2025 16:29:16 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCS9-007Y3l-3Z; Tue, 07 Jan 2025 16:29:13 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 09/18] net: stmmac: report EEE error statistics if EEE is supported Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:29:13 +0000 X-Patchwork-Delegate: kuba@kernel.org Report the number of EEE error statistics in the xstats even when EEE is not enabled in hardware, but is supported. The PHY maintains this counter even when EEE is not enabled. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 693f59c3c47a..918a32f8fda8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -654,7 +654,7 @@ static void stmmac_get_ethtool_stats(struct net_device *dev, (*(u32 *)p); } } - if (priv->eee_enabled) { + if (priv->dma_cap.eee) { int val = phylink_get_eee_err(priv->phylink); if (val) priv->xstats.phy_eee_wakeup_error_n = val; From patchwork Tue Jan 7 16:29:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929328 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BE6E1F427D for ; Tue, 7 Jan 2025 16:29:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267373; cv=none; b=VnnNdxVnGnOzeHHwg6wICZbQyyHjafaNoGH+QeCmX3RTxnq23PUIUa62GySrcZMcevKjLdJxLDXqEsYj+IEQsAvRlAhneUvsa7vihZncnb3Ui0nPdE61vhACCYMV6nXyrTALdLgEx9l/lVl+yigrj2fNI7tbd//4x/K0aT0pgE0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267373; c=relaxed/simple; bh=XpQJgvv7g3DBB6FY0belgE1EvvfgaICwr5zCjMjvsGI=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=mdWczPmV68jxf8nZFRPVblQvYJ89yncz72UStMRIDNybRTmskl/SIZQeWH15QrDjyzCkXQuDpwRBUpP36+cthhDkJzhAfY/Bnl5vwqKzlS+Kj0lQJh+ZiNDwS5GIcCbXNsexT9CPvxKjFzfCinacoAKVdTrPBhWUNOriUPBCawA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=nT36DyoO; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="nT36DyoO" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=7d7BQ/BETeIV65nPIiOzm00NlijFDRQ+qTkPLKa/GqA=; b=nT36DyoO7lQAsXQtF3lEL6XxzT b8nLupooWuvs9EvGJA9qpperJjbyL8XznPcoKtDDA2IOGxa1T8tBq4LCCrzoLwUYOY7qFqzSWbqLb Ol1CsoxA40XUEDqGRjPwC0j+Fc+oJfu+jAubAGMce2ml5GNrVQTfFNjeCyG0nc59QgGqGDpx+ZoSC oN/+oHKPqnfCHVyIv7dg+tsEhar0wZ3ObggT82HIsXla0guTZwOskzL2u11Y/XVMgN4O7yXDytTh9 gCqiCWUJozg1rP6jsWsIcG0UVo0FNUy9EmzrG9rGFq7yOGKuHR5nfUuLxTgCJRdOY57JuYwaKzy8S JpuFNzlw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:43520 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCSH-0007nN-0v; Tue, 07 Jan 2025 16:29:21 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCSE-007Y3r-8D; Tue, 07 Jan 2025 16:29:18 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 10/18] net: stmmac: convert to use phy_eee_rx_clock_stop() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:29:18 +0000 X-Patchwork-Delegate: kuba@kernel.org Convert stmmac to use phy_eee_rx_clock_stop() to set the PHY receive clock stop in LPI setting, rather than calling the legacy phy_init_eee() function. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index fc80ed101a79..adc51087f2ba 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1077,10 +1077,10 @@ static void stmmac_mac_link_up(struct phylink_config *config, stmmac_mac_set(priv, priv->ioaddr, true); if (phy && priv->dma_cap.eee) { - priv->eee_active = phy->enable_tx_lpi && - phy_init_eee(phy, !(priv->plat->flags & - STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0; + phy_eee_rx_clock_stop(phy, !(priv->plat->flags & + STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)); priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer; + priv->eee_active = phy->enable_tx_lpi; priv->eee_enabled = stmmac_eee_init(priv); stmmac_set_eee_pls(priv, priv->hw, true); } From patchwork Tue Jan 7 16:29:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929329 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A21EA1F76A1 for ; Tue, 7 Jan 2025 16:29:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267377; cv=none; b=Exvd2mqsB8ktmsD/ebKUip+K0cp9r8bwhBWwXyfDopc/lg5t76iE4YFghlfRMPnLz/SxQ8CmxRsomSa+V4po5zD/2jmCBPCwsiJMooXRCMpLPc+TAS3YdrGlwVop6ZnE77pyHgxhwKilp0NWcA1jXERtWR5I2hNBl/uujQXd/EY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267377; c=relaxed/simple; bh=/ZTCQwc+7lcByQBBAiIBM6tAWqPwN9xnOOBBW8DkLtw=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=T3OpasXFkPgUF6D73LZ7WAUwM93eQAh/cDzaMLW1ZrhbcMnlNGUVvm0yhF4iLF9YZupVukkHZ5GiMdRcBJ91uHNKSn+7DhxDFAgNej6MNNaiQENPSyu+XA2dY8FLLAu8taEmPvjbXwgQMEkBOgqvFIvKYkA3rgl+Q2+KmLmPhEM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=TRs/wFrb; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="TRs/wFrb" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=Mt9PshpQqw68RFtJuRwMKIvYJt4mlpJLQSaP3lR5Qzk=; b=TRs/wFrbefMQBevnRZ11L1ROMJ PPEdgGHgV78aTWt7DstbuheA/huYsrue2LTMKnN++rLniEzjyuQ25PAZn2EJr39BeXzkW1cR6hrYB gcSf+qxIFKYVWR/SNaeiUrjiDQo2mdnKEwAsWWzvcgflkGlxyh1vM35lIhub0J60NT7SgXk8DuudI hG0d7PvN77PnmHDyeaxfSUkR8rZt4O+0EQTuYAzDaU6LMCc/jSsOchRpK97DcTOHHNneFV2+9lk4R VkNc+LvjuAgkzF1G3TbLV/dvVCMxAxbTBMJYykgPzznqYKvSvvRKg1/NeUVpKarK9Nn5I8uP4oXmz Htqn8dKw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:43532 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCSM-0007nf-1F; Tue, 07 Jan 2025 16:29:26 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCSJ-007Y3x-C0; Tue, 07 Jan 2025 16:29:23 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 11/18] net: stmmac: remove priv->eee_tw_timer Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:29:23 +0000 X-Patchwork-Delegate: kuba@kernel.org priv->eee_tw_timer is only assigned during initialisation to a constant value (STMMAC_DEFAULT_TWT_LS) and then never changed. Remove priv->eee_tw_timer, and instead use STMMAC_DEFAULT_TWT_LS for both uses in stmmac_eee_init(). Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 507b6ac14289..1556804cca38 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -308,7 +308,6 @@ struct stmmac_priv { int eee_enabled; int eee_active; u32 tx_lpi_timer; - int eee_tw_timer; bool eee_sw_timer_en; unsigned int mode; unsigned int chain_mode; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index adc51087f2ba..94bb6b07f96f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -464,8 +464,6 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t) */ static bool stmmac_eee_init(struct stmmac_priv *priv) { - int eee_tw_timer = priv->eee_tw_timer; - /* Check if MAC core supports the EEE feature. */ if (!priv->dma_cap.eee) return false; @@ -478,7 +476,8 @@ static bool stmmac_eee_init(struct stmmac_priv *priv) netdev_dbg(priv->dev, "disable EEE\n"); stmmac_lpi_entry_timer_config(priv, 0); del_timer_sync(&priv->eee_ctrl_timer); - stmmac_set_eee_timer(priv, priv->hw, 0, eee_tw_timer); + stmmac_set_eee_timer(priv, priv->hw, 0, + STMMAC_DEFAULT_TWT_LS); if (priv->hw->xpcs) xpcs_config_eee(priv->hw->xpcs, priv->plat->mult_fact_100ns, @@ -491,7 +490,7 @@ static bool stmmac_eee_init(struct stmmac_priv *priv) if (priv->eee_active && !priv->eee_enabled) { timer_setup(&priv->eee_ctrl_timer, stmmac_eee_ctrl_timer, 0); stmmac_set_eee_timer(priv, priv->hw, STMMAC_DEFAULT_LIT_LS, - eee_tw_timer); + STMMAC_DEFAULT_TWT_LS); if (priv->hw->xpcs) xpcs_config_eee(priv->hw->xpcs, priv->plat->mult_fact_100ns, @@ -3446,8 +3445,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool ptp_register) else if (ptp_register) stmmac_ptp_register(priv); - priv->eee_tw_timer = STMMAC_DEFAULT_TWT_LS; - if (priv->use_riwt) { u32 queue; From patchwork Tue Jan 7 16:29:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929330 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCAA11F7575 for ; Tue, 7 Jan 2025 16:29:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267382; cv=none; b=q9PlEmCzKtnGZV5BwNj89263ZuBNw4j9LBJxFr/TGORejXfmYfPW6RmqcuGhYaqSDG756UlVVC1o51oq+H0bBHShr8XdgvgaQ0g7uc7BPWgUjYSPqLhvUZYqv+XNMzNHVAhwkHSaNYy+5KxXp4kQze9JqiP52vJUbQvjGoZTYtA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267382; c=relaxed/simple; bh=MbbElpiISCmXlQ+d02zeQiaXWQGdSHJu5HKs9PxwHAA=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=Qa+rcbBZtyU1Htk9GXP3mPO9/SNbYCR15qH81RtquIfx4GqxsDBCjdoaCuJD6ILc9HqP9+w9qcjQkcm51tTtbJsDopJ0+zI0blE3ZoAkj9OFan2q7fcZZ+m7KlDrL2oPgXVH4uv9/M9Bis2cGUW2On2Xdxh1x70zimeHmPrqXPw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=acBQQ+Ny; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="acBQQ+Ny" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=AtobVMnr8E5gzN8ZgvrreHjtEy+CmRHbLYgzCHnDnG4=; b=acBQQ+NyHAqjSuSoJzPyYnAk3v 4n+lmW/UgxASD7sLSNkoXl5EANM5UHgfIZ/2530W9UaVyNDKtpYYbDCkxV2OVfGEeWVSe9r0l8mbn 5ZVzo81Fpfevfrf0VG4JbcCmBWhk/YkVAURV0xkGoptuC+98Q109QMk8r45FwwjMqsmmxhGFvUuz8 gbNErKg2ETG1MohLqC8fz768v1Z0iVblTlZTB9qdOiPsq1x+8IPPGVHOjM6/igTRZ8F28hdbLDWnb O/KsaNI9PGcG54RwEjKOpNZ7drgrjzvuY4Pe86QZiQLUk7yHj+Y8kKc5XL9D7e8M9d/x6zreSBCIF U3+faP8w==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:59402 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCSR-0007nz-1X; Tue, 07 Jan 2025 16:29:31 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCSO-007Y43-Fa; Tue, 07 Jan 2025 16:29:28 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 12/18] net: stmmac: move priv->eee_enabled into stmmac_eee_init() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:29:28 +0000 X-Patchwork-Delegate: kuba@kernel.org All call sites for stmmac_eee_init() assign the return code to priv->eee_enabled. Rather than having this coded at each call site, move the assignment inside stmmac_eee_init(). Since stmmac_init_eee() takes priv->lock before checking the state of priv->eee_enabled, move the assignment within the locked region. Also, stmmac_suspend() checks the state of this member under the lock. While two concurrent calls to stmmac_init_eee() aren't possible, there is a possibility that stmmac_suspend() may run concurrently with a change of priv->eee_enabled unless we modify it under the lock. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 94bb6b07f96f..b7e0026c271b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -462,11 +462,13 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t) * can also manage EEE, this function enable the LPI state and start related * timer. */ -static bool stmmac_eee_init(struct stmmac_priv *priv) +static void stmmac_eee_init(struct stmmac_priv *priv) { /* Check if MAC core supports the EEE feature. */ - if (!priv->dma_cap.eee) - return false; + if (!priv->dma_cap.eee) { + priv->eee_enabled = false; + return; + } mutex_lock(&priv->lock); @@ -483,8 +485,9 @@ static bool stmmac_eee_init(struct stmmac_priv *priv) priv->plat->mult_fact_100ns, false); } + priv->eee_enabled = false; mutex_unlock(&priv->lock); - return false; + return; } if (priv->eee_active && !priv->eee_enabled) { @@ -507,9 +510,10 @@ static bool stmmac_eee_init(struct stmmac_priv *priv) STMMAC_LPI_T(priv->tx_lpi_timer)); } + priv->eee_enabled = true; + mutex_unlock(&priv->lock); netdev_dbg(priv->dev, "Energy-Efficient Ethernet initialized\n"); - return true; } /* stmmac_get_tx_hwtstamp - get HW TX timestamps @@ -967,7 +971,7 @@ static void stmmac_mac_link_down(struct phylink_config *config, stmmac_mac_set(priv, priv->ioaddr, false); priv->eee_active = false; - priv->eee_enabled = stmmac_eee_init(priv); + stmmac_eee_init(priv); stmmac_set_eee_pls(priv, priv->hw, false); if (stmmac_fpe_supported(priv)) @@ -1080,7 +1084,7 @@ static void stmmac_mac_link_up(struct phylink_config *config, STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)); priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer; priv->eee_active = phy->enable_tx_lpi; - priv->eee_enabled = stmmac_eee_init(priv); + stmmac_eee_init(priv); stmmac_set_eee_pls(priv, priv->hw, true); } From patchwork Tue Jan 7 16:29:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929331 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56FD21F708B for ; Tue, 7 Jan 2025 16:29:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267388; cv=none; b=H/X9/yGU5Q4f7Cw4/rLaujGuW+uFYgCWPfHj78tIrSTqfXKsv60Wkzs/X9GQzHsbR2Sb8mHZ3jQo5IeLqx3eTnoHSc64ssx+LCSayXXtDMNAO8aEaqQFhkr1biDKoWIK3OTUKKmSb5W4MeSk880j7HKzC/qdg3XkTMmJtbCCXAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267388; c=relaxed/simple; bh=5zoNMm/muoicMU0Nc8p1Fm+E9Nzsn10YLobO/fLH5lM=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=PZZLktHUK/UQ5zdagMOU8NomsOGVHcPwU9ngketeHdR95Be7rAQ3k54DXa7lSFjr7DLXoirSoJmGttQU5yi1qBu8psA+S2c0Mwolehi6uXsklLyUIG3KS6JUpFxHFgr5QLMuYEbsI/K8afJR9+9kZcVn28Ovv5xxVKIb197qODY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=NehBVLUz; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="NehBVLUz" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=j7GTEfja/07m/dxB/a0CmEMLPjybqsk6izUSl+b/tGQ=; b=NehBVLUzKnsWVryZjHikpQFsFc SP4CIefwSQ7PZaqxSlnyZI+mGSaYqNjOLu0MMub8lkZAKpvZcBZZuolgCtQBGGbOxEW1WfFLrnrCv KKpZSF3yQEtViR/VZka8uwtJ3Izj/zbg854NgsBgzOyOP9mG19PTGf4INZcks8QRYHYsP7sh5f0fc ihhkcVnU8NlbWX7LfUthgvqf14V05TCjgNClIVz9v0WdlsJhfn/nMMhyAxu4GpgkhbKD5R6jwGW1l Tr6an33e/hrWFtnM/fnFcVtmxP1ioD2qlbRFPXZI1GNpHGKJDEZfn56rByFkhLxBBajkIiZL0N0Ma 0pjrDNig==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:59408 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCSW-0007oH-1t; Tue, 07 Jan 2025 16:29:36 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCST-007Y49-In; Tue, 07 Jan 2025 16:29:33 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 13/18] net: stmmac: move priv->eee_active into stmmac_eee_init() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:29:33 +0000 X-Patchwork-Delegate: kuba@kernel.org Since all call sites of stmmac_eee_init() assign priv->eee_active immediately before, pass this state into stmmac_eee_init() and assign priv->eee_active within this function. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index b7e0026c271b..7c1dbc5fa84b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -457,13 +457,16 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t) /** * stmmac_eee_init - init EEE * @priv: driver private structure + * @active: indicates whether EEE should be enabled. * Description: * if the GMAC supports the EEE (from the HW cap reg) and the phy device * can also manage EEE, this function enable the LPI state and start related * timer. */ -static void stmmac_eee_init(struct stmmac_priv *priv) +static void stmmac_eee_init(struct stmmac_priv *priv, bool active) { + priv->eee_active = active; + /* Check if MAC core supports the EEE feature. */ if (!priv->dma_cap.eee) { priv->eee_enabled = false; @@ -970,8 +973,7 @@ static void stmmac_mac_link_down(struct phylink_config *config, struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev)); stmmac_mac_set(priv, priv->ioaddr, false); - priv->eee_active = false; - stmmac_eee_init(priv); + stmmac_eee_init(priv, false); stmmac_set_eee_pls(priv, priv->hw, false); if (stmmac_fpe_supported(priv)) @@ -1083,8 +1085,7 @@ static void stmmac_mac_link_up(struct phylink_config *config, phy_eee_rx_clock_stop(phy, !(priv->plat->flags & STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)); priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer; - priv->eee_active = phy->enable_tx_lpi; - stmmac_eee_init(priv); + stmmac_eee_init(priv, phy->enable_tx_lpi); stmmac_set_eee_pls(priv, priv->hw, true); } From patchwork Tue Jan 7 16:29:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929332 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D8A01F708B for ; Tue, 7 Jan 2025 16:29:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267393; cv=none; b=XL3EGFjTKagVgBz2B2WSwO9N3x4DZJuGUB1nNun42WcWbLW2detZeTDibwabrIQovV1ioRbXEDaNw1PRVuMpUEiq66DC6hCSq8IVLPyVBws/GA8mgVHmgtPQX8ZT1JYaegpqU40MP509BCOvBWGqNCXBtjFvROF8onsNuv1Ygkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267393; c=relaxed/simple; bh=N5xE7KL1nMb5Cie6NsoLk/Sd/S1DY19s5keOkmgatPU=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=rbdSnQQe6i1kIMeO0AjmN+gLZ82kHZ+amZbuRmK4VE7e3q9OkTMe5kw9omHnsxan0Cl0vl8bYk4sVuXqHm1340aEs8SW51Hi2SdPtz/ZAJG8KM3bIlqRGoDM42IyNn5m33wPH3NsQsafo7NmzDm4eC+hEsLMmt/3mSCyb2xWJWI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=BftMc+tD; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="BftMc+tD" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=qm2Cf1BaSz15K4PsGl3xyn8XApkKB5nwZMBaIeywDjc=; b=BftMc+tDMdP13nYTQJ+MD6pNQ6 h0c0M1qARwtVqPx8zfyKwTQ9yc+jEN9KgqKPLTJq2nKYWbYKDxKvcWfhxDW41QNy5+2TZiXy8InQq 3bIyOggB8xnH21xsVs3FJPX2/qX7fhvvVfoG5QohY9KI+Kxm0ywRanbHg1rkv99NZcryp0rpAhNwp XjM5i5AQYiijyENWy0dqMNXVQCK+xb2DlXOalMYQk3PkYXSg1QdfI+4l0kCl+XrxtT32lvp1tm1E+ zZ84TaIZeptyxoruxnGvlrqOn2OX+LVr/Mnjr4bzRjo/FdYod+SaksxTZLDKioEi5zEL5W/PrFyXG WetQSx4w==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:42170 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCSb-0007oY-2G; Tue, 07 Jan 2025 16:29:41 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCSY-007Y4F-Mz; Tue, 07 Jan 2025 16:29:38 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 14/18] net: stmmac: use boolean for eee_enabled and eee_active Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:29:38 +0000 X-Patchwork-Delegate: kuba@kernel.org priv->eee_enabled and priv->eee_active are both assigned using boolean values. Type them as bool rather than int. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 1556804cca38..25ad3f92e14d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -305,9 +305,9 @@ struct stmmac_priv { int clk_csr; struct timer_list eee_ctrl_timer; int lpi_irq; - int eee_enabled; - int eee_active; u32 tx_lpi_timer; + bool eee_enabled; + bool eee_active; bool eee_sw_timer_en; unsigned int mode; unsigned int chain_mode; From patchwork Tue Jan 7 16:29:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929333 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B5481E0DE6 for ; Tue, 7 Jan 2025 16:29:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267400; cv=none; b=TSik3UwL/8L1e3EuBkRO3XdfAPwu1mTt4flDkwcQH/NDBt94gSTxfOhDag1VvyDSDVj0UxVJ4vKYSLF/DNbJ+Ty6CoC2DDeC34tMU87rASJkD9jmoozoxVKl7EUCxyeAIOV6M2hDCSyCjjKCu1BKp7Sp3LOtOcVxdG1eOxYtAhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267400; c=relaxed/simple; bh=53rWGxr7i+69EZqyxSdISgixUGQXESVaECS0S6gLTXo=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=MQ5F0vmH8jJg61V/NmCQDmpyQ9N7EuGfJ6ccFkWtv+l3l6o6YWqQY5TkkFNW+O0YUMvXLVl/XqlKVLcec9gZBvqJfmutXUleFezW2gqzgQiO7OkSFRPz+u4jEskDr+G9mN+Pp6Im55Hn/I5gmmbRS4rhLsLMSkei9EgKUzRxs6k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=nsRAKSRg; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="nsRAKSRg" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=4M3GO1u5UO9gUdI/y1VtJSws8EiP+NlPYd8R2GK9U4M=; b=nsRAKSRgFV/Rlj2frgJxeu6KwT JwDa8bCCsHm2IM4BTEzxxrX8YavfoFcimxYvb07Q1IRLxJuoQAaZGWAarzBfnO15nyJs094iOXTxo Hlwks6/oh66B8AEzWkeA3YJWqDiVRh7VIDBEGdBEa1dShKxRKi1dbAjFnNtbRWLnyOtIUm8zn+It5 r+NLblaL+M//ZqY3wpb1MOvnsfC7j1lmskrLZSp8jTjYg8S+6t2knoUS9so4yt0VB2kgakUFbskvq RGb81qR+j5p6mwLahIqjY1SW/0Smz1SZWw1fX+TMB1AKx3ASxOi8Mr81c4J7OhZMOzYHDA45Zl+6q ozvIDauw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:42184 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCSg-0007op-2g; Tue, 07 Jan 2025 16:29:46 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCSd-007Y4L-QX; Tue, 07 Jan 2025 16:29:43 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 15/18] net: stmmac: move setup of eee_ctrl_timer to stmmac_dvr_probe() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:29:43 +0000 X-Patchwork-Delegate: kuba@kernel.org Move the initialisation of the EEE software timer to the probe function as it is unnecessary to do this each time we enable software LPI. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 7c1dbc5fa84b..b003f462006d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -494,7 +494,6 @@ static void stmmac_eee_init(struct stmmac_priv *priv, bool active) } if (priv->eee_active && !priv->eee_enabled) { - timer_setup(&priv->eee_ctrl_timer, stmmac_eee_ctrl_timer, 0); stmmac_set_eee_timer(priv, priv->hw, STMMAC_DEFAULT_LIT_LS, STMMAC_DEFAULT_TWT_LS); if (priv->hw->xpcs) @@ -7405,6 +7404,8 @@ int stmmac_dvr_probe(struct device *device, INIT_WORK(&priv->service_task, stmmac_service_task); + timer_setup(&priv->eee_ctrl_timer, stmmac_eee_ctrl_timer, 0); + /* Override with kernel parameters if supplied XXX CRS XXX * this needs to have multiple instances */ From patchwork Tue Jan 7 16:29:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929334 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7255F1F63F4 for ; Tue, 7 Jan 2025 16:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267403; cv=none; b=ZCQQYwJc07G/ooB8SAZ2xgrsYc1/3m2tmAICxeW03qenPIXhMaRwju8HgcZz3IBLk9BUr+ZdxQS5F2Kt3Rv2+WEEP6M96k1AlDmhsC4KAjd+oiOlSzQ6yhXEjhTgdr8VanWGGOUE1TyY4VjlQhRn8PSRHvZiSqvkre3d46sIt3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267403; c=relaxed/simple; bh=+BgHdbVcM52iUi6wURyxBWgYJXvWUdhKlW5WTBcUyYg=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=W/hgL67y4+gbqWq9lZt8q25zF5TwgLp5ojxlEwf11ZV0UtHxFEXK2jzeH3+ZJw1QeLg0yaTtI2JOyDFp+vn15yJ28pnC/ib5DjszIYRBXKIgpGS7PuUA2KhBEa/h4A1yGvTIioXkGN4jM991rz7IkYs3iPsnVBU9lvHnMxCxyCU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=dAcy0TwS; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="dAcy0TwS" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=3AUocAZiwiTM1o3I9pmtV7S57CGscNwsOJhG3dqdD+Q=; b=dAcy0TwSRtzxc0Xqwrm9/xQUeJ Ome5mKrqurdLIfGC2+a6M6xY+zw11Dr8D8qhi4i2aoUaujt1CRyy6fTY3MpO8SjBIYfY/p/5Wriwz 2UyMQxUr8AbMqfOjWsD62NrMzY5pnUjS4oDGiX/bSZ9vyNtSW5hgNGxQTEIyf8tiqOX7brvGesBlL c+058lUb46ni4zWZMF6qNv0dUh1W8iBTIHNP8pxqlNOk/vX3OAglY3cy9ZXkqn2rfK+hBtUjditz9 unp/K1O7VP7vK60W4+vHtGEDS0WELKxNdwUqgGtWGNekiYUbhsTIXAfRqtsV28d2KFcsVkFt1wFzc OJAOvkfQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:40852 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCSl-0007p6-35; Tue, 07 Jan 2025 16:29:51 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCSi-007Y4R-V7; Tue, 07 Jan 2025 16:29:48 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 16/18] net: stmmac: remove unnecessary EEE handling in stmmac_release() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:29:48 +0000 X-Patchwork-Delegate: kuba@kernel.org phylink_stop() will cause phylink to call the mac_link_down() operation before phylink_stop() returns. As mac_link_down() will call stmmac_eee_init(false), this will set both priv->eee_active and priv->eee_enabled to be false, deleting the eee_ctrl_timer if priv->eee_enabled was previously set. As stmmac_release() calls phylink_stop() before checking whether priv->eee_enabled is true, this is a condition that can never be satisfied, and thus the code within this if() block will never be executed. Remove it. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index b003f462006d..0a1e2587f8c7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4033,11 +4033,6 @@ static int stmmac_release(struct net_device *dev) /* Free the IRQ lines */ stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0); - if (priv->eee_enabled) { - priv->tx_path_in_lpi_mode = false; - del_timer_sync(&priv->eee_ctrl_timer); - } - /* Stop TX/RX DMA and clear the descriptors */ stmmac_stop_all_dma(priv); From patchwork Tue Jan 7 16:29:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929335 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 238AC1F8ACE for ; Tue, 7 Jan 2025 16:30:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267410; cv=none; b=YxK6HaHYAFcoRRTFohjfIzW7W/DFMDRrIOT1bz7A6+mfY9lNVnQmh/lKP0/XO520sBamZMVqXDJxuwp5AW9u44bgKW8Ou5YY34Z0FUACCjsn+3LnZN9SWQXnGaPfsvbJuIbFYD8jRxYnw54caJbtfQQoNmT0Y4MRfXc1ULpkYWU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267410; c=relaxed/simple; bh=1dDLMbgMUgS6hrb7JPS8Hk2ZwqAEPgyR5tPtD4m3W3c=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=FFcuFQ2BoQwOFIWJccNVZ2YO1Fi3Sl/t4aoOIZSohkXs6C0Plpr6XZsC9LYRmuwiASmYlRe4eX5aLpX/Qe5i+HGdT0uZW7fS3jD1hqu+ICMV3cC4EqhyWyq1JO9GsFlNzyLetxrPGYKX5rl+oLsywA27sIVK9wDixHFrUDciSkg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=IFqXqYQ4; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="IFqXqYQ4" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=iaGToDXR4V19BkyZaj/bzbtvRG0ijebygnWTlbtXVvM=; b=IFqXqYQ4AA3NJIyUzxEEmKRbHZ i7OUfKI12WQCOA6IFaXrTcVdbxnAkomuA7jUfxfkErIJIfZw2rIcSJYQM9WTONRyGulKpjoy1Hw6j UUe++bp8YFHOiTeaOql3PqFbssTrZgeD3FeZodzo7ypUiXyhLyUVU/IRSyDUlD7YQAiPRDHuh5tU7 i1NVZftjkB+ign82rJTYk3e92GPy2yOu0kaciFAVjK15F9EQKzAdy4leeXlx9SosaSTPnPiF9Bphu pk5gS62JJnkru3ZxmW8oilvZFn5emoIb1kuoUEFYipSmZWPkrmcHume6zdAXEJDvMaQIvVrYgWxxj UZQVT2Ew==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:40856 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCSr-0007pN-0Q; Tue, 07 Jan 2025 16:29:57 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCSo-007Y4X-2A; Tue, 07 Jan 2025 16:29:54 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 17/18] net: stmmac: split hardware LPI timer control Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:29:54 +0000 X-Patchwork-Delegate: kuba@kernel.org Provide stmmac_disable_hw_lpi_timer() and stmmac_enable_hw_lpi_timer() to control the hardware transmit LPI timer. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 0a1e2587f8c7..5b2ce5305b4b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -390,14 +390,24 @@ static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv, u32 queue) return dirty; } -static void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en) +static void stmmac_disable_hw_lpi_timer(struct stmmac_priv *priv) +{ + stmmac_set_eee_lpi_timer(priv, priv->hw, 0); +} + +static void stmmac_enable_hw_lpi_timer(struct stmmac_priv *priv) { - u32 tx_lpi_timer; + stmmac_set_eee_lpi_timer(priv, priv->hw, priv->tx_lpi_timer); +} +static void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en) +{ /* Clear/set the SW EEE timer flag based on LPI ET enablement */ priv->eee_sw_timer_en = en ? 0 : 1; - tx_lpi_timer = en ? priv->tx_lpi_timer : 0; - stmmac_set_eee_lpi_timer(priv, priv->hw, tx_lpi_timer); + if (en) + stmmac_enable_hw_lpi_timer(priv); + else + stmmac_disable_hw_lpi_timer(priv); } /** From patchwork Tue Jan 7 16:29:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13929336 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8623B1F76CA for ; Tue, 7 Jan 2025 16:30:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267414; cv=none; b=bcF4DhkpzLf2lKN3JbAmYCdsf58e+HcAetQVGp3PmfpDWxmMkdaQ82qw8udoAzNXYGpsYkRSmUVfPkoDiIxwhsFTW+t3ogAwtTCQH9/7RD4sZYb/pLjdxqTeJVUCdvFIgA5Z5v82wK8mG2pO+0X73BgGo7q9KpsyqF7Q4/Vt0a0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736267414; c=relaxed/simple; bh=waPPysbUpjgDiIEhpIbMiwDwc8BtiBe/v+ngxznYh78=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=FX9LBQXCPPdCehe9ukVY4bW8wu4lImdp7L1mCbr+8LNrwRQ70bGmdajG/nJ+fHNklNI8/qeL9u3TxDsJlYu1Q9xweUI0DCKOaSUGWO6VqAH5yjLXOsW9lOZQkw0BCwqSVngRIb7cTb2UxeqEN5Ha4/Bh5gaRvvsBJHnuGXrqQwk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=KWm+xDqU; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="KWm+xDqU" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=k4h4DvLs6eIAMMB+SiDt1jAxdP1YqbY0pFewk/QkNZQ=; b=KWm+xDqUuNYy43JeQyW+mp8Lhd AGblvifSnlJllc1Awi+zNSYef4lfrfaOat9RjHoyoJHs/pSaL+dVB0PfAu4HXuzCuorYorOoUaMI6 Tb5sBGwfKk0wM10xecW7rYGrlQCR/+wsl9xxjUQyVxu7CpklL2DTKZ/kZMiCxg32uz+j6nLV2EkgU Q9dO+yiwiOI9tm0jZBLwoGBDjPL8Ru0wn6EER36W88l8zLtkt0UWeHdElnygY0pEiLrovqyUKzLoL OxXXDWBz/w2UYAg0yUdbEPkAiZoZBDAQz0dprPHaMKPKbtJtfxIisKtwvo8VKHbCbwbzj4QjhnpHT +K8P5/rA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:50608 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVCSw-0007pe-1G; Tue, 07 Jan 2025 16:30:02 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVCSt-007Y4d-5y; Tue, 07 Jan 2025 16:29:59 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v3 18/18] net: stmmac: remove stmmac_lpi_entry_timer_config() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 07 Jan 2025 16:29:59 +0000 X-Patchwork-Delegate: kuba@kernel.org Remove stmmac_lpi_entry_timer_config(), setting priv->eee_sw_timer_en at the original call sites, and calling the appropriate stmmac_xxx_hw_lpi_timer() function. No functional change. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 5b2ce5305b4b..250e1e7df050 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -400,16 +400,6 @@ static void stmmac_enable_hw_lpi_timer(struct stmmac_priv *priv) stmmac_set_eee_lpi_timer(priv, priv->hw, priv->tx_lpi_timer); } -static void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en) -{ - /* Clear/set the SW EEE timer flag based on LPI ET enablement */ - priv->eee_sw_timer_en = en ? 0 : 1; - if (en) - stmmac_enable_hw_lpi_timer(priv); - else - stmmac_disable_hw_lpi_timer(priv); -} - /** * stmmac_enable_eee_mode - check and enter in LPI mode * @priv: driver private structure @@ -489,7 +479,8 @@ static void stmmac_eee_init(struct stmmac_priv *priv, bool active) if (!priv->eee_active) { if (priv->eee_enabled) { netdev_dbg(priv->dev, "disable EEE\n"); - stmmac_lpi_entry_timer_config(priv, 0); + priv->eee_sw_timer_en = true; + stmmac_disable_hw_lpi_timer(priv); del_timer_sync(&priv->eee_ctrl_timer); stmmac_set_eee_timer(priv, priv->hw, 0, STMMAC_DEFAULT_TWT_LS); @@ -513,11 +504,15 @@ static void stmmac_eee_init(struct stmmac_priv *priv, bool active) } if (priv->plat->has_gmac4 && priv->tx_lpi_timer <= STMMAC_ET_MAX) { + /* Use hardware LPI mode */ del_timer_sync(&priv->eee_ctrl_timer); priv->tx_path_in_lpi_mode = false; - stmmac_lpi_entry_timer_config(priv, 1); + priv->eee_sw_timer_en = false; + stmmac_enable_hw_lpi_timer(priv); } else { - stmmac_lpi_entry_timer_config(priv, 0); + /* Use software LPI mode */ + priv->eee_sw_timer_en = true; + stmmac_disable_hw_lpi_timer(priv); mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer)); }