stmmac_phylink_setup() allows the PHY to stop the RX clock in LPI whenever the platform does not need RXC in LPI and no VLAN features are advertised. The VLAN feature check was only a proxy for "the driver may program RXC-dependent registers from atomic context": stmmac_set_rx_mode() and the VLAN filter callbacks run with bottom halves disabled and cannot use phylink_rx_clk_stop_block(). That proxy is fragile because it changes with the advertised offload set, and it does not cover CONFIG_VLAN_8021Q=n. A filter update while the link is in LPI with RXC stopped can be lost, leaving the hardware filter out of sync with the software address lists. Since the driver cannot know whether a filter update will happen while RXC is stopped, keep RXC running and never let the PHY stop it during LPI. A platform that has verified its filter programming does not need RXC can restore the power saving in a follow-up with an explicit opt-in. STMMAC_FLAG_RX_CLK_RUNS_IN_LPI is now redundant, so remove it and its qcs404 setting; keeping RXC running everywhere supersedes it. Fixes: 4218647d4556 ("net: stmmac: convert to phylink managed EEE support") Signed-off-by: Lorenzo Bianconi --- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 -- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++----- include/linux/stmmac.h | 1 - 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index d24509a4b4d7..b5cc68fa4014 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -942,8 +942,6 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->pmt = true; if (of_property_read_bool(np, "snps,tso")) plat_dat->flags |= STMMAC_FLAG_TSO_EN; - if (of_device_is_compatible(np, "qcom,qcs404-ethqos")) - plat_dat->flags |= STMMAC_FLAG_RX_CLK_RUNS_IN_LPI; if (data->dma_addr_width) plat_dat->host_dma_width = data->dma_addr_width; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index d32d3e7b1b8c..4199e3c2d038 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1418,12 +1418,11 @@ static int stmmac_phylink_setup(struct stmmac_priv *priv) /* Stmmac always requires an RX clock for hardware initialization */ config->mac_requires_rxc = true; - /* Disable EEE RX clock stop to ensure VLAN register access works - * correctly. + /* stmmac_set_rx_mode() and the VLAN filter callbacks run in atomic + * context and cannot block the PHY RX clock stop, so keep RXC + * running even in LPI. A platform that has verified its filter + * programming does not need RXC can re-enable PHY clock stop later. */ - if (!(priv->plat->flags & STMMAC_FLAG_RX_CLK_RUNS_IN_LPI) && - !(priv->dev->features & NETIF_F_VLAN_FEATURES)) - config->eee_rx_clk_stop_enable = true; /* Set the default transmit clock stop bit based on the platform glue */ priv->tx_lpi_clk_stop = priv->plat->flags & diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 00be2df63d22..505337365d5a 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -205,7 +205,6 @@ enum dwmac_core_type { #define STMMAC_FLAG_EXT_SNAPSHOT_EN BIT(8) #define STMMAC_FLAG_INT_SNAPSHOT_EN BIT(9) #define STMMAC_FLAG_EEE_DISABLE BIT(10) -#define STMMAC_FLAG_RX_CLK_RUNS_IN_LPI BIT(11) #define STMMAC_FLAG_EN_TX_LPI_CLOCKGATING BIT(12) #define STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP BIT(13) #define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY BIT(14) --- base-commit: e9d78fc6741ac06d438cf64e314c28e57014432a change-id: 20261205-stmmac-keep-rxc-running-9380df0dacc6 Best regards, -- Lorenzo Bianconi