[PATCH net-next 5/5] net: dsa: microchip: ksz9477: report the trapped link-local groups

From
Oleksij Rempel <o.rempel@pengutronix.de>
Date
2026-11-26 08:08:06
Also in
bridge
Reply to
Oleksij Rempel, 2026-11-26
Tell the tagger which link-local groups the KSZ9477 family and LAN937x
trap to the CPU. 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.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/dsa/microchip/ksz9477.c      |  1 +
 drivers/net/dsa/microchip/ksz_common.h   | 12 ++++++++++++
 drivers/net/dsa/microchip/lan937x_main.c |  1 +
 3 files changed, 14 insertions(+)
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index b972c9fab55c170758dac97bda026e1f29e487f2..3dee81d89c1d7e64314a073980fb648431126a09 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -2109,6 +2109,7 @@ static int ksz9477_connect_tag_protocol(struct dsa_switch *ds,
 
 	tagger_data = ksz_tagger_data(ds);
 	tagger_data->xmit_work_fn = ksz_port_deferred_xmit;
+	ksz_tagger_set_link_local_to_cpu(ds);
 
 	return 0;
 }
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index 7b96d110b1f64f4226ee7a371da38cd7e5b3767a..1f96b91016fcfa20f99599c10d4095d7f384f7f6 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -7,6 +7,7 @@
 #ifndef __KSZ_COMMON_H
 #define __KSZ_COMMON_H
 
+#include <linux/dsa/ksz_common.h>
 #include <linux/etherdevice.h>
 #include <linux/irqdomain.h>
 #include <linux/kernel.h>
@@ -836,6 +837,17 @@ static inline bool is_lan937x_tx_phy(struct ksz_device *dev, int port)
 		dev->chip_id == LAN9372_CHIP_ID) && port == KSZ_PORT_4;
 }
 
+/* Copy dev->link_local_to_cpu to the tagger. Call this from
+ * connect_tag_protocol: ksz9477_enable_stp_addr() fills the bitmap during
+ * ->setup(), and DSA connects the tagger only after ->setup().
+ */
+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;
+}
+
 static inline int ksz_get_sgmii_port(struct ksz_device *dev)
 {
 	return dev->info->sgmii_port - 1;
diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c
index 7971d120630d173a1bbed6fb98683cee27d8fe89..7452b8c6a73552d9ae4f410dead3b968f22124e5 100644
--- a/drivers/net/dsa/microchip/lan937x_main.c
+++ b/drivers/net/dsa/microchip/lan937x_main.c
@@ -924,6 +924,7 @@ static int lan937x_connect_tag_protocol(struct dsa_switch *ds,
 
 	tagger_data = ksz_tagger_data(ds);
 	tagger_data->xmit_work_fn = ksz_port_deferred_xmit;
+	ksz_tagger_set_link_local_to_cpu(ds);
 
 	return 0;
 }
-- 
2.47.3
Thread (14 messages) 14 messages, 4 authors, last reply 5d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help