mirror of https://gitee.com/openkylin/linux.git
IB/mlx5: Verify that Q counters are supported
Make sure that the Q counters are supported by the FW before trying
to allocate/deallocte them, this will avoid driver load failure when
they aren't supported by the FW.
Fixes: 0837e86a7a
('IB/mlx5: Add per port counters')
Cc: <stable@vger.kernel.org> # v4.7+
Signed-off-by: Kamal Heib <kamalh@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
12bbf1ea7e
commit
45bded2c21
|
@ -3313,9 +3313,11 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
|
||||||
if (err)
|
if (err)
|
||||||
goto err_rsrc;
|
goto err_rsrc;
|
||||||
|
|
||||||
|
if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt)) {
|
||||||
err = mlx5_ib_alloc_q_counters(dev);
|
err = mlx5_ib_alloc_q_counters(dev);
|
||||||
if (err)
|
if (err)
|
||||||
goto err_odp;
|
goto err_odp;
|
||||||
|
}
|
||||||
|
|
||||||
dev->mdev->priv.uar = mlx5_get_uars_page(dev->mdev);
|
dev->mdev->priv.uar = mlx5_get_uars_page(dev->mdev);
|
||||||
if (!dev->mdev->priv.uar)
|
if (!dev->mdev->priv.uar)
|
||||||
|
@ -3364,6 +3366,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
|
||||||
mlx5_put_uars_page(dev->mdev, dev->mdev->priv.uar);
|
mlx5_put_uars_page(dev->mdev, dev->mdev->priv.uar);
|
||||||
|
|
||||||
err_q_cnt:
|
err_q_cnt:
|
||||||
|
if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt))
|
||||||
mlx5_ib_dealloc_q_counters(dev);
|
mlx5_ib_dealloc_q_counters(dev);
|
||||||
|
|
||||||
err_odp:
|
err_odp:
|
||||||
|
@ -3397,6 +3400,7 @@ static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context)
|
||||||
mlx5_free_bfreg(dev->mdev, &dev->fp_bfreg);
|
mlx5_free_bfreg(dev->mdev, &dev->fp_bfreg);
|
||||||
mlx5_free_bfreg(dev->mdev, &dev->bfreg);
|
mlx5_free_bfreg(dev->mdev, &dev->bfreg);
|
||||||
mlx5_put_uars_page(dev->mdev, mdev->priv.uar);
|
mlx5_put_uars_page(dev->mdev, mdev->priv.uar);
|
||||||
|
if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt))
|
||||||
mlx5_ib_dealloc_q_counters(dev);
|
mlx5_ib_dealloc_q_counters(dev);
|
||||||
destroy_umrc_res(dev);
|
destroy_umrc_res(dev);
|
||||||
mlx5_ib_odp_remove_one(dev);
|
mlx5_ib_odp_remove_one(dev);
|
||||||
|
|
Loading…
Reference in New Issue