net: dsa: b53: implement port isolation support
Jonas Gorski
maintainerPATCH 1/1 net: dsa: b53: implement port isolation support
Implement port isolation support via the Protected Ports register.
Protected ports can only communicate with unprotected ports, but not with each other, matching the expected behaviour of isolated ports.
Tested on BCM963268BU.
--- drivers/net/dsa/b53/b53_common.c | 25 ++++++++++++++++++++++++- drivers/net/dsa/b53/b53_regs.h | 4 ++++ 2 files changed, 28 insertions(+), 1 deletion(-)
drivers/net/dsa/b53/b53_common.c +24 -1
@@ -632,6 +632,25 @@ static void b53_port_set_learning(struct b53_device *dev, int port,b53_write16 (dev,B53_CTRL_PAGE ,B53_DIS_LEARNING , reg); } +static void b53_port_set_isolated (struct b53_device *dev,int port, +bool isolated) +{ +u8 offset; +u16 reg; + +if (is5325 (dev)) + offset =B53_PROTECTED_PORT_SEL_25 ; +else + offset =B53_PROTECTED_PORT_SEL ; + +b53_read16 (dev,B53_CTRL_PAGE , offset, ®); +if (isolated) + reg |=BIT (port); +else + reg &= ~BIT (port); +b53_write16 (dev,B53_CTRL_PAGE , offset, reg); +} +static void b53_eee_enable_set (struct dsa_switch *ds,int port,bool enable) {struct b53_device *dev = ds->priv;
@@ -652,6 +671,7 @@ int b53_setup_port(struct dsa_switch *ds, int port)b53_port_set_ucast_flood (dev, port, true);b53_port_set_mcast_flood (dev, port, true);b53_port_set_learning (dev, port, false); +b53_port_set_isolated (dev, port, false);/* Force all traffic to go to the CPU port to prevent the ASIC from * trying to forward to bridged ports on matching FDB entries, then
@@ -2318,7 +2338,7 @@ int b53_br_flags_pre(struct dsa_switch *ds, int port, struct netlink_ext_ack *extack) {struct b53_device *dev = ds->priv; -unsigned long mask = (BR_FLOOD |BR_MCAST_FLOOD ); +unsigned long mask = (BR_FLOOD |BR_MCAST_FLOOD |BR_ISOLATED );if (!is5325 (dev)) mask |=BR_LEARNING ;
@@ -2343,6 +2363,9 @@ int b53_br_flags(struct dsa_switch *ds, int port,if (flags.mask &BR_LEARNING )b53_port_set_learning (ds->priv, port, !!(flags.val &BR_LEARNING )); +if (flags.mask &BR_ISOLATED ) +b53_port_set_isolated (ds->priv, port, + !!(flags.val &BR_ISOLATED ));return 0 ; }
drivers/net/dsa/b53/b53_regs.h +4 -0
@@ -120,6 +120,10 @@#define B53_SWITCH_CTRL 0x22#define B53_MII_DUMB_FWDG_EN BIT(6) +/* Protected Port Selection (16 bit) */ +#define B53_PROTECTED_PORT_SEL 0x24 +#define B53_PROTECTED_PORT_SEL_25 0x26 +/* (16 bit) */ #define B53_UC_FLOOD_MASK 0x32#define B53_MC_FLOOD_MASK 0x34
base-commit: 18a7e218cfcdca6666e1f7356533e4c988780b57
Signature · 1 line
2.43.0
Quoted 8 lines · Jonas Gorski
Implement port isolation support via the Protected Ports register.
Protected ports can only communicate with unprotected ports, but not with each other, matching the expected behaviour of isolated ports.
Tested on BCM963268BU.
Signed-off-by Jonas Gorski <[email protected]>
Signature · 1 line
Florian
Quoted 9 lines · Jonas Gorski
Implement port isolation support via the Protected Ports register.
Protected ports can only communicate with unprotected ports, but not with each other, matching the expected behaviour of isolated ports.
Tested on BCM963268BU.
Signed-off-by Jonas Gorski <[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 Mon, 13 Oct 2025 17:28:34 +0200 you wrote:
Implement port isolation support via the Protected Ports register.
Protected ports can only communicate with unprotected ports, but not with each other, matching the expected behaviour of isolated ports.
Tested on BCM963268BU.
[...]
Here is the summary with links:
- [net-next] net: dsa: b53: implement port isolation support
https://git.kernel.org/netdev/net-next/c/bdec4271e808
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html