diff mbox series

[for-next,10/12] RDMA/bnxt_re: Correct FRMR size calculation

Message ID 1631470526-22228-11-git-send-email-selvin.xavier@broadcom.com (mailing list archive)
State Superseded
Delegated to: Leon Romanovsky
Headers show
Series RDMA/bnxt_re: Driver update | expand

Commit Message

Selvin Xavier Sept. 12, 2021, 6:15 p.m. UTC
FRMR WQE requires to provide the log2 value of the
PBL and page size.
Use the standard ilog2 to calculate the log2 value

Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
---
 drivers/infiniband/hw/bnxt_re/ib_verbs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Leon Romanovsky Sept. 13, 2021, 11:11 a.m. UTC | #1
On Sun, Sep 12, 2021 at 11:15:24AM -0700, Selvin Xavier wrote:
> FRMR WQE requires to provide the log2 value of the
> PBL and page size.
> Use the standard ilog2 to calculate the log2 value
> 
> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
> ---
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index c4d7a9e..1cbc7e1 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -2487,7 +2487,8 @@  static int bnxt_re_build_reg_wqe(const struct ib_reg_wr *wr,
 
 	wqe->frmr.l_key = wr->key;
 	wqe->frmr.length = wr->mr->length;
-	wqe->frmr.pbl_pg_sz_log = (wr->mr->page_size >> PAGE_SHIFT_4K) - 1;
+	wqe->frmr.pbl_pg_sz_log = ilog2(PAGE_SIZE >> PAGE_SHIFT_4K);
+	wqe->frmr.pg_sz_log = ilog2(wr->mr->page_size >> PAGE_SHIFT_4K);
 	wqe->frmr.va = wr->mr->iova;
 	return 0;
 }