Commit 3d49ee21 authored by Matthias Schiffer's avatar Matthias Schiffer Committed by David S. Miller

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: default avatarMatthias Schiffer <mschiffer@universe-factory.net>
Reviewed-by: default avatarWojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
Tested-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c25c961f
...@@ -1311,6 +1311,7 @@ static void mt7530_update_port_member(struct mt7530_priv *priv, int port, ...@@ -1311,6 +1311,7 @@ static void mt7530_update_port_member(struct mt7530_priv *priv, int port,
struct dsa_port *cpu_dp = dp->cpu_dp; struct dsa_port *cpu_dp = dp->cpu_dp;
u32 port_bitmap = BIT(cpu_dp->index); u32 port_bitmap = BIT(cpu_dp->index);
int other_port; int other_port;
bool isolated;
dsa_switch_for_each_user_port(other_dp, priv->ds) { dsa_switch_for_each_user_port(other_dp, priv->ds) {
other_port = other_dp->index; other_port = other_dp->index;
...@@ -1327,7 +1328,9 @@ static void mt7530_update_port_member(struct mt7530_priv *priv, int port, ...@@ -1327,7 +1328,9 @@ static void mt7530_update_port_member(struct mt7530_priv *priv, int port,
if (!dsa_port_offloads_bridge_dev(other_dp, bridge_dev)) if (!dsa_port_offloads_bridge_dev(other_dp, bridge_dev))
continue; continue;
if (join) { isolated = p->isolated && other_p->isolated;
if (join && !isolated) {
other_p->pm |= PCR_MATRIX(BIT(port)); other_p->pm |= PCR_MATRIX(BIT(port));
port_bitmap |= BIT(other_port); port_bitmap |= BIT(other_port);
} else { } else {
...@@ -1354,7 +1357,7 @@ mt7530_port_pre_bridge_flags(struct dsa_switch *ds, int port, ...@@ -1354,7 +1357,7 @@ mt7530_port_pre_bridge_flags(struct dsa_switch *ds, int port,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
if (flags.mask & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | if (flags.mask & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD |
BR_BCAST_FLOOD)) BR_BCAST_FLOOD | BR_ISOLATED))
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -1383,6 +1386,17 @@ mt7530_port_bridge_flags(struct dsa_switch *ds, int port, ...@@ -1383,6 +1386,17 @@ mt7530_port_bridge_flags(struct dsa_switch *ds, int port,
mt7530_rmw(priv, MT753X_MFC, BC_FFP(BIT(port)), mt7530_rmw(priv, MT753X_MFC, BC_FFP(BIT(port)),
flags.val & BR_BCAST_FLOOD ? BC_FFP(BIT(port)) : 0); flags.val & BR_BCAST_FLOOD ? BC_FFP(BIT(port)) : 0);
if (flags.mask & BR_ISOLATED) {
struct dsa_port *dp = dsa_to_port(ds, port);
struct net_device *bridge_dev = dsa_port_bridge_dev_get(dp);
priv->ports[port].isolated = !!(flags.val & BR_ISOLATED);
mutex_lock(&priv->reg_mutex);
mt7530_update_port_member(priv, port, bridge_dev, true);
mutex_unlock(&priv->reg_mutex);
}
return 0; return 0;
} }
......
...@@ -721,6 +721,7 @@ struct mt7530_fdb { ...@@ -721,6 +721,7 @@ struct mt7530_fdb {
*/ */
struct mt7530_port { struct mt7530_port {
bool enable; bool enable;
bool isolated;
u32 pm; u32 pm;
u16 pvid; u16 pvid;
struct phylink_pcs *sgmii_pcs; struct phylink_pcs *sgmii_pcs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment