summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
authorSelvin Xavier <selvin.xavier@broadcom.com>2021-09-15 05:32:41 -0700
committerJason Gunthorpe <jgg@nvidia.com>2021-09-20 13:37:02 -0300
commit7a3c3a121eb73f59f04939a14c117e884f3538e2 (patch)
tree12b961a4ba9bcaa46ad470aac1fd5e0cdfb1bc0f /drivers/infiniband/hw
parent690ea7fe00afe1270590a9e4211705691dcef1bd (diff)
downloadlwn-7a3c3a121eb73f59f04939a14c117e884f3538e2.tar.gz
lwn-7a3c3a121eb73f59f04939a14c117e884f3538e2.zip
RDMA/bnxt_re: Correct FRMR size calculation
FRMR WQE requires to provide the log2 value of the PBL and page size. Use the standard ilog2() to calculate the log2 value Link: https://lore.kernel.org/r/1631709163-2287-11-git-send-email-selvin.xavier@broadcom.com Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/bnxt_re/ib_verbs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index 1654260611a7..938088f86d3d 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -2488,7 +2488,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;
}