From: netdev-bot+sashiko@kernel.org
To: mmyangfl@gmail.com
Cc: netdev@vger.kernel.org, andrew@lunn.ch, olteanv@gmail.com,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com
Subject: Re: [PATCH net v3 2/3] net: dsa: motorcomm: Do not inherit ports from dynamic FDB entries
Date: Mon, 23 Nov 2026 22:11:11 +0000 [thread overview]
Message-ID: <179547187187.3135.17425549919833355866@kernel.org> (raw)
In-Reply-To: <20261119221110.1123578-3-mmyangfl@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] When yt921x_fdb_join() (drivers/net/dsa/motorcomm/chip.c)
finds an existing non-static (hardware-learned) entry for the (addr,…
--
net: dsa: motorcomm: Do not inherit ports from dynamic FDB entries
This patch changes yt921x_fdb_join() so that an existing non-static
(hardware-learned) entry for the same (address, VID) key has its egress
port mask replaced, not merged, when it is converted into a static
fdb/mdb entry.
> diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
> index 9a9e8ed76e01f..ea305159cd5e7 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);
[Severity: Medium]
When a learned entry is turned into a static one here, only
YT921X_FDB_IO2_EGR_PORTS_M is cleared. Should the other attributes of the
learned entry be cleared as well?
The remaining OUT2 bits are written back through
yt921x_fdb_add_index_in12():
YT921X_FDB_IO2_MOVE_AGING_STATUS_M GENMASK(31, 30)
YT921X_FDB_IO2_IGR_DROP BIT(29)
YT921X_FDB_IO2_EGR_DROP BIT(17)
YT921X_FDB_IO2_COPY_TO_CPU BIT(16)
YT921X_FDB_IO2_IGR_PRIO_EN BIT(15)
YT921X_FDB_IO2_PRIO_M GENMASK(14, 12)
YT921X_FDB_IO2_NEW_VID_M GENMASK(11, 0)
YT921X_FDB_IO1_EGR_PRIO_EN in ctrl1 is kept as well, because only
YT921X_FDB_IO1_STATUS_M is replaced.
The other path that creates a static entry, yt921x_fdb_add(), writes
only the port mask to IN2:
ctrl = YT921X_FDB_IO2_EGR_PORTS(ports_mask);
res = yt921x_reg_write(priv, YT921X_FDB_IN2, ctrl);
The driver never sets any of the other IO1/IO2 attribute bits. That
means the contents of a static entry added through port_fdb_add or
port_mdb_add now depend on whether the switch learned the address
first. If the hardware fills in MOVE_AGING_STATUS or any of the drop,
copy or priority bits on a learned entry, the static entry inherits
them. yt921x_fdb_leave() also writes OUT1/OUT2 back with only the
egress ports changed, so nothing later clears that state.
This looks like the same kind of problem the commit message describes,
untracked hardware state carried into a DSA-installed static entry, but
handled only for the port mask.
The later patch in this series, "net: dsa: motorcomm: Rewrite FDB entry
on port migration", moves this logic into yt921x_fdb_update() and keeps
the same partial mask:
if (join_ports_mask) {
ctrl1 &= ~YT921X_FDB_IO1_STATUS_M;
ctrl1 |= YT921X_FDB_IO1_STATUS_STATIC;
if (ctrl1 != val1)
ctrl2 &= ~YT921X_FDB_IO2_EGR_PORTS_M;
}
So the issue is still present at the end of the series.
For the non-static case, could ctrl1/ctrl2 be rebuilt the way
yt921x_fdb_add() builds them (STATUS_STATIC plus FID and address in
IN1, only EGR_PORTS in IN2), instead of masking out a single field?
> if (ctrl1 == val1 && ctrl2 == val2)
> return 0;
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119221110.1123578-1-mmyangfl%40gmail.com
next prev parent reply other threads:[~2026-11-23 22:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 22:10 [PATCH net v3 0/3] net: dsa: motorcomm: FDB fixup David Yang
2026-11-19 22:10 ` [PATCH net v3 1/3] net: dsa: motorcomm: Ignore multicast addresses in FDB ops David Yang
2026-11-23 22:11 ` netdev-bot+sashiko
2026-11-19 22:10 ` [PATCH net v3 2/3] net: dsa: motorcomm: Do not inherit ports from dynamic FDB entries David Yang
2026-11-23 22:11 ` netdev-bot+sashiko [this message]
2026-11-19 22:10 ` [PATCH net v3 3/3] net: dsa: motorcomm: Rewrite FDB entry on port migration David Yang
2026-11-23 22:11 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179547187187.3135.17425549919833355866@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=mmyangfl@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox