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/2026…%40pengutronix.de