From patchwork Mon Jan 6 12:24: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: 13927357 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 EB409E77188 for ; Mon, 6 Jan 2025 12:30:46 +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=OXNykwxT+SEQhza6dNAvYA0zWQ +MPJ2Vx5YF9+jFS0Ws06ac4EpByEoXdr4udiFMi8pRCrEmUTfSm9YlRvnXofLIfuCCMP0GKyD++qp T312p47bRhcnwQ/fLG/Dz8F7vd6LBbZ8RZPlC34dghHXh+sS4PQOUhr7e1oES20UnVvFF2J1ZtNqu Pmq69U3vzQABh3oLr4RXtImumnfTQ+J+vATKj3a1rEPqc2FYbMmUgG7SR/q6n02QVmioLy/z/rshB 15zD2KyDKVLRCmLFJ8OlNCkew0dUvxQmFEMAu8AvdCqJ619xwgaoOCazf6WT1wvdVwBrhcz4u0kzR LcoHNySQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmFg-00000001EQ8-0M5W; Mon, 06 Jan 2025 12:30: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 1tUmAC-00000001D0d-15LF for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:24:57 +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=h11kneiITp/NaXQfWyCCxfPLo3 H4+v5OHtcbjf7duXrP18OusOkkmakYQMcTp6p94gE5jqjQRzRdDLI4T61AYFbeFpvQRq43UbAMIRE frdJAWmFsHOdNLMHxWCBKfjbrS5QiIkLgblfzpCpZWox2WhcciHXNbBmdKLeUiJsj64n1jCy83Uxx Smh0oJ2I12eJlRGvayQ7kmBOhXNLzYHEgWHNvhl+DKTPmRF1v+l5hnBH+KQgabkDsOcpBmMtUBFXx 1fxQZAKaGzWx14agfAum0iFYgKhvvEGuRfQabnS0ZDRnnMQQ0rCKoEzwVfOGXnSeIvOgyKniYDhlG 4nT/wpjg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:58556 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 1tUmA7-0005qL-20; Mon, 06 Jan 2025 12:24:51 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmA4-007VWj-MW; Mon, 06 Jan 2025 12:24: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 v2 01/17] net: phy: add configuration of rx clock stop mode MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:24:48 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042456_299891_C9AD1691 X-CRM114-Status: GOOD ( 12.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 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 Mon Jan 6 12:24:53 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: 13927358 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 74AFDE77188 for ; Mon, 6 Jan 2025 12:32:00 +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=KwRogkv+w1GhZ74kKJ/MwkPNF9BIfsN83Kamp9zLqQk=; b=Qj5mql8Ne+0hu8/yQsqcvHqmp1 xf+A6eSTO1NrVpYVLyXK+5Tjrdc9ylUQ03XVqpR8N95XRbCQxwfAMQmEYRvJRt2MLZLEWj5bAFvQs kXjWJ4J7GWAhnmHEk9oCRwcWO8K4kzJDCooAJVb+11sY+N5XygrLwPMgxmWlQi0IuzCOw9wDg7UOm tanDiM+9cZLgCQbBN8CZUM+o4UP6hRYvxoH8EZa8mq/b1uUG/5r8IENu3X1EOGhDrxYvSNwgBvyTB +tPmUNA7CjxTBaWIDatk5QEhbbzL3cZ7IybixCvZ0GcgOhtyoOWQ1RyD8+4FleMqsxvE+YUlXSGuF Idxf2NtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmGp-00000001Eh9-30dc; Mon, 06 Jan 2025 12:31:47 +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 1tUmAH-00000001D17-06gF for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:25:02 +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=KwRogkv+w1GhZ74kKJ/MwkPNF9BIfsN83Kamp9zLqQk=; b=WJFSzlQD3RooeTjVNRN5J6Ojym SNFk4TOyuPdK2ZPCGnoToM35azS6VBdDcoYrwCiVSwojGy8j4EJIoRL8H7lP33vS1FL7x8TIgAphN Xnbx3dA2QzogARbxlTK3X4b8GVas0eIcMqpmIkuFMWG53Y1SOeH5VZobTR+xE7RVCA/+cxi+WxOLv 9YVQC5+jUWlMRKyIPPkGvZld0Svdb0js+s+7M5wb3qmvwKWF+jabErgsVz9eXyhk/ziphAjFX+hKO QWqlSdSle4MtwXq7ZkY8hkEp9nruF0P9ASeE5JpyhA20si9vEuGoDKzYybXeeGQLXFLF8+3U9kY4Y l98h95IA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:58568 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 1tUmAC-0005qX-2M; Mon, 06 Jan 2025 12:24:56 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmA9-007VWp-Pg; Mon, 06 Jan 2025 12:24:53 +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 v2 02/17] net: stmmac: move tx_lpi_timer tracking to phylib MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:24:53 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042501_106551_3B8BE423 X-CRM114-Status: GOOD ( 18.16 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- 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 99eaec8bac4a..9a9169ca7cd2 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 }; @@ -3439,10 +3450,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; @@ -3909,6 +3916,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 Mon Jan 6 12:24:58 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: 13927359 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 A0614E77188 for ; Mon, 6 Jan 2025 12:33:09 +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=+LLQHoSX8vSQlf7J1c+gTb1Q0VknSoMaDWaAEv2Pels=; b=rpd9ykfSID0H9vaqzmHBW6/KQg HohUaXCWt62VQDOO9DNLJDzFMNDOT2tlTqMfiPagdZR7zqE9xjFqHIgGI77zI+etuThsXGAiJG7UK 2foSvNEGC8QwiIqzt2/OXQtjZA6sRc6KIHqYWc0TtRTudIcQlQODa+7CNbR2gQpc/aZf26wUaPdhi UAKSm+s8BVln6R6s5vnQiAHW1ZasYhOzfTwXytFQhNaXD6tjoflOOr6GyrRUVFBzrQNPZ9PjF0ZAc pPimtjtjFAVd3hdjSmkOtAflX93oG0DYjPIt9lvrgXSbStNqaHuBoqQttcG1X0P6rtBUXyL3w2a8t 1z4BRTeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmHz-00000001Ex0-1SoM; Mon, 06 Jan 2025 12:32:59 +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 1tUmAM-00000001D20-2MHo for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:25:07 +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=+LLQHoSX8vSQlf7J1c+gTb1Q0VknSoMaDWaAEv2Pels=; b=l6AaXcqNRD7tuml0jIh3UNFqxb pJRvGNLFOPt/o4Ps/e0IDziS59vYd0qHm2Nhn3/iAErEXofbQpqYtfwON/oe+6Q9x5hyeYplRI6b5 9ZX89deffIodV+7QnBxvndGNNLL4zBL8ugZDxTaohxwTBh6bPqw+/+0tUpighLBGz70Q8iofncIob uUloDW789ndgGSBJpPO/LAPNdSHOUZGH1Bhpu2UiFCeASGspr5Jioxk1y7OXEHgXliSdVjHzAvX5f auKJ3uwfz+Vf0Z/ZToABf0JHuoVdL7/w+2phFuXP86Kg4d+tTelmdCiMUPZwKK7mqezfYKwAEdQ5N A20c9wsg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:35822 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 1tUmAH-0005qo-35; Mon, 06 Jan 2025 12:25:01 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmAE-007VWv-UW; Mon, 06 Jan 2025 12:24:58 +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 v2 03/17] net: stmmac: use correct type for tx_lpi_timer MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:24:58 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042506_602333_63CA6696 X-CRM114-Status: GOOD ( 14.86 ) 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. 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. Also correct "value" in dwmac4_set_eee_lpi_entry_timer() to use u32 rather than int, which is derived from tx_lpi_timer, even though masking with STMMAC_ET_MAX will truncate the sign bits. u32 is the value argument type for writel(). Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- 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 | 8 ++++---- 4 files changed, 8 insertions(+), 8 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 9a9169ca7cd2..b0ef439b715b 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)) @@ -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 Mon Jan 6 12:25:04 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: 13927362 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 A7929E77188 for ; Mon, 6 Jan 2025 12:34:22 +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=v9uE5xTG9qTQ0AUPbco1oDtQCPyFLisTdvXtKl/xZsU=; b=m2bV2Nw4Ia8imODoRHRUnL8zJK YLYpcg3n6HPo3qHxyQwfHZGZeyuwkDIiXSuGEwZ6fg5RxxFWri5vRO8cqk1YeWmU8RnZT4Y9+SuLI mGfklPx9AHMHKAH0P0D9P3hyvsJ3IVJuyHb2W8S9Tne+vwon8je46y0RI90mrD6qynt/yg7ODL1yn 04y4U4R5w3pEsr21M9hj1RVjOsfDUaALZ3hqu/syqTyA+BF3vqEvlTnWJym3HiT7OK222cg+/j+Pm os+WibI6Jl6lBNf7WugvBLIT12RR2ALIOzeL09/egCvl9GB6dZS/pSULhetQWFdH5Rk3VH5ZlF1x5 RcIy7b9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmJ8-00000001F4m-0FOe; Mon, 06 Jan 2025 12:34:10 +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 1tUmAR-00000001D3E-19dz for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:25:12 +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=v9uE5xTG9qTQ0AUPbco1oDtQCPyFLisTdvXtKl/xZsU=; b=hDA8FV4WWi/YZh4SpbMJtoCTx5 cTOx/jNNwaxmWMj//2xA0aLilY5IhIYvl9Rz7lb246whJ/4ULsh/0in1HiS0qa0rkl9HGixTNyS2A elnQMdP8gXVwI6TPOTM3mL48iaAkW1X+F0Pp4lJ43E1ChH+i16vqdRO2wzfJNz6wkzv90QN8fxPvP TBjY8XgKII2w5ufccQYJiHLYU3pTK3CTA0m38QXOiFEprJvaYiq2ZldfpN8HeLiXV85QT9kN2OLkx 1R/4K6zjxrlGmmJjy+Y9vBwd8PjusLitoNG2aTsuEq5/Mpnnfl9r5/UmqyvYNY+ynBO+9oE1ZjWth JF/gJV4g==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:35836 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 1tUmAN-0005r5-00; Mon, 06 Jan 2025 12:25:07 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmAK-007VX1-2Q; Mon, 06 Jan 2025 12:25:04 +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 v2 04/17] net: stmmac: make EEE depend on phy->enable_tx_lpi MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:25:04 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042511_314992_280FD16A X-CRM114-Status: GOOD ( 11.99 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- 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 b0ef439b715b..dbee2de08583 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1085,7 +1085,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 Mon Jan 6 12:25:09 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: 13927363 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 C1640E77188 for ; Mon, 6 Jan 2025 12:35:31 +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=tH1Du5lBcy6uX8uHJ7Q3PvQHP4R+mjatSNiKbMVdnuE=; b=WCzWKpr9BqhScM6gEHPP7RxKiU E9VlY9Nppa+ZnASJL2qKHpd8MILmew/Lb0BYQWzND0SysNrP8zf1DgcoRDMk1x8ehrjUk48aJdsRU uJxDCg2wsGA8BnwCCb9nhzQh6ukJneuAXOMbkfBui9Wo4zP775uHit0abVLbjXUmLF8kXTpTqnOyH GNMtrZilLviA8SUnJWrPCWNteWcynnLeLPlOKk4j9YkfK7P1zjCpI3So/T/hhZyf0VroydBjBDWUD dbWJE57cry/R1nJNa+ixRGuoMBB/ANUGRFfvZ3ka0143XDQ5gyTOw/4Jyqo23PQlUDEUZWOtfvobH fZS/qZKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmKH-00000001FCN-2uTS; Mon, 06 Jan 2025 12:35:21 +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 1tUmAX-00000001D4p-03IL for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:25:18 +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=tH1Du5lBcy6uX8uHJ7Q3PvQHP4R+mjatSNiKbMVdnuE=; b=Kfu98VwpJzV+QVjV93z/2G0qk2 BgSHqYG39zQGv0FxXJnGRUhPY3WDn7HHna0P//ngegEDqDNfmiGWi7z0FAh9J+KwUSx22Qh8vdxfK kEF4yMvKtXZZQraU4sogxtx+ThgsrSOHEKAQQC2HK58paujkDbRadKFLLqMqJIE+TYih2l0WN/lc/ wNpMyxwgIXjAxeY7mDn5dJS85i8d8Org+L5T7KIAsGhQFgD5DI7+BjOs4JEiBE0wHi2bjlzf1wVQ5 GtgIPlhMTo3nX+oMsyDLnfQocsVBS8DSXf4cP0YUNzIBgu3dTyiVAkqhoXOUzJ7Hd3aih4h0bsnHa vhk71jWg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:55606 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 1tUmAS-0005rN-0k; Mon, 06 Jan 2025 12:25:12 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmAP-007VX7-5s; Mon, 06 Jan 2025 12:25:09 +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 v2 05/17] net: stmmac: remove redundant code from ethtool EEE ops MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:25:09 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042517_048953_22DCDBB6 X-CRM114-Status: GOOD ( 13.97 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- 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 dbee2de08583..f895bdd75678 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -434,7 +434,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 Mon Jan 6 12:25:14 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: 13927364 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 1D0FBE77188 for ; Mon, 6 Jan 2025 12:36: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=iv3o0tQi4mVCZMUEX+EXxrZSrKEvf9ort8xPFeup/9E=; b=YzxziAXpwba8BbccJT2b/8pccq opRFOhN/QfmfpHKem86oGJ1xFAZeLxNAKbWD8YNEMlSsLGDx8iHOsoklouPs5uPf9i9eUB1b4u63M Bs9QwhaeSGgnCd+14UoEhxStnd8ZWdVCb4yjkOOepOlVAf5T2WwYolTpkrCdjjPC3B3TBjGQXu3Tn D2ATB0yLHZr9/p9nVHHDyzVNc/tECylFJcqCUi3Bs92981Q+i5RpDMrsk1NxT3pAPCMDEIIdkCc4T bVwZmszHeT1W31thzFZxkrwpUNmWv0+u/D2lSbdwPa3+MoWnBG+dcqcxvYLD/kFF4DlGFjZ8iPRKX 21FH/g0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmLQ-00000001FLq-1XKa; Mon, 06 Jan 2025 12:36:32 +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 1tUmAb-00000001D6R-36dG for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:25:22 +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=iv3o0tQi4mVCZMUEX+EXxrZSrKEvf9ort8xPFeup/9E=; b=HPCvXjvLIYux4i2OdJkQRn7z6R oJ26BVHgPVWjocxdKwiWvfBfkRwSM+x2LSHwSztmG1zw67j98C7UAVWFHgybOaMAjQDNaaQmrmXco s2rY5V+CS6zr1EnDJcJnh1Jksbg7Irr/UrG7Aobe8ny+WkuxrotIwCkuTOM5fEQ3iDZqjjGsvsLxy MPLPPqht7kkgFnw9jIMlf+f6SjkatFX2Qw3fGT2roupS+G9ncLVRvyfD69xOejlOvmUMJk1gRw6o4 ErzhJGsqoRWoB6K0PnM5PpF+T2KvWKiSP5Rj87NTEyDW3tJ7YpaLvEQvhwrQQ307wy+15/54QmJ+5 DyjhsNng==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:55610 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 1tUmAX-0005re-12; Mon, 06 Jan 2025 12:25:17 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmAU-007VXD-A4; Mon, 06 Jan 2025 12:25:14 +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 v2 06/17] net: stmmac: clean up stmmac_disable_eee_mode() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:25:14 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042521_785354_ECAD3C37 X-CRM114-Status: GOOD ( 11.72 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- 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 f895bdd75678..47c57a558e5b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -429,18 +429,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; @@ -4490,7 +4485,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 Mon Jan 6 12:25:19 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: 13927365 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 C4FF1E77188 for ; Mon, 6 Jan 2025 12:37:53 +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=kFIrQtPP73QU4OizVuDkpWxR7v/mfucuSSfwYZ7Tf/I=; b=tXz4csKx9kDziPcDL3dBlc9lkD UjI8LCtkZZSw8mBXPhosX4k3y6J9lj5Vm2KpSI48tcOX2yE/j+xpipK4dqHPEO2dWufcuV/oCeAPY Tp87FWBzMNBwkMjfjvMWvXJz/PN3mr6r894E1zaF321mV4Ob5XhjHFpmXHoctH/SXJ8LMa4Y3nqlr +u/iGy4D9N+s8ur1D0vtkqXOY+OPz0G+km9qGTGr7taqhBKQGv55MVAPgPuPelR89hI6TqzTWVYET DqVotDxNYS/58HyJJeLIgS+0qo3ny9w2X7ivGzZJiUGBlniwlBiuU0FdZ7/ZZVnTvTCzBLKznavKL iWGi8UhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmMZ-00000001FVq-44Aq; Mon, 06 Jan 2025 12:37:43 +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 1tUmAh-00000001D80-46CZ for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:25:29 +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=kFIrQtPP73QU4OizVuDkpWxR7v/mfucuSSfwYZ7Tf/I=; b=mnr1paHawwFHv+iS5yPQjuCSUt OCj+0iRtT4T6c2iSO6+Wc/TDbGvF4GBKau1/UOaxxbrIpPDE7msYNa3e3+oGLg8/c0szHtsEFqNuU wNtFyre6KMDjm683BpAg8yzRRD9Zfgn3QI/FthFotFtG6R4BqxcOfrDMJpcohNG1OZUW/JjROyfsA PdVfDlDPPgIgMF1GOzonFtgv1K5i9aZEzMDGaofTNYwheWRZ02YewJDpLVU5BYvMmxVZ+Tx6xco9v 9DGFM0q52k2sJqKi1hRB+Kev/LrG3xlznUWfhdte0Df3/ptGZIWQOydBvMWd9HQY8CyjMrOSfqUON rGlZjzsg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:40256 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 1tUmAc-0005rv-1B; Mon, 06 Jan 2025 12:25:22 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmAZ-007VXJ-DT; Mon, 06 Jan 2025 12:25:19 +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 v2 07/17] net: stmmac: remove priv->tx_lpi_enabled MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:25:19 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042528_013578_8F62E7C8 X-CRM114-Status: UNSURE ( 8.89 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- 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 47c57a558e5b..ba6de7b7d572 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -970,7 +970,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); @@ -1085,7 +1084,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 Mon Jan 6 12:25:24 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: 13927366 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 6C669E77198 for ; Mon, 6 Jan 2025 12:39: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=Ch93sjX3yKed7sqxo6SdigJoOaMQciUQxLBCPT3Hs9s=; b=DkJytY1qkwXS9CtcFPRs5T5paq ufS01i9V4M+dZLjvkYD2uU90FJSe0HuEbzkVenxk+SzZD99IRbdjM8UAfgvwyGgZ6VNG35W1GgJ2m kZh7KgG0wzLQn/VLqVsa6x7aOvbKcC7Fmrr6O25Rc1nsUbpla9H0EviHouLPjlFtPF424aONYjdmK fsL09NNVZ9LJNjheTTYmOQYUBJxGaxDv5l4HPXBRc7D2pIJImQDyapfdV1FYBhRaDXfE/CYnptmme IdgE979uS9nu9E/abovBG3WW5rBVJB0+d+jtfvj8TECTTn12MCJU60ATlvIfUZbcU/SzW0Lrta62e JRiMXRnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmNj-00000001FhM-2q6p; Mon, 06 Jan 2025 12:38:55 +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 1tUmAl-00000001D91-2xuf for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:25:32 +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=Ch93sjX3yKed7sqxo6SdigJoOaMQciUQxLBCPT3Hs9s=; b=oImsLya7F872LfpIdNFePcggYT a91a8ID2tALkdg0mpfYQsNNf8yVW/Y3F1gNfn5r73jRtw0KXcu3Ti4m0J/Vt1NPwoGUND9K/do37L zSyk3SwxFzaSgdJFO/nzfeH+bs6ezrrxL05371EKcrWmRRuFUtGtnGb7vYHzoD/W6PASq+pcHiwRG UzskXp0Am107P2a56rgLFY/0TjdU14nvcc47cyitfU3k7CPofCSNj91ylZrGdsm5S0PdLZV7behdg WtAUDu/hkasLyEv1k8P0mQEkxlxUAi2VwLDh/NVj450KGgARHiREijjrY84hYOQMrf78VilQ4Ag4e j6Q/FPdQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:40270 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 1tUmAh-0005sC-1h; Mon, 06 Jan 2025 12:25:27 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmAe-007VXP-Hm; Mon, 06 Jan 2025 12:25:24 +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 v2 08/17] net: stmmac: report EEE error statistics if EEE is supported MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:25:24 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042531_749943_3CCA8B1A X-CRM114-Status: GOOD ( 12.78 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- 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 Mon Jan 6 12:25:29 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: 13927379 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 C81E9E77188 for ; Mon, 6 Jan 2025 12:40:17 +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=I/RIftHbt8VFMxVfrKl1hBMHY5IBHn8GF+dKjddCicw=; b=htmzsDYqJKQgdvZbaVeVaHgFIy ejo70Tv86iCiEbV4NgqDKnBg9YNEEaLIOPs/S4Iexfi5lInkzQeqOOzkZRuJX+8IcaVuOaSCEH0e/ z+fxOi2BpD7ftVH8miCfOWSk9L3V5MtdGmZLVriRBu3nbMYx7PYBnOPaQNOtQ1OlznttyJC6geGmK 1UiHmBz0dtQVKd3WIiODTG4cMOkwTcoF0OFQmiXPcMi4dilblTgARKCHbZLLhoA0ed30fg439EDCG 4uHz2HAc6XvlOw4aSQL101+OOoH3WXVK+hcYuyWjuDPQkJ3Z6SHMk5xXbMsg3hgZJQCuw+asZTKSf 3DNOYVyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmOs-00000001Frk-17Z0; Mon, 06 Jan 2025 12:40:06 +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 1tUmAq-00000001DBD-3uWB for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:25:37 +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=I/RIftHbt8VFMxVfrKl1hBMHY5IBHn8GF+dKjddCicw=; b=EFBA6G7Xk4v+CQS+KZvRBHetW7 riiDF407NrkA4uokwh9bV/SgF+BGYypbDTKnYNNkmyT+MOUViHyGWQKPWxGNcKSvtASbsx7UiOcyH hJm40yJDkllKW946H+dFwr7xQldgJlwkCWRgX02vEFKIv+gCqUjDa8kYuAtCju3CLl86IngEq7WvS 6EVEjd7JAUxMhi5LMXplktap5eVktFyELpa7qt1k2Ogh2pxK6SrsmFZcidiSKSOYnENmlGYN5/VKA Gg5DsdbRCR/DB7CXTHgFpBP6Mn0qUIKKnta5AACYye3Z+77HT3C0PihhCAhUqnVkwIdfxcjCDYMiD MjDdJ10Q==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:42802 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 1tUmAm-0005sT-2A; Mon, 06 Jan 2025 12:25:32 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmAj-007VXV-Lb; Mon, 06 Jan 2025 12:25:29 +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 v2 09/17] net: stmmac: convert to use phy_eee_rx_clock_stop() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:25:29 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042536_968335_53D05CA5 X-CRM114-Status: GOOD ( 10.56 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- 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 ba6de7b7d572..6b66a25716b0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1079,10 +1079,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 Mon Jan 6 12:25:34 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: 13927380 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 57885E77188 for ; Mon, 6 Jan 2025 12:41:31 +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=6gI78ITBgr5u8YVqy0tbvTfgVY6l4zQzaJ81AYLIoMY=; b=WhTYEF9BF+U3tkQOqxwtYsNdpS LDzXx8A1ALAR6EbZfSbfcZyjzMh9XUqhYSuFj7ntTuScpoTbdK3w4PK8tcqOYPhXgJdTCyyvKA+7u Yo2dq7L8788rqLUgrMTkohJkXSEdX9yh33soAxlkAo5psAkEXv3KBDegX5W2tTtpfvFDJg1DwVxB3 rdbqU0EY+T8t5rm27FL90OAarBROaPmoercoejOvd6mlORbL8vCdVVX93oiFb98HBR6saw8ie4noo NjY4fl0etpTsAQqSM0IoxjgQNtjliIK/WNQMWZxkUNmXQu/MP6hrW+yZpMciawR/5ba4jhzNneUwq m9L787Zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmQ1-00000001FzJ-3drm; Mon, 06 Jan 2025 12:41:17 +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 1tUmAw-00000001DCg-0gZS for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:25:43 +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=6gI78ITBgr5u8YVqy0tbvTfgVY6l4zQzaJ81AYLIoMY=; b=V/ZmxwXDi1xF14+Akhuih89uOh RZzuGN5+3ocWSNv0k2fqzUB3F/x1SjCXKTt9sNKw1s6E1g5h18geA3i8BqO3MyL7DjM5UXIyWmnXu 010n0hTB2hVJlUxN7ZKRPD7wji3qFGUkdmk75C0tj7fSXfKbZfbDIh3VOlgO5Vlp7kOdxH/erMCcN cOzEtDTB4R0XgPfsI7zk7m0o5glCnzhyAB0Zajx/RpbryqKr7eZ/Xdsq/VUmWG1ot0PfwvXcVDLGp HXox0RWGJubC9hmvplSrqNbm/NFOKkpUIBK3t5IfEUuBXLpJzYb3gY9jxFFEy8I48wL8ORMn6AQgi N4BExLfA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:42818 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 1tUmAr-0005sl-2W; Mon, 06 Jan 2025 12:25:37 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmAo-007VXb-Pg; Mon, 06 Jan 2025 12:25:34 +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 v2 10/17] net: stmmac: remove priv->eee_tw_timer MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:25:34 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042542_207881_FA23FCD2 X-CRM114-Status: GOOD ( 11.30 ) 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(). Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- 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 6b66a25716b0..7cce2eb3d82e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -466,8 +466,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; @@ -480,7 +478,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, @@ -493,7 +492,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, @@ -3441,8 +3440,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 Mon Jan 6 12:25:39 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: 13927381 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 59771E77188 for ; Mon, 6 Jan 2025 12:42:39 +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=SvAOfuk/gG22WA/IG+mdfXq2MSJzE4kmQ+mvTvKuMFY=; b=mXJuNKzYN7Vmyoqq5KXw/13tEI quXgk6GdfcIitSw3XWnQbcV9tNMBb9iIQGgmDUnUeV9xqR0yxoZVixrkzJRw2jSbCCd1V1NvY7Aja EuFELSABtgmdLtwk5F0//LfPIONUxr4nCjxbg3t597aSjg0xsBDCNhltzvqEUnMOVNE4YCs+QRW2m 2Zte06wH+MJxJSEZGUqsMvrBFBWbV/gcTBjdrJTrAeO/c4K70c0v4okzu+XLgAkQR+IWUJiXmczm4 WGNJvNrfptnY58awvGu/yxztKIc4TZdbI1/UkSm0O9+M4H1rD6lI7uvowCWBmELUvT1b0gyf8Yp18 d/G4dxAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmRA-00000001GCa-2uQ7; Mon, 06 Jan 2025 12:42:28 +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 1tUmB3-00000001DFS-2ibP for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:25: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=SvAOfuk/gG22WA/IG+mdfXq2MSJzE4kmQ+mvTvKuMFY=; b=HQj0GLqH4EYc6NFoSFE+2c/JYV eKetogjHxORanqxFGxIReDq6aegl3nXWj1xosQAhOD52WiVzOdGQhXX3DXmxLPw4Mb2rHdPpjxW8t K3AnpGIh/qNWRuaFvy53W1HFqCW+Lzp/WPtIwmyy4BTXqKYkbrzc1WW/HZ5rN3nuDjkpFWU67jilG bM4GICGWUC9B4fV1uQUHIqR2XJmzHF8GZN5OJXC/Dc0+6zyozrrwiaMkMx2pmWBCHT2CKglX+wtuc CKg+VcRobxAqq17cvQsgyj75zamooZbofNkWNJoSAuniBTUWuH1qpQYdnOV2TphtU/4D9+RtAcnED RtcNRcXA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:37410 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 1tUmAw-0005t1-2k; Mon, 06 Jan 2025 12:25:42 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmAt-007VXh-TZ; Mon, 06 Jan 2025 12:25:39 +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 v2 11/17] net: stmmac: move priv->eee_enabled into stmmac_eee_init() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:25:39 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042549_684300_0B89E203 X-CRM114-Status: GOOD ( 12.31 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- .../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 7cce2eb3d82e..cf294fe3f726 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -464,11 +464,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); @@ -485,8 +487,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) { @@ -509,9 +512,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 @@ -969,7 +973,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)) @@ -1082,7 +1086,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 Mon Jan 6 12:25:45 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: 13927382 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 AC43FE77188 for ; Mon, 6 Jan 2025 12:43:51 +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=eKXXjy/uKptM2YnzYmRo9ocTbTaqXsBTlP/WP9Ye8Nk=; b=IDwOlp3GJB7kDIsh0tTs/04kwx 4v2pU5NLfa01G6zyvaqUPAhRmL//LIpnuCUJHdFTyZPYd6On/x4Ka/gJO/LYCJbBw+uJ0tdJjLxbL ilDqHVQdPsJfEYRPk7d/KXGUxcp31NG2ujtkkdp/lYx3LZFagQ1c+AoPCYaHMcLvK+z8LvqTaLrt+ VP3ckBdmhQjlQDNzq4pRfI4baVsMcUyjgdAZj0+7QjjIMuOXH9y/5tkoQITzVYo2VjGARFrohedxn hXB9HoPhB/70qd8tsSFLAtgiZrjKlB0avdZEVHTVJUj7b9K8q1YSVriZeKO+l4D6Npd0kGqYATBCr 8sxwgTTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmSK-00000001GVv-1RfY; Mon, 06 Jan 2025 12:43:40 +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 1tUmB8-00000001DHk-0cId for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:25:55 +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=eKXXjy/uKptM2YnzYmRo9ocTbTaqXsBTlP/WP9Ye8Nk=; b=gZXTgFinuKQ/y5exjaBo1n5QZR KKT0eQ5c4HsCxovqCEVXOaR2vgbCupl2WwaCyELwYEQ5uQ3TlC16RkzgU6NJ2gB5jI3Es+yP847d1 DtmS9nsJV6cHh5m7oYt+8IYZxS69XvtR8qmFsRdKbd8jK1JkAuo0HUk2mTU+EnQeXPB2c/4LNA5w9 EtTlh35fP7uysjN+6CWEWNOmUDkYbEZaEDOcb9GjQ80Kum4XGzYK0hetIifUilrUu+/wGav+HZwGW 0UpRnb+QKRHd6WavF8osljEfGvY5JAekLjzo7Joj7mZt4qlKgd34XSbWo4AMVQ4j4dpM6oJum8eY1 IyQxgGVQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:37426 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 1tUmB1-0005tL-3D; Mon, 06 Jan 2025 12:25:48 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmAz-007VXn-0o; Mon, 06 Jan 2025 12:25:45 +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 v2 12/17] net: stmmac: move priv->eee_active into stmmac_eee_init() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:25:45 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042554_182372_323EDF18 X-CRM114-Status: GOOD ( 11.33 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index cf294fe3f726..1aedb49944ec 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -464,8 +464,10 @@ 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 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; @@ -972,8 +974,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)) @@ -1085,8 +1086,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 Mon Jan 6 12:25:50 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: 13927383 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 78FFBE77188 for ; Mon, 6 Jan 2025 12:45: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=45CZAwIamAG8WuVB/J0OCl/kYd5Vjv/J3SFjjvjhd8s=; b=W6EXGRLCr56y/Epo3vKThjO+b3 hnNCNnTNlW22EVITf2AEk3olt2tEoYhB2N4zvf/TJn+0yK8xV5HrO8NtgvYDfUb3gy66FcRZiJfha OXFQrylZz0HRBcSabNAB0ssyvtn721UkUSw90CotqSw7zWzCIGIM5VuAsv+uOhA3jrxsSlqIiv69G m823/RjQ2GNpfctbtXKZuQq0sEKi2X91yfJyIzhZHcTmYxXFDJe5gDbvZdFan7gurkJqWICas2kBN ExRHVcpYpbmgO5BuArZDoOKRBNSRkwk5svAfbVY7fPfTNfZ4J/J5FXemWgLdc5JsS8xTa2LHPVxLi sWcdm1Yw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmTT-00000001Ggd-3ySc; Mon, 06 Jan 2025 12:44: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 1tUmBD-00000001DJH-06RA for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:26: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=45CZAwIamAG8WuVB/J0OCl/kYd5Vjv/J3SFjjvjhd8s=; b=HY3Od1+Ij8S9Dc5yXZIy0tcbPp V5WeSzIWqR3LYC8fEfuwpKIL4rUjnA4rdNQouwbOPk2TgItgnz+zS2is6y+tAcZvVyhSISkf26iVh 0shJxh9XKjBgW2YAc87jff0WURuq3A1Jr+sUmEAS2fiGUeLggMFpdxsuxhNAFh7qk3Q0cGv+QCej/ KDfJHvXwXnpJkDTG51xBH+jgXXO7Sb1jbMO0AF/k5K4nyyMlg19eyWQrzMqlLPGswmjhWumqZ+LvI nFoR9EdtSJJbwHfAwGv3oxkeg/JnNi8YFPmwQvODGwZ3yjbxj7pIBiwL7JbdzTmRLMfW8thh4lwCh J/LTwVuA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:51890 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 1tUmB7-0005tc-0F; Mon, 06 Jan 2025 12:25:53 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmB4-007VXt-4o; Mon, 06 Jan 2025 12:25:50 +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 v2 13/17] net: stmmac: use boolean for eee_enabled and eee_active MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:25:50 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042559_058435_3CF03599 X-CRM114-Status: UNSURE ( 9.86 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- 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 Mon Jan 6 12:25:55 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: 13927384 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 98B4FE77198 for ; Mon, 6 Jan 2025 12:46:15 +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=YRoEPXMnuvWAlKLiIj/33TvZCcNaaMUqV2ZCf8NplQI=; b=qv5kTvr4f6s/tPmt+AqpKAF7NU dulJMNqFS6hlm4M45vnv/KaY9S3wrtN7ojupcKdHhbNIOh5+9X/V5GgSFrdl1ee9OuhTFzqb/DB2D 05oBrXzO9P5lUYZilWun8cbFXgNbFH9XB45ndgGXA9PS8C/L2KesMxKDjLhLQgEWTfhOgZTAeRCyi 2xImc9Mtedg25Pxl7IZ5paGQSuWpsaVl11PDfaxX7/el+EDTRXzyO5YEh9NhtPc0fC4NzBbeBNbPm td5H9yK7f6fJEXJD5sJpN1TAfZQH1SA+ap2Taxp2dfGY9O7x5GGRhUyQKFCBwNQQlG3vfoJs/Es7w Oaynz/Uw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmUe-00000001Gtv-2MZ0; Mon, 06 Jan 2025 12:46: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 1tUmBG-00000001DKF-2JzE for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:26:03 +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=YRoEPXMnuvWAlKLiIj/33TvZCcNaaMUqV2ZCf8NplQI=; b=ET5LMLXh2i7t3Hquxxv9WUCwg5 CoqjNHrafHutcPwgU0wCcTQO3LNbN5J+iWrK7MJEPdvlZwi3utCGD6AiClBwLvkrsom1SS3HqZ8pp O7CZwL4wXZz4H2GvX/TvvsRa/OttjnzpFmFpNwY9hko8XHCC1hS9ThuDrNUJN8/5BOtLFvDtLenb2 xXkSZp32EUSrc5lYHP1ZF0fgiuxPCBgJPmxc45zboXO3c5qurOeYAIExkdrp3IHJhZ36fugbYqRLc QxOmBXkwCppIuLPN3eAfG4Fe7c4QJGmVusu7RGTOBjgpqAsIocrJh7uH5BpkGzNoLP/quN2EIwsPk zvmiesaw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:51898 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 1tUmBC-0005tv-1N; Mon, 06 Jan 2025 12:25:58 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmB9-007VXz-8c; Mon, 06 Jan 2025 12:25:55 +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 v2 14/17] net: stmmac: move setup of eee_ctrl_timer to stmmac_dvr_probe() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:25:55 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042602_588706_E7FB57A3 X-CRM114-Status: GOOD ( 10.84 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- 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 1aedb49944ec..aac45c16d7b5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -495,7 +495,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) @@ -7399,6 +7398,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 Mon Jan 6 12:26:00 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: 13927385 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 118DAE77188 for ; Mon, 6 Jan 2025 12:47:32 +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=ELZbe4ORBYcEswjWnSIgUcJQUopY3ta7DtPy0O6ILXg=; b=p9x4f85Wqy44OcO0XG0ClC7m46 42pXZh59PAVab/IXxaLQC4jYcSiV866j7uMCNIM8ijoPeuTdobbanpvWrqY5gWE8+nscQWagjlQXd gLc0j2I1dYcz9bBokUeKMOAAK5Jd0rlvHQF3IDjn9I6YxgahtlBNLrmz8SVsJg/nKnFjTctl82UAa djHPfdnjETFC9nGgolnPY5Cr/yl+bDX87mvnnAyxTz1GM+rjKuOwD8u/Ngi4MbcJonKOMLj/QDK+B X28kHvfDMe6QDgZwOLe0EHDFQkdtv2VJNoBvDlEzEYqGY+KAep/QCD19hdZGpjGjgqxagaw5qVC3b Q+2YI+xg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmVr-00000001H7O-0wss; Mon, 06 Jan 2025 12:47:19 +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 1tUmBM-00000001DM4-1242 for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:26: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=ELZbe4ORBYcEswjWnSIgUcJQUopY3ta7DtPy0O6ILXg=; b=HTaQmiyv/4hw5y/kzU6bO4IjPu uXVM+N6K2D93jwmxZhnwvcjNdsqSfr63+NF6iyDmTO4Tu4qqMeOIlwvQzJdvMo22VCZwLUNJ1Jnyw 8kauy6V8nu4n/mwuOyoC8+ptLx7kVAlh8PylcQuh7DuCH3cbR1kxPYNBCgY2xHyUCfKpf8ePWvWd4 7p/cohbKmL5SrM0enUXvGBiu2NvdIJERuGa1EIjcwnIctYtRbZMhn+QiJWFx43mQ//QzovckSnTRe SvYgxp7LM0KxsMHVrCqwIqTVUOg/RD6PnRpts8LEw89CZ/sqCWkul3nbn8kIv+DUyynKT6+Nz2eud vVPQSxeA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:36916 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 1tUmBH-0005uC-1e; Mon, 06 Jan 2025 12:26:03 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmBE-007VY5-DJ; Mon, 06 Jan 2025 12:26:00 +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 v2 15/17] net: stmmac: remove unnecessary EEE handling in stmmac_release() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:26:00 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042608_285924_6751FED6 X-CRM114-Status: UNSURE ( 9.61 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- 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 aac45c16d7b5..7ba3c7a8f535 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4027,11 +4027,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 Mon Jan 6 12:26:05 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: 13927386 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 2B17AE77188 for ; Mon, 6 Jan 2025 12:48: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=nZcvQXRgGTFglMN1Eb+bWjhXlMJHCVFgCTjX9HZlDeY=; b=siJR+cwM92haEpGb9bL/CnGUYh kUezHFDWF8RNGzTgyTdXOoVK1dPOeeau/lfkumq0jak60zAI2v+Z8zf1CDo/c7cQpVXfIk8oGCuZv i3hmrVH6uf9gN3RE7N7RlSDmJzBAhYi580DQ89a8jINdm/G/pjePhENxmG9xMf5IcKRCsPxi2kRfA pYMzpOZ0rUd940zCVA3A4vKH5sfYk7+V97xh7Kz4NpTeTa6Ot10Tq+j+bSQAoQUzRG2MI0aojJ7HZ B4Qo+CKZJoe38kcxTBxF6Nf3gIK3dYlvnIAEsITTIckj8NFk6eat1YnoHrKY/F29+/TutcbV9X0xg pGwUiw+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmX2-00000001HWO-3xHu; Mon, 06 Jan 2025 12:48:32 +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 1tUmBQ-00000001DNy-31gC for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:26:13 +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=nZcvQXRgGTFglMN1Eb+bWjhXlMJHCVFgCTjX9HZlDeY=; b=G2hs9YwcjlbdIdY0N0LLQQ8PEG o6u54wS+qOQRANf3bh3vPaXmHm6r71TlgbQgZ4Uot8Q/34LWGkqmd7aqvy8xLzfpcht6EadoLtRv5 j8+i00/Yzv7vwd41hQCMYiHLVbud+2xGMyApaiEOC5Vmx2lvRzctUteBC5bjpHkBiNtKTLFNH5D7Q TRSlwUG30QxRP5iOdmTe0tKtcdYrQDwUALPutggLNRqM6YC4Fv4qv/Wce+a0dDD5O3TMdFMnwIWbm evG0um7JV0GnNJYcgyf+P/lHM4tg9mcON1v/PvHvcK/9H82UoOHycK4qlLPLQcW4ZC9+fIv+fe0FU dT317XfQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:36930 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 1tUmBM-0005uT-1X; Mon, 06 Jan 2025 12:26:08 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmBJ-007VYB-H2; Mon, 06 Jan 2025 12:26:05 +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 v2 16/17] net: stmmac: split hardware LPI timer control MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:26:05 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042612_756629_689824D1 X-CRM114-Status: UNSURE ( 9.10 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- .../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 7ba3c7a8f535..8d4b9c42aac0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -392,14 +392,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 Mon Jan 6 12:26:10 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: 13927401 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 AA580E77188 for ; Mon, 6 Jan 2025 12:49:55 +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=ni5k9SbRbh4aJd4zhQ7wbF1lNatzNxra2mHNYT7FdTA=; b=f8fFzwQs9f6ubAX/LPEnoHuYU3 Ckkbor9ayJUsMFM0fcFQT75rgaI8DuVd0ObnPv0HK5Vb1CQ5LXSf4ug6RhFk98btRYqXPWAHEViQf q7/etHDi4sxNc+scvO3DbYeTUAhx1MkBqIOHnKSTLxxqJS691lG1PlKHOiZh1jm0W0IHOW+G2stg5 +NquNFX4i9RiVtBIautxMJFg1YqiYC2u/PQ3mt/0cuTjdMkIlPLCC4QZQB42Rm1t/UjC0JCsjE57r /uvKnYIy3cogUIEwCOcA4Kqlift300HZIO/WRhxbkaHmr732xdCl4VKxdJ9Ies/OJ+En+0o0JnZoA /4I6P2oA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUmYD-00000001HqX-2ecw; Mon, 06 Jan 2025 12:49:45 +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 1tUmBV-00000001DOi-2txi for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2025 12:26:18 +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=ni5k9SbRbh4aJd4zhQ7wbF1lNatzNxra2mHNYT7FdTA=; b=xOE5YbHsS3Oy0sIQfo4sieODs2 taCC4EUr75Ivxs6qYatENyVYC0FEk5Nup53/XeVa1C8mrFuMthg5gba1xDwxx0CXzWjcReJGyczW6 zvoqCin23cbupEFdJR8/5pgx8w1KrcNaoMkk2xlfWXp2QgPttrf5tKGNvG+nCZqRGeo/sDaSnwzXG OSVwO5J06mJT5OubNk3PCsCJQTUg/iycZmFCsSG36pLt9enLUNbrTJPEwDbFlTiGZY2jdTQ53Q0uS VOq/92LNU92OBkPnVXhXrM6/w+38Ho5DnkX8pvUnMTBEGEBLygYVtBQy7ZHgEV+LMpTGYAKolJ6Rl Q0qJVhuw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:48134 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 1tUmBR-0005uk-1w; Mon, 06 Jan 2025 12:26:13 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tUmBO-007VYH-Kj; Mon, 06 Jan 2025 12:26:10 +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 v2 17/17] net: stmmac: remove stmmac_lpi_entry_timer_config() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 06 Jan 2025 12:26:10 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_042617_727502_3CFD5FD4 X-CRM114-Status: UNSURE ( 9.72 ) 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. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- .../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 8d4b9c42aac0..3b600967cb65 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -402,16 +402,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 @@ -490,7 +480,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); @@ -514,11 +505,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)); }