Commit b414970e authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

mlxsw: spectrum: Sanitize bridge's upper devices

We're going to allow bridges stacked on top of port netdevs to be
enslaved to a VRF, but for now, only VLAN uppers of the VLAN-aware
bridge are supported.

Sanitize any other bridge upper. This is consistent with the way we
sanitize port netdevs' uppers.
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1015d743
...@@ -4565,33 +4565,40 @@ static int mlxsw_sp_netdevice_bridge_event(struct net_device *br_dev, ...@@ -4565,33 +4565,40 @@ static int mlxsw_sp_netdevice_bridge_event(struct net_device *br_dev,
struct netdev_notifier_changeupper_info *info; struct netdev_notifier_changeupper_info *info;
struct net_device *upper_dev; struct net_device *upper_dev;
struct mlxsw_sp *mlxsw_sp; struct mlxsw_sp *mlxsw_sp;
int err; int err = 0;
mlxsw_sp = mlxsw_sp_lower_get(br_dev); mlxsw_sp = mlxsw_sp_lower_get(br_dev);
if (!mlxsw_sp) if (!mlxsw_sp)
return 0; return 0;
if (br_dev != mlxsw_sp->master_bridge.dev)
return 0;
info = ptr; info = ptr;
switch (event) { switch (event) {
case NETDEV_CHANGEUPPER: case NETDEV_PRECHANGEUPPER:
upper_dev = info->upper_dev; upper_dev = info->upper_dev;
if (!is_vlan_dev(upper_dev)) if (!is_vlan_dev(upper_dev))
break; return -EINVAL;
if (info->linking) { if (is_vlan_dev(upper_dev) &&
err = mlxsw_sp_master_bridge_vlan_link(mlxsw_sp, br_dev != mlxsw_sp->master_bridge.dev)
upper_dev); return -EINVAL;
if (err) break;
return err; case NETDEV_CHANGEUPPER:
upper_dev = info->upper_dev;
if (is_vlan_dev(upper_dev)) {
if (info->linking)
err = mlxsw_sp_master_bridge_vlan_link(mlxsw_sp,
upper_dev);
else
mlxsw_sp_master_bridge_vlan_unlink(mlxsw_sp,
upper_dev);
} else { } else {
mlxsw_sp_master_bridge_vlan_unlink(mlxsw_sp, upper_dev); err = -EINVAL;
WARN_ON(1);
} }
break; break;
} }
return 0; return err;
} }
static u16 mlxsw_sp_avail_vfid_get(const struct mlxsw_sp *mlxsw_sp) static u16 mlxsw_sp_avail_vfid_get(const struct mlxsw_sp *mlxsw_sp)
......
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