net: dsa: realtek: rtl8366rb: Fix up port isolation

Sashiko reports that we incorrectly disable isolation in the setup
loop while what we want to do is to enable it.

Enable it by unconditionally setting the enable bit 0 in
rtl8366rb_port_set_isolation() so a mask of 0 when passed in
will enable isolation and isolate from ALL ports.

Fix up the comments so it is clear what is going on, including a
missing word in the helper function.

Reported-by: Paolo Abeni <pabeni@redhat.com>
Closes: https://sashiko.dev/#/patchset/20260630-rtl8366rb-improvements-v2-0-05eb9d6a37f5%40kernel.org
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260731-rtl8366rb-fixes-v4-1-fbf0c95b829a@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Linus Walleij
2026-07-31 23:06:06 +02:00
committed by Jakub Kicinski
parent c509971352
commit 6d356e4086

View File

@@ -794,11 +794,10 @@ static int rtl8366rb_setup_all_leds_off(struct realtek_priv *priv)
static int rtl8366rb_port_set_isolation(struct realtek_priv *priv, int port,
u32 mask)
{
/* Bit 0 enables isolation so set this if we enable isolation
* any of the ports an clear it if we disable on all of them.
/* Bit 0 enables isolation, the mask indicates allowed forwarding
* ports
*/
if (mask)
mask = RTL8366RB_PORT_ISO_PORTS(mask) | RTL8366RB_PORT_ISO_EN;
mask = RTL8366RB_PORT_ISO_PORTS(mask) | RTL8366RB_PORT_ISO_EN;
return regmap_write(priv->map, RTL8366RB_PORT_ISO(port),
mask);
@@ -974,7 +973,7 @@ static int rtl8366rb_setup(struct dsa_switch *ds)
if (!dsa_port_is_user(dp))
continue;
/* Forward only to the CPU */
/* Forward only to the CPU(s), isolate from all other ports */
ret = rtl8366rb_port_set_isolation(priv, dp->index, upports_mask);
if (ret)
return ret;