Skip to content

Commit 1b75da2

Browse files
shayshyikuba-moo
authored andcommitted
net/mlx5: Always drain health in shutdown callback
There is no point in recovery during device shutdown. if health work started need to wait for it to avoid races and NULL pointer access. Hence, drain health WQ on shutdown callback. Fixes: 1958fc2 ("net/mlx5: SF, Add auxiliary device driver") Fixes: d2aa060 ("net/mlx5: Cancel health poll before sending panic teardown command") Signed-off-by: Shay Drory <[email protected]> Reviewed-by: Moshe Shemesh <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Reviewed-by: Wojciech Drewek <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8f73ef8 commit 1b75da2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,6 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev *dev)
21422142
/* Panic tear down fw command will stop the PCI bus communication
21432143
* with the HCA, so the health poll is no longer needed.
21442144
*/
2145-
mlx5_drain_health_wq(dev);
21462145
mlx5_stop_health_poll(dev, false);
21472146

21482147
ret = mlx5_cmd_fast_teardown_hca(dev);
@@ -2177,6 +2176,7 @@ static void shutdown(struct pci_dev *pdev)
21772176

21782177
mlx5_core_info(dev, "Shutdown was called\n");
21792178
set_bit(MLX5_BREAK_FW_WAIT, &dev->intf_state);
2179+
mlx5_drain_health_wq(dev);
21802180
err = mlx5_try_fast_unload(dev);
21812181
if (err)
21822182
mlx5_unload_one(dev, false);

drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ static void mlx5_sf_dev_shutdown(struct auxiliary_device *adev)
112112
struct mlx5_core_dev *mdev = sf_dev->mdev;
113113

114114
set_bit(MLX5_BREAK_FW_WAIT, &mdev->intf_state);
115+
mlx5_drain_health_wq(mdev);
115116
mlx5_unload_one(mdev, false);
116117
}
117118

0 commit comments

Comments
 (0)