Commit c12f4c6a authored by Moshe Shemesh's avatar Moshe Shemesh Committed by Jakub Kicinski

net/mlx5: Move fw reset unload to mlx5_fw_reset_complete_reload

Refactor fw reset code to have the unload driver part done on
mlx5_fw_reset_complete_reload(), so if it was called by the PF which
initiated the reload fw activate flow, the unload part will be handled
by the mlx5_devlink_reload_fw_activate() callback itself and not by the
reset event work.

This will be used by the downstream patch to invoke devlink reload
callbacks with devlink lock held.
Signed-off-by: default avatarMoshe Shemesh <moshe@nvidia.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 2dec18ad
...@@ -104,7 +104,16 @@ static int mlx5_devlink_reload_fw_activate(struct devlink *devlink, struct netli ...@@ -104,7 +104,16 @@ static int mlx5_devlink_reload_fw_activate(struct devlink *devlink, struct netli
if (err) if (err)
return err; return err;
return mlx5_fw_reset_wait_reset_done(dev); err = mlx5_fw_reset_wait_reset_done(dev);
if (err)
return err;
mlx5_unload_one(dev);
err = mlx5_health_wait_pci_up(dev);
if (err)
NL_SET_ERR_MSG_MOD(extack, "FW activate aborted, PCI reads fail after reset");
return err;
} }
static int mlx5_devlink_trigger_fw_live_patch(struct devlink *devlink, static int mlx5_devlink_trigger_fw_live_patch(struct devlink *devlink,
......
...@@ -149,6 +149,9 @@ static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev) ...@@ -149,6 +149,9 @@ static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev)
if (test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags)) { if (test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags)) {
complete(&fw_reset->done); complete(&fw_reset->done);
} else { } else {
mlx5_unload_one(dev);
if (mlx5_health_wait_pci_up(dev))
mlx5_core_err(dev, "reset reload flow aborted, PCI reads still not working\n");
mlx5_load_one(dev, false); mlx5_load_one(dev, false);
devlink_remote_reload_actions_performed(priv_to_devlink(dev), 0, devlink_remote_reload_actions_performed(priv_to_devlink(dev), 0,
BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) | BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) |
...@@ -183,15 +186,9 @@ static void mlx5_sync_reset_reload_work(struct work_struct *work) ...@@ -183,15 +186,9 @@ static void mlx5_sync_reset_reload_work(struct work_struct *work)
struct mlx5_fw_reset *fw_reset = container_of(work, struct mlx5_fw_reset, struct mlx5_fw_reset *fw_reset = container_of(work, struct mlx5_fw_reset,
reset_reload_work); reset_reload_work);
struct mlx5_core_dev *dev = fw_reset->dev; struct mlx5_core_dev *dev = fw_reset->dev;
int err;
mlx5_sync_reset_clear_reset_requested(dev, false); mlx5_sync_reset_clear_reset_requested(dev, false);
mlx5_enter_error_state(dev, true); mlx5_enter_error_state(dev, true);
mlx5_unload_one(dev);
err = mlx5_health_wait_pci_up(dev);
if (err)
mlx5_core_err(dev, "reset reload flow aborted, PCI reads still not working\n");
fw_reset->ret = err;
mlx5_fw_reset_complete_reload(dev); mlx5_fw_reset_complete_reload(dev);
} }
...@@ -395,7 +392,6 @@ static void mlx5_sync_reset_now_event(struct work_struct *work) ...@@ -395,7 +392,6 @@ static void mlx5_sync_reset_now_event(struct work_struct *work)
} }
mlx5_enter_error_state(dev, true); mlx5_enter_error_state(dev, true);
mlx5_unload_one(dev);
done: done:
fw_reset->ret = err; fw_reset->ret = err;
mlx5_fw_reset_complete_reload(dev); mlx5_fw_reset_complete_reload(dev);
......
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