Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Selvin Xavier <selvin.xavier@broadcom.com>
To: leon@kernel.org, jgg@ziepe.ca
Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com,
	Selvin Xavier <selvin.xavier@broadcom.com>
Subject: [PATCH for-next v3 3/5] RDMA/bnxt_re: Fix the table size for PSN/MSN entries
Date: Sun, 18 Aug 2024 21:47:25 -0700	[thread overview]
Message-ID: <1724042847-1481-4-git-send-email-selvin.xavier@broadcom.com> (raw)
In-Reply-To: <1724042847-1481-1-git-send-email-selvin.xavier@broadcom.com>

HW MSN table size is always a power of 2. So the pages
should be mapped accordingly.

Use the power of two calculation while get the number of
PSN/MSN entries.

Fixes: 6f6bfbc595fb ("RDMA/bnxt_re: Expose the MSN table capability for user library")
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
---
 drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index 5073ab1..4dd137b 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -1042,6 +1042,8 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd,
 			    qplib_qp->sq.max_wqe :
 			    ((qplib_qp->sq.max_wqe * qplib_qp->sq.wqe_size) /
 			      sizeof(struct bnxt_qplib_sge));
+		if (_is_host_msn_table(rdev->qplib_res.dattr->dev_cap_flags2))
+			psn_nume = roundup_pow_of_two(psn_nume);
 		bytes += (psn_nume * psn_sz);
 	}
 
-- 
2.5.5


  parent reply	other threads:[~2024-08-19  5:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-19  4:47 [PATCH for-next v3 0/5] RDMA/bnxt_re: Use variable size Work Queue entry for Gen P7 adapters Selvin Xavier
2024-08-19  4:47 ` [PATCH for-next v3 1/5] RDMA/bnxt_re: Add support for Variable WQE in Genp7 adapters Selvin Xavier
2024-08-19  4:47 ` [PATCH for-next v3 2/5] RDMA/bnxt_re: Get the WQE index from slot index while completing the WQEs Selvin Xavier
2024-08-19  4:47 ` Selvin Xavier [this message]
2024-08-19  4:47 ` [PATCH for-next v3 4/5] RDMA/bnxt_re: Handle variable WQE support for user applications Selvin Xavier
2024-08-19  4:47 ` [PATCH for-next v3 5/5] RDMA/bnxt_re: Enable variable size WQEs for user space applications Selvin Xavier
2024-08-26  4:38 ` [PATCH for-next v3 0/5] RDMA/bnxt_re: Use variable size Work Queue entry for Gen P7 adapters Selvin Xavier
2024-08-27 13:44 ` Jason Gunthorpe
2024-08-27 14:03 ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1724042847-1481-4-git-send-email-selvin.xavier@broadcom.com \
    --to=selvin.xavier@broadcom.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox