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 3/5] net: dsa: microchip: ksz9477: do not learn addresses on the CPU port
Date: Fri, 27 Nov 2026 08:24:34 +0000 [thread overview]
Message-ID: <179576787449.3135.11974599854572162575@kernel.org> (raw)
In-Reply-To: <20261126-ksz-stp-link-local-v1-3-39aed15f6271@pengutronix.de>
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] This patch causes an HSR offload regression on KSZ9477.
--
net: dsa: microchip: ksz9477: do not learn addresses on the CPU port
This patch turns off address learning on the CPU port of the KSZ9477
family and LAN937x. It sets ds->assisted_learning_on_cpu_port instead, so
DSA installs the addresses the bridge learns outside the switch as static
entries on the CPU port. This prepares for software forwarding of trapped
link-local frames.
> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index 98211d9835734..8271bc742ddc5 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
[ ... ]
> @@ -1792,13 +1791,15 @@ static int ksz9477_setup(struct dsa_switch *ds)
> if (ret < 0)
> return ret;
>
> - /* Start with learning disabled on standalone user ports, and enabled
> - * on the CPU port. In lack of other finer mechanisms, learning on the
> - * CPU port will avoid flooding bridge local addresses on the network
> - * in some cases.
> + /* Ask DSA to add the addresses that the bridge learns on ports
> + * outside the switch as static entries on the CPU port. The CPU
> + * port itself does not learn: when the bridge forwards a frame in
> + * software between two ports of the switch, the switch would learn
> + * the sender on the CPU port. p->learning is never set for the CPU
> + * port, so ksz_port_stp_state_set() disables learning when DSA sets
> + * the port to forwarding.
> */
> - p = &dev->ports[dev->cpu_port];
> - p->learning = true;
> + ds->assisted_learning_on_cpu_port = true;
[Severity: Medium]
Does this cause a regression for HSR offload on KSZ9477? Unicast frames
addressed to the local HSR node now seem to be forwarded to the other ring
port as well.
Before this change, the CPU port learned the HSR MAC from frames the host
sent. That learned entry sent unicast with DA == HSR MAC to the CPU only.
Now dsa_port_enable_rt() moves the CPU port to BR_STATE_FORWARDING, and
p->learning is false, so ksz_port_stp_state_set() disables learning there:
ksz_port_stp_state_set() {
...
case BR_STATE_FORWARDING:
data |= (PORT_TX_ENABLE | PORT_RX_ENABLE);
if (!p->learning)
data |= PORT_LEARN_DISABLE;
...
}
The replacement doesn't seem to cover HSR, because HSR ports are not in a
bridge:
dsa_user_fdb_event() {
...
if (!dp->bridge)
return 0;
...
}
dsa_switch_supports_uc_filtering() needs ds->fdb_isolation, which the
microchip drivers don't set, so standalone host address filtering doesn't
add the entry either.
ksz9477_hsr_join() doesn't install a static ALU entry for the HSR MAC.
ksz_switch_macaddr_get() only programs the self-address filter register.
ksz9477_hsr_join() also makes the two ring ports and the CPU members of
each other's forwarding set:
ksz9477_hsr_join() {
...
hsr_ports |= BIT(dsa_upstream_port(ds, port));
dsa_hsr_foreach_port(hsr_dp, ds, hsr)
ksz9477_cfg_port_member(dev, hsr_dp->index, hsr_ports);
...
data |= HSR_DUPLICATE_DISCARD;
data &= ~HSR_NODE_UNICAST;
...
}
ksz9477 never programs unknown unicast control (REG_SW_LUE_UNK_UCAST_CTRL__4
is unused). Unicast to this node would then miss in the ALU and flood to
the other ring port and the CPU. It would keep going around the ring until
the sender's self-address filter drops it.
The hardware meaning of HSR_NODE_UNICAST is not documented in the tree.
If clearing that bit made the switch deliver node-addressed unicast only
to the host, this flooding would not happen. The note below the --- line
reaches the same conclusion, that the frames are flooded.
That note is dropped when the patch is applied. The commit message doesn't
mention this behavior change, and nothing in the series changes the HSR
join/leave path.
Could ksz9477_hsr_join() add a static ALU entry for hsr->dev_addr on the
CPU port, with ksz9477_hsr_leave() removing it? Another option is to keep
CPU port learning enabled while dev->hsr_ports is non-zero.
>
> if (dev->irq > 0) {
> ret = ksz_girq_setup(dev);
[ ... ]
--
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 [this message]
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
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=179576787449.3135.11974599854572162575@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