Commit b54eb093 authored by Ioana Ciornei's avatar Ioana Ciornei Committed by David S. Miller

dpaa2-switch: add support for configuring per port broadcast flooding

The BR_BCAST_FLOOD bridge port flag is now accepted by the driver and a
change in its state will determine a reconfiguration of the broadcast
egress flooding list on the FDB associated with the port.
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1e7cbabf
...@@ -127,6 +127,9 @@ static void dpaa2_switch_fdb_get_flood_cfg(struct ethsw_core *ethsw, u16 fdb_id, ...@@ -127,6 +127,9 @@ static void dpaa2_switch_fdb_get_flood_cfg(struct ethsw_core *ethsw, u16 fdb_id,
if (ethsw->ports[j]->fdb->fdb_id != fdb_id) if (ethsw->ports[j]->fdb->fdb_id != fdb_id)
continue; continue;
if (type == DPSW_BROADCAST && ethsw->ports[j]->bcast_flood)
cfg->if_id[i++] = ethsw->ports[j]->idx;
else if (type == DPSW_FLOODING)
cfg->if_id[i++] = ethsw->ports[j]->idx; cfg->if_id[i++] = ethsw->ports[j]->idx;
} }
...@@ -1260,11 +1263,22 @@ static int dpaa2_switch_port_set_learning(struct ethsw_port_priv *port_priv, boo ...@@ -1260,11 +1263,22 @@ static int dpaa2_switch_port_set_learning(struct ethsw_port_priv *port_priv, boo
return err; return err;
} }
static int dpaa2_switch_port_flood(struct ethsw_port_priv *port_priv,
struct switchdev_brport_flags flags)
{
struct ethsw_core *ethsw = port_priv->ethsw_data;
if (flags.mask & BR_BCAST_FLOOD)
port_priv->bcast_flood = !!(flags.val & BR_BCAST_FLOOD);
return dpaa2_switch_fdb_set_egress_flood(ethsw, port_priv->fdb->fdb_id);
}
static int dpaa2_switch_port_pre_bridge_flags(struct net_device *netdev, static int dpaa2_switch_port_pre_bridge_flags(struct net_device *netdev,
struct switchdev_brport_flags flags, struct switchdev_brport_flags flags,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
if (flags.mask & ~(BR_LEARNING)) if (flags.mask & ~(BR_LEARNING | BR_BCAST_FLOOD))
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -1285,6 +1299,12 @@ static int dpaa2_switch_port_bridge_flags(struct net_device *netdev, ...@@ -1285,6 +1299,12 @@ static int dpaa2_switch_port_bridge_flags(struct net_device *netdev,
return err; return err;
} }
if (flags.mask & BR_BCAST_FLOOD) {
err = dpaa2_switch_port_flood(port_priv, flags);
if (err)
return err;
}
return 0; return 0;
} }
...@@ -1643,6 +1663,12 @@ static int dpaa2_switch_port_bridge_leave(struct net_device *netdev) ...@@ -1643,6 +1663,12 @@ static int dpaa2_switch_port_bridge_leave(struct net_device *netdev)
if (err) if (err)
netdev_err(netdev, "Unable to restore RX VLANs to the new FDB, err (%d)\n", err); netdev_err(netdev, "Unable to restore RX VLANs to the new FDB, err (%d)\n", err);
/* Reset the flooding state to denote that this port can send any
* packet in standalone mode. With this, we are also ensuring that any
* later bridge join will have the flooding flag on.
*/
port_priv->bcast_flood = true;
/* Setup the egress flood policy (broadcast, unknown unicast). /* Setup the egress flood policy (broadcast, unknown unicast).
* When the port is not under a bridge, only the CTRL interface is part * When the port is not under a bridge, only the CTRL interface is part
* of the flooding domain besides the actual port * of the flooding domain besides the actual port
...@@ -2728,6 +2754,8 @@ static int dpaa2_switch_probe_port(struct ethsw_core *ethsw, ...@@ -2728,6 +2754,8 @@ static int dpaa2_switch_probe_port(struct ethsw_core *ethsw,
port_netdev->needed_headroom = DPAA2_SWITCH_NEEDED_HEADROOM; port_netdev->needed_headroom = DPAA2_SWITCH_NEEDED_HEADROOM;
port_priv->bcast_flood = true;
/* Set MTU limits */ /* Set MTU limits */
port_netdev->min_mtu = ETH_MIN_MTU; port_netdev->min_mtu = ETH_MIN_MTU;
port_netdev->max_mtu = ETHSW_MAX_FRAME_LENGTH; port_netdev->max_mtu = ETHSW_MAX_FRAME_LENGTH;
......
...@@ -105,13 +105,13 @@ struct ethsw_port_priv { ...@@ -105,13 +105,13 @@ struct ethsw_port_priv {
struct ethsw_core *ethsw_data; struct ethsw_core *ethsw_data;
u8 link_state; u8 link_state;
u8 stp_state; u8 stp_state;
bool flood;
u8 vlans[VLAN_VID_MASK + 1]; u8 vlans[VLAN_VID_MASK + 1];
u16 pvid; u16 pvid;
u16 tx_qdid; u16 tx_qdid;
struct dpaa2_switch_fdb *fdb; struct dpaa2_switch_fdb *fdb;
bool bcast_flood;
}; };
/* Switch data */ /* Switch data */
......
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