Re: [net-next PATCH 07/10] net: dsa: realtek: rtl8365mb: add port_bridge_{join,leave}

From: Linus Walleij

Date: Tue Apr 07 2026 - 04:12:43 EST


Hi Luiz, Alvin,

thanks for your patch!

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

> static int rtl8365mb_port_set_isolation(struct realtek_priv *priv, int port,
> u32 mask)
> +static int rtl8365mb_port_add_isolation(struct realtek_priv *priv, int port,
> + u32 mask)
> +static int rtl8365mb_port_remove_isolation(struct realtek_priv *priv, int port,
> + u32 mask)

This is smart!

> +static int rtl8365mb_port_bridge_join(struct dsa_switch *ds, int port,
> + struct dsa_bridge bridge,
> + bool *tx_forward_offload,
> + struct netlink_ext_ack *extack)
> +static void rtl8365mb_port_bridge_leave(struct dsa_switch *ds, int port,
> + struct dsa_bridge bridge)

The content of these functions are very similar to
rtl8366rb_port_bridge_join() and rtl8366rb_port_bridge_leave().

What about moving this code to the shared library rtl8366-core as
rtl8366_port_bridge_join() and rtl8366_port_bridge_leave()
and add per-variant callbacks for ->port_set_isolation()
->port_add_isolation() and ->port_remove_isolation() to
struct realtek_ops and share this with rtl8366rb by refactoring
rtl8366rb.c to use the same callbacks.

Using shared code will help us to avoid having to fix the same
bugs in more than one place.

I don't know about this EFID stuff in rtl8365mb_port_set_efid()
(maybe RTL8366RB needs something like that too) but certainly that
can be an optional callback in struct realtek_ops for now.

Yours,
Linus Walleij