RDMA/bnxt_re: Allow bigger MR creation
authorSelvin Xavier <selvin.xavier@broadcom.com>
Thu, 7 Jan 2021 09:43:28 +0000 (01:43 -0800)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 18 Jan 2021 20:56:09 +0000 (16:56 -0400)
Allow users to create bigger MRs. Remove the check that prevented creating
MRs with number of pages more than 512.

Link: https://lore.kernel.org/r/1610012608-14528-3-git-send-email-selvin.xavier@broadcom.com
Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/bnxt_re/ib_verbs.c
drivers/infiniband/hw/bnxt_re/qplib_sp.c

index 00d2a5a..ba515ef 100644 (file)
@@ -3829,14 +3829,6 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length,
        }
        mr->qplib_mr.total_size = length;
 
-       if (page_size == BNXT_RE_PAGE_SIZE_4K &&
-           length > BNXT_RE_MAX_MR_SIZE_LOW) {
-               ibdev_err(&rdev->ibdev, "Requested MR Sz:%llu Max sup:%llu",
-                         length, (u64)BNXT_RE_MAX_MR_SIZE_LOW);
-               rc = -EINVAL;
-               goto free_umem;
-       }
-
        umem_pgs = ib_umem_num_dma_blocks(umem, page_size);
        rc = bnxt_qplib_reg_mr(&rdev->qplib_res, &mr->qplib_mr, umem,
                               umem_pgs, page_size);
index 22cb46a..049b357 100644 (file)
@@ -658,24 +658,14 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
        struct creq_register_mr_resp resp;
        struct cmdq_register_mr req;
        u16 cmd_flags = 0, level;
-       int pages, rc, pg_ptrs;
+       int pages, rc;
        u32 pg_size;
 
        if (num_pbls) {
+               pages = roundup_pow_of_two(num_pbls);
                /* Allocate memory for the non-leaf pages to store buf ptrs.
                 * Non-leaf pages always uses system PAGE_SIZE
                 */
-               pg_ptrs = roundup_pow_of_two(num_pbls);
-               pages = pg_ptrs >> MAX_PBL_LVL_1_PGS_SHIFT;
-               if (!pages)
-                       pages++;
-
-               if (pages > MAX_PBL_LVL_1_PGS) {
-                       dev_err(&res->pdev->dev,
-                               "SP: Reg MR: pages requested (0x%x) exceeded max (0x%x)\n",
-                               pages, MAX_PBL_LVL_1_PGS);
-                       return -ENOMEM;
-               }
                /* Free the hwq if it already exist, must be a rereg */
                if (mr->hwq.max_elements)
                        bnxt_qplib_free_hwq(res, &mr->hwq);