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: 13929349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62903E77197 for ; Tue, 7 Jan 2025 16:43:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=CT43NNJbVwdfAfypfZGQdJlroOFKN88S2LgKWnUbjeQ=; b=5BpViqEoz4v0xT9BTfv5KlP1Sp LNdNzu5ZPpaxM+8o2eEOJbpe2jF5gJa1h6OY7ulxl1OT1+qTiUF5r4uZA/oawiwaalNDlwYiD9kYL ATjE65/zfmp1s5Vdd0gf2vTltpysad+UrRUUcEkBZV09O3r/7mNJbvjnOjLakczD9jobVIEq2Vs6G boOV+Rj6nootsQdoE2IAG8+3thfh+o7Jk7sb9uwqu7rqX4kUq/4TZdWbeS2aTWZ+fB6SHOedQRf2h nFOt+SoB6eegwfZvyQbW/4TRKhlP9Fsu8fp0RHotKYP5E/nkoXFBESt67tIajm7T1xdOrZjxmXG++ j3tigOOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCfR-00000005gTm-0vP6; Tue, 07 Jan 2025 16:42:57 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCRd-00000005dIN-2zF8 for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:28:45 +0000 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 MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:28:32 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082841_744182_581B0AEF X-CRM114-Status: GOOD ( 12.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3356DE77197 for ; Tue, 7 Jan 2025 16:44:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=wTucdxBsyxS+cOkxhWYe5qi3kbnYyn1rZzQUdPRV6AU=; b=QHtbxBZT6HHe4mRpDwGfEMqvnY 2ZPwT5JyWzSW5vS5wfBwJc6Wn7nMFnYQhRAtt34JR5gt7sH8txMLP9O30v8H4V4GJdKQOEv8YAVR4 YMH2bbboBQVoQ6c7Xs3R3ktogIz78uAeSwWc4mWibE3Dq/C7xIkWR4rTN14EDmLHCt+kt8sn+rzhN PhH5bDZPmhoIuwxOvypz+zPWRWE/mhC5fyOG4n8WmksdlHGUR9BwfJMaYM2M734I1Hsz9205h0F7B K/K0CKWPPgT71N03hn5QI5ujAoJ8HmXfViH4yepw5G/De7WphRRTQb1rocPiRK+TT4FW+136FeSmy 7drRXlXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCgb-00000005gly-3cO8; Tue, 07 Jan 2025 16:44:09 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCRg-00000005dJt-47xZ for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:28:49 +0000 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 MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:28:37 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082845_026547_557F9BAF X-CRM114-Status: GOOD ( 17.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63694E77197 for ; Tue, 7 Jan 2025 16:45:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=Hy6dMB/NYlTUoopxS/bUiLuE4+CdWNkcsNTcUQf43qQ=; b=hdmT20ThVGumf1FClNaMe2p1VQ BzHSQpzfB2UpRhaMqRUbDDOETlSVKkXKvY5R8/lRr7CxoFMGKCe7GQH8dqwXbdEzrrY+PJ+3lT+Yn xC3ypjjcfLa49Yax+MBSwVO88iyPOgVO1Ql0+BpgkjFL3TVTu8oYFl5sC8lbzUSvHT5TxeL/DFNPp 17D6IU2ZGitMbJ9Xw18P+q/gQ57sYaMEmAKdHJMyNc4FFVgzb20v8vHQMUR1zSEChtsBAauL8616m M7JExPsAgXrnz5flARNmRGXTeVU0baIhRgOm8Kh3c6Ecx9+asKDWP/MJdbUpeAI3PHgYbGXPkmZPc vGuArCKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVChn-00000005h5k-2Y8k; Tue, 07 Jan 2025 16:45:23 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCRn-00000005dLm-1BkD for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:28:53 +0000 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 MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:28:42 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082851_328229_D8A43E10 X-CRM114-Status: GOOD ( 13.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929354 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D32B4E77198 for ; Tue, 7 Jan 2025 16:46:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=tyoVehIX0KvqvNNqrOunqnbcASeMfHXCgtKkR1jpJa4=; b=xhmSyf6dev8qZSGChoap+7ZGYP PCRxX/cHTIjAKhOFw9qxL2REcLEQcVmyNEvOoLmiYdtVg9ZGe8yz4u+zAh9d2sdOyJtaNr37WURKb vTxjNMFmu65+x1BRrut2EARaFYT/F0y2XPP9ZsRjXPZpZH6bEKBcylqU+3P/Eu56d8M0+IkDozy+w xxuDwTtmy0bCH85Pto5ArGmNTASl/3zRMtFjX/hkYy+ySuS1WuP0T9+cwIfUrr3tQbojIlxs6Egdo 41pl39nHPmRVOXejwYyPf9bTzoJxS6NDQ4VKQUhE5l+toMIRhfAnYlqtTNzwow3JbidnVBgrFI/im Qr9rDQHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCiy-00000005hMF-1Hvg; Tue, 07 Jan 2025 16:46:36 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCRq-00000005dNM-3ZD2 for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:29:00 +0000 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 MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:28:47 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082854_894252_3F9A9F42 X-CRM114-Status: GOOD ( 12.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D19DE77197 for ; Tue, 7 Jan 2025 16:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=m7sRj8MyoTLWqspxEn08rVS2H9QlJQS/1BnosoK5uUE=; b=GH+Pkeb6ucgCJzc4AA5xDF3MB7 +00j79brKHewCy+RIDDiSpZxfdZ8yYeIc0w4yUjxAEv7ywXMjIorInGwzA2GsflCYbTtGRgHb9bGR zXpI7MbC/tfDuUEsVVoAs1qhUsinEgFF718W0v8nHAONOaTweHUtgFaPgIwVKvy/drYMnHtVSRuY2 ryGSOsvl7rEUBIRvuvfXt6zsJzJHWxkRC3i61vjGxE87CasMfhIyD0WQikW2u8m9I7y8RVxHOht/o PLpGFTPI1p1Kz+dsV4vVEFxIWsm5KvfLiVtY86ACgQtqOQcZGnvbU7bYecOEDlkUv5G/9plTZg2nc 1PRZKrhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCk8-00000005hZp-3ztV; Tue, 07 Jan 2025 16:47:48 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCRw-00000005dP2-0Xfx for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:29:04 +0000 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 MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:28:52 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082900_169868_03C4D26D X-CRM114-Status: GOOD ( 11.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929356 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3122E77198 for ; Tue, 7 Jan 2025 16:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=htW5qn6DvTQCml5FV0+E9wXF615rxk0Wx5RrDokY4q4=; b=w16ZNGZGw3GGjEHg0eERnwTr8c FqCktlgyiOGZvdepTSxbNrPI46+0jt8mRVgNtFq3sJwfEdGwRnze1okJ12Miz41wAsDAMp26YsHWn t3omNfuirxPaVAmbCm7wDv2H8VdSJBPwT8Podr/myZooSkUrQqqsbltlPaiSysNrJZM4vIgqigO/n i8e9zfCf1L58ZyV0gQwbF4LS/MZVCmP7GDDYI4lhNl00nYSPTuX6C4As1F8NprR3v9r1cWeRaySIV LKs4CPGFqlhXpSwWJY04cBXm/X3bgFNCfpScGSGBwCuuLPw6rMVNW6eC2atJekKgxv6qmJECRhQM5 8UwFP7sw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVClJ-00000005hrU-2M7T; Tue, 07 Jan 2025 16:49:01 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCS1-00000005dQu-2mLz for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:29:09 +0000 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 MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:28:57 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082905_705306_7569A465 X-CRM114-Status: GOOD ( 13.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E4CEE77199 for ; Tue, 7 Jan 2025 16:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=oq60lzgRpWi3eAZ/MUBwnwLL6gwP4hqHvvlrP8GACm8=; b=WBWf1vA4Z4+6KGX+vyZxlsR8oW ZHGhbo26Qt6cJU0XX0iA/iEeb++DH4ZsjKFeAkgfMmx7HfYCW6MeGcwmeeQSWlknD5yvggf8ooela 7pWiNha2Baa5LDJqTqmBQVpKTb9/+42KfityS2qzpizRIPTyByBd9STeVyAiVUzZ4HDaChDpW1DbU B66OhD7avf7BnDNjbTLgM/9Z3D79AuXlpTLE1oYBPT5HkRpAn5oVn0Dv0iN/pGg5jtxNHfFk94WdB 2vTlPdm2ldmh2yd9Sx7hgsLfE9/Nn3m4LPY0rQp4yqksUzXohI7QCrsA05OcPQKXGtLZgaeUH+SyV bgaXHDkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCmU-00000005iA1-0kmP; Tue, 07 Jan 2025 16:50:14 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCS7-00000005dSA-0PBj for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:29:15 +0000 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() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:29:02 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082911_133622_F170D8EC X-CRM114-Status: GOOD ( 11.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 835EFE77197 for ; Tue, 7 Jan 2025 16:51:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=5r/JJISMaJlmINK1abzjxiwPeWCf2+xNCCl1rn0zXJo=; b=GGCAenZm/f1NGfQ/H5JAp/AKcP xSO5EvQLud4XmBni2T6+5B7Ku94qiggjDBoLVXHBmvfmXUt6CEVhLw0Nr8ZFjcuqJdUj5i2pbZM4/ KbktU4+74BkD5AeCAE5Gx7EV00pqpuUordAmCie9yxhOTcRiBV01BGuTOZNDA5nhQyrqLfuhyXo3P RpOCyUJISTWTQkOI+TKbed6DY4NjqxsKLRSH7qTv9pE0NBP7ix8K49SDchBWh4WA6NSSR1pA2F/fs RIlkkw71F/FgOABUVeVnRMtAWbt5qcP3DV3ruQsBNRLh9vG+l1J2fqZuNYDyR1jxC0kx2hFgTG04k 47iOzbzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCnf-00000005iUh-3Zx9; Tue, 07 Jan 2025 16:51:27 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCSB-00000005dTH-0KPO for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:29:19 +0000 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 MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:29:07 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082915_115829_4B5DEA76 X-CRM114-Status: UNSURE ( 8.60 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D035E77199 for ; Tue, 7 Jan 2025 16:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=ecrgOpPZJ++e0c3wZgjy52va9WtAhn5oj3/YTdAkwvw=; b=CrcJHVpOYB24I3U6gfZ4D3bSti W+uAP4z7e6G/e7KJof8A5prcCLiZseI/UKikkfxS9/j1EsVEgMrJV2HfJzhEUnUgQ/Kogex2jJCDA 4SMHxegsnPzedh7JaDi0yoOPfptfOceUdoL7dUvl4f1t1MEhKqxDVSDfSQ+ndlD8JLRxw7bucxmdH oE4vteePxVVJY3+YGxGDEPVF+rm7cfTpdwnhf2wv3AXy5EgZlSg6yWnnbJzKGzwz85GQap/lysvhw 3acluPo+rOYSNuplMFTJ7TOn9tVqON0MXJc+YMXevUtLa/M/G9fwuzUdtdUHxY0/Ejee1IPOo2RPq F/8a/AzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCq2-00000005iz5-2kgt; Tue, 07 Jan 2025 16:53:54 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCSG-00000005dUg-3LKu for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:29:24 +0000 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 MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:29:13 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082920_832358_860CE887 X-CRM114-Status: GOOD ( 12.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929382 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 883A4E77197 for ; Tue, 7 Jan 2025 16:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=7d7BQ/BETeIV65nPIiOzm00NlijFDRQ+qTkPLKa/GqA=; b=ru+o7MHtiTzfQDjN7V2ugmAI2/ x/McdmT/38zQ9WKPLGgAMNIyP2/h6pj0ZGzlF7SsOS3qvz/vqHCIi+eOdhbb/YPGaMaJtMCWNwGt0 hMrd5VfhVOd5maoKZyb/QczhCaowROjzbyOzONA2ffSD85gc2ZntjffANH08SyhjqQh5/sy5/ChPg C8gcQGjA3dMypkHQh6xyXaCS72zmh/w5nmtsyzsTd4KNoWEoqsOd6+FUK0jtoBe2dIkShT7kHLi0f +Bj31elHuNMxxXSGDLCYJNZNz0KZOEtHnEznatROn4eBNOmjA2TdQs0emt/yV0PN0TE+iB+mE+ZFo 67P8qq1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCrE-00000005jCf-1FIT; Tue, 07 Jan 2025 16:55:08 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCSL-00000005dWb-47Tv for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:29:31 +0000 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() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:29:18 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082926_047045_9DA11E2A X-CRM114-Status: GOOD ( 10.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929383 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92CB1E77198 for ; Tue, 7 Jan 2025 16:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=Mt9PshpQqw68RFtJuRwMKIvYJt4mlpJLQSaP3lR5Qzk=; b=B0o8QSu5/v4itpF9LuKwFN1vcI tx1Ec3uIeD+f5benfFu6xr604iG5BqNcmdszVJLJJC0Hh5IFAgvx/MMcAOkf9sipaEcFlo/ninYaX M+nUYJTR13q5dDHiGDLzvjMDfpOFswmfvVdH8czUi0jdJmNlUwKWqIEhvBigvmPA8Rn9WgwyfrjuZ WUorxF7XxqbBtIRlyiXbpbWcle9Ws+P5Ns8u6fhk0VZzPrHUifm5iGwOTlJ+mBaAWpDwmZliABl0E CPqIyXxYeDxpUH4L36B79ZEPMKZNDCopuFLdyJFEhZFYqJe0qcq4qQd8wkQtOi21DOBaoJ8E6uREp ZkULK2qA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCsQ-00000005jRV-3tTz; Tue, 07 Jan 2025 16:56:22 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCSQ-00000005dYk-3Lbe for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:29:34 +0000 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 MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:29:23 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082930_839356_0EFEBC1E X-CRM114-Status: GOOD ( 11.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929384 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F830E77197 for ; Tue, 7 Jan 2025 16:57:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=AtobVMnr8E5gzN8ZgvrreHjtEy+CmRHbLYgzCHnDnG4=; b=R++xRx+J0tR2HNR0To+HVPnDJm kzTTClmVAutfrtzea1NaPVMsNkCotzvo9U4cl4yxX4ABgF7Uzel+vufZuTi9qpQOM/YmvLls43UqQ Voo/s+4Wvyyjq2kcSHG4WHTuQEeeDeafkg0vIFvdTib+ZRARBQM0X9cuiTK7mB320toAt6T+nLEeG dghDC5KdGC2OiI+HG0Ydqr33KBguXLl1wbOApERCeLpEsjGhbF1QhFD3WB1RiV0gp09o9g/m77sev nR2qzfCk+rli1brBNndoPrZSo4AVGr0Kd1lqNYLaJ0clCaFJSQbgrIAKAygrAE3k96bbJGYlYYSbT mjIHDvLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCtc-00000005je6-2Hrp; Tue, 07 Jan 2025 16:57:36 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCSV-00000005db8-44gb for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:29:39 +0000 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() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:29:28 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082936_009717_AB69E429 X-CRM114-Status: GOOD ( 12.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929385 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32542E77198 for ; Tue, 7 Jan 2025 16:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=j7GTEfja/07m/dxB/a0CmEMLPjybqsk6izUSl+b/tGQ=; b=cazbEJgpGYm3nkCiikFC6CSdCk roXZaWgqjb2q91bRgcppm515dE1r3BbOdsL4MdUO6rPcpoboQgA+XwbLcn4bP2ZVM1Y/SMhyytKr6 ZHYmqJ8xwSI+G6QZTJ/XcAtSL9jeL1p7l7F2B9hDoydK19WMq8RY6zClniLcFUnvMbLXvbFTrFsD0 aZgslaBeEQXHGXDMbgqFpfUvGTKvhFUl7qHbGoMgUxOboNrqajqRaV3/sXbfTm/TM0/mEU6ux1dYF 9rFKmXJpbN8FibxlgSV0dCqZNs28R3at8y9RyQ1OrLxW4R9Nij0fD2+RvAJ8+551ZJhpibYIoDniy N6zXJD6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCup-00000005jtk-13Xc; Tue, 07 Jan 2025 16:58:51 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCSb-00000005deC-1NSt for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:29:45 +0000 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() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:29:33 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082941_366242_FE1F9A8C X-CRM114-Status: GOOD ( 11.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929398 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6FFAE77197 for ; Tue, 7 Jan 2025 17:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=qm2Cf1BaSz15K4PsGl3xyn8XApkKB5nwZMBaIeywDjc=; b=ACqq4jZi7FwLCnuFI1+hRstp5W CmSgsYmET8hSt39u6CcERxZSCwemxoyDRFblz00SiIYezUxoAVH39QtB+aZzStKVDrg/6RdQ0TIrn C78Drnzb3N15/E3KkkuImpsBqsScAYXZWiaX0jngp5c3xV9+QTwg8T/zR+B7OZjESwe3+q/ZPv9b9 pBHQurS4iG5q8p6IZKWjwcwU0GwnTz6xu84dYiMxYlQ8Ezmu5ys0BI5ca7F7tmVIuw1EZwP9jMCtn 5eVWTPGFTJStPRxO0Dt7w4Yxfuifa1YlLqJcqXkJpH/tSXKO2Xzc2V9eslSf3TPHA30yCZ+ep03eU 3UyD+u7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCw0-00000005k83-3gNf; Tue, 07 Jan 2025 17:00:04 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCSg-00000005dg2-39oy for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:29:50 +0000 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 MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:29:38 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082946_801777_8022C6D4 X-CRM114-Status: UNSURE ( 9.49 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 87F01E77197 for ; Tue, 7 Jan 2025 17:01:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=4M3GO1u5UO9gUdI/y1VtJSws8EiP+NlPYd8R2GK9U4M=; b=QOyQtP11IOCn2g88wYjZh4UO0/ i2VQ84vAjyrHKo6YQGfj3J70ihbZWd0RxAK4kEnKp2tpCeA+mHIG9UvIu7SgoPfBuiCuWmCT9zaI2 QxPKJgqDpwCv2UyqlQK7eY+C5ZxfmaE2EjEG5IECaiUUuyhBmMVe1V+5Wsn41z73fO1CXeMzC/Sag g1uyuEzUF0f12VZYMq7DBFbBiCIvFjYDWXYd9w48DpeEcfDafTRbAMe1YZfRDO/23INhDXauQ10N+ bBiEX7kcU5H1QQX9wcDHPVYkahKdFyPZsUilmbeYsd72l5xWcNYDpIt2GgPioZNDXgE7r0qIacX7S HokD5s4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCxC-00000005kNA-2GzY; Tue, 07 Jan 2025 17:01:18 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCSk-00000005di5-3p3C for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:29:53 +0000 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() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:29:43 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082950_949625_A405D67C X-CRM114-Status: GOOD ( 10.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929400 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B188E77197 for ; Tue, 7 Jan 2025 17:02:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=3AUocAZiwiTM1o3I9pmtV7S57CGscNwsOJhG3dqdD+Q=; b=lpQZp/OvGm5HpBHcLDL5JnF5Uc cuA3zWK9DVMfpJFYU8nLwcE+7itdbaweh3Aas1AQgf0tgeLI4ZYKTJXK2iqz/AsQ7godv0gBmNaHn k/A50SF6VPm/YvEohvmv5mRD81iYD4c1DbweuAeSi8Y1lwpTcbcabCt1CLI762Zr+erCFyDzZ/kp2 DYD5a20pBsKmubtJFVBd81YTOH4VPmzZ4R89sHjAbHgiwzEXMi6BPBgd/N2xBe1ilb8VI0gpVTpy0 JEWrIMJH/s5MUuds8cAT5JBeCUPOOsANyyxRXn3k0oAo1XuNMJt1TdR8lexosBXOxrjnjvmxYVBvi MHyI/joA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCyP-00000005keO-0ozx; Tue, 07 Jan 2025 17:02:33 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCSq-00000005dki-3Whd for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:30:00 +0000 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() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:29:48 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_082956_889118_EBB85A2A X-CRM114-Status: UNSURE ( 9.37 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F737E77197 for ; Tue, 7 Jan 2025 17:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=iaGToDXR4V19BkyZaj/bzbtvRG0ijebygnWTlbtXVvM=; b=EmWGLUIoJ7PIa2o/iBXIurUjHa 4RsU7PmpxirNrIUFon6SMP/Oyag62hGOeNBqnJqxNOqkndCZzNWXPcBvW81cBEo22VvLVl6lTyp6i SRQ5rMU6BDmx8cnc34kIv91Wmx5PR/96LoVgDjlc06Ea0HE9jjFf8aow/ta+DraDTmib/GSbAt5bg /PCOoXRxrMyJPU0tS3D8foMuWNTjXQBbqsdgjl3mW61zkfpAxQd6mG7wReWEHyAadfjjlrAT8VDQj lxGK6tkC7fGKdO91keGVWZtH+njoueWXmPozdJDx0+bykDnisGiUl2uJaY9lcfqzOkuCzSe24wWbS SbGEDfLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVCza-00000005kmT-3QUW; Tue, 07 Jan 2025 17:03:46 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCSv-00000005dmU-3q0d for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:30:05 +0000 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 MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:29:54 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_083001_957162_1396E7D9 X-CRM114-Status: UNSURE ( 8.81 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 13929402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35ACAE77199 for ; Tue, 7 Jan 2025 17:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date: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-Owner; bh=k4h4DvLs6eIAMMB+SiDt1jAxdP1YqbY0pFewk/QkNZQ=; b=uC04zSUaOx0e7HVyTOxBD67NQv bxy83hW3lxgxIh6CRSen6pYIG+p7FMzdo/62v8uZCPTlEUuAqqpYXyoxYm0+QKd4EKB3d6vxvSCf6 aWGWfmiFzkMKVhlYhpx/thcfdIklf9bWG0AJxJiMun3QgwUVLmLjIeg27LXzul0knP5Qm4CDrdqz9 7hp6O8XX/YwQicHdZ5aKLkHVnVji+7EkmOcVkB0eoBanCK7MMC+XFWu0dF+O/9D5E3SoGgiIJW8kx BQHsyKMijRv157ecNOe8+XRtTvcJlR6MHANkiWK65J3pSMQxpmvbDyZyEgbvW2bGNIq/TM5PpZ0FY SEtrkUMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVD0m-00000005kyw-2Ccj; Tue, 07 Jan 2025 17:05:00 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVCT2-00000005dou-1G74 for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 16:30:09 +0000 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() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 07 Jan 2025 16:29:59 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_083008_335717_A035AC86 X-CRM114-Status: UNSURE ( 9.55 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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)); }