net: dsa: realtek: rtl8366rb: Fix up port isolation
Linus Walleij
maintainerPATCH v4 1/1 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.
---
Changes in v4:
- Fix the bug by going back to passing 0 (disable forwarding
to all ports) and just enforcing the enable bit so that
isolation is turned on with all zeroes in the port mask.
- Link to v3: https://patch.msgid.link/[email protected]
Changes in v3:
- Fixup the erroneous shifted bitmask (I did not have my coffee...)
- Use GENMASK(ds->num_ports - 1, 0) top properly create a bitmask of
all the ports, and isolate every port from every port.
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Properly fix the issue by setting all isolation bits to 1.
- Link to v1: https://patch.msgid.link/[email protected]
--- drivers/net/dsa/realtek/rtl8366rb.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/dsa/realtek/rtl8366rb.c +4 -5
@@ -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;
---
base-commit: 23dad2d088dfc82cae1f5a936f8ff7ffebb38dd9
change-id: 20260702-rtl8366rb-fixes-a93f831ec2a4
Best regards,
Signature · 1 line
Linus Walleij <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Fri, 31 Jul 2026 23:06:06 +0200 you wrote:
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.[...]
Here is the summary with links:
- [net-next,v4] net: dsa: realtek: rtl8366rb: Fix up port isolation
https://git.kernel.org/netdev/net-next/c/6d356e408670
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html