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: Ioana Ciornei <ioana.ciornei@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1e7cbabfdb
commit
b54eb093f5
drivers/net/ethernet/freescale/dpaa2
@ -127,7 +127,10 @@ static void dpaa2_switch_fdb_get_flood_cfg(struct ethsw_core *ethsw, u16 fdb_id,
|
||||
if (ethsw->ports[j]->fdb->fdb_id != fdb_id)
|
||||
continue;
|
||||
|
||||
cfg->if_id[i++] = ethsw->ports[j]->idx;
|
||||
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;
|
||||
}
|
||||
|
||||
/* Add the CTRL interface to the egress flooding domain */
|
||||
@ -1260,11 +1263,22 @@ static int dpaa2_switch_port_set_learning(struct ethsw_port_priv *port_priv, boo
|
||||
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,
|
||||
struct switchdev_brport_flags flags,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
if (flags.mask & ~(BR_LEARNING))
|
||||
if (flags.mask & ~(BR_LEARNING | BR_BCAST_FLOOD))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
@ -1285,6 +1299,12 @@ static int dpaa2_switch_port_bridge_flags(struct net_device *netdev,
|
||||
return err;
|
||||
}
|
||||
|
||||
if (flags.mask & BR_BCAST_FLOOD) {
|
||||
err = dpaa2_switch_port_flood(port_priv, flags);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1643,6 +1663,12 @@ static int dpaa2_switch_port_bridge_leave(struct net_device *netdev)
|
||||
if (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).
|
||||
* When the port is not under a bridge, only the CTRL interface is part
|
||||
* of the flooding domain besides the actual port
|
||||
@ -2728,6 +2754,8 @@ static int dpaa2_switch_probe_port(struct ethsw_core *ethsw,
|
||||
|
||||
port_netdev->needed_headroom = DPAA2_SWITCH_NEEDED_HEADROOM;
|
||||
|
||||
port_priv->bcast_flood = true;
|
||||
|
||||
/* Set MTU limits */
|
||||
port_netdev->min_mtu = ETH_MIN_MTU;
|
||||
port_netdev->max_mtu = ETHSW_MAX_FRAME_LENGTH;
|
||||
|
@ -105,13 +105,13 @@ struct ethsw_port_priv {
|
||||
struct ethsw_core *ethsw_data;
|
||||
u8 link_state;
|
||||
u8 stp_state;
|
||||
bool flood;
|
||||
|
||||
u8 vlans[VLAN_VID_MASK + 1];
|
||||
u16 pvid;
|
||||
u16 tx_qdid;
|
||||
|
||||
struct dpaa2_switch_fdb *fdb;
|
||||
bool bcast_flood;
|
||||
};
|
||||
|
||||
/* Switch data */
|
||||
|
Loading…
x
Reference in New Issue
Block a user