]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
RDMA/bnxt_re: Fix the table size for PSN/MSN entries
authorSelvin Xavier <selvin.xavier@broadcom.com>
Mon, 19 Aug 2024 04:47:25 +0000 (21:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:38:11 +0000 (16:38 +0200)
[ Upstream commit b930d0bac9c671c053dd66229010ca9298e84aab ]

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")
Link: https://patch.msgid.link/r/1724042847-1481-4-git-send-email-selvin.xavier@broadcom.com
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/bnxt_re/ib_verbs.c

index 7c757351a0166fc176d597555347463442d646fd..982e85ba211bc694c75ac8124e347fead9ed5ade 100644 (file)
@@ -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);
        }