* [PATCH net-next 1/7] net: stmmac: remove unnecessary checks in ethtool eee ops
2025-08-15 11:32 [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups Russell King (Oracle)
@ 2025-08-15 11:31 ` Russell King (Oracle)
2025-08-15 11:31 ` [PATCH net-next 2/7] net: stmmac: remove write-only mac->pmt Russell King (Oracle)
` (6 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Russell King (Oracle) @ 2025-08-15 11:31 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
Phylink will check whether the MAC supports the LPI methods in
struct phylink_mac_ops, and return -EOPNOTSUPP if the LPI capabilities
are not provided. stmmac doesn't provide LPI capabilities if
priv->dma_cap.eee is not set.
Therefore, checking the state of priv->dma_cap.eee in the ethtool ops
and returning -EOPNOTSUPP is redundant - let phylink handle this.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 77758a7299b4..dda7ba1f524d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -852,9 +852,6 @@ static int stmmac_ethtool_op_get_eee(struct net_device *dev,
{
struct stmmac_priv *priv = netdev_priv(dev);
- if (!priv->dma_cap.eee)
- return -EOPNOTSUPP;
-
return phylink_ethtool_get_eee(priv->phylink, edata);
}
@@ -863,9 +860,6 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev,
{
struct stmmac_priv *priv = netdev_priv(dev);
- if (!priv->dma_cap.eee)
- return -EOPNOTSUPP;
-
return phylink_ethtool_set_eee(priv->phylink, edata);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 2/7] net: stmmac: remove write-only mac->pmt
2025-08-15 11:32 [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups Russell King (Oracle)
2025-08-15 11:31 ` [PATCH net-next 1/7] net: stmmac: remove unnecessary checks in ethtool eee ops Russell King (Oracle)
@ 2025-08-15 11:31 ` Russell King (Oracle)
2025-08-15 11:32 ` [PATCH net-next 3/7] net: stmmac: remove redundant WoL option validation Russell King (Oracle)
` (5 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Russell King (Oracle) @ 2025-08-15 11:31 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
mac_device_info->pmt is only ever written, nothing reads it. Remove
this struct member.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/common.h | 1 -
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index cbffccb3b9af..eaa1f2e1c5a5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -602,7 +602,6 @@ struct mac_device_info {
unsigned int mcast_bits_log2;
unsigned int rx_csum;
unsigned int pcs;
- unsigned int pmt;
unsigned int ps;
unsigned int xlgmac;
unsigned int num_vlan;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4a82045ea6eb..c24b890e1089 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7240,7 +7240,6 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
priv->plat->enh_desc = priv->dma_cap.enh_desc;
priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up &&
!(priv->plat->flags & STMMAC_FLAG_USE_PHY_WOL);
- priv->hw->pmt = priv->plat->pmt;
if (priv->dma_cap.hash_tb_sz) {
priv->hw->multicast_filter_bins =
(BIT(priv->dma_cap.hash_tb_sz) << 5);
--
2.30.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 3/7] net: stmmac: remove redundant WoL option validation
2025-08-15 11:32 [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups Russell King (Oracle)
2025-08-15 11:31 ` [PATCH net-next 1/7] net: stmmac: remove unnecessary checks in ethtool eee ops Russell King (Oracle)
2025-08-15 11:31 ` [PATCH net-next 2/7] net: stmmac: remove write-only mac->pmt Russell King (Oracle)
@ 2025-08-15 11:32 ` Russell King (Oracle)
2025-08-15 11:32 ` [PATCH net-next 4/7] net: stmmac: remove unnecessary "stmmac: wakeup enable" print Russell King (Oracle)
` (4 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Russell King (Oracle) @ 2025-08-15 11:32 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
The core ethtool API validates the WoL options passed from userspace
against the support which the driver reports from its get_wol() method,
returning EINVAL if an unsupported mode is requested.
Therefore, there is no need for stmmac to implement its own validation.
Remove this unnecessary code.
See ethnl_set_wol() in net/ethtool/wol.c and ethtool_set_wol() in
net/ethtool/ioctl.c.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index dda7ba1f524d..cd2fb92ac84c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -803,7 +803,6 @@ static void stmmac_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
struct stmmac_priv *priv = netdev_priv(dev);
- u32 support = WAKE_MAGIC | WAKE_UCAST;
if (!device_can_wakeup(priv->device))
return -EOPNOTSUPP;
@@ -816,15 +815,6 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
return ret;
}
- /* By default almost all GMAC devices support the WoL via
- * magic frame but we can disable it if the HW capability
- * register shows no support for pmt_magic_frame. */
- if ((priv->hw_cap_support) && (!priv->dma_cap.pmt_magic_frame))
- wol->wolopts &= ~WAKE_MAGIC;
-
- if (wol->wolopts & ~support)
- return -EINVAL;
-
if (wol->wolopts) {
pr_info("stmmac: wakeup enable\n");
device_set_wakeup_enable(priv->device, 1);
--
2.30.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 4/7] net: stmmac: remove unnecessary "stmmac: wakeup enable" print
2025-08-15 11:32 [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups Russell King (Oracle)
` (2 preceding siblings ...)
2025-08-15 11:32 ` [PATCH net-next 3/7] net: stmmac: remove redundant WoL option validation Russell King (Oracle)
@ 2025-08-15 11:32 ` Russell King (Oracle)
2025-08-15 11:32 ` [PATCH net-next 5/7] net: stmmac: use core wake IRQ support Russell King (Oracle)
` (3 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Russell King (Oracle) @ 2025-08-15 11:32 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
Printing "stmmac: wakeup enable" to the kernel log isn't useful - it
doesn't identify the adapter, and is effectively nothing more than a
debugging print. This information can be discovered by looking at
/sys/device.../power/wakeup as the device_set_wakeup_enable() call
updates this sysfs file.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index cd2fb92ac84c..58542b72cc01 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -816,7 +816,6 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
}
if (wol->wolopts) {
- pr_info("stmmac: wakeup enable\n");
device_set_wakeup_enable(priv->device, 1);
/* Avoid unbalanced enable_irq_wake calls */
if (priv->wol_irq_disabled)
--
2.30.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 5/7] net: stmmac: use core wake IRQ support
2025-08-15 11:32 [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups Russell King (Oracle)
` (3 preceding siblings ...)
2025-08-15 11:32 ` [PATCH net-next 4/7] net: stmmac: remove unnecessary "stmmac: wakeup enable" print Russell King (Oracle)
@ 2025-08-15 11:32 ` Russell King (Oracle)
2025-08-17 16:03 ` Andrew Lunn
2025-08-15 11:32 ` [PATCH net-next 6/7] net: stmmac: add helpers to indicate WoL enable status Russell King (Oracle)
` (2 subsequent siblings)
7 siblings, 1 reply; 12+ messages in thread
From: Russell King (Oracle) @ 2025-08-15 11:32 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
The PM core provides management of wake IRQs along side setting the
device wake enable state. In order to use this, we need to register
the interrupt used to wakeup the system using devm_pm_set_wake_irq()
or dev_pm_set_wake_irq(). The core will then enable or disable IRQ
wake state on this interrupt as appropriate, depending on the
device_set_wakeup_enable() state. device_set_wakeup_enable() does not
care about having balanced enable/disable calls.
Make use of this functionality, rather than explicitly managing the
IRQ enable state in the set_wol() ethtool op. This removes the IRQ
wake state management from stmmac.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 -
.../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 14 +-------------
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
3 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index bf95f03dd33f..b16b8aeeb583 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -289,7 +289,6 @@ struct stmmac_priv {
u32 msg_enable;
int wolopts;
int wol_irq;
- bool wol_irq_disabled;
int clk_csr;
struct timer_list eee_ctrl_timer;
int lpi_irq;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 58542b72cc01..39fa1ec92f82 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -815,19 +815,7 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
return ret;
}
- if (wol->wolopts) {
- device_set_wakeup_enable(priv->device, 1);
- /* Avoid unbalanced enable_irq_wake calls */
- if (priv->wol_irq_disabled)
- enable_irq_wake(priv->wol_irq);
- priv->wol_irq_disabled = false;
- } else {
- device_set_wakeup_enable(priv->device, 0);
- /* Avoid unbalanced disable_irq_wake calls */
- if (!priv->wol_irq_disabled)
- disable_irq_wake(priv->wol_irq);
- priv->wol_irq_disabled = true;
- }
+ device_set_wakeup_enable(priv->device, !!wol->wolopts);
mutex_lock(&priv->lock);
priv->wolopts = wol->wolopts;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c24b890e1089..e715e9f2fe22 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -29,6 +29,7 @@
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/pm_runtime.h>
+#include <linux/pm_wakeirq.h>
#include <linux/prefetch.h>
#include <linux/pinctrl/consumer.h>
#ifdef CONFIG_DEBUG_FS
@@ -3724,7 +3725,6 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev)
/* Request the Wake IRQ in case of another line
* is used for WoL
*/
- priv->wol_irq_disabled = true;
if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) {
int_name = priv->int_name_wol;
sprintf(int_name, "%s:%s", dev->name, "wol");
@@ -3885,7 +3885,6 @@ static int stmmac_request_irq_single(struct net_device *dev)
/* Request the Wake IRQ in case of another line
* is used for WoL
*/
- priv->wol_irq_disabled = true;
if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) {
ret = request_irq(priv->wol_irq, stmmac_interrupt,
IRQF_SHARED, dev->name, dev);
@@ -7277,6 +7276,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
if (priv->plat->pmt) {
dev_info(priv->device, "Wake-Up On Lan supported\n");
device_set_wakeup_capable(priv->device, 1);
+ devm_pm_set_wake_irq(priv->device, priv->wol_irq);
}
if (priv->dma_cap.tsoen)
--
2.30.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups
@ 2025-08-15 11:32 Russell King (Oracle)
2025-08-15 11:31 ` [PATCH net-next 1/7] net: stmmac: remove unnecessary checks in ethtool eee ops Russell King (Oracle)
` (7 more replies)
0 siblings, 8 replies; 12+ messages in thread
From: Russell King (Oracle) @ 2025-08-15 11:32 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
Hi,
This series contains a series of cleanup patches for the EEE and WoL
code in stmmac, prompted by issues raised during the last three weeks.
Andrew's r-b's added from the RFC posting.
drivers/net/ethernet/stmicro/stmmac/common.h | 1 -
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 11 +++++++-
.../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 31 +---------------------
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++++++-------
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 4 +--
5 files changed, 25 insertions(+), 43 deletions(-)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net-next 6/7] net: stmmac: add helpers to indicate WoL enable status
2025-08-15 11:32 [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups Russell King (Oracle)
` (4 preceding siblings ...)
2025-08-15 11:32 ` [PATCH net-next 5/7] net: stmmac: use core wake IRQ support Russell King (Oracle)
@ 2025-08-15 11:32 ` Russell King (Oracle)
2025-08-17 16:04 ` Andrew Lunn
2025-08-15 11:32 ` [PATCH net-next 7/7] net: stmmac: explain the phylink_speed_down() call in stmmac_release() Russell King (Oracle)
2025-08-19 1:20 ` [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups patchwork-bot+netdevbpf
7 siblings, 1 reply; 12+ messages in thread
From: Russell King (Oracle) @ 2025-08-15 11:32 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
Add two helpers to abstract the WoL enable status at the PHY and MAC to
make the code easier to read.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 10 ++++++++++
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +++++------
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 4 ++--
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index b16b8aeeb583..78d6b3737a26 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -375,6 +375,16 @@ enum stmmac_state {
extern const struct dev_pm_ops stmmac_simple_pm_ops;
+static inline bool stmmac_wol_enabled_mac(struct stmmac_priv *priv)
+{
+ return priv->plat->pmt && device_may_wakeup(priv->device);
+}
+
+static inline bool stmmac_wol_enabled_phy(struct stmmac_priv *priv)
+{
+ return !priv->plat->pmt && device_may_wakeup(priv->device);
+}
+
int stmmac_mdio_unregister(struct net_device *ndev);
int stmmac_mdio_register(struct net_device *ndev);
int stmmac_mdio_reset(struct mii_bus *mii);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e715e9f2fe22..78113e2602ee 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7857,7 +7857,7 @@ int stmmac_suspend(struct device *dev)
priv->plat->serdes_powerdown(ndev, priv->plat->bsp_priv);
/* Enable Power down mode by programming the PMT regs */
- if (device_may_wakeup(priv->device) && priv->plat->pmt) {
+ if (stmmac_wol_enabled_mac(priv)) {
stmmac_pmt(priv, priv->hw, priv->wolopts);
priv->irq_wake = 1;
} else {
@@ -7868,11 +7868,10 @@ int stmmac_suspend(struct device *dev)
mutex_unlock(&priv->lock);
rtnl_lock();
- if (device_may_wakeup(priv->device) && !priv->plat->pmt)
+ if (stmmac_wol_enabled_phy(priv))
phylink_speed_down(priv->phylink, false);
- phylink_suspend(priv->phylink,
- device_may_wakeup(priv->device) && priv->plat->pmt);
+ phylink_suspend(priv->phylink, stmmac_wol_enabled_mac(priv));
rtnl_unlock();
if (stmmac_fpe_supported(priv))
@@ -7948,7 +7947,7 @@ int stmmac_resume(struct device *dev)
* this bit because it can generate problems while resuming
* from another devices (e.g. serial console).
*/
- if (device_may_wakeup(priv->device) && priv->plat->pmt) {
+ if (stmmac_wol_enabled_mac(priv)) {
mutex_lock(&priv->lock);
stmmac_pmt(priv, priv->hw, 0);
mutex_unlock(&priv->lock);
@@ -8001,7 +8000,7 @@ int stmmac_resume(struct device *dev)
* workqueue thread, which will race with initialisation.
*/
phylink_resume(priv->phylink);
- if (device_may_wakeup(priv->device) && !priv->plat->pmt)
+ if (stmmac_wol_enabled_phy(priv))
phylink_speed_up(priv->phylink);
rtnl_unlock();
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index c849676d98e8..a3e077f225d1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -934,7 +934,7 @@ static int __maybe_unused stmmac_pltfr_noirq_suspend(struct device *dev)
if (!netif_running(ndev))
return 0;
- if (!device_may_wakeup(priv->device) || !priv->plat->pmt) {
+ if (!stmmac_wol_enabled_mac(priv)) {
/* Disable clock in case of PWM is off */
clk_disable_unprepare(priv->plat->clk_ptp_ref);
@@ -955,7 +955,7 @@ static int __maybe_unused stmmac_pltfr_noirq_resume(struct device *dev)
if (!netif_running(ndev))
return 0;
- if (!device_may_wakeup(priv->device) || !priv->plat->pmt) {
+ if (!stmmac_wol_enabled_mac(priv)) {
/* enable the clk previously disabled */
ret = pm_runtime_force_resume(dev);
if (ret)
--
2.30.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 7/7] net: stmmac: explain the phylink_speed_down() call in stmmac_release()
2025-08-15 11:32 [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups Russell King (Oracle)
` (5 preceding siblings ...)
2025-08-15 11:32 ` [PATCH net-next 6/7] net: stmmac: add helpers to indicate WoL enable status Russell King (Oracle)
@ 2025-08-15 11:32 ` Russell King (Oracle)
2025-08-17 16:04 ` Andrew Lunn
2025-08-19 1:20 ` [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups patchwork-bot+netdevbpf
7 siblings, 1 reply; 12+ messages in thread
From: Russell King (Oracle) @ 2025-08-15 11:32 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
The call to phylink_speed_down() looks odd on the face of it. Add a
comment to explain why this call is there. phylink_speed_up() is
always called in __stmmac_open(), and already has a comment.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 78113e2602ee..b5f1fb8b2b30 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4138,8 +4138,13 @@ static int 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);
phylink_disconnect_phy(priv->phylink);
--
2.30.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 5/7] net: stmmac: use core wake IRQ support
2025-08-15 11:32 ` [PATCH net-next 5/7] net: stmmac: use core wake IRQ support Russell King (Oracle)
@ 2025-08-17 16:03 ` Andrew Lunn
0 siblings, 0 replies; 12+ messages in thread
From: Andrew Lunn @ 2025-08-17 16:03 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 Fri, Aug 15, 2025 at 12:32:10PM +0100, Russell King (Oracle) wrote:
> The PM core provides management of wake IRQs along side setting the
> device wake enable state. In order to use this, we need to register
> the interrupt used to wakeup the system using devm_pm_set_wake_irq()
> or dev_pm_set_wake_irq(). The core will then enable or disable IRQ
> wake state on this interrupt as appropriate, depending on the
> device_set_wakeup_enable() state. device_set_wakeup_enable() does not
> care about having balanced enable/disable calls.
>
> Make use of this functionality, rather than explicitly managing the
> IRQ enable state in the set_wol() ethtool op. This removes the IRQ
> wake state management from stmmac.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 6/7] net: stmmac: add helpers to indicate WoL enable status
2025-08-15 11:32 ` [PATCH net-next 6/7] net: stmmac: add helpers to indicate WoL enable status Russell King (Oracle)
@ 2025-08-17 16:04 ` Andrew Lunn
0 siblings, 0 replies; 12+ messages in thread
From: Andrew Lunn @ 2025-08-17 16:04 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 Fri, Aug 15, 2025 at 12:32:15PM +0100, Russell King (Oracle) wrote:
> Add two helpers to abstract the WoL enable status at the PHY and MAC to
> make the code easier to read.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 7/7] net: stmmac: explain the phylink_speed_down() call in stmmac_release()
2025-08-15 11:32 ` [PATCH net-next 7/7] net: stmmac: explain the phylink_speed_down() call in stmmac_release() Russell King (Oracle)
@ 2025-08-17 16:04 ` Andrew Lunn
0 siblings, 0 replies; 12+ messages in thread
From: Andrew Lunn @ 2025-08-17 16:04 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 Fri, Aug 15, 2025 at 12:32:21PM +0100, Russell King (Oracle) wrote:
> The call to phylink_speed_down() looks odd on the face of it. Add a
> comment to explain why this call is there. phylink_speed_up() is
> always called in __stmmac_open(), and already has a comment.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups
2025-08-15 11:32 [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups Russell King (Oracle)
` (6 preceding siblings ...)
2025-08-15 11:32 ` [PATCH net-next 7/7] net: stmmac: explain the phylink_speed_down() call in stmmac_release() Russell King (Oracle)
@ 2025-08-19 1:20 ` patchwork-bot+netdevbpf
7 siblings, 0 replies; 12+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-19 1:20 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 Fri, 15 Aug 2025 12:32:12 +0100 you wrote:
> Hi,
>
> This series contains a series of cleanup patches for the EEE and WoL
> code in stmmac, prompted by issues raised during the last three weeks.
>
> Andrew's r-b's added from the RFC posting.
>
> [...]
Here is the summary with links:
- [net-next,1/7] net: stmmac: remove unnecessary checks in ethtool eee ops
https://git.kernel.org/netdev/net-next/c/6d598e856d10
- [net-next,2/7] net: stmmac: remove write-only mac->pmt
https://git.kernel.org/netdev/net-next/c/49b97bc52aff
- [net-next,3/7] net: stmmac: remove redundant WoL option validation
https://git.kernel.org/netdev/net-next/c/b181306e5e68
- [net-next,4/7] net: stmmac: remove unnecessary "stmmac: wakeup enable" print
https://git.kernel.org/netdev/net-next/c/f17bd297bb83
- [net-next,5/7] net: stmmac: use core wake IRQ support
https://git.kernel.org/netdev/net-next/c/d09413dd2577
- [net-next,6/7] net: stmmac: add helpers to indicate WoL enable status
https://git.kernel.org/netdev/net-next/c/6a9a6ce96229
- [net-next,7/7] net: stmmac: explain the phylink_speed_down() call in stmmac_release()
https://git.kernel.org/netdev/net-next/c/5e5b39aa6f82
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] 12+ messages in thread
end of thread, other threads:[~2025-08-19 1:20 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-15 11:32 [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups Russell King (Oracle)
2025-08-15 11:31 ` [PATCH net-next 1/7] net: stmmac: remove unnecessary checks in ethtool eee ops Russell King (Oracle)
2025-08-15 11:31 ` [PATCH net-next 2/7] net: stmmac: remove write-only mac->pmt Russell King (Oracle)
2025-08-15 11:32 ` [PATCH net-next 3/7] net: stmmac: remove redundant WoL option validation Russell King (Oracle)
2025-08-15 11:32 ` [PATCH net-next 4/7] net: stmmac: remove unnecessary "stmmac: wakeup enable" print Russell King (Oracle)
2025-08-15 11:32 ` [PATCH net-next 5/7] net: stmmac: use core wake IRQ support Russell King (Oracle)
2025-08-17 16:03 ` Andrew Lunn
2025-08-15 11:32 ` [PATCH net-next 6/7] net: stmmac: add helpers to indicate WoL enable status Russell King (Oracle)
2025-08-17 16:04 ` Andrew Lunn
2025-08-15 11:32 ` [PATCH net-next 7/7] net: stmmac: explain the phylink_speed_down() call in stmmac_release() Russell King (Oracle)
2025-08-17 16:04 ` Andrew Lunn
2025-08-19 1:20 ` [PATCH net-next 0/7] net: stmmac: EEE and WoL cleanups patchwork-bot+netdevbpf
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).