OSDN Git Service

net/mlx5: No command allowed when command interface is not ready
authorHuy Nguyen <huyn@mellanox.com>
Thu, 7 Feb 2019 15:22:56 +0000 (09:22 -0600)
committerSaeed Mahameed <saeedm@mellanox.com>
Wed, 13 Feb 2019 23:40:50 +0000 (15:40 -0800)
commit4cab346bcf74f44665d57726ec2bccff6e679619
treec015177b037e0871fa2d032fe1b6925481a299e4
parentfb35c534b7881c0f7f94b01ddd95a9b17483252f
net/mlx5: No command allowed when command interface is not ready

When EEH is injected and PCI bus stalls, mlx5's pci error detect
function is called to deactivate the command interface and tear down
the device. The issue is that there can be a thread that already
passed MLX5_DEVICE_STATE_INTERNAL_ERROR check, it will send the command
and stuck in the wait_func.

Solution:
Add function mlx5_cmd_flush to disable command interface and clear all
the pending commands. When device state is set to
MLX5_DEVICE_STATE_INTERNAL_ERROR, call mlx5_cmd_flush to ensure all
pending threads waiting for firmware commands completion are terminated.

Fixes: c1d4d2e92ad6 ("net/mlx5: Avoid calling sleeping function by the health poll thread")
Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
drivers/net/ethernet/mellanox/mlx5/core/health.c
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h