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

mlxsw: spectrum: Make unlinking functions return void

When responding to unlinking CHANGEUPPER notifications we shouldn't
return any value, as it's not checked by upper layers.

In addition, there's nothing the driver can do in case of failure, so it
should simply continue and try to free as much resources as possible and
not stop on first error.
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 423b937e
......@@ -2673,7 +2673,7 @@ static int mlxsw_sp_port_bridge_join(struct mlxsw_sp_port *mlxsw_sp_port)
return 0;
}
static int mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port,
static void mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port,
bool flush_fdb)
{
struct net_device *dev = mlxsw_sp_port->dev;
......@@ -2691,7 +2691,7 @@ static int mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port,
/* Add implicit VLAN interface in the device, so that untagged
* packets will be classified to the default vFID.
*/
return mlxsw_sp_port_add_vid(dev, 0, 1);
mlxsw_sp_port_add_vid(dev, 0, 1);
}
static bool mlxsw_sp_master_bridge_check(struct mlxsw_sp *mlxsw_sp,
......@@ -2873,30 +2873,25 @@ static int mlxsw_sp_port_lag_join(struct mlxsw_sp_port *mlxsw_sp_port,
return err;
}
static int mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport,
static void mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport,
struct net_device *br_dev,
bool flush_fdb);
static int mlxsw_sp_port_lag_leave(struct mlxsw_sp_port *mlxsw_sp_port,
static void mlxsw_sp_port_lag_leave(struct mlxsw_sp_port *mlxsw_sp_port,
struct net_device *lag_dev)
{
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
struct mlxsw_sp_port *mlxsw_sp_vport;
struct mlxsw_sp_upper *lag;
u16 lag_id = mlxsw_sp_port->lag_id;
int err;
if (!mlxsw_sp_port->lagged)
return 0;
return;
lag = mlxsw_sp_lag_get(mlxsw_sp, lag_id);
WARN_ON(lag->ref_count == 0);
err = mlxsw_sp_lag_col_port_disable(mlxsw_sp_port, lag_id);
if (err)
return err;
err = mlxsw_sp_lag_col_port_remove(mlxsw_sp_port, lag_id);
if (err)
return err;
mlxsw_sp_lag_col_port_disable(mlxsw_sp_port, lag_id);
mlxsw_sp_lag_col_port_remove(mlxsw_sp_port, lag_id);
/* In case we leave a LAG device that has bridges built on top,
* then their teardown sequence is never issued and we need to
......@@ -2922,16 +2917,13 @@ static int mlxsw_sp_port_lag_leave(struct mlxsw_sp_port *mlxsw_sp_port,
if (lag->ref_count == 1) {
if (mlxsw_sp_port_fdb_flush_by_lag_id(mlxsw_sp_port))
netdev_err(mlxsw_sp_port->dev, "Failed to flush FDB\n");
err = mlxsw_sp_lag_destroy(mlxsw_sp, lag_id);
if (err)
return err;
mlxsw_sp_lag_destroy(mlxsw_sp, lag_id);
}
mlxsw_core_lag_mapping_clear(mlxsw_sp->core, lag_id,
mlxsw_sp_port->local_port);
mlxsw_sp_port->lagged = 0;
lag->ref_count--;
return 0;
}
static int mlxsw_sp_lag_dist_port_add(struct mlxsw_sp_port *mlxsw_sp_port,
......@@ -2988,7 +2980,7 @@ static int mlxsw_sp_port_vlan_link(struct mlxsw_sp_port *mlxsw_sp_port,
return 0;
}
static int mlxsw_sp_port_vlan_unlink(struct mlxsw_sp_port *mlxsw_sp_port,
static void mlxsw_sp_port_vlan_unlink(struct mlxsw_sp_port *mlxsw_sp_port,
struct net_device *vlan_dev)
{
struct mlxsw_sp_port *mlxsw_sp_vport;
......@@ -2996,7 +2988,7 @@ static int mlxsw_sp_port_vlan_unlink(struct mlxsw_sp_port *mlxsw_sp_port,
mlxsw_sp_vport = mlxsw_sp_port_vport_find(mlxsw_sp_port, vid);
if (WARN_ON(!mlxsw_sp_vport))
return -EINVAL;
return;
/* When removing a VLAN device while still bridged we should first
* remove it from the bridge, as we receive the bridge's notification
......@@ -3010,8 +3002,6 @@ static int mlxsw_sp_port_vlan_unlink(struct mlxsw_sp_port *mlxsw_sp_port,
}
mlxsw_sp_vport->dev = mlxsw_sp_port->dev;
return 0;
}
static int mlxsw_sp_netdevice_port_upper_event(struct net_device *dev,
......@@ -3057,15 +3047,14 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *dev,
err = mlxsw_sp_port_vlan_link(mlxsw_sp_port,
upper_dev);
else
err = mlxsw_sp_port_vlan_unlink(mlxsw_sp_port,
mlxsw_sp_port_vlan_unlink(mlxsw_sp_port,
upper_dev);
} else if (netif_is_bridge_master(upper_dev)) {
if (info->linking) {
err = mlxsw_sp_port_bridge_join(mlxsw_sp_port);
mlxsw_sp_master_bridge_inc(mlxsw_sp, upper_dev);
} else {
err = mlxsw_sp_port_bridge_leave(mlxsw_sp_port,
true);
mlxsw_sp_port_bridge_leave(mlxsw_sp_port, true);
mlxsw_sp_master_bridge_dec(mlxsw_sp, upper_dev);
}
} else if (netif_is_lag_master(upper_dev)) {
......@@ -3073,7 +3062,7 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *dev,
err = mlxsw_sp_port_lag_join(mlxsw_sp_port,
upper_dev);
else
err = mlxsw_sp_port_lag_leave(mlxsw_sp_port,
mlxsw_sp_port_lag_leave(mlxsw_sp_port,
upper_dev);
} else {
err = -EINVAL;
......@@ -3221,7 +3210,7 @@ static void mlxsw_sp_br_vfid_destroy(struct mlxsw_sp *mlxsw_sp,
kfree(vfid);
}
static int mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport,
static void mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport,
struct net_device *br_dev,
bool flush_fdb)
{
......@@ -3233,7 +3222,7 @@ static int mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport,
vfid = mlxsw_sp_br_vfid_find(mlxsw_sp, br_dev);
if (WARN_ON(!vfid))
return -EINVAL;
return;
/* We need a vFID to go back to after leaving the bridge's vFID. */
new_vfid = mlxsw_sp_vfid_find(mlxsw_sp, vid);
......@@ -3242,7 +3231,7 @@ static int mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport,
if (IS_ERR(new_vfid)) {
netdev_err(dev, "Failed to create vFID for VID=%d\n",
vid);
return PTR_ERR(new_vfid);
return;
}
}
......@@ -3306,7 +3295,7 @@ static int mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport,
mlxsw_sp_vport->uc_flood = 0;
mlxsw_sp_vport->bridged = 0;
return 0;
return;
err_port_stp_state_set:
err_vport_flood_set:
......@@ -3316,7 +3305,6 @@ static int mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport,
/* Rollback vFID only if new. */
if (!new_vfid->nr_vports)
mlxsw_sp_vfid_destroy(mlxsw_sp, new_vfid);
return err;
}
static int mlxsw_sp_vport_bridge_join(struct mlxsw_sp_port *mlxsw_sp_vport,
......@@ -3459,8 +3447,8 @@ static int mlxsw_sp_netdevice_vport_event(struct net_device *dev,
*/
if (!mlxsw_sp_vport)
return 0;
err = mlxsw_sp_vport_bridge_leave(mlxsw_sp_vport,
upper_dev, true);
mlxsw_sp_vport_bridge_leave(mlxsw_sp_vport, upper_dev,
true);
}
}
......
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