Skip to content

Commit b67ff41

Browse files
committed
net/mlx5: Fix sync reset event handler error flow
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2131117 Upstream commit(s): commit e1ad07b Author: Moshe Shemesh <moshe@nvidia.com> Date: Sat Oct 29 09:03:48 2022 +0300 net/mlx5: Fix sync reset event handler error flow When sync reset now event handling fails on mlx5_pci_link_toggle() then no reset was done. However, since mlx5_cmd_fast_teardown_hca() was already done, the firmware function is closed and the driver is left without firmware functionality. Fix it by setting device error state and reopen the firmware resources. Reopening is done by the thread that was called for devlink reload fw_activate as it already holds the devlink lock. Fixes: 5ec6974 ("net/mlx5: Add support for devlink reload action fw activate") Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Aya Levin <ayal@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Petr Oros <poros@redhat.com>
1 parent 0c43f52 commit b67ff41

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ enum {
99
MLX5_FW_RESET_FLAGS_RESET_REQUESTED,
1010
MLX5_FW_RESET_FLAGS_NACK_RESET_REQUEST,
1111
MLX5_FW_RESET_FLAGS_PENDING_COMP,
12-
MLX5_FW_RESET_FLAGS_DROP_NEW_REQUESTS
12+
MLX5_FW_RESET_FLAGS_DROP_NEW_REQUESTS,
13+
MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED
1314
};
1415

1516
struct mlx5_fw_reset {
@@ -388,7 +389,7 @@ static void mlx5_sync_reset_now_event(struct work_struct *work)
388389
err = mlx5_pci_link_toggle(dev);
389390
if (err) {
390391
mlx5_core_warn(dev, "mlx5_pci_link_toggle failed, no reset done, err %d\n", err);
391-
goto done;
392+
set_bit(MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED, &fw_reset->reset_flags);
392393
}
393394

394395
mlx5_enter_error_state(dev, true);
@@ -464,6 +465,10 @@ int mlx5_fw_reset_wait_reset_done(struct mlx5_core_dev *dev)
464465
goto out;
465466
}
466467
err = fw_reset->ret;
468+
if (test_and_clear_bit(MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED, &fw_reset->reset_flags)) {
469+
mlx5_unload_one_devl_locked(dev);
470+
mlx5_load_one_devl_locked(dev, false);
471+
}
467472
out:
468473
clear_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags);
469474
return err;

0 commit comments

Comments
 (0)