Skip to content

Commit 08c7f09

Browse files
selvintxavierjgunthorpe
authored andcommitted
RDMA/bnxt_re: Fix the page_size used during the MR creation
Driver populates the list of pages used for Memory region wrongly when page size is more than system page size. This is causing a failure when some of the applications that creates MR with page size as 2M. Since HW can support multiple page sizes, pass the correct page size while creating the MR. Also, driver need not adjust the number of pages when HW Queues are created with user memory. It should work with the number of dma blocks returned by ib_umem_num_dma_blocks. Fix this calculation also. Fixes: 0c4dcd6 ("RDMA/bnxt_re: Refactor hardware queue memory allocation") Fixes: f6919d5 ("RDMA/bnxt_re: Code refactor while populating user MRs") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kalesh AP <[email protected]> Signed-off-by: Kashyap Desai <[email protected]> Signed-off-by: Selvin Xavier <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent ac9a786 commit 08c7f09

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

drivers/infiniband/hw/bnxt_re/qplib_res.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,9 @@ int bnxt_qplib_alloc_init_hwq(struct bnxt_qplib_hwq *hwq,
215215
return -EINVAL;
216216
hwq_attr->sginfo->npages = npages;
217217
} else {
218-
unsigned long sginfo_num_pages = ib_umem_num_dma_blocks(
219-
hwq_attr->sginfo->umem, hwq_attr->sginfo->pgsize);
220-
218+
npages = ib_umem_num_dma_blocks(hwq_attr->sginfo->umem,
219+
hwq_attr->sginfo->pgsize);
221220
hwq->is_user = true;
222-
npages = sginfo_num_pages;
223-
npages = (npages * PAGE_SIZE) /
224-
BIT_ULL(hwq_attr->sginfo->pgshft);
225-
if ((sginfo_num_pages * PAGE_SIZE) %
226-
BIT_ULL(hwq_attr->sginfo->pgshft))
227-
if (!npages)
228-
npages++;
229221
}
230222

231223
if (npages == MAX_PBL_LVL_0_PGS && !hwq_attr->sginfo->nopte) {

drivers/infiniband/hw/bnxt_re/qplib_sp.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -617,16 +617,15 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
617617
/* Free the hwq if it already exist, must be a rereg */
618618
if (mr->hwq.max_elements)
619619
bnxt_qplib_free_hwq(res, &mr->hwq);
620-
/* Use system PAGE_SIZE */
621620
hwq_attr.res = res;
622621
hwq_attr.depth = pages;
623-
hwq_attr.stride = buf_pg_size;
622+
hwq_attr.stride = sizeof(dma_addr_t);
624623
hwq_attr.type = HWQ_TYPE_MR;
625624
hwq_attr.sginfo = &sginfo;
626625
hwq_attr.sginfo->umem = umem;
627626
hwq_attr.sginfo->npages = pages;
628-
hwq_attr.sginfo->pgsize = PAGE_SIZE;
629-
hwq_attr.sginfo->pgshft = PAGE_SHIFT;
627+
hwq_attr.sginfo->pgsize = buf_pg_size;
628+
hwq_attr.sginfo->pgshft = ilog2(buf_pg_size);
630629
rc = bnxt_qplib_alloc_init_hwq(&mr->hwq, &hwq_attr);
631630
if (rc) {
632631
dev_err(&res->pdev->dev,

0 commit comments

Comments
 (0)