RDMA/mana_ib: Use num_comp_vectors of ib_device
authorKonstantin Taranov <kotaranov@microsoft.com>
Fri, 12 Apr 2024 08:47:36 +0000 (01:47 -0700)
committerLeon Romanovsky <leon@kernel.org>
Tue, 16 Apr 2024 10:29:47 +0000 (13:29 +0300)
Use num_comp_vectors of struct ib_device instead of max_num_queues
from gdma_context.

Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
Link: https://lore.kernel.org/r/1712911656-17352-1-git-send-email-kotaranov@linux.microsoft.com
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/mana/cq.c
drivers/infiniband/hw/mana/device.c
drivers/infiniband/hw/mana/qp.c

index c9129218f1be170cf91a59d4fe18b0689dc5ef80..dc931b9c3491903b2b23d86e857d2e59e9dbc9ba 100644 (file)
@@ -12,19 +12,14 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
        struct ib_device *ibdev = ibcq->device;
        struct mana_ib_create_cq ucmd = {};
        struct mana_ib_dev *mdev;
-       struct gdma_context *gc;
        int err;
 
        mdev = container_of(ibdev, struct mana_ib_dev, ib_dev);
-       gc = mdev_to_gc(mdev);
 
        if (udata->inlen < sizeof(ucmd))
                return -EINVAL;
 
-       if (attr->comp_vector > gc->max_num_queues)
-               return -EINVAL;
-
-       cq->comp_vector = attr->comp_vector;
+       cq->comp_vector = attr->comp_vector % ibdev->num_comp_vectors;
 
        err = ib_copy_from_udata(&ucmd, udata, min(sizeof(ucmd), udata->inlen));
        if (err) {
index 6fa902ee80a62ee8db3f5808c8e5918dab5d1dff..07e97de318863d6abc1b1a25794c1b9c5d0daf22 100644 (file)
@@ -74,7 +74,7 @@ static int mana_ib_probe(struct auxiliary_device *adev,
         * num_comp_vectors needs to set to the max MSIX index
         * when interrupts and event queues are implemented
         */
-       dev->ib_dev.num_comp_vectors = 1;
+       dev->ib_dev.num_comp_vectors = mdev->gdma_context->max_num_queues;
        dev->ib_dev.dev.parent = mdev->gdma_context->dev;
 
        ret = mana_gd_register_device(&mdev->gdma_context->mana_ib);
index 8fedf6e01925125e36d49ff495080f3fb27349c7..280e85a83f7eb21168761feecec6544c113555de 100644 (file)
@@ -198,7 +198,7 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
                cq_spec.gdma_region = cq->queue.gdma_region;
                cq_spec.queue_size = cq->cqe * COMP_ENTRY_SIZE;
                cq_spec.modr_ctx_id = 0;
-               eq = &mpc->ac->eqs[cq->comp_vector % gc->max_num_queues];
+               eq = &mpc->ac->eqs[cq->comp_vector];
                cq_spec.attached_eq = eq->eq->id;
 
                ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
@@ -357,7 +357,7 @@ static int mana_ib_create_qp_raw(struct ib_qp *ibqp, struct ib_pd *ibpd,
        cq_spec.gdma_region = send_cq->queue.gdma_region;
        cq_spec.queue_size = send_cq->cqe * COMP_ENTRY_SIZE;
        cq_spec.modr_ctx_id = 0;
-       eq_vec = send_cq->comp_vector % gc->max_num_queues;
+       eq_vec = send_cq->comp_vector;
        eq = &mpc->ac->eqs[eq_vec];
        cq_spec.attached_eq = eq->eq->id;