diff mbox series

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

Message ID 1713459125-14914-4-git-send-email-kotaranov@linux.microsoft.com (mailing list archive)
State Superseded
Headers show
Series RDMA/mana_ib: Implement RNIC CQs | expand

Commit Message

Konstantin Taranov April 18, 2024, 4:52 p.m. UTC
From: Konstantin Taranov <kotaranov@microsoft.com>

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@microsoft.com>
---
 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(-)

Comments

Long Li April 23, 2024, 11:34 p.m. UTC | #1
> Subject: [PATCH rdma-next 3/6] RDMA/mana_ib: replace duplicate cqe with
> buf_size

I don't understand this commit message on "duplicate" cqe. I couldn't find a duplicate of it in the existing code.
Konstantin Taranov April 24, 2024, 8:43 a.m. UTC | #2
> From: Long Li <longli@microsoft.com>
> Sent: Wednesday, 24 April 2024 01:35
> To: Konstantin Taranov <kotaranov@linux.microsoft.com>; Konstantin
> Taranov <kotaranov@microsoft.com>; sharmaajay@microsoft.com;
> jgg@ziepe.ca; leon@kernel.org
> Cc: linux-rdma@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: RE: [PATCH rdma-next 3/6] RDMA/mana_ib: replace duplicate cqe
> with buf_size
> 
> > Subject: [PATCH rdma-next 3/6] RDMA/mana_ib: replace duplicate cqe
> > with buf_size
> 
> I don't understand this commit message on "duplicate" cqe. I couldn't find a
> duplicate of it in the existing code.

If we need cqe, we could use it at cq->ibcq.cqe. The patch does not assign it as
it is not used, but if you want I can add "cq->ibcq.cqe = attr->cqe;" in v2.

- Konstantin
Long Li April 25, 2024, 8:17 p.m. UTC | #3
> Subject: RE: [PATCH rdma-next 3/6] RDMA/mana_ib: replace duplicate cqe with
> buf_size
> 
> > From: Long Li <longli@microsoft.com>
> > Sent: Wednesday, 24 April 2024 01:35
> > To: Konstantin Taranov <kotaranov@linux.microsoft.com>; Konstantin
> > Taranov <kotaranov@microsoft.com>; sharmaajay@microsoft.com;
> > jgg@ziepe.ca; leon@kernel.org
> > Cc: linux-rdma@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: RE: [PATCH rdma-next 3/6] RDMA/mana_ib: replace duplicate cqe
> > with buf_size
> >
> > > Subject: [PATCH rdma-next 3/6] RDMA/mana_ib: replace duplicate cqe
> > > with buf_size
> >
> > I don't understand this commit message on "duplicate" cqe. I couldn't
> > find a duplicate of it in the existing code.
> 
> If we need cqe, we could use it at cq->ibcq.cqe. The patch does not assign it as it
> is not used, but if you want I can add "cq->ibcq.cqe = attr->cqe;" in v2.
> 
> - Konstantin

I see. We don't need buf_size because it can be computed from cq->ibcq.cqe?

The commit message is confusing enough to make people think cqe is a duplicate of buf_size.

Long
diff mbox series

Patch

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];