Re: [net-next PATCH 09/10] net: dsa: realtek: rtl8365mb: add bridge port flags

From: Linus Walleij

Date: Tue Apr 07 2026 - 05:20:57 EST


Hi Luiz, Alvin,

On Wed, Apr 1, 2026 at 1:01 AM Luiz Angelo Daros de Luca
<luizluca@xxxxxxxxx> wrote:

> From: Alvin Šipraga <alsi@xxxxxxxxxxxxxxx>
>
> Add bridge port flags for:
> - BR_LEARNING
> - BR_FLOOD
> - BR_MCAST_FLOOD
> - BR_BCAST_FLOOD
>
> Co-developed-by: Alvin Šipraga <alsi@xxxxxxxxxxxxxxx>
> Signed-off-by: Alvin Šipraga <alsi@xxxxxxxxxxxxxxx>
> Signed-off-by: Luiz Angelo Daros de Luca <luizluca@xxxxxxxxx>

I have been working on a patch for RTL8366RB for this as well:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator.git/patch/?id=0d58a9d74f363b969c06a8ac8446e6eef5511795

> +static int rtl8365mb_port_set_ucast_flood(struct realtek_priv *priv, int port,
> + bool enable)
> +static int rtl8365mb_port_set_mcast_flood(struct realtek_priv *priv, int port,
> + bool enable)
> +static int rtl8365mb_port_set_bcast_flood(struct realtek_priv *priv, int port,
> + bool enable)

Those are small and just writing registers so I guess they can be kept local,
but I think they should be accessed indirectly through
struct realtek_ops .rtl8366_port_set_ucast_flood() etc.

I can just make a simple patch adding the same three callbacks for
RTL8366RB and then it's done for both chips.

> +static int rtl8365mb_port_pre_bridge_flags(struct dsa_switch *ds, int port,
> + struct switchdev_brport_flags flags,
> + struct netlink_ext_ack *extack)
> +static int rtl8365mb_port_bridge_flags(struct dsa_switch *ds, int port,
> + struct switchdev_brport_flags flags,
> + struct netlink_ext_ack *exack)

Move this one to rtl8366-core.c under the name rtl8366_port_[pre_]bridge_flags()
and use the abstract accessors to do the register writes.

> @@ -1691,6 +1797,8 @@ static int rtl8365mb_port_bridge_join(struct dsa_switch *ds, int port,
> int ret;
> int i;
>
> + dev_dbg(priv->dev, "bridge %d join port %d\n", port, bridge.num);
> +
> /* Add this port to the isolation group of every other port
> * offloading this bridge.
> */
> @@ -1730,6 +1838,8 @@ static void rtl8365mb_port_bridge_leave(struct dsa_switch *ds, int port,
> u32 mask = 0;
> int i;
>
> + dev_dbg(priv->dev, "bridge %d leave port %d\n", port, bridge.num);
> +
> /* Remove this port from the isolation group of every other
> * port offloading this bridge.
> */

These debug prints seem unrelated to this patch?

> @@ -2547,6 +2657,19 @@ static int rtl8365mb_setup(struct dsa_switch *ds)
> if (ret)
> goto out_teardown_irq;
>
> + /* Enable all types of flooding */
> + ret = rtl8365mb_port_set_ucast_flood(priv, i, true);
> + if (ret)
> + goto out_teardown_irq;
> +
> + ret = rtl8365mb_port_set_mcast_flood(priv, i, true);
> + if (ret)
> + goto out_teardown_irq;
> +
> + ret = rtl8365mb_port_set_bcast_flood(priv, i, true);
> + if (ret)
> + goto out_teardown_irq;

Create rtl8366_setup_flood_control() in realtek-core.c and add these
three calls as a helper using the rtl8366_* generic calls there. It will be
done the same on all chips.

Yours,
Linus Walleij