Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/bnxt_re: Refactor bnxt_re_create_cq()

Some applications may allocate dmabuf based memory for CQs. To support
this, update the existing code to use SZ_4K to specify supported HW
page size for CQs, as we support only 4K pages for now.
Call ib_umem_find_best_pgsz() to ensure umem supports this requested
page size. A helper function includes these changes.

Link: https://patch.msgid.link/r/20260302110036.36387-5-sriharsha.basavapatna@broadcom.com
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Reviewed-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Sriharsha Basavapatna and committed by
Jason Gunthorpe
3d4a4236 1234a9d8

+26 -3
+26 -3
drivers/infiniband/hw/bnxt_re/ib_verbs.c
··· 3349 3349 return ib_respond_empty_udata(udata); 3350 3350 } 3351 3351 3352 + static int bnxt_re_setup_sginfo(struct bnxt_re_dev *rdev, 3353 + struct ib_umem *umem, 3354 + struct bnxt_qplib_sg_info *sginfo) 3355 + { 3356 + unsigned long page_size; 3357 + 3358 + if (!umem) 3359 + return -EINVAL; 3360 + 3361 + page_size = ib_umem_find_best_pgsz(umem, SZ_4K, 0); 3362 + if (!page_size || page_size != SZ_4K) 3363 + return -EINVAL; 3364 + 3365 + sginfo->umem = umem; 3366 + sginfo->npages = ib_umem_num_dma_blocks(umem, page_size); 3367 + sginfo->pgsize = page_size; 3368 + sginfo->pgshft = __builtin_ctz(page_size); 3369 + return 0; 3370 + } 3371 + 3352 3372 int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, 3353 3373 struct uverbs_attr_bundle *attrs) 3354 3374 { ··· 3400 3380 if (entries > dev_attr->max_cq_wqes + 1) 3401 3381 entries = dev_attr->max_cq_wqes + 1; 3402 3382 3403 - cq->qplib_cq.sg_info.pgsize = PAGE_SIZE; 3404 - cq->qplib_cq.sg_info.pgshft = PAGE_SHIFT; 3405 3383 if (udata) { 3406 3384 struct bnxt_re_cq_req req; 3407 3385 ··· 3414 3396 rc = PTR_ERR(cq->umem); 3415 3397 goto fail; 3416 3398 } 3417 - cq->qplib_cq.sg_info.umem = cq->umem; 3399 + rc = bnxt_re_setup_sginfo(rdev, cq->umem, &cq->qplib_cq.sg_info); 3400 + if (rc) 3401 + goto fail; 3402 + 3418 3403 cq->qplib_cq.dpi = &uctx->dpi; 3419 3404 } else { 3420 3405 cq->max_cql = min_t(u32, entries, MAX_CQL_PER_POLL); ··· 3427 3406 goto fail; 3428 3407 } 3429 3408 3409 + cq->qplib_cq.sg_info.pgsize = SZ_4K; 3410 + cq->qplib_cq.sg_info.pgshft = __builtin_ctz(SZ_4K); 3430 3411 cq->qplib_cq.dpi = &rdev->dpi_privileged; 3431 3412 } 3432 3413 cq->qplib_cq.max_wqe = entries;