* [PATCH net] net: dsa: motorcomm: Do not inherit ports from dynamic FDB entries
@ 2026-11-09 15:34 David Yang
0 siblings, 0 replies; only message in thread
From: David Yang @ 2026-11-09 15:34 UTC (permalink / raw)
To: netdev
Cc: David Yang, Andrew Lunn, Vladimir Oltean, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-kernel
When adding an fdb/mdb entry that the hardware has already learned as
dynamic, the learned ports were silently converted into the static
entry, which DSA loses track of; the entry is silently expanded and can
never be deleted. Replace the port mask instead of merging when the
existing entry is not static.
Found by code inspection.
Fixes: 186623f4aa72 ("net: dsa: yt921x: Add support for Motorcomm YT921x")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
drivers/net/dsa/motorcomm/chip.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
index a7a9a7439304..6efd74e7eac6 100644
--- a/drivers/net/dsa/motorcomm/chip.c
+++ b/drivers/net/dsa/motorcomm/chip.c
@@ -805,7 +805,10 @@ yt921x_fdb_join(struct yt921x_priv *priv, const unsigned char *addr, u16 vid,
ctrl1 = val1 & ~YT921X_FDB_IO1_STATUS_M;
ctrl1 |= YT921X_FDB_IO1_STATUS_STATIC;
- ctrl2 = val2 | YT921X_FDB_IO2_EGR_PORTS(ports_mask);
+ ctrl2 = val2;
+ if (ctrl1 != val1)
+ ctrl2 &= ~YT921X_FDB_IO2_EGR_PORTS_M;
+ ctrl2 |= YT921X_FDB_IO2_EGR_PORTS(ports_mask);
if (ctrl1 == val1 && ctrl2 == val2)
return 0;
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-09 15:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 15:34 [PATCH net] net: dsa: motorcomm: Do not inherit ports from dynamic FDB entries David Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®