[PATCH net 1/3] net: dsa: b53: fix enabling ip multicast

Jonas Gorski posted 3 patches 3 months, 1 week ago
[PATCH net 1/3] net: dsa: b53: fix enabling ip multicast
Posted by Jonas Gorski 3 months, 1 week ago
In the New Control register bit 1 is either reserved, or has a different
function:

    Out of Range Error Discard

    When enabled, the ingress port discards any frames
    if the Length field is between 1500 and 1536
    (excluding 1500 and 1536) and with good CRC.

The actual bit for enabling IP multicast is bit 0, which was only
explicitly enabled for BCM5325 so far.

For older switch chips, this bit defaults to 0, so we want to enable it
as well, while newer switch chips default to 1, and their documentation
says "It is illegal to set this bit to zero."

So drop the wrong B53_IPMC_FWD_EN define, enable the IP multicast bit
also for other switch chips. While at it, rename it to (B53_)IP_MC as
that is how it is called in Broadcom code.

Fixes: 63cc54a6f073 ("net: dsa: b53: Fix egress flooding settings")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 drivers/net/dsa/b53/b53_common.c | 4 ++--
 drivers/net/dsa/b53/b53_regs.h   | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 2f846381d5a7..77571a46311e 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -371,11 +371,11 @@ static void b53_set_forwarding(struct b53_device *dev, int enable)
 		 * frames should be flooded or not.
 		 */
 		b53_read8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, &mgmt);
-		mgmt |= B53_UC_FWD_EN | B53_MC_FWD_EN | B53_IPMC_FWD_EN;
+		mgmt |= B53_UC_FWD_EN | B53_MC_FWD_EN | B53_IP_MC;
 		b53_write8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, mgmt);
 	} else {
 		b53_read8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, &mgmt);
-		mgmt |= B53_IP_MCAST_25;
+		mgmt |= B53_IP_MC;
 		b53_write8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, mgmt);
 	}
 }
diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h
index 309fe0e46dad..8ce1ce72e938 100644
--- a/drivers/net/dsa/b53/b53_regs.h
+++ b/drivers/net/dsa/b53/b53_regs.h
@@ -111,8 +111,7 @@
 
 /* IP Multicast control (8 bit) */
 #define B53_IP_MULTICAST_CTRL		0x21
-#define  B53_IP_MCAST_25		BIT(0)
-#define  B53_IPMC_FWD_EN		BIT(1)
+#define  B53_IP_MC			BIT(0)
 #define  B53_UC_FWD_EN			BIT(6)
 #define  B53_MC_FWD_EN			BIT(7)
 
-- 
2.43.0
Re: [PATCH net 1/3] net: dsa: b53: fix enabling ip multicast
Posted by Florian Fainelli 3 months, 1 week ago

On 11/2/2025 2:07 AM, Jonas Gorski wrote:
> In the New Control register bit 1 is either reserved, or has a different
> function:
> 
>      Out of Range Error Discard
> 
>      When enabled, the ingress port discards any frames
>      if the Length field is between 1500 and 1536
>      (excluding 1500 and 1536) and with good CRC.
> 
> The actual bit for enabling IP multicast is bit 0, which was only
> explicitly enabled for BCM5325 so far.
> 
> For older switch chips, this bit defaults to 0, so we want to enable it
> as well, while newer switch chips default to 1, and their documentation
> says "It is illegal to set this bit to zero."

The IP_MC bit is definitively a better name and matches what exists in 
the newer switching IP, it does default to 1 there as well, and it has 
the mention that it is illegal to set to zero (makes you wonder why it 
is exposed then).

> 
> So drop the wrong B53_IPMC_FWD_EN define, enable the IP multicast bit
> also for other switch chips. While at it, rename it to (B53_)IP_MC as
> that is how it is called in Broadcom code.
> 
> Fixes: 63cc54a6f073 ("net: dsa: b53: Fix egress flooding settings")
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian