Re: [RFC PATCH 08/10] net: dsa: b53: fix unicast/multicast flooding on BCM5325

From: Vladimir Oltean
Date: Mon Jun 02 2025 - 05:46:03 EST


On Sat, May 31, 2025 at 12:13:06PM +0200, Álvaro Fernández Rojas wrote:
> BCM5325 doesn't implement UC_FLOOD_MASK, MC_FLOOD_MASK and IPMC_FLOOD_MASK
> registers.
> This has to be handled differently with other pages and registers.
>
> Fixes: a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags")
> Signed-off-by: Álvaro Fernández Rojas <noltari@xxxxxxxxx>
> ---
> drivers/net/dsa/b53/b53_common.c | 85 +++++++++++++++++++++++++-------
> drivers/net/dsa/b53/b53_regs.h | 38 ++++++++++++++
> 2 files changed, 105 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
> index 387e1e7ec749..d5216ea2c984 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
> @@ -560,12 +560,36 @@ static void b53_port_set_ucast_flood(struct b53_device *dev, int port,
> {
> u16 uc;
>
> - b53_read16(dev, B53_CTRL_PAGE, B53_UC_FLOOD_MASK, &uc);
> - if (unicast)
> - uc |= BIT(port);
> - else
> - uc &= ~BIT(port);
> - b53_write16(dev, B53_CTRL_PAGE, B53_UC_FLOOD_MASK, uc);
> + if (is5325(dev)) {

Maybe instead of a big "if (is5325(dev)) else", you could have this instead?

if (is5325(dev))
return b5325_port_set_ucast_flood();

... // go on with regular procedure

Here and in other places.