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] This patch makes the tagger trust dev->link_local_to_cpu when it
decides whether a link-local frame was trapped or flooded by the…
--
net: dsa: microchip: ksz9477: report the trapped link-local groups
This patch adds ksz_tagger_set_link_local_to_cpu(). It copies
dev->link_local_to_cpu into the KSZ tagger data from
ksz9477_connect_tag_protocol() and lan937x_connect_tag_protocol(). The
tagger then stops setting offload_fwd_mark on trapped link-local frames,
so the bridge can forward them to other switch ports.
> diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
> index 7b96d110b1f64..76f08e4dd9235 100644
> --- a/drivers/net/dsa/microchip/ksz_common.h
> +++ b/drivers/net/dsa/microchip/ksz_common.h
[ ... ]
> @@ -836,6 +837,13 @@ static inline bool is_lan937x_tx_phy(struct ksz_device *dev, int port)
> dev->chip_id == LAN9372_CHIP_ID) && port == KSZ_PORT_4;
> }
>
> +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]
Can dev->link_local_to_cpu say that groups are trapped to the CPU when
the switch is not trapping them?
ksz9477_enable_stp_addr() turns on the reserved multicast table through
ksz_cfg(). ksz_cfg() is a void wrapper that drops the return value of
regmap_update_bits():
drivers/net/dsa/microchip/ksz9477.c:ksz9477_enable_stp_addr() {
...
dev->link_local_to_cpu = 0;
/* Enable Reserved multicast table */
ksz_cfg(dev, REG_SW_LUE_CTRL_0, SW_RESV_MCAST_ENABLE, true);
...
}
The loop that follows sets bits each time the per-entry ALU table writes
succeed:
/* Record entry i only after it is written, so that the bitmap
* matches the switch if a later write fails.
*/
if (update == BIT(dev->cpu_port)) {
dev->link_local_to_cpu |=
ksz9477_resv_mcast_link_local[i];
}
Suppose the SW_RESV_MCAST_ENABLE read-modify-write fails at setup and
the later table writes succeed. The switch then ignores the reserved
multicast table and floods those frames as ordinary multicast. The
bitmap still reports groups 00 and 02-0F as trapped to the CPU only. The
comment above holds for the per-entry writes, but not for the global
enable.
ksz9477_setup() and lan937x_setup() also ignore the return value of
ksz9477_enable_stp_addr(), so nothing higher up catches the failure.
With this patch, ksz_tagger_set_link_local_to_cpu() copies that bitmap
into the tagger. ksz_common_rcv()->dsa_link_local_offload_fwd_mark()
then leaves those frames without offload_fwd_mark.
Would the bridge then forward a second copy of frames the hardware has
already flooded? That would affect groups set in group_fwd_mask, and STP
BPDUs when STP is off.
Could the result of the SW_RESV_MCAST_ENABLE update be checked, or the
bit read back, with link_local_to_cpu left at 0 on failure?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40pengutronix.de