Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8186699 authored by Kamal Heib's avatar Kamal Heib Committed by Greg Kroah-Hartman
Browse files

IB/mlx5: Verify that Q counters are supported



commit 45bded2c216da6010184ac5ebe88c27f73439009 upstream.

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: 0837e86a ('IB/mlx5: Add per port counters')
Signed-off-by: default avatarKamal Heib <kamalh@mellanox.com>
Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8fed8fc1
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -3141,9 +3141,11 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
	if (err)
		goto err_rsrc;

	if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt)) {
		err = mlx5_ib_alloc_q_counters(dev);
		if (err)
			goto err_odp;
	}

	err = ib_register_device(&dev->ib_dev, NULL);
	if (err)
@@ -3171,6 +3173,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
	ib_unregister_device(&dev->ib_dev);

err_q_cnt:
	if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt))
		mlx5_ib_dealloc_q_counters(dev);

err_odp:
@@ -3201,6 +3204,7 @@ static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context)

	mlx5_remove_roce_notifier(dev);
	ib_unregister_device(&dev->ib_dev);
	if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt))
		mlx5_ib_dealloc_q_counters(dev);
	destroy_umrc_res(dev);
	mlx5_ib_odp_remove_one(dev);