Skip to content

Commit 1726ad0

Browse files
mosheshemesh2kuba-moo
authored andcommitted
net/mlx5: Start health poll after enable hca
The health poll mechanism performs periodic checks to detect firmware errors. One of the checks verifies the function is still enabled on firmware side, but the function is enabled only after enable_hca command completed. Start health poll after enable_hca command to avoid a race between function enabled and first health polling. Fixes: 9b98d39 ("net/mlx5: Start health poll at earlier stage of driver load") Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Shay Drori <shayd@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Link: https://patch.msgid.link/1742331077-102038-3-git-send-email-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent bdf549a commit 1726ad0

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx5/core

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,24 +1205,24 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
12051205
dev->caps.embedded_cpu = mlx5_read_embedded_cpu(dev);
12061206
mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_UP);
12071207

1208-
mlx5_start_health_poll(dev);
1209-
12101208
err = mlx5_core_enable_hca(dev, 0);
12111209
if (err) {
12121210
mlx5_core_err(dev, "enable hca failed\n");
1213-
goto stop_health_poll;
1211+
goto err_cmd_cleanup;
12141212
}
12151213

1214+
mlx5_start_health_poll(dev);
1215+
12161216
err = mlx5_core_set_issi(dev);
12171217
if (err) {
12181218
mlx5_core_err(dev, "failed to set issi\n");
1219-
goto err_disable_hca;
1219+
goto stop_health_poll;
12201220
}
12211221

12221222
err = mlx5_satisfy_startup_pages(dev, 1);
12231223
if (err) {
12241224
mlx5_core_err(dev, "failed to allocate boot pages\n");
1225-
goto err_disable_hca;
1225+
goto stop_health_poll;
12261226
}
12271227

12281228
err = mlx5_tout_query_dtor(dev);
@@ -1235,10 +1235,9 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
12351235

12361236
reclaim_boot_pages:
12371237
mlx5_reclaim_startup_pages(dev);
1238-
err_disable_hca:
1239-
mlx5_core_disable_hca(dev, 0);
12401238
stop_health_poll:
12411239
mlx5_stop_health_poll(dev, boot);
1240+
mlx5_core_disable_hca(dev, 0);
12421241
err_cmd_cleanup:
12431242
mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN);
12441243
mlx5_cmd_disable(dev);
@@ -1249,8 +1248,8 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
12491248
static void mlx5_function_disable(struct mlx5_core_dev *dev, bool boot)
12501249
{
12511250
mlx5_reclaim_startup_pages(dev);
1252-
mlx5_core_disable_hca(dev, 0);
12531251
mlx5_stop_health_poll(dev, boot);
1252+
mlx5_core_disable_hca(dev, 0);
12541253
mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN);
12551254
mlx5_cmd_disable(dev);
12561255
}

0 commit comments

Comments
 (0)