Skip to content

Commit 432161e

Browse files
Eran Ben ElishaSaeed Mahameed
authored andcommitted
net/mlx5: Fix a race when moving command interface to polling mode
As part of driver unload, it destroys the commands EQ (via FW command). As the commands EQ is destroyed, FW will not generate EQEs for any command that driver sends afterwards. Driver should poll for later commands status. Driver commands mode metadata is updated before the commands EQ is actually destroyed. This can lead for double completion handle by the driver (polling and interrupt), if a command is executed and completed by FW after the mode was changed, but before the EQ was destroyed. Fix that by using the mlx5_cmd_allowed_opcode mechanism to guarantee that only DESTROY_EQ command can be executed during this time period. Fixes: e126ba9 ("mlx5: Add driver for Mellanox Connect-IB adapters") Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com> Reviewed-by: Moshe Shemesh <moshe@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent a59cf61 commit 432161e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,10 @@ static void destroy_async_eqs(struct mlx5_core_dev *dev)
656656

657657
cleanup_async_eq(dev, &table->pages_eq, "pages");
658658
cleanup_async_eq(dev, &table->async_eq, "async");
659+
mlx5_cmd_allowed_opcode(dev, MLX5_CMD_OP_DESTROY_EQ);
659660
mlx5_cmd_use_polling(dev);
660661
cleanup_async_eq(dev, &table->cmd_eq, "cmd");
662+
mlx5_cmd_allowed_opcode(dev, CMD_ALLOWED_OPCODE_ALL);
661663
mlx5_eq_notifier_unregister(dev, &table->cq_err_nb);
662664
}
663665

0 commit comments

Comments
 (0)