* [PATCH net 0/2] Further SJA1105 phylink link replay fixups
@ 2026-03-04 22:08 Vladimir Oltean
2026-03-04 22:08 ` [PATCH net 1/2] net: dsa: sja1105: reorder sja1105_reload_cbs() and phylink_replay_link_end() Vladimir Oltean
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Vladimir Oltean @ 2026-03-04 22:08 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Russell King
While I was playing around with the subsystem knowledge in Chris Mason's
review-prompts to see what LLMs would have needed to catch the bug
behind commit bfd264fbbbca ("net: dsa: sja1105: protect link replay
helpers against NULL phylink instance"), it flagged another issue
instead, which IMO is valid. This is being fixed in patch 2/2.
Patch 1/2 is preparatory reordering for that.
I haven't noticed any physical issues, it only has to do with the
soundness of the new call path introduced in January in commit
0b2edc531e0b ("net: dsa: sja1105: let phylink help with the replay of
link callbacks").
Vladimir Oltean (2):
net: dsa: sja1105: reorder sja1105_reload_cbs() and
phylink_replay_link_end()
net: dsa: sja1105: ensure phylink_replay_link_end() will not be missed
drivers/net/dsa/sja1105/sja1105_main.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/2] net: dsa: sja1105: reorder sja1105_reload_cbs() and phylink_replay_link_end()
2026-03-04 22:08 [PATCH net 0/2] Further SJA1105 phylink link replay fixups Vladimir Oltean
@ 2026-03-04 22:08 ` Vladimir Oltean
2026-03-04 22:09 ` [PATCH net 2/2] net: dsa: sja1105: ensure phylink_replay_link_end() will not be missed Vladimir Oltean
2026-03-07 2:00 ` [PATCH net 0/2] Further SJA1105 phylink link replay fixups patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2026-03-04 22:08 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Russell King
Move phylink_replay_link_end() as the last locked operation under
sja1105_static_config_reload(). The purpose is to be able to goto
this step from the error path of intermediate steps (we must call
phylink_replay_link_end()).
sja1105_reload_cbs() notably does not depend on port states or link
speeds. See commit 954ad9bf13c4 ("net: dsa: sja1105: fix bandwidth
discrepancy between tc-cbs software and offload") which has discussed
this issue specifically.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
drivers/net/dsa/sja1105/sja1105_main.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
index 94d17b06da40..bf720d96bad8 100644
--- a/drivers/net/dsa/sja1105/sja1105_main.c
+++ b/drivers/net/dsa/sja1105/sja1105_main.c
@@ -2339,13 +2339,11 @@ int sja1105_static_config_reload(struct sja1105_private *priv,
goto out;
}
+ rc = sja1105_reload_cbs(priv);
+
dsa_switch_for_each_available_port(dp, ds)
if (dp->pl)
phylink_replay_link_end(dp->pl);
-
- rc = sja1105_reload_cbs(priv);
- if (rc < 0)
- goto out;
out:
mutex_unlock(&priv->mgmt_lock);
mutex_unlock(&priv->fdb_lock);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/2] net: dsa: sja1105: ensure phylink_replay_link_end() will not be missed
2026-03-04 22:08 [PATCH net 0/2] Further SJA1105 phylink link replay fixups Vladimir Oltean
2026-03-04 22:08 ` [PATCH net 1/2] net: dsa: sja1105: reorder sja1105_reload_cbs() and phylink_replay_link_end() Vladimir Oltean
@ 2026-03-04 22:09 ` Vladimir Oltean
2026-03-07 2:00 ` [PATCH net 0/2] Further SJA1105 phylink link replay fixups patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2026-03-04 22:09 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Russell King
Most errors that can occur in sja1105_static_config_reload() are fatal
(example: fail to communicate with hardware), but not all are.
For example, sja1105_static_config_upload() -> kcalloc() may fail, and
if that happens, we have called phylink_replay_link_begin() but never
phylink_replay_link_end().
Under that circumstance, all port phylink instances are left in a state
where the resolver is stopped with the PHYLINK_DISABLE_REPLAY bit set.
We have effectively disabled link management with no way to recover from
this condition.
Avoid that situation by ensuring phylink_replay_link_begin() is always
paired with phylink_replay_link_end(), regardless of whether we faced
any errors during switch reset, configuration reload and general state
reload.
Fixes: 0b2edc531e0b ("net: dsa: sja1105: let phylink help with the replay of link callbacks")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
drivers/net/dsa/sja1105/sja1105_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
index bf720d96bad8..c72c2bfdcffb 100644
--- a/drivers/net/dsa/sja1105/sja1105_main.c
+++ b/drivers/net/dsa/sja1105/sja1105_main.c
@@ -2341,10 +2341,11 @@ int sja1105_static_config_reload(struct sja1105_private *priv,
rc = sja1105_reload_cbs(priv);
+out:
dsa_switch_for_each_available_port(dp, ds)
if (dp->pl)
phylink_replay_link_end(dp->pl);
-out:
+
mutex_unlock(&priv->mgmt_lock);
mutex_unlock(&priv->fdb_lock);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 0/2] Further SJA1105 phylink link replay fixups
2026-03-04 22:08 [PATCH net 0/2] Further SJA1105 phylink link replay fixups Vladimir Oltean
2026-03-04 22:08 ` [PATCH net 1/2] net: dsa: sja1105: reorder sja1105_reload_cbs() and phylink_replay_link_end() Vladimir Oltean
2026-03-04 22:09 ` [PATCH net 2/2] net: dsa: sja1105: ensure phylink_replay_link_end() will not be missed Vladimir Oltean
@ 2026-03-07 2:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-07 2:00 UTC (permalink / raw)
To: Vladimir Oltean; +Cc: netdev, andrew, davem, edumazet, kuba, pabeni, linux
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 5 Mar 2026 00:08:58 +0200 you wrote:
> While I was playing around with the subsystem knowledge in Chris Mason's
> review-prompts to see what LLMs would have needed to catch the bug
> behind commit bfd264fbbbca ("net: dsa: sja1105: protect link replay
> helpers against NULL phylink instance"), it flagged another issue
> instead, which IMO is valid. This is being fixed in patch 2/2.
> Patch 1/2 is preparatory reordering for that.
>
> [...]
Here is the summary with links:
- [net,1/2] net: dsa: sja1105: reorder sja1105_reload_cbs() and phylink_replay_link_end()
https://git.kernel.org/netdev/net/c/976703cae737
- [net,2/2] net: dsa: sja1105: ensure phylink_replay_link_end() will not be missed
https://git.kernel.org/netdev/net/c/ce2da643f00a
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] 4+ messages in thread
end of thread, other threads:[~2026-03-07 2:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 22:08 [PATCH net 0/2] Further SJA1105 phylink link replay fixups Vladimir Oltean
2026-03-04 22:08 ` [PATCH net 1/2] net: dsa: sja1105: reorder sja1105_reload_cbs() and phylink_replay_link_end() Vladimir Oltean
2026-03-04 22:09 ` [PATCH net 2/2] net: dsa: sja1105: ensure phylink_replay_link_end() will not be missed Vladimir Oltean
2026-03-07 2:00 ` [PATCH net 0/2] Further SJA1105 phylink link replay fixups 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