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

mlxsw: spectrum: Use correct PVID value when removing VLANs

When removing a range of VLANs in which PVID is a member we should use
the correct PVID value instead of some VLAN in the range.

Also, change two print statements to use 'dev' instead of
'mlxsw_sp_port->dev', as it's already used in other print statements in
the function.
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 f99bf205
...@@ -532,7 +532,7 @@ static int __mlxsw_sp_port_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -532,7 +532,7 @@ static int __mlxsw_sp_port_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port,
u16 vid_begin, u16 vid_end, bool init) u16 vid_begin, u16 vid_end, bool init)
{ {
struct net_device *dev = mlxsw_sp_port->dev; struct net_device *dev = mlxsw_sp_port->dev;
u16 vid, vid_e; u16 vid, vid_e, pvid;
int err; int err;
/* In case this is invoked with BRIDGE_FLAGS_SELF and port is /* In case this is invoked with BRIDGE_FLAGS_SELF and port is
...@@ -549,23 +549,21 @@ static int __mlxsw_sp_port_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -549,23 +549,21 @@ static int __mlxsw_sp_port_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port,
err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, vid, vid_e, false, err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, vid, vid_e, false,
false); false);
if (err) { if (err) {
netdev_err(mlxsw_sp_port->dev, "Unable to del VIDs %d-%d\n", netdev_err(dev, "Unable to del VIDs %d-%d\n", vid,
vid, vid_e); vid_e);
return err; return err;
} }
} }
if ((mlxsw_sp_port->pvid >= vid_begin) && pvid = mlxsw_sp_port->pvid;
(mlxsw_sp_port->pvid <= vid_end)) { if (pvid >= vid_begin && pvid <= vid_end && pvid != 1) {
/* Default VLAN is always 1 */ /* Default VLAN is always 1 */
mlxsw_sp_port->pvid = 1; err = mlxsw_sp_port_pvid_set(mlxsw_sp_port, 1);
err = mlxsw_sp_port_pvid_set(mlxsw_sp_port,
mlxsw_sp_port->pvid);
if (err) { if (err) {
netdev_err(mlxsw_sp_port->dev, "Unable to del PVID %d\n", netdev_err(dev, "Unable to del PVID %d\n", pvid);
vid);
return err; return err;
} }
mlxsw_sp_port->pvid = 1;
} }
if (init) if (init)
......
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