[PATCH rdma-next 3/6] RDMA/mana_ib: replace duplicate cqe with buf_size

From: Konstantin Taranov
Date: Thu Apr 18 2024 - 12:52:32 EST


From: Konstantin Taranov <kotaranov@xxxxxxxxxxxxx>

Replace cqe with buf_size in struct mana_ib_cq.
The cqe field is already present in struct ib_cq and can be accessed there.
The buf_size field is required for mana RNIC CQs.

Signed-off-by: Konstantin Taranov <kotaranov@xxxxxxxxxxxxx>
---
drivers/infiniband/hw/mana/cq.c | 4 ++--
drivers/infiniband/hw/mana/mana_ib.h | 2 +-
drivers/infiniband/hw/mana/qp.c | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/mana/cq.c b/drivers/infiniband/hw/mana/cq.c
index dc931b9..0467ee8 100644
--- a/drivers/infiniband/hw/mana/cq.c
+++ b/drivers/infiniband/hw/mana/cq.c
@@ -33,8 +33,8 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
return -EINVAL;
}

- cq->cqe = attr->cqe;
- err = mana_ib_create_queue(mdev, ucmd.buf_addr, cq->cqe * COMP_ENTRY_SIZE, &cq->queue);
+ cq->buf_size = attr->cqe * COMP_ENTRY_SIZE;
+ err = mana_ib_create_queue(mdev, ucmd.buf_addr, cq->buf_size, &cq->queue);
if (err) {
ibdev_dbg(ibdev, "Failed to create queue for create cq, %d\n", err);
return err;
diff --git a/drivers/infiniband/hw/mana/mana_ib.h b/drivers/infiniband/hw/mana/mana_ib.h
index 9162f29..9c07021 100644
--- a/drivers/infiniband/hw/mana/mana_ib.h
+++ b/drivers/infiniband/hw/mana/mana_ib.h
@@ -90,7 +90,7 @@ struct mana_ib_mr {
struct mana_ib_cq {
struct ib_cq ibcq;
struct mana_ib_queue queue;
- int cqe;
+ u32 buf_size;
u32 comp_vector;
mana_handle_t cq_handle;
};
diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
index 280e85a..c4fb8b4 100644
--- a/drivers/infiniband/hw/mana/qp.c
+++ b/drivers/infiniband/hw/mana/qp.c
@@ -196,7 +196,7 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
wq_spec.queue_size = wq->wq_buf_size;

cq_spec.gdma_region = cq->queue.gdma_region;
- cq_spec.queue_size = cq->cqe * COMP_ENTRY_SIZE;
+ cq_spec.queue_size = cq->buf_size;
cq_spec.modr_ctx_id = 0;
eq = &mpc->ac->eqs[cq->comp_vector];
cq_spec.attached_eq = eq->eq->id;
@@ -355,7 +355,7 @@ static int mana_ib_create_qp_raw(struct ib_qp *ibqp, struct ib_pd *ibpd,
wq_spec.queue_size = ucmd.sq_buf_size;

cq_spec.gdma_region = send_cq->queue.gdma_region;
- cq_spec.queue_size = send_cq->cqe * COMP_ENTRY_SIZE;
+ cq_spec.queue_size = send_cq->buf_size;
cq_spec.modr_ctx_id = 0;
eq_vec = send_cq->comp_vector;
eq = &mpc->ac->eqs[eq_vec];
--
2.43.0