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,
willemb@google.com, daniel@makrotopia.org, 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 v2 5/7] net: dsa: microchip: ksz9477: do not learn addresses on the CPU port
Date: Fri, 04 Dec 2026 12:00:54 +0000 [thread overview]
Message-ID: <179638565405.3146.5813472222670938710@kernel.org> (raw)
In-Reply-To: <20261201-ksz-stp-link-local-v2-5-5dd1201d67c6@pengutronix.de>
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 3
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] This patch adds a new refusal path to ksz9477_hsr_join()
(drivers/net/dsa/microchip/ksz9477.c:1959-1965).
- [Low] Concern: the KSZ8 family still turns on learning on the CPU port
(drivers/net/dsa/microchip/ksz8.c:2581 and :2881).
- [Low] Concern: on KSZ9477 the patch makes HSR offload and bridge
offload mutually exclusive.
- [Low] Concern: the new guards in ksz_port_bridge_join() and
ksz9477_hsr_join() miss two cases.
--
net: dsa: microchip: ksz9477: do not learn addresses on the CPU port
This patch turns off learning on the CPU port of the KSZ9477 family and
LAN937x, and sets ds->assisted_learning_on_cpu_port instead. While HSR is
offloaded on a KSZ9477, the CPU port learns again. HSR offload and bridge
offload are now mutually exclusive in ksz9477_hsr_join() and
ksz_port_bridge_join().
> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index 98211d9835734..2b563e4494541 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
[ ... ]
> @@ -1937,6 +1953,17 @@ static int ksz9477_hsr_join(struct dsa_switch *ds, int port,
> return -EOPNOTSUPP;
> }
>
> + /* The CPU port learns while HSR is offloaded, so it would also learn
> + * the senders of frames that an offloaded bridge forwards in software.
> + */
> + dsa_switch_for_each_user_port(hsr_dp, ds) {
> + if (dsa_port_bridge_dev_get(hsr_dp)) {
> + NL_SET_ERR_MSG_MOD(extack,
> + "HSR offload not supported while a bridge is offloaded - using software HSR");
> + return -EOPNOTSUPP;
> + }
> + }
[Severity: Medium]
Does the "using software HSR" fallback work if these ports offloaded HSR
before?
When ksz9477_hsr_join() succeeds, it sets the offload feature bits on the
user netdev:
user->features |= KSZ9477_SUPPORTED_HSR_FEATURES;
ksz9477_hsr_leave() never clears NETIF_F_HW_HSR_DUP or NETIF_F_HW_HSR_FWD.
Consider this sequence:
1. hsr0 is created on lan1/lan2 and offloaded.
2. hsr0 is deleted. The port map, the membership and PORT_SRC_ADDR_FILTER
are cleared, but the feature bits stay set.
3. lan3/lan4 join an offloaded bridge. ksz_port_bridge_join() accepts
this because dev->hsr_ports is 0.
4. hsr0 is created on lan1/lan2 again.
In step 4, hsr_dev_finalize() checks the slave features before the driver
join is called:
net/hsr/hsr_device.c:hsr_dev_finalize() {
...
if ((slave[0]->features & NETIF_F_HW_HSR_FWD) &&
(slave[1]->features & NETIF_F_HW_HSR_FWD))
hsr->fwd_offloaded = true;
...
}
Then ksz9477_hsr_join() returns -EOPNOTSUPP from the new check above, and
dsa_port_hsr_join() resets dp->hsr_dev to NULL.
Would ring forwarding then stop at this node? The hardware no longer
forwards between lan1 and lan2. hsr_drop_frame() still skips software
forwarding between the slaves, because NETIF_F_HW_HSR_FWD is set.
hsr_forward_do() also sends on only one slave, because NETIF_F_HW_HSR_DUP
is set. For that slave, dsa_xmit_port_mask() runs with dp->hsr_dev ==
NULL:
net/dsa/tag.h:dsa_xmit_port_mask() {
...
struct net_device *hsr_dev = dp->hsr_dev;
struct dsa_port *other_dp;
dsa_hsr_foreach_port(other_dp, dp->ds, hsr_dev)
mask |= BIT(other_dp->index);
...
}
Can this loop match every port whose hsr_dev is NULL, including the
bridged lan3/lan4? If so, HSR frames from this node would leak into the
bridge's L2 domain.
The notes below the commit message say the stale feature flags are an
older issue in ksz9477_hsr_leave(). This patch adds a new and common
trigger, though: any offloaded bridge on the switch. The new HSR/bridge
exclusion also relies on the software fallback working.
Could ksz9477_hsr_leave() clear KSZ9477_SUPPORTED_HSR_FEATURES as part of
this change?
> +
> /* Self MAC address filtering, to avoid frames traversing
> * the HSR ring more than once.
> */
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201-ksz-stp-link-local-v2-0-5dd1201d67c6%40pengutronix.de
next prev parent reply other threads:[~2026-12-04 12:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 11:59 [PATCH net-next v2 0/7] net: dsa: microchip: let the bridge decide about link-local frames Oleksij Rempel
2026-12-01 11:59 ` [PATCH net-next v2 1/7] net: dsa: add dsa_link_local_offload_fwd_mark() Oleksij Rempel
2026-12-01 11:59 ` [PATCH net-next v2 2/7] net: dsa: tag_mxl862xx: use dsa_link_local_offload_fwd_mark() Oleksij Rempel
2026-12-01 11:59 ` [PATCH net-next v2 3/7] net: dsa: tag_ksz: do not mark trapped link-local frames as forwarded Oleksij Rempel
2026-12-01 11:59 ` [PATCH net-next v2 4/7] net: dsa: microchip: ksz9477: do not keep the learned port in FDB entries Oleksij Rempel
2026-12-01 11:59 ` [PATCH net-next v2 5/7] net: dsa: microchip: ksz9477: do not learn addresses on the CPU port Oleksij Rempel
2026-12-04 12:00 ` netdev-bot+sashiko [this message]
2026-12-01 11:59 ` [PATCH net-next v2 6/7] net: dsa: microchip: ksz9477: refuse FDB/MDB entries for trapped groups Oleksij Rempel
2026-12-01 11:59 ` [PATCH net-next v2 7/7] net: dsa: microchip: ksz9477: report the trapped link-local groups Oleksij Rempel
2026-12-04 12:00 ` 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=179638565405.3146.5813472222670938710@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=bridge@lists.linux.dev \
--cc=daniel@makrotopia.org \
--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=willemb@google.com \
--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