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] On a bridge with STP disabled, which is the default for a new
Linux bridge, this patch changes how STP BPDUs are handled.
--
net: dsa: microchip: ksz9477: report the trapped link-local groups
The KSZ9477 family and LAN937x drivers now copy dev->link_local_to_cpu
into the tagger data from their connect_tag_protocol callbacks. As a
result, the tagger stops setting offload_fwd_mark on link-local frames
that the switch traps to the CPU, and the bridge can forward those frames
in software.
The tagger then no longer marks these frames as
forwarded in hardware (offload_fwd_mark). The bridge applies
group_fwd_mask and the STP state to them and can forward them to the
other ports of the switch.
Tested on a KSZ9893: with the group_fwd_mask bit for 01:80:C2:00:00:0E
set, the bridge relayed 20 of 20 frames to that group from lan1 to lan2
with this change, and 0 of 20 without it.
[ ... ]
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index 7b96d110b1f64..1f96b91016fcf 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
[ ... ]
quoted hunk ↗ jump to hunk
+static inline void ksz_tagger_set_link_local_to_cpu(struct dsa_switch *ds)
+{
+ struct ksz_device *dev = ds->priv;
+
+ ksz_tagger_data(ds)->link_local_to_cpu = dev->link_local_to_cpu;
[Severity: Low]
This isn't a bug, but should the commit message mention what this does to
STP BPDUs on a bridge with STP disabled? That is the default for a new
Linux bridge.
ksz9477_enable_stp_addr() programs group 0 (01:80:C2:00:00:00) as
CPU-only, so BIT(0) is always set in the bitmap copied here:
drivers/net/dsa/microchip/ksz9477.c:ksz9477_enable_stp_addr() {
...
if (update == BIT(dev->cpu_port))
link_local_to_cpu |= ksz9477_resv_mcast_link_local[i];
...
}
Once the bitmap reaches the tagger, ksz_common_rcv() skips
dsa_default_offload_fwd_mark() for BPDUs:
net/dsa/tag_ksz.c:ksz_common_rcv() {
...
if (!ksz_link_local_trapped(skb->dev, eth_hdr(skb)->h_dest))
dsa_default_offload_fwd_mark(skb);
...
}
br_handle_frame() then forwards group 0 frames when STP is off:
net/bridge/br_input.c:br_handle_frame() {
...
case 0x00: /* Bridge Group Address */
/* If STP is turned off,
then must forward to keep loop detection */
if (p->br->stp_enabled == BR_NO_STP ||
fwd_mask & (1u << dest[5]))
goto forward;
...
}
Without offload_fwd_mark, nbp_switchdev_allowed_egress() no longer stops
these frames from egressing the other ports of the same switch.
So a KSZ9477/KSZ9893/LAN937x bridge with stp_state 0 now relays BPDUs
received on one switch port to every other switch port. Before this
change they were dropped between those ports.
External STP switches attached to different KSZ ports will now see each
other's BPDUs. That can change root election and cause ports to be
blocked.
The new behaviour matches the software bridge and the br_input.c comment,
so it looks intended. It is still a visible change in the default
configuration. The message only says "The bridge applies group_fwd_mask
and the STP state to them and can forward them to the other ports of the
switch", and the reported test covers only 01:80:C2:00:00:0E.
Could the message state that BPDUs are now forwarded on bridges with STP
disabled?
+}
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126-ksz-stp-link-local-v1-0-39aed15f6271%40pengutronix.de