net/mlx5: E-switch, Set to legacy mode if failed to change switchdev mode
No need to rollback to the other mode because probably will fail
again. Just set to legacy mode and clear fdb table created flag.
So that fdb table will not be cleared again.
Fixes: f019679ea5
("net/mlx5: E-switch, Remove dependency between sriov and eswitch mode")
Signed-off-by: Chris Mi <cmi@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
Родитель
2808b37b59
Коммит
e12de39c07
|
@ -1387,12 +1387,14 @@ void mlx5_eswitch_disable_locked(struct mlx5_eswitch *esw)
|
|||
esw->mode == MLX5_ESWITCH_LEGACY ? "LEGACY" : "OFFLOADS",
|
||||
esw->esw_funcs.num_vfs, esw->enabled_vports);
|
||||
|
||||
esw->fdb_table.flags &= ~MLX5_ESW_FDB_CREATED;
|
||||
if (esw->mode == MLX5_ESWITCH_OFFLOADS)
|
||||
esw_offloads_disable(esw);
|
||||
else if (esw->mode == MLX5_ESWITCH_LEGACY)
|
||||
esw_legacy_disable(esw);
|
||||
mlx5_esw_acls_ns_cleanup(esw);
|
||||
if (esw->fdb_table.flags & MLX5_ESW_FDB_CREATED) {
|
||||
esw->fdb_table.flags &= ~MLX5_ESW_FDB_CREATED;
|
||||
if (esw->mode == MLX5_ESWITCH_OFFLOADS)
|
||||
esw_offloads_disable(esw);
|
||||
else if (esw->mode == MLX5_ESWITCH_LEGACY)
|
||||
esw_legacy_disable(esw);
|
||||
mlx5_esw_acls_ns_cleanup(esw);
|
||||
}
|
||||
|
||||
if (esw->mode == MLX5_ESWITCH_OFFLOADS)
|
||||
devl_rate_nodes_destroy(devlink);
|
||||
|
|
|
@ -2310,7 +2310,7 @@ out_free:
|
|||
static int esw_offloads_start(struct mlx5_eswitch *esw,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
int err, err1;
|
||||
int err;
|
||||
|
||||
esw->mode = MLX5_ESWITCH_OFFLOADS;
|
||||
err = mlx5_eswitch_enable_locked(esw, esw->dev->priv.sriov.num_vfs);
|
||||
|
@ -2318,11 +2318,6 @@ static int esw_offloads_start(struct mlx5_eswitch *esw,
|
|||
NL_SET_ERR_MSG_MOD(extack,
|
||||
"Failed setting eswitch to offloads");
|
||||
esw->mode = MLX5_ESWITCH_LEGACY;
|
||||
err1 = mlx5_eswitch_enable_locked(esw, MLX5_ESWITCH_IGNORE_NUM_VFS);
|
||||
if (err1) {
|
||||
NL_SET_ERR_MSG_MOD(extack,
|
||||
"Failed setting eswitch back to legacy");
|
||||
}
|
||||
mlx5_rescan_drivers(esw->dev);
|
||||
}
|
||||
if (esw->offloads.inline_mode == MLX5_INLINE_MODE_NONE) {
|
||||
|
@ -3389,19 +3384,12 @@ err_metadata:
|
|||
static int esw_offloads_stop(struct mlx5_eswitch *esw,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
int err, err1;
|
||||
int err;
|
||||
|
||||
esw->mode = MLX5_ESWITCH_LEGACY;
|
||||
err = mlx5_eswitch_enable_locked(esw, MLX5_ESWITCH_IGNORE_NUM_VFS);
|
||||
if (err) {
|
||||
if (err)
|
||||
NL_SET_ERR_MSG_MOD(extack, "Failed setting eswitch to legacy");
|
||||
esw->mode = MLX5_ESWITCH_OFFLOADS;
|
||||
err1 = mlx5_eswitch_enable_locked(esw, MLX5_ESWITCH_IGNORE_NUM_VFS);
|
||||
if (err1) {
|
||||
NL_SET_ERR_MSG_MOD(extack,
|
||||
"Failed setting eswitch back to offloads");
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче