Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: stmmac: keep RXC running for atomic filter updates
@ 2026-12-05 17:31 Lorenzo Bianconi
  2026-12-05 17:36 ` netdev-bot+sinfo
  2026-12-05 21:11 ` Maxime Chevallier
  0 siblings, 2 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2026-12-05 17:31 UTC (permalink / raw)
  To: Mohd Ayaan Anwar, Maxime Chevallier, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Alexandre Torgue, Russell King, Russell King (Oracle),
	Jacob Keller
  Cc: netdev, linux-arm-msm, linux-arm-kernel, Lorenzo Bianconi

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 <lorenzo.bianconi@oss.qualcomm.com>
---
 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 <lorenzo.bianconi@oss.qualcomm.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: stmmac: keep RXC running for atomic filter updates
  2026-12-05 17:31 [PATCH net] net: stmmac: keep RXC running for atomic filter updates Lorenzo Bianconi
@ 2026-12-05 17:36 ` netdev-bot+sinfo
  2026-12-05 17:39   ` Lorenzo Bianconi
  2026-12-05 21:11 ` Maxime Chevallier
  1 sibling, 1 reply; 4+ messages in thread
From: netdev-bot+sinfo @ 2026-12-05 17:36 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Mohd Ayaan Anwar, Maxime Chevallier, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Alexandre Torgue, Russell King, Russell King (Oracle),
	Jacob Keller, netdev, linux-arm-msm, linux-arm-kernel

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by LLM and not proven at runtime). If it was triggered
   please include the symptoms, like the stack trace or kernel messages.

 - What hardware the change was tested on. For driver fixes please
   mention the device (and if relevant firmware version) used for
   testing, or say that the change was not tested on real hardware.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: stmmac: keep RXC running for atomic filter updates
  2026-12-05 17:36 ` netdev-bot+sinfo
@ 2026-12-05 17:39   ` Lorenzo Bianconi
  0 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2026-12-05 17:39 UTC (permalink / raw)
  To: netdev-bot+sinfo
  Cc: Mohd Ayaan Anwar, Maxime Chevallier, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Alexandre Torgue, Russell King, Russell King (Oracle),
	Jacob Keller, netdev, linux-arm-msm, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]

> Hi!
> 
> This is an automated message. This series looks like a fix, but its
> commit messages seem to be missing some information:
> 
>  - How the issue was discovered, e.g. hit in production, hit during
>    development, syzbot report, manual code inspection, LLM or static
>    analysis tool scan.

The issue has been reported by sashiko

> 
>  - Whether the issue was actually triggered, or is only theoretical
>    (e.g. found by LLM and not proven at runtime). If it was triggered
>    please include the symptoms, like the stack trace or kernel messages.

This is a real issue reported by sashiko

> 
>  - What hardware the change was tested on. For driver fixes please
>    mention the device (and if relevant firmware version) used for
>    testing, or say that the change was not tested on real hardware.

I tested the fix on a Qualcomm rb3-gen2 board

Regards,
Lorenzo

> 
> Please do not repost the series just to address the above. Instead,
> reply to this email with the missing information, so that reviewers
> can take it into account.
> 
> *IMPORTANT*: If you do repost (for other reasons) - please include
> the relevant info in the cover letter or commit messages.
> -- 
> The evaluation is done by an LLM so it may be wrong, if you think
> that is the case please reply and explain.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: stmmac: keep RXC running for atomic filter updates
  2026-12-05 17:31 [PATCH net] net: stmmac: keep RXC running for atomic filter updates Lorenzo Bianconi
  2026-12-05 17:36 ` netdev-bot+sinfo
@ 2026-12-05 21:11 ` Maxime Chevallier
  1 sibling, 0 replies; 4+ messages in thread
From: Maxime Chevallier @ 2026-12-05 21:11 UTC (permalink / raw)
  To: Lorenzo Bianconi, Mohd Ayaan Anwar, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Alexandre Torgue, Russell King, Russell King (Oracle),
	Jacob Keller
  Cc: netdev, linux-arm-msm, linux-arm-kernel

Hi,

On 12/5/26 18:31, Lorenzo Bianconi wrote:
> 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.

That would introduce some power consumption impacts though no ?

Besides that, we have an async version of the .set_rx_mode() NDO
now: ndo_set_rx_mode_async()

Maybe the right move is to switch to that ?

Maxime


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-12-05 21:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 17:31 [PATCH net] net: stmmac: keep RXC running for atomic filter updates Lorenzo Bianconi
2026-12-05 17:36 ` netdev-bot+sinfo
2026-12-05 17:39   ` Lorenzo Bianconi
2026-12-05 21:11 ` Maxime Chevallier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox