Correctly define the interface state bits in mlx5en(4).
While at it remove unused interface state bits. This also fixes and issue during shutdown: There is an issue where the firmware fails during mlx5_load_one, the health_care timer detects the issue and schedules a health_care call. Then the mlx5_load_one detects the issue, cleans up and quits. Then the health_care starts and calls mlx5_unload_one to clean up the resources that no longer exist and causes kernel panic. The root cause is that the bit MLX5_INTERFACE_STATE_DOWN is not set after mlx5_load_one fails. The solution is removing the bit MLX5_INTERFACE_STATE_DOWN and quit mlx5_unload_one if the bit MLX5_INTERFACE_STATE_UP is not set. The bit MLX5_INTERFACE_STATE_DOWN is redundant and we can use MLX5_INTERFACE_STATE_UP instead. Linux commit: 10a8d00707082955b177164d4b4e758ffcbd4017 b3cb5388499c5e219324bfe7da2e46cbad82bfcf MFC after: 3 days Sponsored by: Mellanox Technologies
This commit is contained in:
parent
641eac0b61
commit
38379ab7c9
@ -662,9 +662,7 @@ enum mlx5_device_state {
|
||||
};
|
||||
|
||||
enum mlx5_interface_state {
|
||||
MLX5_INTERFACE_STATE_DOWN = BIT(0),
|
||||
MLX5_INTERFACE_STATE_UP = BIT(1),
|
||||
MLX5_INTERFACE_STATE_SHUTDOWN = BIT(2),
|
||||
MLX5_INTERFACE_STATE_UP,
|
||||
};
|
||||
|
||||
enum mlx5_pci_status {
|
||||
|
@ -1096,7 +1096,6 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
|
||||
goto err_fs;
|
||||
}
|
||||
|
||||
clear_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state);
|
||||
set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state);
|
||||
|
||||
out:
|
||||
@ -1159,7 +1158,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
|
||||
mlx5_drain_health_recovery(dev);
|
||||
|
||||
mutex_lock(&dev->intf_state_mutex);
|
||||
if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) {
|
||||
if (!test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) {
|
||||
dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", __func__);
|
||||
if (cleanup)
|
||||
mlx5_cleanup_once(dev);
|
||||
@ -1191,7 +1190,6 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
|
||||
|
||||
out:
|
||||
clear_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state);
|
||||
set_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state);
|
||||
mutex_unlock(&dev->intf_state_mutex);
|
||||
return err;
|
||||
}
|
||||
@ -1451,7 +1449,6 @@ static void shutdown_one(struct pci_dev *pdev)
|
||||
struct mlx5_priv *priv = &dev->priv;
|
||||
int err;
|
||||
|
||||
set_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &dev->intf_state);
|
||||
err = mlx5_try_fast_unload(dev);
|
||||
if (err)
|
||||
mlx5_unload_one(dev, priv, false);
|
||||
|
Loading…
Reference in New Issue
Block a user