From patchwork Wed Jan 8 16:47:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13931341 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 044BA1F4E5F for ; Wed, 8 Jan 2025 16:48:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354881; cv=none; b=soMf14SoZ5RSLIrrOh0Mz0yRbP8gxj7Sj8kW5t8SlYCaIFDOLeSEWyhq6QVtxWhd8h4fi+dJYtcg/1YltCmZ+wG7A4FTT6PzkyoXlY/F6dZp7iRziqDHL7VwRrNBnNFhXjJGKk7KjfP19nRwYFJ51a4dMWy61gusFvt3acCHRs0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354881; c=relaxed/simple; bh=HdfJuNgjt1LTTgAlg1s8j1ItWsyZmALnhQJ0G5Z96Ak=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=SryeG4mJ7+DBBTY4DqibywxvpbYVnnonAjHHAdzHq+vF1ttpsbNYIIqgBbsHGihuEtP3XmjS4huejVMcli4/u/6WJxypB3W7XZdKcN0u9B+H9YfSX6YgfYdO43p5Bab3Z1fj+xsOEPx29laLH0gchWp2MdcvTQ/k5xeki+7KVPM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=MypmERfh; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="MypmERfh" 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=mHzLCFAK6LmfewM2QZlzveIbAPK2b40OOxmrRx/WiPA=; b=MypmERfhQAS8W2syXnHe781rbK eJxyPHXJ++FnNdu92qgxyjWkFZsJE2BEFZyVY+zq6aUvl/62mcS4JuIoQeG1XpEy9pg4opbmIVnTM 63djnyP08E86uiunzTm4Ikasv+BKCQgVZIB7K+8A0a6HJnCqw/44FPrxjAYuMAZ+o1GBtlzTIUu2q km+Ibqgv/r0j2kzdYRlsYpW1yp64Tv3LAEq5gg7jjc21bxxjJPBWSBvtP7safEvwWcVKAT+PfcuRO EQ1+AthteezxahdrhCiMoshLFPwz0u6UnIY7M98OiakxTPdLyf0ek2pavmRzDfd2RFboHD36fQPF+ hmYJDnEw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:59796 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 1tVZDk-0000uO-2V; Wed, 08 Jan 2025 16:47:52 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZDR-0002Jl-Ry; Wed, 08 Jan 2025 16:47:33 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v4 01/18] net: phy: add configuration of rx clock stop mode Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:47:33 +0000 X-Patchwork-Delegate: kuba@kernel.org Add a function to allow configuration of the PCS's clock stop enable bit, used to configure whether the xMII receive clock can be stopped during LPI mode. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang 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 Wed Jan 8 16:47:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13931342 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC9B52594BC for ; Wed, 8 Jan 2025 16:48:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354889; cv=none; b=uRwUsxkvcrArwmh6p+xCdi8YRTVwTYBzEver7Jn1VY9eIgpBsYWlvAEhRIs9w2WEpruVnMMszjG+50hE/GGdN4UdD8R28Aob0YGb3or2tS2qSyqEevScRaiDnT40/aNnb60b36M+GbeLnaERPp+TBeffTeO64erWdQ7FRF3tjKU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354889; c=relaxed/simple; bh=QNWuf/lr+glJm1+M4Wm4PZglgdj/glHXBp/YELQty4E=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=FMbM1d9pmQN9XMGoLrVXGis6YU7+5EJBbZYf0NREBlcj9Zj3sRThuQx5OPUzFi6Htskqi7MUQf3K9agwqaRPTUW7zncawwL2RzDnmRFfPZtrP6Zk2OUcR9rmgUU+3ZjqWWqfGwBcDyeaHuQidJG7UsZyL/a40L7Q2ATTnkLCLfY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=TXUGWN+o; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="TXUGWN+o" 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=e7kSuOJ4GV6ndaTIagWvNA4y/FeBjhFoyB+/jci08qE=; b=TXUGWN+obuJNW5/WvbUOhCQV8b 3k8FK1xEB60dMPHaK21NY4OO+B4IMSVy1uaoyIyl4aP+8Et9y3DHhYuaI75mo5udwwIjUhGO5mY90 Kgb/dLbfkEmmmYsLW3HB/lAIl1An0msJt48WMJlLWOR9cZMZusa22Nif6i4BmQ+xrBGGPvlVRL56p BQw/0ZLGYbPGeDzPh4VSm8b9QxXSXtJleyf5C7UOEgfhlJq310zAT1UYWXJbTEE340X0fwJjphx1T KFgSlCTFc+wBTHP2mXUW6s0+5GBQELGXy3KOlOa85uwG6wGrOE7bj3Ali9OtNxpAQGFW6NmLZm2aS 7Eph86Ow==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:59812 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 1tVZDp-0000ua-2i; Wed, 08 Jan 2025 16:47:57 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZDW-0002Jr-W3; Wed, 08 Jan 2025 16:47: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 v4 02/18] net: stmmac: move tx_lpi_timer tracking to phylib Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:47:38 +0000 X-Patchwork-Delegate: kuba@kernel.org When stmmac_ethtool_op_get_eee() is called, stmmac sets the tx_lpi_timer and tx_lpi_enabled members, and then calls into phylink and thus phylib. phylib overwrites these members. phylib will also cause a link down/link up transition when settings that impact the MAC have been changed. Convert stmmac to use the tx_lpi_timer setting in struct phy_device, updating priv->tx_lpi_timer each time when the link comes up, rather than trying to maintain this user setting itself. We initialise the phylib tx_lpi_timer setting by doing a get_ee-modify-set_eee sequence with the last known priv->tx_lpi_timer value. In order for this to work correctly, we also need this member to be initialised earlier. As stmmac_eee_init() is no longer called outside of stmmac_main.c, make it static. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- 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 70c8f60d34f2..e80ac74538d2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -469,7 +469,7 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t) * can also manage EEE, this function enable the LPI state and start related * timer. */ -bool stmmac_eee_init(struct stmmac_priv *priv) +static bool stmmac_eee_init(struct stmmac_priv *priv) { int eee_tw_timer = priv->eee_tw_timer; @@ -1088,6 +1088,7 @@ static void stmmac_mac_link_up(struct phylink_config *config, priv->eee_active = phy_init_eee(phy, !(priv->plat->flags & STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0; + priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer; priv->eee_enabled = stmmac_eee_init(priv); priv->tx_lpi_enabled = priv->eee_enabled; stmmac_set_eee_pls(priv, priv->hw, true); @@ -1187,6 +1188,16 @@ static int stmmac_init_phy(struct net_device *dev) ret = phylink_fwnode_phy_connect(priv->phylink, fwnode, 0); } + if (ret == 0) { + struct ethtool_keee eee; + + /* Configure phylib's copy of the LPI timer */ + if (!phylink_ethtool_get_eee(priv->phylink, &eee)) { + eee.tx_lpi_timer = priv->tx_lpi_timer; + phylink_ethtool_set_eee(priv->phylink, &eee); + } + } + if (!priv->plat->pmt) { struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; @@ -3446,10 +3457,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool ptp_register) priv->eee_tw_timer = STMMAC_DEFAULT_TWT_LS; - /* Convert the timer from msec to usec */ - if (!priv->tx_lpi_timer) - priv->tx_lpi_timer = eee_timer * 1000; - if (priv->use_riwt) { u32 queue; @@ -3916,6 +3923,10 @@ static int __stmmac_open(struct net_device *dev, u32 chan; int ret; + /* Initialise the tx lpi timer, converting from msec to usec */ + if (!priv->tx_lpi_timer) + priv->tx_lpi_timer = eee_timer * 1000; + ret = pm_runtime_resume_and_get(priv->device); if (ret < 0) return ret; From patchwork Wed Jan 8 16:47:44 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: 13931343 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 762442594BC for ; Wed, 8 Jan 2025 16:48:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354893; cv=none; b=U4Q6iBlXfHVB7mxyf8uS0o4rnkt7zSsyf8L+gKND02GwD22B6FyqiKHhNOGkKFh0e7qo4u5ctrvE2T4mZl52KvdQuXYfXMg7pZQyCTMFl68YaiqJcZ2na5LmsF/uT2c1ZXn4FeWujqloWyrYVPRtL7xbNha9Vm7n8bWa+wtKXrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354893; c=relaxed/simple; bh=XzFIWFSFAYoM3yVGO7igZz7uRnFOYhZiArUnBSPGjCs=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=CCH0FEMWBACM197T7/rWfQeTog77bhBqV1b+9BvevPtM8Lwplj9go4tzq4TOZxVgBPyq56jB0A/KXYuUvyiyxvZi5IhRc3PgbWdoZxAgaonfqwL8++4R8GH1Rvs7dzkwOpPtrkzu0kO93on7oTUVFlJxd5IQcl/tfpz7EOM7yr8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=wBULUhLm; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="wBULUhLm" 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=+MtoFE7mIggxU2pLuJ181OqtBDlmJXFPdnSDCH11MFk=; b=wBULUhLmCbpzkLBoBjyrrwPz6J GO4V71vlYD4TGnMdOAq09hc8WRCnfCJ3cWl75s6EwGxDuWfJUCbfNQE23N/fHiIGsgqUvaerjdmCk cYpGHZyQzP/3/D+4RLwzBdgDsys74yq7l3DjG1EzfthMiqDNwZvjlml817NXOOhOsy/MFj7z/qljr fywArusI8CpCoJtym4NMgxsDLNbRZW5eppaYpq2xIY6UHI9j2NCRYcVrbV0LFovp/NM3JC7zJq6A2 E0Y8rOQ2L8RFJaGN9umrJ48Ivfr18ABfeuc8z0AEf2MaArAPg7AH6QtYo1AwqHB9d+C3j34cVOkfB I1DlTPnw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:47626 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 1tVZDv-0000ur-0T; Wed, 08 Jan 2025 16:48:03 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZDc-0002Jx-3b; Wed, 08 Jan 2025 16:47:44 +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 v4 03/18] net: stmmac: use correct type for tx_lpi_timer Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:47:44 +0000 X-Patchwork-Delegate: kuba@kernel.org The ethtool interface uses u32 for tx_lpi_timer, and so does phylib. Use u32 to store this internally within stmmac rather than "int" which could misinterpret large values. Correct "value" in dwmac4_set_eee_lpi_entry_timer() to use u32 rather than int, which is derived from tx_lpi_timer. Even though this path won't be used with values larger than STMMAC_ET_MAX, this brings consistency of type usage to the stmmac code for this variable. We leave eee_timer unchanged for now, with the assumption that values up to INT_MAX will safely fit in a u32. Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 4 ++-- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index c36f90a782c5..9ed8620580a8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -420,10 +420,10 @@ static void dwmac4_set_eee_pls(struct mac_device_info *hw, int link) writel(value, ioaddr + GMAC4_LPI_CTRL_STATUS); } -static void dwmac4_set_eee_lpi_entry_timer(struct mac_device_info *hw, int et) +static void dwmac4_set_eee_lpi_entry_timer(struct mac_device_info *hw, u32 et) { void __iomem *ioaddr = hw->pcsr; - int value = et & STMMAC_ET_MAX; + u32 value = et & STMMAC_ET_MAX; int regval; /* Program LPI entry timer value into register */ diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 2f7295b6c1c5..0f200b72c225 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -363,7 +363,7 @@ struct stmmac_ops { void (*set_eee_mode)(struct mac_device_info *hw, bool en_tx_lpi_clockgating); void (*reset_eee_mode)(struct mac_device_info *hw); - void (*set_eee_lpi_entry_timer)(struct mac_device_info *hw, int et); + void (*set_eee_lpi_entry_timer)(struct mac_device_info *hw, u32 et); void (*set_eee_timer)(struct mac_device_info *hw, int ls, int tw); void (*set_eee_pls)(struct mac_device_info *hw, int link); void (*debug)(struct stmmac_priv *priv, void __iomem *ioaddr, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index df386fc948ec..984e708d019f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -307,7 +307,7 @@ struct stmmac_priv { int lpi_irq; int eee_enabled; int eee_active; - int tx_lpi_timer; + u32 tx_lpi_timer; int tx_lpi_enabled; int eee_tw_timer; bool eee_sw_timer_en; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index e80ac74538d2..afdf992cd91a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -394,11 +394,11 @@ static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv, u32 queue) static void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en) { - int tx_lpi_timer; + u32 tx_lpi_timer; /* Clear/set the SW EEE timer flag based on LPI ET enablement */ priv->eee_sw_timer_en = en ? 0 : 1; - tx_lpi_timer = en ? priv->tx_lpi_timer : 0; + tx_lpi_timer = en ? priv->tx_lpi_timer : 0; stmmac_set_eee_lpi_timer(priv, priv->hw, tx_lpi_timer); } From patchwork Wed Jan 8 16:47:49 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: 13931344 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 193182594BC for ; Wed, 8 Jan 2025 16:48:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354898; cv=none; b=EqMTdaW8CJE0J92WHQXkHTIMv4eoPXoNvr5RF/JrHRTB92Fhj7V/8GhGI6MZJrKZlbQGKBAEP5Z6E1NFmdE3qeVGX43R5RykxJZGlgU1u4qbh3loL2k/HsN2QI1rVq2pHN8ImwKFzEqSyWYFqDONOrvLa/Kb3rQ8AsDXAn0jeKY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354898; c=relaxed/simple; bh=ueUBqw4Yf79jq6zPR72a415E/zlOxQMLu2ZFkVLJwnE=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=Pm9H+8K77cDfTbO3J5ODLevOiN46D3CicMBl7RfDsHAHwP4RMPqgAM9DPv7n4E52eL/clUFrCqMPDHM+4UMS0y8iENNkXdldduVkQvlxjLovTVOGz4GOP42YThBGiOWNa5HK1WW5GzrRzHFX2UC2CsCQmbPoI/0Sojr4vldEq4o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=Xx+nhyy3; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="Xx+nhyy3" 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=lGXo6iOaeIiwSHl5ozXwsyA28mb00cTSXuiV4cJArrM=; b=Xx+nhyy3RsyqionMFc4LxEqzmJ KV6RnyfiNlm2Vtj5nxoh3B8MFZ7qt5ZPN6iM2wLjRvKjeu+Ev2fk2mDPC0/mOT61mqfhe1xJZEJ9Q J9KWZ54yzKEOyIo5w2LarprDA9R9zxu1mP3Jd7LzIexEOnuAvIM1O1v7o4YhFl26mnp2keB6xyZFE OxIWMfJMMNei8w3fNLJw4LFAIO63oa4NaYjLh92T6t7JlBKuGmtCLsBIQYf4PZMVLBUnp7Do9Nx1f b7vnArflTvrdLj1yWmLLNt6j/Tbr8MqRQerzAGrzS5/SyAvRyAcOBVhZYPXq6chUhIt7mRVgUtniX RNmfqySA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:47636 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 1tVZE0-0000v7-0Z; Wed, 08 Jan 2025 16:48:08 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZDh-0002K3-6y; Wed, 08 Jan 2025 16:47:49 +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 v4 04/18] net: stmmac: use unsigned int for eee_timer Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:47:49 +0000 X-Patchwork-Delegate: kuba@kernel.org Since eee_timer is used to initialise priv->tx_lpi_timer, this also should be unsigned to avoid a negative number being interpreted as a very large positive number. Note that this makes the check for negative numbers passed in as a module parameter redundant, and passing a negative number will now produce a large delay rather than the default. Since the default is used without an argument, passing a negative number would be quite obscure. However, if users do, then this will need to be revisited. Reviewed-by: Simon Horman Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index afdf992cd91a..94cd58c636d9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -111,8 +111,8 @@ static const u32 default_msg_level = (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFDOWN | NETIF_MSG_TIMER); #define STMMAC_DEFAULT_LPI_TIMER 1000 -static int eee_timer = STMMAC_DEFAULT_LPI_TIMER; -module_param(eee_timer, int, 0644); +static unsigned int eee_timer = STMMAC_DEFAULT_LPI_TIMER; +module_param(eee_timer, uint, 0644); MODULE_PARM_DESC(eee_timer, "LPI tx expiration time in msec"); #define STMMAC_LPI_T(x) (jiffies + usecs_to_jiffies(x)) @@ -194,8 +194,6 @@ static void stmmac_verify_args(void) flow_ctrl = FLOW_OFF; if (unlikely((pause < 0) || (pause > 0xffff))) pause = PAUSE_TIME; - if (eee_timer < 0) - eee_timer = STMMAC_DEFAULT_LPI_TIMER; } static void __stmmac_disable_all_queues(struct stmmac_priv *priv) From patchwork Wed Jan 8 16:47:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13931345 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CA5C1FECB3 for ; Wed, 8 Jan 2025 16:48:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354902; cv=none; b=AW4BudOL/2TYs8pXe0FljFA1d2fePdbt+Pmww54cnn3OkaeFwWa8ilW6nXD4+a+G4fTNU21WJHFWbyR0eEr9hT9p3YsnJQ7djz876Rm5qYiNNL/9SBzIw9sAeZQ2r2r9Fprg9gHcdxyfzy1wInBAFjeoYTvJgxhEWXmHuV+zeKI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354902; c=relaxed/simple; bh=QPthJONvFoQ75ArwDn/wYM3U5qpTMW0EIqNuv/25f1A=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=qfpwcmkDYs7gNfH9TawVDPip53h8sucM+HcIwmWsfW/jypOZj1JUeht63/4fhV4UEZRZG+W68/sxpJZ1h+MDF02+vOMuhgYHdpAt5mCSPN1z8wOLCq7Oj8nS4Dg8G5OQYMZuOG28KNRDWC4Hac5yfWqJWE/XJUWzFpwL0SrCSg8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=ZCpwvmcx; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="ZCpwvmcx" 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=45jodzeGoZzJRGl4qUGbn4CBAiapq7fH+q/6DF2cB70=; b=ZCpwvmcx39wQYPz/0qHNGjZxmQ bBiZjpewT3eNXwDbk2iYtYnXDUo9SdVi6/QUrLOdzRPMO4IvggvfiLWjXSuqmxJLQXON8bnaH9SS9 iUfR5jexDQIA9PkW/jb/uiC4AsPuw45chjA4kQ646Qp1S5s3Ss9ic91YcO/rkfOxhMj2seyv0K4nz rgtS5u6AwOok0wCNqE1AWGEGIKj+eW0KvJmPbHnTtt07GB6S5eJlfGtz8nXLmXc34swgNm0boti/e TGpljP2jGdfc/tfEKpY6OWde5Num9tHCc1DbDRyjdfBXECAd3MpZ11FraI7MEZ3OtaNat24bfnmOg Xqapc7dQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:39618 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 1tVZE5-0000vN-0k; Wed, 08 Jan 2025 16:48:13 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZDm-0002K9-9w; Wed, 08 Jan 2025 16:47:54 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v4 05/18] net: stmmac: make EEE depend on phy->enable_tx_lpi Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:47:54 +0000 X-Patchwork-Delegate: kuba@kernel.org Make stmmac EEE depend on phylib's evaluation of user settings and PHY negotiation, as indicated by phy->enable_tx_lpi. This will ensure when phylib has evaluated that the user has disabled LPI, phy_init_eee() will not be called, and priv->eee_active will be false, causing LPI/EEE to be disabled. This is an interim measure - phy_init_eee() will be removed in a later patch. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 94cd58c636d9..a0d1144507dd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1083,7 +1083,7 @@ static void stmmac_mac_link_up(struct phylink_config *config, stmmac_mac_set(priv, priv->ioaddr, true); if (phy && priv->dma_cap.eee) { - priv->eee_active = + priv->eee_active = phy->enable_tx_lpi && phy_init_eee(phy, !(priv->plat->flags & STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0; priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer; From patchwork Wed Jan 8 16:47:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13931346 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 115331FECC1 for ; Wed, 8 Jan 2025 16:48:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354907; cv=none; b=a49Er1XHM2pIywiUbfFYevhS7AoLYeuyBqNc62nE/mRjRot7kdBZqzB8K37hSEkVgqFQPxrdffjizGptX3HpAzuCBjl58hAAnCf1zinlFZuaasaRZUtGbXecj1f5iV8iqBCl0LfRBzujnybMCihf8EwhHtMFG3whSK/6r7WAUeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354907; c=relaxed/simple; bh=cKghFwdyFTGXseJ/FiUx2rt8NhTCh/6HKmNsg2DlHW4=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=Z2zGZszgfJwT3G9/SR5BiAJv+dCLYHj93pZfomaCjNd52rIgimoNd7gkWWyGpsfwUcS0/We4hYrUrVIG4QqGSCl2ANuv6k5SJ6dJCONEdX0r67aIMBF7InaVVHahAprEhXwnbpwDHSNqO2/6Mo441wvJniB2Hi/XzlNK435xno0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=qo3vSVaT; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="qo3vSVaT" 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=7hE4EeXv53OSz/8DGAk3QLChy+iFvZSWMogT3CTeyGU=; b=qo3vSVaTi7vE+9ljApMVlZoe4e LLzERpmhtKQW9OgAlPcVYMfg2willIiLoFqfDECRLzMvp8HzBLfuplt8zL6PEXi95WPm/Oxr/bXlN 3sJ8fF+GJ/wrAzH35weArJLIXELnX25LHFV1P9ezRvUs/f0/ewBiDL5kHLde99GOJTTwzKjA2adZK 6U32qv1YKR3i+n3uobMomiLwmrUgQyrkS3TAg7mkAKCHAFV7ODm3mzf0NE8p/qoNm8NxpuUH2n7uz FK3O34mDDchdE2Cvjjj40dNCr39DUI2z2qmLPtbMnQD/YriARnQIs+pOLlaTOuzxuMh+nkWQiTbtX OF5s9NcA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:39630 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 1tVZEA-0000vf-11; Wed, 08 Jan 2025 16:48:18 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZDr-0002KF-Cv; Wed, 08 Jan 2025 16:47:59 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next v4 06/18] net: stmmac: remove redundant code from ethtool EEE ops Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:47:59 +0000 X-Patchwork-Delegate: kuba@kernel.org Setting edata->tx_lpi_enabled in stmmac_ethtool_op_get_eee() gets overwritten by phylib, so there's no point setting this. In stmmac_ethtool_op_set_eee(), now that stmmac is using the result of phylib's evaluation of EEE, there is no need to handle anything in the ethtool EEE ops other than calling through to the appropriate phylink function, which will pass on to phylib the users request. As stmmac_disable_eee_mode() is now no longer called from outside stmmac_main.c, make it static. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 9 --------- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 984e708d019f..2eee3c5c4d1e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -405,7 +405,6 @@ void stmmac_dvr_remove(struct device *dev); int stmmac_dvr_probe(struct device *device, struct plat_stmmacenet_data *plat_dat, struct stmmac_resources *res); -void stmmac_disable_eee_mode(struct stmmac_priv *priv); int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt); int stmmac_reinit_ringparam(struct net_device *dev, u32 rx_size, u32 tx_size); int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 0429a99a8114..693f59c3c47a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -898,8 +898,6 @@ static int stmmac_ethtool_op_get_eee(struct net_device *dev, if (!priv->dma_cap.eee) return -EOPNOTSUPP; - edata->tx_lpi_enabled = priv->tx_lpi_enabled; - return phylink_ethtool_get_eee(priv->phylink, edata); } @@ -911,13 +909,6 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev, if (!priv->dma_cap.eee) return -EOPNOTSUPP; - if (priv->tx_lpi_enabled != edata->tx_lpi_enabled) - netdev_warn(priv->dev, - "Setting EEE tx-lpi is not supported\n"); - - if (!edata->eee_enabled) - stmmac_disable_eee_mode(priv); - return phylink_ethtool_set_eee(priv->phylink, edata); } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a0d1144507dd..de06aa1ff3f6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -432,7 +432,7 @@ static int stmmac_enable_eee_mode(struct stmmac_priv *priv) * Description: this function is to exit and disable EEE in case of * LPI state is true. This is called by the xmit. */ -void stmmac_disable_eee_mode(struct stmmac_priv *priv) +static void stmmac_disable_eee_mode(struct stmmac_priv *priv) { if (!priv->eee_sw_timer_en) { stmmac_lpi_entry_timer_config(priv, 0); From patchwork Wed Jan 8 16:48: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: 13931347 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 943181FF601 for ; Wed, 8 Jan 2025 16:48:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354913; cv=none; b=GRSeEs7fZauRLIKWKYWy/wuiGu09VpsMfZ58LzeLuyGSIgINNypnlZxYTSzUNXT4qAfwMY+yIwvhdKvsjb2iWKqsEIkqYQP4teJ4sW2XvDUSUgAxjCYM3PobnNCVp2RGFsiOdooa72vAEIuMdxJg8MTXHfrQnBfLL95ue4UkjnA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354913; c=relaxed/simple; bh=/ZjyUHK1HFpaTU33/HnlKX8xXJF6lP1lvGbxDWIMFBk=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=ASBgQdtAqC9XTNh1A1HVv/3/edPJnTMbvsdBkFnV9QHyY+3QrVD3wjBsQgfRe32U5Z9qpZWv1AGAOmT3WX2UZvNXf6sEXCYxij34+2Ik2V1KYGlyvojIgHtXThzEdMRFu6pA1NUrqIzlElBOJvHm+t/yVTK5g5Yak5nK1pjz/PU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=jYBWhcmy; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="jYBWhcmy" 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=PQ14Izj44j5dYld782zHWwkwWoBPzRg9ao0ISPNBJRE=; b=jYBWhcmym+D8266EEI09hBd7xB q0sRIn3TK56zfyJGpjYASn29OHbTdZJBPmJXG9lCZf7J/AQgoEUX8kqRFzm5zS/vaY/keWE7oGJaO HwZpEqlPxMe8smFh+f3qy5xdwW7ouqXx7JwRE7icmEt852F694oSwl48tTBXKAJxmXA/vIn5AMqxh uGggnaTrYsGMTMduhaGyHc8pUZFz1RhSs1ZyUZR5QqtpbgMYQTa97G6zDbf5BvJQtB7AdcPGOXfLc h0Z9OeBw22JHOaWYhfG+RCrsgZ/CscmLXDeHhUtnjLejntvIMnj/t8/4y6EoKrJpLnVGlqgwSbZZr o8CcYoWw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:60546 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 1tVZEF-0000vz-1A; Wed, 08 Jan 2025 16:48:23 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZDw-0002KL-Gg; Wed, 08 Jan 2025 16:48: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 v4 07/18] net: stmmac: clean up stmmac_disable_eee_mode() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:48:04 +0000 X-Patchwork-Delegate: kuba@kernel.org stmmac_disable_eee_mode() is now only called from stmmac_xmit() when both priv->tx_path_in_lpi_mode and priv->eee_sw_timer_en are true. Therefore: if (!priv->eee_sw_timer_en) in stmmac_disable_eee_mode() will never be true, so this is dead code. Remove it, and rename the function to indicate that it now only deals with software based EEE mode. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index de06aa1ff3f6..9a043d19ebac 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -427,18 +427,13 @@ static int stmmac_enable_eee_mode(struct stmmac_priv *priv) } /** - * stmmac_disable_eee_mode - disable and exit from LPI mode + * stmmac_disable_sw_eee_mode - disable and exit from LPI mode * @priv: driver private structure * Description: this function is to exit and disable EEE in case of * LPI state is true. This is called by the xmit. */ -static void stmmac_disable_eee_mode(struct stmmac_priv *priv) +static void stmmac_disable_sw_eee_mode(struct stmmac_priv *priv) { - if (!priv->eee_sw_timer_en) { - stmmac_lpi_entry_timer_config(priv, 0); - return; - } - stmmac_reset_eee_mode(priv, priv->hw); del_timer_sync(&priv->eee_ctrl_timer); priv->tx_path_in_lpi_mode = false; @@ -4495,7 +4490,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) first_tx = tx_q->cur_tx; if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en) - stmmac_disable_eee_mode(priv); + stmmac_disable_sw_eee_mode(priv); /* Manage oversized TCP frames for GMAC4 device */ if (skb_is_gso(skb) && priv->tso) { From patchwork Wed Jan 8 16:48: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: 13931348 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A127C1FF60A for ; Wed, 8 Jan 2025 16:48:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354918; cv=none; b=sOot5GijCv2ie9l474UYB7z1nXbdRCa6ZvNrT96koGw99+Mt1o5L3KbutbCLBPj3Uv8bX1h95Nrcg8YrAaBYyns129gV1ZVsdKOzr4p4j2mAhNwJi/14/3/0H2XKnnty4SzglNG0xG8CyXHVerNYdTMrF6SHBvC0Gc+foq9NjSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354918; c=relaxed/simple; bh=WnFUVfmk0hNfcWUgsGPGsBr80CcGRIlLTKh6NXTimxc=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=DFckHkJAWI1A3q7ZctgACe8P6M+s4jkcmcrrhP2VDzhPZa1zc475BfviT2Ctph0OEiEErAEkPXNNODWJRRuvckVfd2ychF1Vr0NBHdMHWc1I04016vUZawAZsgkNNtGSwYw9KpcW87z38awdHdVX5QmOFKDWd1GWaDDIsfEi2LA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=kCPdKdyQ; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="kCPdKdyQ" 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=2CymIfDpI4jQ87Fd6A2r90IrhRXh+fgCvIKVuutMKy0=; b=kCPdKdyQQwYaXkWAeae4t3crQc hXGnzVAF8EUM9UFSrp4x1Wro+//zLNraEUD2sP0Oo2ir5zV1J9u3UH2Y9VJqH047VOqwsCiOdKmw9 SyUvbdsi0X/y/vbnIbh2u42PBzLztWmPWgeuem/6+EM0kSBEXh6LQtRucn2xTOfEE9e8wyE7b9l/+ oKGHOKnT5qKColslUbsfMNpSk0LjlBSK9rqEOzzDhOpysB4yBFJHh86DwPlE392c94hJXtB8+6swe 4WVVBY1E5e9XWrO9QcRYGOC3ktoVhM6hbjLnEfCebme3kTLKE3KZiRcxp5BhQLms5wKwDVa82xUmt s9+cJEuQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:60556 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 1tVZEK-0000wG-2F; Wed, 08 Jan 2025 16:48:28 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZE1-0002KS-K1; Wed, 08 Jan 2025 16:48: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 v4 08/18] net: stmmac: remove priv->tx_lpi_enabled Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:48:09 +0000 X-Patchwork-Delegate: kuba@kernel.org Through using phylib's EEE state, priv->tx_lpi_enabled has become a write-only variable. Remove it. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 2eee3c5c4d1e..507b6ac14289 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -308,7 +308,6 @@ struct stmmac_priv { int eee_enabled; int eee_active; u32 tx_lpi_timer; - int tx_lpi_enabled; int eee_tw_timer; bool eee_sw_timer_en; unsigned int mode; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 9a043d19ebac..b6ac089bfec9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -968,7 +968,6 @@ static void stmmac_mac_link_down(struct phylink_config *config, stmmac_mac_set(priv, priv->ioaddr, false); priv->eee_active = false; - priv->tx_lpi_enabled = false; priv->eee_enabled = stmmac_eee_init(priv); stmmac_set_eee_pls(priv, priv->hw, false); @@ -1083,7 +1082,6 @@ static void stmmac_mac_link_up(struct phylink_config *config, STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0; priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer; priv->eee_enabled = stmmac_eee_init(priv); - priv->tx_lpi_enabled = priv->eee_enabled; stmmac_set_eee_pls(priv, priv->hw, true); } From patchwork Wed Jan 8 16:48: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: 13931349 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D67FE1FF1DB for ; Wed, 8 Jan 2025 16:48:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354923; cv=none; b=hmTivmGukY1/Lh/AAFUDbk/v+Ko334S8n0TTJBy7uCVX/3v43xbkwYnWE6Q9OrdWn6+U0CfuA0rJDoXwjp55Yf731L9hNntfSIzocyiDUOwJTsZCGeBplZ9DqTiQ1B7b9d7R5yxUzHAda+WawlYxL8VsY42OHkdh16lIDYu+aMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354923; c=relaxed/simple; bh=Z06R21r0IDA5++AltNakKSlFoUmF7ofiLz8eZHmJhIs=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=LRLx96uxYaQLrLhnj2Yuo25ywzA4IOycj+JJryYU0WDSfg3NOkSr8hrTth+IIvOw/S2uusvPvDnUZVJslaWWtOwUljxRGe2Z5Bc/DAlGzxcXGnAAZMH6cRFleJWGqqJgfgK/WwcrKg4QFyZiwHwF+XDKOsOSIGElzId4/xcfvoo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=wh0rOs6V; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="wh0rOs6V" 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=edAKNe3zhY2EotSduckpqmoyr3Ch4JP4aX8L24TkpuU=; b=wh0rOs6VodcPE/oNn8K7DaqVJA yHCRzwyB380dpeeUuZKZ5SxXtXKHpOmbSWUv0MTEEJWgHFXnliwerwP5UgddrTl/0JoFyDFMtcNyh lcSoEVhWy7uWZRDYRRIv8bogeu7Uzl/ErjURnV4jQDVN5ipzMhOssT6SY/itwhai+Bto7hGjYYa7z 4ed8/+Cd32iD597/lzdV6AqMf0w8XDEi2tdogzfFbMadaoLsOri1OkM+SBZvZxmOYgnjvbhaozzmu lpeXXY+LKL7XsQyTqo0LHyUnIXAt7DITiwlN3peVaoCfF4a9uH/Eg0sBjK9CsPOgJKJW115umr7zT YK0qGofw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:46334 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 1tVZEP-0000wX-2I; Wed, 08 Jan 2025 16:48:33 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZE6-0002KY-Nx; Wed, 08 Jan 2025 16:48: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 v4 09/18] net: stmmac: report EEE error statistics if EEE is supported Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:48:14 +0000 X-Patchwork-Delegate: kuba@kernel.org Report the number of EEE error statistics in the xstats even when EEE is not enabled in hardware, but is supported. The PHY maintains this counter even when EEE is not enabled. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 693f59c3c47a..918a32f8fda8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -654,7 +654,7 @@ static void stmmac_get_ethtool_stats(struct net_device *dev, (*(u32 *)p); } } - if (priv->eee_enabled) { + if (priv->dma_cap.eee) { int val = phylink_get_eee_err(priv->phylink); if (val) priv->xstats.phy_eee_wakeup_error_n = val; From patchwork Wed Jan 8 16:48: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: 13931350 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 841221FF1DB for ; Wed, 8 Jan 2025 16:48:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354928; cv=none; b=Xxt8MXF6/qhhN0FoZHq/dIGpUjCgOnOdGMs8gSotOmwzrXQCrWjqwJXJOtFATmCAProOiOuDT1lMwD9AL517uHgKdZ+p+908XGTU5jyBda/E8X99tRwnHVa8GdurQpv9CCnbCRd//dMyu/pmJpsjrW3vyCtxpGz/UaWwHuuDkuo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354928; c=relaxed/simple; bh=cw7b9HVl5ZQLuPRuVGYbs3mQS5RtCYWc6JuBHqGmBas=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=a/VFU1SHpWZQpNcN1RoR6Eo70GmFcgIXgZgQwm2g99gILDq8jUcuXiDPbigwi83t8AugvL8IWlDfGlQwVPenQD3XFPSINHk7jUtzBVqBftkIdjcsK4W/QI1bXFNvKGrlnMlvq4eYsusC9HOo4gouMDZbrX7C3VezZj7vf1MeCOs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=pR9IZX7L; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="pR9IZX7L" 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=TxomoAD9vFL3aVX1yAWGRcv8yG1Kn2x7q86Ya4Gi194=; b=pR9IZX7Lc89cSyR8ivmTGWVuwF TontVXDwGHvZbED3gPaiZ4/eaT8QPuSpHIBOklqraKnbydHxf3bVceBokbTr8slYaz6HTcJtHI+ZR XBARrJfi+/e0FPsM+qd4q4h8ogFb9eVyBSpdrzQ1p+7NMuWpJ+xRvg6o/n6IpQvGdUGAc22elFyID +cpOlpYI77g9BlxH3FyF/w/CTlz9k0nWtnZXxZWbv2ozw1vcLSI07LLCUbtMlTF3QisO2+PqUyPYt AQMgAHGr5auQ84ZOhqd9tZi4IX5z7vxgWZqkAGLE0VTId//YVTaLB2/CW3I/blFKZC1/JiVh2KIwf b5IIXOXA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:46342 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 1tVZEU-0000wp-2a; Wed, 08 Jan 2025 16:48:38 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZEB-0002Ke-RZ; Wed, 08 Jan 2025 16:48: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 v4 10/18] net: stmmac: convert to use phy_eee_rx_clock_stop() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:48:19 +0000 X-Patchwork-Delegate: kuba@kernel.org Convert stmmac to use phy_eee_rx_clock_stop() to set the PHY receive clock stop in LPI setting, rather than calling the legacy phy_init_eee() function. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index b6ac089bfec9..04477f1a5504 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1077,10 +1077,10 @@ static void stmmac_mac_link_up(struct phylink_config *config, stmmac_mac_set(priv, priv->ioaddr, true); if (phy && priv->dma_cap.eee) { - priv->eee_active = phy->enable_tx_lpi && - phy_init_eee(phy, !(priv->plat->flags & - STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0; + phy_eee_rx_clock_stop(phy, !(priv->plat->flags & + STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)); priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer; + priv->eee_active = phy->enable_tx_lpi; priv->eee_enabled = stmmac_eee_init(priv); stmmac_set_eee_pls(priv, priv->hw, true); } From patchwork Wed Jan 8 16:48: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: 13931351 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 180721FF1DB for ; Wed, 8 Jan 2025 16:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354941; cv=none; b=l8xENp6cXHQwNuqWB8rKurfTI5AARd76M6zsaUKlcDfx/kLlhnn3tsByNZw3rkuWYLQsVPYOcxGiSkcv7Z0dn9dBoG7Nm5UXCwdhEQeNBOLUMDvEKKeGX22iM4CThC22xV49RH23TWbkCd/Yj0/GRdNLkEBbulsFfhTF3w4p07E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354941; c=relaxed/simple; bh=1ff0H4h8UmXg11qWMQ8iYP1tejklGZObaLRXYxMUQV0=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=EOy4CK/B9PRv4dwLbAT8fm8vdyderu3JPoH6DVWlEfq6AudQeGiwR4wCjWsbwzhjlCgTyoG6okaDS4o1KaKRTtCU2ymVoaQTRynh/IiGjQyTYZNH+PIklgkwX/G88BkttHmrCBDxdw5w9GJKu/SGgFXHUTLLDOSfMWjw0lqdhw8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=lD7wovUA; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="lD7wovUA" 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=SZ5T8q7bO1y7ursfh0UIM7D9ZCy/fpzscizel2RCB9k=; b=lD7wovUA4SEp8YCycPuID0AEDI /JMGR3T9RnM8NRjYfzi54RQ6FC2HLjKh+PdwGd8Uk/D/NFapCd/AXCZbIBqXgQzT/WD3ab9OP3kQz 8U1mcIfifWx8ou8ZlGQq2FQP+0FqNlQrFhBVena1alFTdB6JHgadJzuhM/Mds3Aqa+86N13gvpgpL YLQzEmcRJxn93tFWkW2+vjt5RKx5ULsfoBtdIZN7lmEU6rtJhO0TzkDufrYnoIBJmZB9oT5NxKWvl /RF0DN7tpZjAHPBKaQfE7+xELdGmF31esqywIMJaFeC1yQuI/sKAERi1q3X+iS4NrghhI1oqMrrDN Stk0zWDQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:41958 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 1tVZEZ-0000xA-2l; Wed, 08 Jan 2025 16:48:43 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZEG-0002Kk-VH; Wed, 08 Jan 2025 16:48:25 +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 v4 11/18] net: stmmac: remove priv->eee_tw_timer Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:48:24 +0000 X-Patchwork-Delegate: kuba@kernel.org priv->eee_tw_timer is only assigned during initialisation to a constant value (STMMAC_DEFAULT_TWT_LS) and then never changed. Remove priv->eee_tw_timer, and instead use STMMAC_DEFAULT_TWT_LS for both uses in stmmac_eee_init(). Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 507b6ac14289..1556804cca38 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -308,7 +308,6 @@ struct stmmac_priv { int eee_enabled; int eee_active; u32 tx_lpi_timer; - int eee_tw_timer; bool eee_sw_timer_en; unsigned int mode; unsigned int chain_mode; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 04477f1a5504..7bbf7839e69b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -464,8 +464,6 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t) */ static bool stmmac_eee_init(struct stmmac_priv *priv) { - int eee_tw_timer = priv->eee_tw_timer; - /* Check if MAC core supports the EEE feature. */ if (!priv->dma_cap.eee) return false; @@ -478,7 +476,8 @@ static bool stmmac_eee_init(struct stmmac_priv *priv) netdev_dbg(priv->dev, "disable EEE\n"); stmmac_lpi_entry_timer_config(priv, 0); del_timer_sync(&priv->eee_ctrl_timer); - stmmac_set_eee_timer(priv, priv->hw, 0, eee_tw_timer); + stmmac_set_eee_timer(priv, priv->hw, 0, + STMMAC_DEFAULT_TWT_LS); if (priv->hw->xpcs) xpcs_config_eee(priv->hw->xpcs, priv->plat->mult_fact_100ns, @@ -491,7 +490,7 @@ static bool stmmac_eee_init(struct stmmac_priv *priv) if (priv->eee_active && !priv->eee_enabled) { timer_setup(&priv->eee_ctrl_timer, stmmac_eee_ctrl_timer, 0); stmmac_set_eee_timer(priv, priv->hw, STMMAC_DEFAULT_LIT_LS, - eee_tw_timer); + STMMAC_DEFAULT_TWT_LS); if (priv->hw->xpcs) xpcs_config_eee(priv->hw->xpcs, priv->plat->mult_fact_100ns, @@ -3446,8 +3445,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool ptp_register) else if (ptp_register) stmmac_ptp_register(priv); - priv->eee_tw_timer = STMMAC_DEFAULT_TWT_LS; - if (priv->use_riwt) { u32 queue; From patchwork Wed Jan 8 16:48:30 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: 13931358 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E3701FF5E3 for ; Wed, 8 Jan 2025 16:49:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354954; cv=none; b=QdZcuGwbJ1iK4rvnclpDHoIWnhWEQq8FvxJd/44+63WBNXXJUBs7hbmY84P8sj5edCRpKkvXq8m+l+W29xWHYby1hDlju59mICfLe+kZxVGzXYWAvpv4cT8wLPDCi2y7Ww2G/htLblUJGsk5DOHuHhpjrpqqYtIjtfhEAaXsRm8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354954; c=relaxed/simple; bh=350Pt7lRSRjJSdjJfXJXrnrQmbkJ5WVhXHVFGK9IhYs=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=SQqkjy25kRiYJx58l9L1tVMMnREr+4VpdoOOgG/BmNpPRb/36FyWVFDwDu1w+jXhj5TZZbxlTEuWyD9ysuAJpOKJILmL3SFX3AtJX9ygCAczQ8BsgrdZoaEh6QvQfNvIFEMIpjX8GyNv+M/3W+v+5g9ziQm7LarnGGb+kVdX+ko= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=xZ4q5HMu; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="xZ4q5HMu" 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=0oWj6JlUTpgxmTZ6PJqx9dqpvb1wkaivqtcgt+oGt+E=; b=xZ4q5HMuVzzr5qbybv/GiMaUhg OIIX4yDjzAsQch7MlUZc2W6ZmOshNZkDGCpDpCpCrNKxNUeYwTO4bGksNVobbPwskBbHKYCBN4G7Z Pkq+fUm5SIwmzzJIxSk2cWoaFnCofOoT0VU03XFpguPTzd1HZn1Jl64w6h0OIQKI+IduQ7GGuWxdS 40h/0JajNCCwQDGOaOYtK3bogFMF5A2vJNDvP9ugP4apw2cE3hrD13uo6UbLBRm9UnNI3mxsJlKp1 Kn+0f2b2D/mTqyxG2zY4maSBrQZ3i5Wa6oxuuUXQAEJjcE7MHLmnH5a8juKJWBIikr1LqqS5k99/c ricWI8ww==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:41974 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 1tVZEi-0000xW-2x; Wed, 08 Jan 2025 16:48:53 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZEM-0002Kq-2Z; Wed, 08 Jan 2025 16:48:30 +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 v4 12/18] net: stmmac: move priv->eee_enabled into stmmac_eee_init() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:48:30 +0000 X-Patchwork-Delegate: kuba@kernel.org All call sites for stmmac_eee_init() assign the return code to priv->eee_enabled. Rather than having this coded at each call site, move the assignment inside stmmac_eee_init(). Since stmmac_init_eee() takes priv->lock before checking the state of priv->eee_enabled, move the assignment within the locked region. Also, stmmac_suspend() checks the state of this member under the lock. While two concurrent calls to stmmac_init_eee() aren't possible, there is a possibility that stmmac_suspend() may run concurrently with a change of priv->eee_enabled unless we modify it under the lock. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 7bbf7839e69b..7c492f14f56f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -462,11 +462,13 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t) * can also manage EEE, this function enable the LPI state and start related * timer. */ -static bool stmmac_eee_init(struct stmmac_priv *priv) +static void stmmac_eee_init(struct stmmac_priv *priv) { /* Check if MAC core supports the EEE feature. */ - if (!priv->dma_cap.eee) - return false; + if (!priv->dma_cap.eee) { + priv->eee_enabled = false; + return; + } mutex_lock(&priv->lock); @@ -483,8 +485,9 @@ static bool stmmac_eee_init(struct stmmac_priv *priv) priv->plat->mult_fact_100ns, false); } + priv->eee_enabled = false; mutex_unlock(&priv->lock); - return false; + return; } if (priv->eee_active && !priv->eee_enabled) { @@ -507,9 +510,10 @@ static bool stmmac_eee_init(struct stmmac_priv *priv) STMMAC_LPI_T(priv->tx_lpi_timer)); } + priv->eee_enabled = true; + mutex_unlock(&priv->lock); netdev_dbg(priv->dev, "Energy-Efficient Ethernet initialized\n"); - return true; } /* stmmac_get_tx_hwtstamp - get HW TX timestamps @@ -967,7 +971,7 @@ static void stmmac_mac_link_down(struct phylink_config *config, stmmac_mac_set(priv, priv->ioaddr, false); priv->eee_active = false; - priv->eee_enabled = stmmac_eee_init(priv); + stmmac_eee_init(priv); stmmac_set_eee_pls(priv, priv->hw, false); if (stmmac_fpe_supported(priv)) @@ -1080,7 +1084,7 @@ static void stmmac_mac_link_up(struct phylink_config *config, STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)); priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer; priv->eee_active = phy->enable_tx_lpi; - priv->eee_enabled = stmmac_eee_init(priv); + stmmac_eee_init(priv); stmmac_set_eee_pls(priv, priv->hw, true); } From patchwork Wed Jan 8 16:48:35 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: 13931357 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4893A1FF1DB for ; Wed, 8 Jan 2025 16:49:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354953; cv=none; b=DuIylhn38a/S/dxmsgNiCn7rlSx2CskA44CeycpynkVv0mnx5BNyg21LsXKyBSxPLxcBv+VvYQvlLHBYbA/+MYcjgMxkbz3b1iNW0UmJZQC1ffKziOcSzL96vKVqabhAEO7TDOO0Jw8YvjSWwW7ng6W5XaoJQsNtzzLP3HCXTBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354953; c=relaxed/simple; bh=fSLzNnUhJVq4m12WlxRoJ/Wbivbi+44MjHxD7ojy6RU=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=Us9qn7skWkHrGMP/A3KCHHzAmjVnbTe/aU2EyPf5FsKVNXDCQrvY/Yp0Dcbd0U/z2oOBEW5O1B8GZXgLIkQ1LxiKJ878mXzm9NMAInuYXl1orLT86IhM1VD0LkMSZilsUQ8m79njjhdrJjGno1BhcyYkK1qpJ9XO0bB42y59PgE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=clpE6C01; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="clpE6C01" 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=7qLLbaaYFisIspn/SUJF7U5WjZqj+c1h7oIc0JP/qVk=; b=clpE6C01hPneWqNs2huudpuNHk gQVnLguolncvySvzMVxCb+VPX/EnJkRwt6ZEayDTC2YeB1oAn26GEzLqaoYOAd9f+NnI8PhdgX6F6 hewjyLkGFZCyY/SPh2cqn9ltxrihSgJr+Bhvf+Br5ZHoMqcXpRi1IhVIaCuQxkpAFFxf+tvVmhsV/ WwN5dMJI2jkMD30/j0KRY0qm3RRyoRqv/ddRI1kHtDSxMddkxS9QB/LEfqEyu07Kr/21Kdg0lzgv+ 6NkbPRKSq0QuWPX+QDzPFARAOQ4oZ9aoptklYMikV9BJrFock6nRaBmtuxHF0HyY/luuj8wKk7il7 9T93YpqQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:46344 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 1tVZEn-0000xb-0F; Wed, 08 Jan 2025 16:48:57 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZER-0002Kv-5O; Wed, 08 Jan 2025 16:48:35 +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 v4 13/18] net: stmmac: move priv->eee_active into stmmac_eee_init() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:48:35 +0000 X-Patchwork-Delegate: kuba@kernel.org Since all call sites of stmmac_eee_init() assign priv->eee_active immediately before, pass this state into stmmac_eee_init() and assign priv->eee_active within this function. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 7c492f14f56f..f2038dca8a02 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -457,13 +457,16 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t) /** * stmmac_eee_init - init EEE * @priv: driver private structure + * @active: indicates whether EEE should be enabled. * Description: * if the GMAC supports the EEE (from the HW cap reg) and the phy device * can also manage EEE, this function enable the LPI state and start related * timer. */ -static void stmmac_eee_init(struct stmmac_priv *priv) +static void stmmac_eee_init(struct stmmac_priv *priv, bool active) { + priv->eee_active = active; + /* Check if MAC core supports the EEE feature. */ if (!priv->dma_cap.eee) { priv->eee_enabled = false; @@ -970,8 +973,7 @@ static void stmmac_mac_link_down(struct phylink_config *config, struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev)); stmmac_mac_set(priv, priv->ioaddr, false); - priv->eee_active = false; - stmmac_eee_init(priv); + stmmac_eee_init(priv, false); stmmac_set_eee_pls(priv, priv->hw, false); if (stmmac_fpe_supported(priv)) @@ -1083,8 +1085,7 @@ static void stmmac_mac_link_up(struct phylink_config *config, phy_eee_rx_clock_stop(phy, !(priv->plat->flags & STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)); priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer; - priv->eee_active = phy->enable_tx_lpi; - stmmac_eee_init(priv); + stmmac_eee_init(priv, phy->enable_tx_lpi); stmmac_set_eee_pls(priv, priv->hw, true); } From patchwork Wed Jan 8 16:48:40 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: 13931359 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BC551FF1DD for ; Wed, 8 Jan 2025 16:49:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354954; cv=none; b=LVFStgq2FD2cxXz5MCifADOGR6+zlLKuV1nfHOIvcHz/+8nq6u/lEYx0bKXrBxf24BmSPo6BzMzA+cN7I/FIA+tX6I/EKHwxD/4agRgQ+CmpwSUQKj8WlgtdfAk9QLXJbtQZgmpnkzxJHINLJTxR5hcHzZYIj9B/eV7RX6Tz+3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354954; c=relaxed/simple; bh=TBz2nujOAI5/Y8Zg70CFpY+rYmOsL/gsDYa2XanvEww=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=F4+Zw7PK4ApZR06muslh0PwW3TjDFtFKapNLBXV18rZSUTIuPWIKP5girD2CCco8F1nljgPKj2qnitMnEXO0T+0qsHJy9awFEGuGgG5LFfW7VI5TzIjANgKxGLzF05yTTyjpZX+MjNH7i1o2P6QoizHdcGGPC7HXtbTdYW+45Uk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=A6sszLKe; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="A6sszLKe" 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=yu+9Qz2lxGwIw57DzDZsWsaRAx4ta+qmYcXg3UwOVJo=; b=A6sszLKeP/QSnJl3kDVsu1ch29 ID2U1+Aww1kOny76+/D9gQQfVNwafxlY/e3YLW0LBpKzMAS9QXVrv8ObbMLTFEDt0m8Z79ZZ33PlM zmZCMEXFU/L19Jd1Ws3tk2imaAEihLwQPrBrcCcXxOJpMwCZyMK9HqIHqMhVqLgsO1JMfDeM0WUwo Eoypj15LHJi28d3IxPgrUE1PkxQIVEj6weBuf5gLgMc1G35Njz0N2N9E4VotRso/DCvZoil9TuCto P1KaWJ4FTz2y85ZzpTwbXDDXf/fItkEYHZ5ImhCTH8Sb+2DT8RTCWSbls9u2CJbyAZ22nvujTcwuE bxQsJPVQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:46358 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 1tVZEr-0000xl-2J; Wed, 08 Jan 2025 16:49:01 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZEW-0002L2-9w; Wed, 08 Jan 2025 16:48:40 +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 v4 14/18] net: stmmac: use boolean for eee_enabled and eee_active Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:48:40 +0000 X-Patchwork-Delegate: kuba@kernel.org priv->eee_enabled and priv->eee_active are both assigned using boolean values. Type them as bool rather than int. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 1556804cca38..25ad3f92e14d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -305,9 +305,9 @@ struct stmmac_priv { int clk_csr; struct timer_list eee_ctrl_timer; int lpi_irq; - int eee_enabled; - int eee_active; u32 tx_lpi_timer; + bool eee_enabled; + bool eee_active; bool eee_sw_timer_en; unsigned int mode; unsigned int chain_mode; From patchwork Wed Jan 8 16:48: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: 13931360 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C58B31FF61A for ; Wed, 8 Jan 2025 16:49:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354956; cv=none; b=XAFe/X+eSm9FOrcXcZ8+E7UfJmMKxOxUGZD7frNUAaEIeDXvFhVD7mCsDSjJ3RK1OTg8Yr79q9gi/qWh8Qz+G7qfURdtyo5S+SZ8HjpzDZK/qHwK79vEFMqt9WivxLzd6X+jbgc/QkNl3cofTZ6HoyI6fuNIg4IAejVUnc90eFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354956; c=relaxed/simple; bh=REigeGodmWi3x/DWGknFmrkWMW3jGDUBbazrrkLsxLI=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=PAasCLStXKSoh9+oC4Y2p3hPlCZQQAMXvDd9rzmoGSxBxQQ9uLQrCgrALbf4plEBDD5TEL/Bg7NPfXaYfWidYPdthaTAyMGnrU0K+mpEhnmaxXedMgiGHMx3EHd9ybpkzIQ847GikW9FWTZ0djl5jBMwsnY3MEwmwRK3qgO8FOk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=1U4lh3tb; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="1U4lh3tb" 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=KHRng+xDV3xNyaudjuVxs4GBrXTsurm2SQrnhxQx0WU=; b=1U4lh3tbst0bBH4If+eqkR+GPC s5oqi7RpaPS+0JK1aap19e1RljTjQi6BbTTgor6glKtOvVExZ2tIK5ATMwYosr9oSedSSM7DrTBaO e8eTFhuAJgtrPYkLtoTKcI7WvosYWjqs9mbcTLFEvc0ED3+jbywTV1tfyKls9FKPXxWA1fTm3B8iX TQrsXNHzoSC5But6qbd+8MLt4DqdRdY1qPegPqZVHevQ2X2kPfVsn/ZZy8bSnqLXlvRuSyipIK0Mt Vwx5f72Ab4Cg5zawael7/ygzkegmAiR9RBxSEROxO/cnQ9Uel0AkvbhiSgkkLqDshGO73l+pzjhYr mawYRd6A==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:59554 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 1tVZEv-0000y7-2G; Wed, 08 Jan 2025 16:49:05 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZEb-0002L8-DJ; Wed, 08 Jan 2025 16:48: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 v4 15/18] net: stmmac: move setup of eee_ctrl_timer to stmmac_dvr_probe() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:48:45 +0000 X-Patchwork-Delegate: kuba@kernel.org Move the initialisation of the EEE software timer to the probe function as it is unnecessary to do this each time we enable software LPI. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f2038dca8a02..57338794695c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -494,7 +494,6 @@ static void stmmac_eee_init(struct stmmac_priv *priv, bool active) } if (priv->eee_active && !priv->eee_enabled) { - timer_setup(&priv->eee_ctrl_timer, stmmac_eee_ctrl_timer, 0); stmmac_set_eee_timer(priv, priv->hw, STMMAC_DEFAULT_LIT_LS, STMMAC_DEFAULT_TWT_LS); if (priv->hw->xpcs) @@ -7405,6 +7404,8 @@ int stmmac_dvr_probe(struct device *device, INIT_WORK(&priv->service_task, stmmac_service_task); + timer_setup(&priv->eee_ctrl_timer, stmmac_eee_ctrl_timer, 0); + /* Override with kernel parameters if supplied XXX CRS XXX * this needs to have multiple instances */ From patchwork Wed Jan 8 16:48: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: 13931361 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18F7E17E900 for ; Wed, 8 Jan 2025 16:49:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354961; cv=none; b=aOllzI6DDJfAB0/Cg9WhfaAr0efTxmud9JQPifB1JmnGMynLLFR3eb8BXgAb0OtadJ89M1sTqdloC1cf1EUnxwO5SeaqRST4+Az4mm8Og3pSBR+ACDhPqcnrP6qtZtoquVhW6IW38ZVz8KhamcTUJgs/DyB45NyA0YWOzqtdIHk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354961; c=relaxed/simple; bh=6XLpcsA9M2bwt44/DXUUOi5WcMJEL4SKHg/DGuc8gls=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=fiRCDyX1QPLj68a1e0SSYv2Y3RSzF6jjpaTP/Az8AOlh3kBSTICO9nhpIlrsRYXefZ/e8Ne6L6+C2vcjEqiet/VBbHggcCXHYrlGtBy9CntQINAGc0GfTi0+2A10q9STD7gebvYpKdsmiKq1XIYZcIPTuQWbljNuPZGwEA70g9U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=ba7qrwnE; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="ba7qrwnE" 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=EoFHmxuk+u6QTKDz08iGDhs9TdaD1EKsFjfn3QavAxs=; b=ba7qrwnEMrA/fpU8LCklFzltLw jM44/Vngd536ICJY0BoRrJNE+JVvUqmMRYGpVsP2x1/h/QspWpsFLWPIB/PVEHzDqdw8bbV06yJFe 3e6rH5kG7oezzcebWx24FhqBWE9UIyz42RsgvQG8bXKKGJgiOXUUj8kIHG6afIQgj7+Yh1Lf5Gm2H PVrv+nhh7DqzcgGdV2s44TlE/0agwF8XQG/PgQTS1tSiNbrfGaTiOpBIWpdPV0mLn2XHz37CL9/yf 7mpNup4mP++YY2Cpq2vaGsFgTy5/clWyL3t7GbXDvWhaeFr2VrnbJOLBk0VKDDigKKmzIoysLtA7n nzcQM90A==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:59562 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 1tVZF0-0000yc-0u; Wed, 08 Jan 2025 16:49:10 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZEg-0002LE-HH; Wed, 08 Jan 2025 16:48: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 v4 16/18] net: stmmac: remove unnecessary EEE handling in stmmac_release() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:48:50 +0000 X-Patchwork-Delegate: kuba@kernel.org phylink_stop() will cause phylink to call the mac_link_down() operation before phylink_stop() returns. As mac_link_down() will call stmmac_eee_init(false), this will set both priv->eee_active and priv->eee_enabled to be false, deleting the eee_ctrl_timer if priv->eee_enabled was previously set. As stmmac_release() calls phylink_stop() before checking whether priv->eee_enabled is true, this is a condition that can never be satisfied, and thus the code within this if() block will never be executed. Remove it. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 57338794695c..6d01dcafaf15 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4033,11 +4033,6 @@ static int stmmac_release(struct net_device *dev) /* Free the IRQ lines */ stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0); - if (priv->eee_enabled) { - priv->tx_path_in_lpi_mode = false; - del_timer_sync(&priv->eee_ctrl_timer); - } - /* Stop TX/RX DMA and clear the descriptors */ stmmac_stop_all_dma(priv); From patchwork Wed Jan 8 16:48: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: 13931362 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74F291FFC7F for ; Wed, 8 Jan 2025 16:49:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354964; cv=none; b=TdWyczkMIsjgoK6Fnb2BZt0+rmQThHh1mxNfQp/G3GOZKQe+q/rxjdKWlSPC5g2MZqR7T7kTFiY7Rf6PYqshknqU199dViQseteMaZqbqStGS+2F1iI68EzB+umI7O+1hUQNX4V/vuCojGrC8Mc8Pfx25ZgHRCXKOka0THTkjO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354964; c=relaxed/simple; bh=6wqtdHOfXbChWcIH8GUqt9x5Guymy+RDP6z5pjSWCEM=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=oW0WDmJOnrRInuffaDhoh8gaNhC505zpy2PTgnZ2nx3TgAsPBFJDCA21buHRNi6Hkz1L0AW6P175jPbHGuQkGsOzPGGe5fpua58pZp8UigStxUrz+AW2vM41Bsvge0Jofet76bnrRGb90iwWZfqPZqO+ucLm4fcEO2/FGA8wTlU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=v+FHQnl9; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="v+FHQnl9" 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=++e+SDGClfcRyopadSBzqoMp8DLijqiGn3Srrs12xlo=; b=v+FHQnl9Wtbhw5yWW4uWiy+g+d f9Qxz4ZbJSIbuWmJJ81czZacO5Gr0CETG2vyREjCnrrW9RE+kb8JYfMeECPFLwy7v0emigc5pMiqw aCXIFl2Denk+6oNBOjEPB0VJP3hBn0nPutUQ8bgvF3NyVwIWf9pJnLdE/BIToIqoQwL9ONZQgjPZG WJv2N56ZbbHPX5SHgAhbo7Xf5ynkRiKaNGAangRGiqWapFILn02YNr9oKyRwQ4GomTsUt2mEQ+sYu jl2MYlDec2e5qgdxszOaAjjit4Piszp8TEuUKwrqzpfJV/TKOdbKQZxb9nno+6EILda3+3yAm/YUg 0S7qLBOw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:56706 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 1tVZF4-0000z4-2i; Wed, 08 Jan 2025 16:49:15 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZEl-0002LK-LA; Wed, 08 Jan 2025 16:48: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 v4 17/18] net: stmmac: split hardware LPI timer control Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:48:55 +0000 X-Patchwork-Delegate: kuba@kernel.org Provide stmmac_disable_hw_lpi_timer() and stmmac_enable_hw_lpi_timer() to control the hardware transmit LPI timer. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 6d01dcafaf15..05fee963c1c4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -390,14 +390,24 @@ static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv, u32 queue) return dirty; } -static void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en) +static void stmmac_disable_hw_lpi_timer(struct stmmac_priv *priv) +{ + stmmac_set_eee_lpi_timer(priv, priv->hw, 0); +} + +static void stmmac_enable_hw_lpi_timer(struct stmmac_priv *priv) { - u32 tx_lpi_timer; + stmmac_set_eee_lpi_timer(priv, priv->hw, priv->tx_lpi_timer); +} +static void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en) +{ /* Clear/set the SW EEE timer flag based on LPI ET enablement */ priv->eee_sw_timer_en = en ? 0 : 1; - tx_lpi_timer = en ? priv->tx_lpi_timer : 0; - stmmac_set_eee_lpi_timer(priv, priv->hw, tx_lpi_timer); + if (en) + stmmac_enable_hw_lpi_timer(priv); + else + stmmac_disable_hw_lpi_timer(priv); } /** From patchwork Wed Jan 8 16:49: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: 13931363 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D34F2200BBF for ; Wed, 8 Jan 2025 16:49:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354968; cv=none; b=gB7kvHln1mWz94oSjOYnq9hoYkryOQUHdBdeKwBHlXCJC0Y/KeKrwkg24E9go860rhDobLgU/BOeXTqL0lOCgFo/ImZcNo07e9w+ZCevVB8lJ/m8RwZ2mfYKLtsJhijrkv6UnfotNIhpA4IdD4zX7oZWNNSy1KRVR7XeHiRZlqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736354968; c=relaxed/simple; bh=W18j/heSv1r138D5BGWWDedmCuKnhjB8Kfif6LxJ9UE=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=cQDjkrLDYxEpOjEsHKEZYRSnuF3Z9N0GwJBffs8GWhT8ShfJZ8nuCJoSLLJYQkcHm7CDh2RQgzF0zNPtdk4f9E7hXQ/Nqs1GMwPrRbXcHKR3NFgpBOjda5PehBXoi2w5JH/AaLv5kCATpDBdZwC+G/YhvcC3L/vX98b8yuzPFtE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=RF3xZroV; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="RF3xZroV" 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=10GtQNKC7q93KhU5yLDXHdI00oq/zQecrX9fq8+Ar8M=; b=RF3xZroVynjvqbcd8ipSatgdB2 57TU6wRoBwGY1Wi7Vn84WeMx1+z0xI5sM3+i0r0dkVTi7BH0+vMYo9Brx8/simNaaIyfc5cH3Yiy9 Abz12/IJ9Bp0u+0h1WVXY8m2wQ/Mk5GZignGF9H1GhjgevqwGcQgc+zkz69YBMA6skhwafgrvUgNx c8VlLsjfTJ+zcI4cKa2nhqlR24ksES5lgJhVxRkJrRq/0Isl8/KBttj0J4jOKCWCbD0EbtW6EI8Aq UdGMRDfaqjleecX5jKTDIfLGQgVyJWLDz5aW+FWOp0HGyPwfdGOjsW4k66OWOlReP6r3V/S4lhJNT 7Ze7gm0w==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:56716 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 1tVZF9-0000zP-2e; Wed, 08 Jan 2025 16:49:19 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tVZEq-0002LQ-PC; Wed, 08 Jan 2025 16:49: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 v4 18/18] net: stmmac: remove stmmac_lpi_entry_timer_config() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 08 Jan 2025 16:49:00 +0000 X-Patchwork-Delegate: kuba@kernel.org Remove stmmac_lpi_entry_timer_config(), setting priv->eee_sw_timer_en at the original call sites, and calling the appropriate stmmac_xxx_hw_lpi_timer() function. No functional change. Reviewed-by: Andrew Lunn Tested-by: Choong Yong Liang Signed-off-by: Russell King (Oracle) --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 05fee963c1c4..ba4659055aa5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -400,16 +400,6 @@ static void stmmac_enable_hw_lpi_timer(struct stmmac_priv *priv) stmmac_set_eee_lpi_timer(priv, priv->hw, priv->tx_lpi_timer); } -static void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en) -{ - /* Clear/set the SW EEE timer flag based on LPI ET enablement */ - priv->eee_sw_timer_en = en ? 0 : 1; - if (en) - stmmac_enable_hw_lpi_timer(priv); - else - stmmac_disable_hw_lpi_timer(priv); -} - /** * stmmac_enable_eee_mode - check and enter in LPI mode * @priv: driver private structure @@ -489,7 +479,8 @@ static void stmmac_eee_init(struct stmmac_priv *priv, bool active) if (!priv->eee_active) { if (priv->eee_enabled) { netdev_dbg(priv->dev, "disable EEE\n"); - stmmac_lpi_entry_timer_config(priv, 0); + priv->eee_sw_timer_en = true; + stmmac_disable_hw_lpi_timer(priv); del_timer_sync(&priv->eee_ctrl_timer); stmmac_set_eee_timer(priv, priv->hw, 0, STMMAC_DEFAULT_TWT_LS); @@ -513,11 +504,15 @@ static void stmmac_eee_init(struct stmmac_priv *priv, bool active) } if (priv->plat->has_gmac4 && priv->tx_lpi_timer <= STMMAC_ET_MAX) { + /* Use hardware LPI mode */ del_timer_sync(&priv->eee_ctrl_timer); priv->tx_path_in_lpi_mode = false; - stmmac_lpi_entry_timer_config(priv, 1); + priv->eee_sw_timer_en = false; + stmmac_enable_hw_lpi_timer(priv); } else { - stmmac_lpi_entry_timer_config(priv, 0); + /* Use software LPI mode */ + priv->eee_sw_timer_en = true; + stmmac_disable_hw_lpi_timer(priv); mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer)); }