When adding an fdb/mdb entry whose (address, VID) key already exists in hardware, the existing egress ports were silently merged into the new static entry. Ports learned by hardware are untracked by DSA and can never be deleted. Replace the port mask instead of merging when the existing entry is not static. Fixes: 186623f4aa72 ("net: dsa: yt921x: Add support for Motorcomm YT921x") Signed-off-by: David Yang --- 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 c753c746490a..c6d0f000a163 100644 --- a/drivers/net/dsa/motorcomm/chip.c +++ b/drivers/net/dsa/motorcomm/chip.c @@ -799,7 +799,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