* [PATCH net-next 1/5] net: stmmac: dwc-qos-eth: move MDIO bus locking into stmmac_mdio
2025-10-15 16:09 [PATCH net-next 0/5] net: stmmac: more cleanups Russell King (Oracle)
@ 2025-10-15 16:10 ` 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)
` (4 subsequent siblings)
5 siblings, 2 replies; 18+ messages in thread
From: Russell King (Oracle) @ 2025-10-15 16:10 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
Rather than dwc-qos-eth manipulating the MDIO bus lock directly, add
helpers to the stmmac MDIO layer and use them in dwc-qos-eth. This
improves my commit 87f43e6f06a2 ("net: stmmac: dwc-qos: calibrate tegra
with mdio bus idle").
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 4 ++--
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 ++
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 14 ++++++++++++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index e8539cad4602..f1c2e35badf7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -162,7 +162,7 @@ static void tegra_eqos_fix_speed(void *bsp_priv, int speed, unsigned int mode)
priv = netdev_priv(dev_get_drvdata(eqos->dev));
/* Calibration should be done with the MDIO bus idle */
- mutex_lock(&priv->mii->mdio_lock);
+ stmmac_mdio_lock(priv);
/* calibrate */
value = readl(eqos->regs + SDMEMCOMPPADCTRL);
@@ -198,7 +198,7 @@ static void tegra_eqos_fix_speed(void *bsp_priv, int speed, unsigned int mode)
value &= ~SDMEMCOMPPADCTRL_PAD_E_INPUT_OR_E_PWRD;
writel(value, eqos->regs + SDMEMCOMPPADCTRL);
- mutex_unlock(&priv->mii->mdio_lock);
+ stmmac_mdio_unlock(priv);
} else {
value = readl(eqos->regs + AUTO_CAL_CONFIG);
value &= ~AUTO_CAL_CONFIG_ENABLE;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 7ca5477be390..ec8bddc1c37f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -388,6 +388,8 @@ static inline bool stmmac_wol_enabled_phy(struct stmmac_priv *priv)
int stmmac_mdio_unregister(struct net_device *ndev);
int stmmac_mdio_register(struct net_device *ndev);
int stmmac_mdio_reset(struct mii_bus *mii);
+void stmmac_mdio_lock(struct stmmac_priv *priv);
+void stmmac_mdio_unlock(struct stmmac_priv *priv);
int stmmac_pcs_setup(struct net_device *ndev);
void stmmac_pcs_clean(struct net_device *ndev);
void stmmac_set_ethtool_ops(struct net_device *netdev);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index f408737f6fc7..d62b2870899d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -734,3 +734,17 @@ int stmmac_mdio_unregister(struct net_device *ndev)
return 0;
}
+
+void stmmac_mdio_lock(struct stmmac_priv *priv)
+{
+ if (priv->mii)
+ mutex_lock(&priv->mii->mdio_lock);
+}
+EXPORT_SYMBOL_GPL(stmmac_mdio_lock);
+
+void stmmac_mdio_unlock(struct stmmac_priv *priv)
+{
+ if (priv->mii)
+ mutex_unlock(&priv->mii->mdio_lock);
+}
+EXPORT_SYMBOL_GPL(stmmac_mdio_unlock);
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net-next 1/5] net: stmmac: dwc-qos-eth: move MDIO bus locking into stmmac_mdio
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
1 sibling, 0 replies; 18+ messages in thread
From: Maxime Chevallier @ 2025-10-16 7:03 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
> Rather than dwc-qos-eth manipulating the MDIO bus lock directly, add
> helpers to the stmmac MDIO layer and use them in dwc-qos-eth. This
> improves my commit 87f43e6f06a2 ("net: stmmac: dwc-qos: calibrate tegra
> with mdio bus idle").
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH net-next 1/5] net: stmmac: dwc-qos-eth: move MDIO bus locking into stmmac_mdio
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
1 sibling, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2025-10-16 20:13 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Heiner Kallweit, Alexandre Torgue, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, linux-arm-kernel, linux-stm32,
Maxime Coquelin, netdev, Paolo Abeni
On Wed, Oct 15, 2025 at 05:10:41PM +0100, Russell King (Oracle) wrote:
> Rather than dwc-qos-eth manipulating the MDIO bus lock directly, add
> helpers to the stmmac MDIO layer and use them in dwc-qos-eth. This
> improves my commit 87f43e6f06a2 ("net: stmmac: dwc-qos: calibrate tegra
> with mdio bus idle").
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net-next 2/5] net: stmmac: place .mac_finish() method more appropriately
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-15 16:10 ` 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)
` (3 subsequent siblings)
5 siblings, 2 replies; 18+ messages in thread
From: Russell King (Oracle) @ 2025-10-15 16:10 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
Place the .mac_finish() initialiser and implementation after the
.mac_config() initialiser and method which reflects the order that
they appear in struct phylink_mac_ops, and the order in which they
are called. This keeps logically similar code together.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 26 +++++++++----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 650d75b73e0b..3728afa701c6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -859,6 +859,18 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
/* Nothing to do, xpcs_config() handles everything */
}
+static int stmmac_mac_finish(struct phylink_config *config, unsigned int mode,
+ phy_interface_t interface)
+{
+ struct net_device *ndev = to_net_dev(config->dev);
+ struct stmmac_priv *priv = netdev_priv(ndev);
+
+ if (priv->plat->mac_finish)
+ priv->plat->mac_finish(ndev, priv->plat->bsp_priv, mode, interface);
+
+ return 0;
+}
+
static void stmmac_mac_link_down(struct phylink_config *config,
unsigned int mode, phy_interface_t interface)
{
@@ -1053,27 +1065,15 @@ static int stmmac_mac_enable_tx_lpi(struct phylink_config *config, u32 timer,
return 0;
}
-static int stmmac_mac_finish(struct phylink_config *config, unsigned int mode,
- phy_interface_t interface)
-{
- struct net_device *ndev = to_net_dev(config->dev);
- struct stmmac_priv *priv = netdev_priv(ndev);
-
- if (priv->plat->mac_finish)
- priv->plat->mac_finish(ndev, priv->plat->bsp_priv, mode, interface);
-
- return 0;
-}
-
static const struct phylink_mac_ops stmmac_phylink_mac_ops = {
.mac_get_caps = stmmac_mac_get_caps,
.mac_select_pcs = stmmac_mac_select_pcs,
.mac_config = stmmac_mac_config,
+ .mac_finish = stmmac_mac_finish,
.mac_link_down = stmmac_mac_link_down,
.mac_link_up = stmmac_mac_link_up,
.mac_disable_tx_lpi = stmmac_mac_disable_tx_lpi,
.mac_enable_tx_lpi = stmmac_mac_enable_tx_lpi,
- .mac_finish = stmmac_mac_finish,
};
/**
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net-next 2/5] net: stmmac: place .mac_finish() method more appropriately
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
1 sibling, 0 replies; 18+ messages in thread
From: Maxime Chevallier @ 2025-10-16 7:06 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
On 15/10/2025 18:10, Russell King (Oracle) wrote:
> Place the .mac_finish() initialiser and implementation after the
> .mac_config() initialiser and method which reflects the order that
> they appear in struct phylink_mac_ops, and the order in which they
> are called. This keeps logically similar code together.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 26 +++++++++----------
> 1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 650d75b73e0b..3728afa701c6 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -859,6 +859,18 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
> /* Nothing to do, xpcs_config() handles everything */
> }
>
> +static int stmmac_mac_finish(struct phylink_config *config, unsigned int mode,
> + phy_interface_t interface)
> +{
> + struct net_device *ndev = to_net_dev(config->dev);
> + struct stmmac_priv *priv = netdev_priv(ndev);
> +
> + if (priv->plat->mac_finish)
> + priv->plat->mac_finish(ndev, priv->plat->bsp_priv, mode, interface);
> +
> + return 0;
> +}
> +
> static void stmmac_mac_link_down(struct phylink_config *config,
> unsigned int mode, phy_interface_t interface)
> {
> @@ -1053,27 +1065,15 @@ static int stmmac_mac_enable_tx_lpi(struct phylink_config *config, u32 timer,
> return 0;
> }
>
> -static int stmmac_mac_finish(struct phylink_config *config, unsigned int mode,
> - phy_interface_t interface)
> -{
> - struct net_device *ndev = to_net_dev(config->dev);
> - struct stmmac_priv *priv = netdev_priv(ndev);
> -
> - if (priv->plat->mac_finish)
> - priv->plat->mac_finish(ndev, priv->plat->bsp_priv, mode, interface);
> -
> - return 0;
> -}
> -
> static const struct phylink_mac_ops stmmac_phylink_mac_ops = {
> .mac_get_caps = stmmac_mac_get_caps,
> .mac_select_pcs = stmmac_mac_select_pcs,
> .mac_config = stmmac_mac_config,
> + .mac_finish = stmmac_mac_finish,
> .mac_link_down = stmmac_mac_link_down,
> .mac_link_up = stmmac_mac_link_up,
> .mac_disable_tx_lpi = stmmac_mac_disable_tx_lpi,
> .mac_enable_tx_lpi = stmmac_mac_enable_tx_lpi,
> - .mac_finish = stmmac_mac_finish,
> };
>
> /**
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH net-next 2/5] net: stmmac: place .mac_finish() method more appropriately
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
1 sibling, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2025-10-16 20:15 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Heiner Kallweit, Alexandre Torgue, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, linux-arm-kernel, linux-stm32,
Maxime Coquelin, netdev, Paolo Abeni
On Wed, Oct 15, 2025 at 05:10:46PM +0100, Russell King (Oracle) wrote:
> Place the .mac_finish() initialiser and implementation after the
> .mac_config() initialiser and method which reflects the order that
> they appear in struct phylink_mac_ops, and the order in which they
> are called. This keeps logically similar code together.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net-next 3/5] net: stmmac: avoid PHY speed change when configuring MTU
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-15 16:10 ` [PATCH net-next 2/5] net: stmmac: place .mac_finish() method more appropriately Russell King (Oracle)
@ 2025-10-15 16:10 ` Russell King (Oracle)
2025-10-16 7:22 ` Maxime Chevallier
` (2 more replies)
2025-10-15 16:10 ` [PATCH net-next 4/5] net: stmmac: rearrange tc_init() Russell King (Oracle)
` (2 subsequent siblings)
5 siblings, 3 replies; 18+ messages in thread
From: Russell King (Oracle) @ 2025-10-15 16:10 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
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>
---
.../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);
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net-next 3/5] net: stmmac: avoid PHY speed change when configuring MTU
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 ` [Linux-stm32] " Gatien CHEVALLIER
2025-10-16 20:16 ` Andrew Lunn
2 siblings, 0 replies; 18+ messages in thread
From: Maxime Chevallier @ 2025-10-16 7:22 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
On 15/10/2025 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: Maxime Chevallier <maxime.chevallier@bootlin.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);
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Linux-stm32] [PATCH net-next 3/5] net: stmmac: avoid PHY speed change when configuring MTU
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
2025-10-16 20:16 ` Andrew Lunn
2 siblings, 0 replies; 18+ messages in thread
From: Gatien CHEVALLIER @ 2025-10-16 7:44 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
Cc: netdev, linux-stm32, Andrew Lunn, Eric Dumazet, Maxime Coquelin,
Jakub Kicinski, Paolo Abeni, David S. Miller, linux-arm-kernel
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);
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH net-next 3/5] net: stmmac: avoid PHY speed change when configuring MTU
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 ` [Linux-stm32] " Gatien CHEVALLIER
@ 2025-10-16 20:16 ` Andrew Lunn
2 siblings, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2025-10-16 20:16 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Heiner Kallweit, Alexandre Torgue, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, linux-arm-kernel, linux-stm32,
Maxime Coquelin, netdev, Paolo Abeni
On Wed, Oct 15, 2025 at 05:10:51PM +0100, 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: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net-next 4/5] net: stmmac: rearrange tc_init()
2025-10-15 16:09 [PATCH net-next 0/5] net: stmmac: more cleanups Russell King (Oracle)
` (2 preceding siblings ...)
2025-10-15 16:10 ` [PATCH net-next 3/5] net: stmmac: avoid PHY speed change when configuring MTU Russell King (Oracle)
@ 2025-10-15 16:10 ` 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 23:10 ` [PATCH net-next 0/5] net: stmmac: more cleanups patchwork-bot+netdevbpf
5 siblings, 1 reply; 18+ messages in thread
From: Russell King (Oracle) @ 2025-10-15 16:10 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
To make future changes easier, rearrange the use of dma_cap->l3l4fnum
vs priv->flow_entries_max.
Always initialise priv->flow_entries_max from dma_cap->l3l4fnum, then
use priv->flow_entries_max to determine whether we allocate
priv->flow_entries and set it up.
This change is safe because tc_init() is only called once from
stmmac_dvr_probe().
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 97e89a604abd..ef65cf511f3e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -262,10 +262,10 @@ static int tc_init(struct stmmac_priv *priv)
unsigned int count;
int ret, i;
- if (dma_cap->l3l4fnum) {
- priv->flow_entries_max = dma_cap->l3l4fnum;
+ priv->flow_entries_max = dma_cap->l3l4fnum;
+ if (priv->flow_entries_max) {
priv->flow_entries = devm_kcalloc(priv->device,
- dma_cap->l3l4fnum,
+ priv->flow_entries_max,
sizeof(*priv->flow_entries),
GFP_KERNEL);
if (!priv->flow_entries)
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net-next 4/5] net: stmmac: rearrange tc_init()
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
0 siblings, 0 replies; 18+ messages in thread
From: Maxime Chevallier @ 2025-10-16 7:25 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
On 15/10/2025 18:10, Russell King (Oracle) wrote:
> To make future changes easier, rearrange the use of dma_cap->l3l4fnum
> vs priv->flow_entries_max.
>
> Always initialise priv->flow_entries_max from dma_cap->l3l4fnum, then
> use priv->flow_entries_max to determine whether we allocate
> priv->flow_entries and set it up.
>
> This change is safe because tc_init() is only called once from
> stmmac_dvr_probe().
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> index 97e89a604abd..ef65cf511f3e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> @@ -262,10 +262,10 @@ static int tc_init(struct stmmac_priv *priv)
> unsigned int count;
> int ret, i;
>
> - if (dma_cap->l3l4fnum) {
> - priv->flow_entries_max = dma_cap->l3l4fnum;
> + priv->flow_entries_max = dma_cap->l3l4fnum;
> + if (priv->flow_entries_max) {
> priv->flow_entries = devm_kcalloc(priv->device,
> - dma_cap->l3l4fnum,
> + priv->flow_entries_max,
> sizeof(*priv->flow_entries),
> GFP_KERNEL);
> if (!priv->flow_entries)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net-next 5/5] net: stmmac: rename stmmac_phy_setup() to include phylink
2025-10-15 16:09 [PATCH net-next 0/5] net: stmmac: more cleanups Russell King (Oracle)
` (3 preceding siblings ...)
2025-10-15 16:10 ` [PATCH net-next 4/5] net: stmmac: rearrange tc_init() Russell King (Oracle)
@ 2025-10-15 16:11 ` Russell King (Oracle)
2025-10-16 7:26 ` Maxime Chevallier
` (2 more replies)
2025-10-16 23:10 ` [PATCH net-next 0/5] net: stmmac: more cleanups patchwork-bot+netdevbpf
5 siblings, 3 replies; 18+ messages in thread
From: Russell King (Oracle) @ 2025-10-15 16:11 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
stmmac_phy_setup() does not set up any PHY, but does setup phylink.
Rename this function to stmmac_phylink_setup() to reflect more what
it is doing.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 500cfd19e6b5..c9fa965c8566 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1185,7 +1185,7 @@ static int stmmac_init_phy(struct net_device *dev)
return 0;
}
-static int stmmac_phy_setup(struct stmmac_priv *priv)
+static int stmmac_phylink_setup(struct stmmac_priv *priv)
{
struct stmmac_mdio_bus_data *mdio_bus_data;
struct phylink_config *config;
@@ -7642,7 +7642,7 @@ int stmmac_dvr_probe(struct device *device,
if (ret)
goto error_pcs_setup;
- ret = stmmac_phy_setup(priv);
+ ret = stmmac_phylink_setup(priv);
if (ret) {
netdev_err(ndev, "failed to setup phy (%d)\n", ret);
goto error_phy_setup;
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net-next 5/5] net: stmmac: rename stmmac_phy_setup() to include phylink
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
2 siblings, 0 replies; 18+ messages in thread
From: Maxime Chevallier @ 2025-10-16 7:26 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
On 15/10/2025 18:11, Russell King (Oracle) wrote:
> stmmac_phy_setup() does not set up any PHY, but does setup phylink.
> Rename this function to stmmac_phylink_setup() to reflect more what
> it is doing.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 500cfd19e6b5..c9fa965c8566 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1185,7 +1185,7 @@ static int stmmac_init_phy(struct net_device *dev)
> return 0;
> }
>
> -static int stmmac_phy_setup(struct stmmac_priv *priv)
> +static int stmmac_phylink_setup(struct stmmac_priv *priv)
> {
> struct stmmac_mdio_bus_data *mdio_bus_data;
> struct phylink_config *config;
> @@ -7642,7 +7642,7 @@ int stmmac_dvr_probe(struct device *device,
> if (ret)
> goto error_pcs_setup;
>
> - ret = stmmac_phy_setup(priv);
> + ret = stmmac_phylink_setup(priv);
> if (ret) {
> netdev_err(ndev, "failed to setup phy (%d)\n", ret);
> goto error_phy_setup;
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Linux-stm32] [PATCH net-next 5/5] net: stmmac: rename stmmac_phy_setup() to include phylink
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 ` Gatien CHEVALLIER
2025-10-16 20:23 ` Andrew Lunn
2 siblings, 0 replies; 18+ messages in thread
From: Gatien CHEVALLIER @ 2025-10-16 7:37 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
Cc: netdev, linux-stm32, Andrew Lunn, Eric Dumazet, Maxime Coquelin,
Jakub Kicinski, Paolo Abeni, David S. Miller, linux-arm-kernel
On 10/15/25 18:11, Russell King (Oracle) wrote:
> stmmac_phy_setup() does not set up any PHY, but does setup phylink.
> Rename this function to stmmac_phylink_setup() to reflect more what
> it is doing.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 500cfd19e6b5..c9fa965c8566 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1185,7 +1185,7 @@ static int stmmac_init_phy(struct net_device *dev)
> return 0;
> }
>
> -static int stmmac_phy_setup(struct stmmac_priv *priv)
> +static int stmmac_phylink_setup(struct stmmac_priv *priv)
> {
> struct stmmac_mdio_bus_data *mdio_bus_data;
> struct phylink_config *config;
> @@ -7642,7 +7642,7 @@ int stmmac_dvr_probe(struct device *device,
> if (ret)
> goto error_pcs_setup;
>
> - ret = stmmac_phy_setup(priv);
> + ret = stmmac_phylink_setup(priv);
> if (ret) {
> netdev_err(ndev, "failed to setup phy (%d)\n", ret);
> goto error_phy_setup;
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH net-next 5/5] net: stmmac: rename stmmac_phy_setup() to include phylink
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
2 siblings, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2025-10-16 20:23 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Heiner Kallweit, Alexandre Torgue, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, linux-arm-kernel, linux-stm32,
Maxime Coquelin, netdev, Paolo Abeni
On Wed, Oct 15, 2025 at 05:11:01PM +0100, Russell King (Oracle) wrote:
> stmmac_phy_setup() does not set up any PHY, but does setup phylink.
> Rename this function to stmmac_phylink_setup() to reflect more what
> it is doing.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net-next 0/5] net: stmmac: more cleanups
2025-10-15 16:09 [PATCH net-next 0/5] net: stmmac: more cleanups Russell King (Oracle)
` (4 preceding siblings ...)
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 23:10 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 18+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-16 23:10 UTC (permalink / raw)
To: Russell King
Cc: andrew, hkallweit1, alexandre.torgue, andrew+netdev, davem,
edumazet, kuba, linux-arm-kernel, linux-stm32, mcoquelin.stm32,
netdev, pabeni
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 15 Oct 2025 17:09:07 +0100 you wrote:
> The subject for the cover message is wearing thin as I've used it a
> number of times, but the scope for cleaning up the driver continues,
> and continue it will do, because this is just a small fraction of the
> queue.
>
> 1. make a better job of one of my previous commits, moving the holding
> of the lock into stmmac_mdio.c
>
> [...]
Here is the summary with links:
- [net-next,1/5] net: stmmac: dwc-qos-eth: move MDIO bus locking into stmmac_mdio
https://git.kernel.org/netdev/net-next/c/12a7b7bc1427
- [net-next,2/5] net: stmmac: place .mac_finish() method more appropriately
https://git.kernel.org/netdev/net-next/c/0bc832a54d27
- [net-next,3/5] net: stmmac: avoid PHY speed change when configuring MTU
https://git.kernel.org/netdev/net-next/c/e82c64be9b45
- [net-next,4/5] net: stmmac: rearrange tc_init()
https://git.kernel.org/netdev/net-next/c/07d91ec99a8a
- [net-next,5/5] net: stmmac: rename stmmac_phy_setup() to include phylink
https://git.kernel.org/netdev/net-next/c/4a4094ba7ad2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 18+ messages in thread