net/mlx5: Delete impossible dev->state checks
New mlx5_core device structure is allocated through devlink_alloc with\ kzalloc and that ensures that all fields are equal to zero and it includes ->state too. That means that checks of that field in the mlx5_init_one() is completely redundant, because that function is called only once in the begging of mlx5_core_dev lifetime. PCI: .probe() -> probe_one() -> mlx5_init_one() The recovery flow can't run at that time or before it, because relevant work initialized later in mlx5_init_once(). Such initialization flow ensures that dev->state can't be MLX5_DEVICE_STATE_UNINITIALIZED at all, so remove such impossible checks. Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
90b85d4e31
commit
8e792700b9
|
@ -213,10 +213,6 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force)
|
||||||
mutex_lock(&dev->intf_state_mutex);
|
mutex_lock(&dev->intf_state_mutex);
|
||||||
if (!err_detected && dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
|
if (!err_detected && dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
|
||||||
goto unlock;/* a previous error is still being handled */
|
goto unlock;/* a previous error is still being handled */
|
||||||
if (dev->state == MLX5_DEVICE_STATE_UNINITIALIZED) {
|
|
||||||
dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
|
|
||||||
goto unlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
enter_error_state(dev, force);
|
enter_error_state(dev, force);
|
||||||
unlock:
|
unlock:
|
||||||
|
|
|
@ -1249,11 +1249,6 @@ int mlx5_init_one(struct mlx5_core_dev *dev)
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
mutex_lock(&dev->intf_state_mutex);
|
mutex_lock(&dev->intf_state_mutex);
|
||||||
if (test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) {
|
|
||||||
mlx5_core_warn(dev, "interface is up, NOP\n");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
/* remove any previous indication of internal error */
|
|
||||||
dev->state = MLX5_DEVICE_STATE_UP;
|
dev->state = MLX5_DEVICE_STATE_UP;
|
||||||
|
|
||||||
err = mlx5_function_setup(dev, true);
|
err = mlx5_function_setup(dev, true);
|
||||||
|
@ -1294,7 +1289,6 @@ function_teardown:
|
||||||
mlx5_function_teardown(dev, true);
|
mlx5_function_teardown(dev, true);
|
||||||
err_function:
|
err_function:
|
||||||
dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
|
dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
|
||||||
out:
|
|
||||||
mutex_unlock(&dev->intf_state_mutex);
|
mutex_unlock(&dev->intf_state_mutex);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -623,8 +623,7 @@ struct mlx5_priv {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum mlx5_device_state {
|
enum mlx5_device_state {
|
||||||
MLX5_DEVICE_STATE_UNINITIALIZED,
|
MLX5_DEVICE_STATE_UP = 1,
|
||||||
MLX5_DEVICE_STATE_UP,
|
|
||||||
MLX5_DEVICE_STATE_INTERNAL_ERROR,
|
MLX5_DEVICE_STATE_INTERNAL_ERROR,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue