[PATCH net v3 2/2] net: dsa: b53: Enable legacy IGMP snooping controls

From: Florian Fainelli

Date: Wed Oct 28 2026 - 19:52:34 EST


The older switches do not implement the high-level protocol control
register used by newer devices, so they are currently skipped when
setting up multicast control packet delivery to the CPU.

Enable the IP-layer IGMP classifier in the 8-bit global management
configuration register on BCM5325E, BCM5365, BCM5389, BCM5397/5398 and
BCM63xx. Their manuals place this control at bit 3 of page 0x02, offset
0x00. Preserve the other management fields and propagate access errors.
Clear the separate IGMP redirection enable on BCM6318 and BCM63268 to
use snooping mode, as documented in 6318-PR100-R and 63X68-PR201-R.

These legacy classifiers have fixed forwarding behavior, including
query flooding which excludes the IMP on BCM5397/5398 and BCM63xx.
They do not provide the newer per-message IGMP/MLD controls. This change
only enables the documented legacy IGMP handling; it does not add MLD
classification.

Keep BCM5325M and unidentified BCM5325 variants excluded. The BCM5325M
manual reserves the global management IGMP bit and instead describes
snooping through the shared mirroring engine, requiring a different
implementation and coordination with port mirroring.

Fixes: 5d65b64a3d97 ("net: dsa: b53: Add support for MDB")
Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
---
drivers/net/dsa/b53/b53_common.c | 23 ++++++++++++++++++++---
drivers/net/dsa/b53/b53_regs.h | 2 ++
2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index e54f6d4d1f7b..957a1501d3f4 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -841,12 +841,29 @@ int b53_enable_mcast_snooping(struct b53_device *dev)
u16 val16;
u32 val;
int ret;
+ u8 val8;

- /* Older switches use different IGMP controls, not HL_PRTC_CTRL. */
- if (is5325(dev) || is5365(dev) || dev->chip_id == BCM5389_DEVICE_ID ||
- is5397_98(dev) || is63xx(dev))
+ /* BCM5325M snooping uses the mirroring engine instead. */
+ if (is5325(dev) && !is5325e(dev))
return 0;

+ /* Older switches classify IGMP in the global management register.
+ * They do not provide the separate MLD controls of newer switches.
+ */
+ if (is5325e(dev) || is5365(dev) ||
+ dev->chip_id == BCM5389_DEVICE_ID || is5397_98(dev) || is63xx(dev)) {
+ ret = b53_read8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, &val8);
+ if (ret)
+ return ret;
+
+ val8 |= GC_IGMP_IP_EN;
+ /* Disable the separate IGMP redirection mode on BCM6318/63268. */
+ if (is6318_268(dev))
+ val8 &= ~GC_IGMP_RED_EN_6318_268;
+
+ return b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, val8);
+ }
+
/* IGMPv2 and MLDv1 reports use the group's destination MAC. Once
* the first listener is offloaded, ordinary multicast forwarding
* can keep subsequent reports from reaching the bridge CPU.
diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h
index cfdb5ed38326..e994d3a188c7 100644
--- a/drivers/net/dsa/b53/b53_regs.h
+++ b/drivers/net/dsa/b53/b53_regs.h
@@ -217,6 +217,8 @@
#define B53_GLOBAL_CONFIG 0x00
#define GC_RESET_MIB 0x01
#define GC_RX_BPDU_EN 0x02
+#define GC_IGMP_IP_EN BIT(3)
+#define GC_IGMP_RED_EN_6318_268 BIT(4)
#define GC_MIB_AC_HDR_EN 0x10
#define GC_MIB_AC_EN 0x20
#define GC_FRM_MGMT_PORT_M 0xC0
--
2.53.0