Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: dsa: mt7530: add support for bridge port isolation

Remove a pair of ports from the port matrix when both ports have the
isolated flag set.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Matthias Schiffer and committed by
David S. Miller
3d49ee21 c25c961f

+17 -2
+16 -2
drivers/net/dsa/mt7530.c
··· 1311 1311 struct dsa_port *cpu_dp = dp->cpu_dp; 1312 1312 u32 port_bitmap = BIT(cpu_dp->index); 1313 1313 int other_port; 1314 + bool isolated; 1314 1315 1315 1316 dsa_switch_for_each_user_port(other_dp, priv->ds) { 1316 1317 other_port = other_dp->index; ··· 1328 1327 if (!dsa_port_offloads_bridge_dev(other_dp, bridge_dev)) 1329 1328 continue; 1330 1329 1331 - if (join) { 1330 + isolated = p->isolated && other_p->isolated; 1331 + 1332 + if (join && !isolated) { 1332 1333 other_p->pm |= PCR_MATRIX(BIT(port)); 1333 1334 port_bitmap |= BIT(other_port); 1334 1335 } else { ··· 1357 1354 struct netlink_ext_ack *extack) 1358 1355 { 1359 1356 if (flags.mask & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | 1360 - BR_BCAST_FLOOD)) 1357 + BR_BCAST_FLOOD | BR_ISOLATED)) 1361 1358 return -EINVAL; 1362 1359 1363 1360 return 0; ··· 1385 1382 if (flags.mask & BR_BCAST_FLOOD) 1386 1383 mt7530_rmw(priv, MT753X_MFC, BC_FFP(BIT(port)), 1387 1384 flags.val & BR_BCAST_FLOOD ? BC_FFP(BIT(port)) : 0); 1385 + 1386 + if (flags.mask & BR_ISOLATED) { 1387 + struct dsa_port *dp = dsa_to_port(ds, port); 1388 + struct net_device *bridge_dev = dsa_port_bridge_dev_get(dp); 1389 + 1390 + priv->ports[port].isolated = !!(flags.val & BR_ISOLATED); 1391 + 1392 + mutex_lock(&priv->reg_mutex); 1393 + mt7530_update_port_member(priv, port, bridge_dev, true); 1394 + mutex_unlock(&priv->reg_mutex); 1395 + } 1388 1396 1389 1397 return 0; 1390 1398 }
+1
drivers/net/dsa/mt7530.h
··· 721 721 */ 722 722 struct mt7530_port { 723 723 bool enable; 724 + bool isolated; 724 725 u32 pm; 725 726 u16 pvid; 726 727 struct phylink_pcs *sgmii_pcs;