From: Leon Romanovsky <[email protected]>

Remove the legacy capability check when issuing the resize‑CQ command.
Instead, rely on choosing the correct ops during initialization.

Signed-off-by: Leon Romanovsky <[email protected]>
---
 drivers/infiniband/hw/mlx5/cq.c   | 5 -----
 drivers/infiniband/hw/mlx5/main.c | 8 +++++++-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
index f7fb6f4aef7d..88f0f5e2944f 100644
--- a/drivers/infiniband/hw/mlx5/cq.c
+++ b/drivers/infiniband/hw/mlx5/cq.c
@@ -1267,11 +1267,6 @@ int mlx5_ib_resize_cq(struct ib_cq *ibcq, unsigned int 
entries,
        int inlen;
        int cqe_size;
 
-       if (!MLX5_CAP_GEN(dev->mdev, cq_resize)) {
-               pr_info("Firmware does not support resize CQ\n");
-               return -ENOSYS;
-       }
-
        if (entries > (1 << MLX5_CAP_GEN(dev->mdev, log_max_cq_sz)))
                return -EINVAL;
 
diff --git a/drivers/infiniband/hw/mlx5/main.c 
b/drivers/infiniband/hw/mlx5/main.c
index 0471155eb739..f86721681f5b 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4496,7 +4496,6 @@ static const struct ib_device_ops mlx5_ib_dev_ops = {
        .reg_user_mr_dmabuf = mlx5_ib_reg_user_mr_dmabuf,
        .req_notify_cq = mlx5_ib_arm_cq,
        .rereg_user_mr = mlx5_ib_rereg_user_mr,
-       .resize_user_cq = mlx5_ib_resize_cq,
        .ufile_hw_cleanup = mlx5_ib_ufile_hw_cleanup,
 
        INIT_RDMA_OBJ_SIZE(ib_ah, mlx5_ib_ah, ibah),
@@ -4509,6 +4508,10 @@ static const struct ib_device_ops mlx5_ib_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_ucontext, mlx5_ib_ucontext, ibucontext),
 };
 
+static const struct ib_device_ops mlx5_ib_dev_resize_cq_ops = {
+       .resize_user_cq = mlx5_ib_resize_cq,
+};
+
 static const struct ib_device_ops mlx5_ib_dev_ipoib_enhanced_ops = {
        .rdma_netdev_get_params = mlx5_ib_rn_get_params,
 };
@@ -4635,6 +4638,9 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev 
*dev)
 
        ib_set_device_ops(&dev->ib_dev, &mlx5_ib_dev_ops);
 
+       if (MLX5_CAP_GEN(mdev, cq_resize))
+               ib_set_device_ops(&dev->ib_dev, &mlx5_ib_dev_resize_cq_ops);
+
        if (IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS))
                dev->ib_dev.driver_def = mlx5_ib_defs;
 

-- 
2.52.0


Reply via email to