netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gatien CHEVALLIER <gatien.chevallier@foss.st.com>
To: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>
Cc: <netdev@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Eric Dumazet <edumazet@google.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [Linux-stm32] [PATCH net-next 3/5] net: stmmac: avoid PHY speed change when configuring MTU
Date: Thu, 16 Oct 2025 09:44:02 +0200	[thread overview]
Message-ID: <f9c7b80b-b750-4eaa-b528-7028e8d8295a@foss.st.com> (raw)
In-Reply-To: <E1v945T-0000000AmeV-2BvU@rmk-PC.armlinux.org.uk>



On 10/15/25 18:10, Russell King (Oracle) wrote:
> There is no need to do the speed-down, speed-up dance when changing
> the MTU as there is little power saving that can be gained from such
> a brief interval between these, and the autonegotiation they cause
> takes much longer.
> 
> Move the calls to phylink_speed_up() and phylink_speed_down() into
> stmmac_open() and stmmac_release() respectively, reducing the work
> done in the __-variants of these functions.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Gatien Chevallier <gatien.chevallier@foss.st.com>

> ---
>   .../net/ethernet/stmicro/stmmac/stmmac_main.c | 19 ++++++++++---------
>   1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 3728afa701c6..500cfd19e6b5 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -3963,8 +3963,6 @@ static int __stmmac_open(struct net_device *dev,
>   	stmmac_init_coalesce(priv);
>   
>   	phylink_start(priv->phylink);
> -	/* We may have called phylink_speed_down before */
> -	phylink_speed_up(priv->phylink);
>   
>   	ret = stmmac_request_irq(dev);
>   	if (ret)
> @@ -4015,6 +4013,9 @@ static int stmmac_open(struct net_device *dev)
>   
>   	kfree(dma_conf);
>   
> +	/* We may have called phylink_speed_down before */
> +	phylink_speed_up(priv->phylink);
> +
>   	return ret;
>   
>   err_disconnect_phy:
> @@ -4032,13 +4033,6 @@ static void __stmmac_release(struct net_device *dev)
>   	struct stmmac_priv *priv = netdev_priv(dev);
>   	u32 chan;
>   
> -	/* If the PHY or MAC has WoL enabled, then the PHY will not be
> -	 * suspended when phylink_stop() is called below. Set the PHY
> -	 * to its slowest speed to save power.
> -	 */
> -	if (device_may_wakeup(priv->device))
> -		phylink_speed_down(priv->phylink, false);
> -
>   	/* Stop and disconnect the PHY */
>   	phylink_stop(priv->phylink);
>   
> @@ -4078,6 +4072,13 @@ static int stmmac_release(struct net_device *dev)
>   {
>   	struct stmmac_priv *priv = netdev_priv(dev);
>   
> +	/* If the PHY or MAC has WoL enabled, then the PHY will not be
> +	 * suspended when phylink_stop() is called below. Set the PHY
> +	 * to its slowest speed to save power.
> +	 */
> +	if (device_may_wakeup(priv->device))
> +		phylink_speed_down(priv->phylink, false);
> +
>   	__stmmac_release(dev);
>   
>   	phylink_disconnect_phy(priv->phylink);


  parent reply	other threads:[~2025-10-16  7:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15 16:09 [PATCH net-next 0/5] net: stmmac: more cleanups Russell King (Oracle)
2025-10-15 16:10 ` [PATCH net-next 1/5] net: stmmac: dwc-qos-eth: move MDIO bus locking into stmmac_mdio Russell King (Oracle)
2025-10-16  7:03   ` Maxime Chevallier
2025-10-16 20:13   ` Andrew Lunn
2025-10-15 16:10 ` [PATCH net-next 2/5] net: stmmac: place .mac_finish() method more appropriately Russell King (Oracle)
2025-10-16  7:06   ` Maxime Chevallier
2025-10-16 20:15   ` Andrew Lunn
2025-10-15 16:10 ` [PATCH net-next 3/5] net: stmmac: avoid PHY speed change when configuring MTU Russell King (Oracle)
2025-10-16  7:22   ` Maxime Chevallier
2025-10-16  7:44   ` Gatien CHEVALLIER [this message]
2025-10-16 20:16   ` Andrew Lunn
2025-10-15 16:10 ` [PATCH net-next 4/5] net: stmmac: rearrange tc_init() Russell King (Oracle)
2025-10-16  7:25   ` Maxime Chevallier
2025-10-15 16:11 ` [PATCH net-next 5/5] net: stmmac: rename stmmac_phy_setup() to include phylink Russell King (Oracle)
2025-10-16  7:26   ` Maxime Chevallier
2025-10-16  7:37   ` [Linux-stm32] " Gatien CHEVALLIER
2025-10-16 20:23   ` Andrew Lunn
2025-10-16 23:10 ` [PATCH net-next 0/5] net: stmmac: more cleanups patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f9c7b80b-b750-4eaa-b528-7028e8d8295a@foss.st.com \
    --to=gatien.chevallier@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).