From: netdev-bot+sashiko@kernel.org
To: o.rempel@pengutronix.de
Cc: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, f.fainelli@gmail.com, razor@blackwall.org,
idosch@nvidia.com, netdev@vger.kernel.org,
bridge@lists.linux.dev, kernel@pengutronix.de
Subject: Re: [PATCH net-next 4/5] net: dsa: microchip: ksz9477: refuse FDB/MDB entries for trapped groups
Date: Fri, 27 Nov 2026 08:24:36 +0000 [thread overview]
Message-ID: <179576787624.3135.13299340815507040998@kernel.org> (raw)
In-Reply-To: <20261126-ksz-stp-link-local-v1-4-39aed15f6271@pengutronix.de>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message describes user-visible failures that this
patch fixes, but the patch has no Fixes: tag and does not say whether…
- [Low] The subject and body describe the change as KSZ9477-family only,
and the test results are for KSZ9893 only.
- [Low] ksz9477_enable_stp_addr() collects the trapped-group bitmap in a
local variable and only copies it to dev->link_local_to_cpu after all…
--
net: dsa: microchip: ksz9477: refuse FDB/MDB entries for trapped groups
The reserved multicast table traps some link-local groups to the CPU.
This patch makes ksz9477_fdb_add() and ksz9477_mdb_add() refuse entries
for those groups: they return -EOPNOTSUPP on user ports and 0 on CPU and
DSA ports. A new dev->link_local_to_cpu bitmap, filled in by
ksz9477_enable_stp_addr(), records which groups are trapped.
> The KSZ9477 family looks up a destination address in the address
> lookup table (learned and static FDB entries), the static address table
> (MDB entries) and the reserved multicast table. The driver traps the
> link-local groups with the reserved multicast table: it sends
> 01:80:C2:00:00:00 to :0F to the CPU only, except :01 (PAUSE frames),
> which it drops. On a KSZ9893, an FDB or MDB entry for a trapped group
> overrides that rule.
[Severity: Low]
This change also applies to LAN937x, but the message doesn't mention it.
Is that intended? And has the override been seen on LAN937x hardware?
lan937x_switch_ops in lan937x_main.c uses the same handlers:
.port_fdb_add = ksz9477_fdb_add,
.port_fdb_del = ksz9477_fdb_del,
.port_mdb_add = ksz9477_mdb_add,
.port_mdb_del = ksz9477_mdb_del,
Also, lan937x_setup() calls ksz9477_enable_stp_addr(dev), which now fills
dev->link_local_to_cpu.
So on LAN937x, FDB and MDB entries for trapped link-local groups on user
ports are now refused with -EOPNOTSUPP too. Until the later tagger patch,
LAN937x also gets the gap where frames to a group with a refused MDB entry
are not forwarded between switch ports.
Other patches in this series name LAN937x explicitly. One example is
"LAN937x uses the same code" in "net: dsa: microchip: ksz9477: do not keep
the learned port in FDB entries". Could this commit message do the same?
> A later patch makes the tagger stop marking these frames as already
> forwarded by the switch. This patch comes first, so that the switch and
> the bridge never both forward such a frame. Until then, frames to a
> group with a refused MDB entry are not forwarded between switch ports
> at all.
[Severity: Low]
The commit message describes failures that users can see. In one of them,
a Blocking port stops passing BPDUs to the CPU and the bridge moves it to
Listening. There is no Fixes: tag and nothing about stable, though. Is a
backport intended?
The earlier patch in this series, "net: dsa: microchip: ksz9477: do not
keep the learned port in FDB entries", carries a Fixes tag, so this patch
is handled differently.
The right Fixes target is not clear. The group 0 (STP) trap in
ksz9477_enable_stp_addr() goes back to 331d64f752bb. The 8-entry
reprogramming loop came from 96baf482ca1f.
Before 96baf482ca1f only entry 0 was written. The hardware default for
group 6 forwards to the last port, and on KSZ9893 the last port is the
CPU port. So the :0E trap likely existed there before that commit too.
What happens if this is backported alone, without "net: dsa: microchip:
ksz9477: report the trapped link-local groups"? Wouldn't stable kernels
get the gap described above, where frames to a group with a refused MDB
entry are not forwarded between switch ports at all?
Could the message name the commit that introduced the problem and the
series dependency, or say explicitly that no backport is intended?
> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index 8271bc742ddc5..b972c9fab55c1 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
[ ... ]
> @@ -1621,6 +1669,14 @@ int ksz9477_enable_stp_addr(struct ksz_device *dev)
> update = ports;
> break;
> }
> +
> + /* Record the link-local addresses of group i if the switch
> + * sends it to the CPU only. Group 1 keeps its drop default and
> + * does not match.
> + */
> + if (update == BIT(dev->cpu_port))
> + link_local_to_cpu |= ksz9477_resv_mcast_link_local[i];
> +
> if (update != ports || override) {
> data &= ~dev->port_mask;
> data |= update;
> @@ -1650,6 +1706,8 @@ int ksz9477_enable_stp_addr(struct ksz_device *dev)
> }
> }
>
> + dev->link_local_to_cpu = link_local_to_cpu;
> +
[Severity: Low]
Can dev->link_local_to_cpu get out of sync with the hardware here?
The first iteration of the loop writes group 0 (01:80:C2:00:00:00, CPU
only, with override). If a later iteration fails, the function returns
before this assignment and dev->link_local_to_cpu stays 0. This early
return in the loop is one example:
ret = ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);
if (ret < 0)
return ret;
A ksz_read32() or ksz9477_wait_alu_sta_ready() failure returns early in
the same way.
Both callers ignore the return value:
ksz9477_setup()
ksz9477_enable_stp_addr(dev);
lan937x_setup()
ksz9477_enable_stp_addr(dev);
So setup completes while the hardware already traps :00 to the CPU.
>From then on, ksz9477_link_local_is_trapped() returns false for :00. Then
ksz9477_fdb_add() and ksz9477_mdb_add() write an entry that overrides the
STP trap. That is the bypass this patch is meant to block.
The callers ignored the return value before this patch, but the new
bitmap is what can now disagree with the hardware. Should the bitmap be
updated as each group is programmed, so that it matches what has already
been written?
> return 0;
> }
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126-ksz-stp-link-local-v1-0-39aed15f6271%40pengutronix.de
next prev parent reply other threads:[~2026-11-27 8:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 8:07 [PATCH net-next 0/5] net: dsa: microchip: let the bridge decide about link-local frames Oleksij Rempel
2026-11-26 8:07 ` [PATCH net-next 1/5] net: dsa: tag_ksz: do not mark trapped link-local frames as forwarded Oleksij Rempel
2026-11-26 14:47 ` Andrew Lunn
2026-11-26 8:07 ` [PATCH net-next 2/5] net: dsa: microchip: ksz9477: do not keep the learned port in FDB entries Oleksij Rempel
2026-11-27 8:24 ` netdev-bot+sashiko
2026-11-26 8:07 ` [PATCH net-next 3/5] net: dsa: microchip: ksz9477: do not learn addresses on the CPU port Oleksij Rempel
2026-11-27 8:24 ` netdev-bot+sashiko
2026-11-26 8:07 ` [PATCH net-next 4/5] net: dsa: microchip: ksz9477: refuse FDB/MDB entries for trapped groups Oleksij Rempel
2026-11-27 8:24 ` netdev-bot+sashiko [this message]
2026-11-26 8:07 ` [PATCH net-next 5/5] net: dsa: microchip: ksz9477: report the trapped link-local groups Oleksij Rempel
2026-11-27 8:24 ` netdev-bot+sashiko
2026-11-26 10:23 ` [PATCH net-next 0/5] net: dsa: microchip: let the bridge decide about link-local frames Vladimir Oltean
2026-11-27 5:53 ` Oleksij Rempel
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=179576787624.3135.13299340815507040998@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=bridge@lists.linux.dev \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=woojung.huh@microchip.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