Re: [PATCH rdma-next v6 4/4] RDMA/bnxt_re: Direct Verbs: Support CQ and QP verbs

Jason Gunthorpe
2026-01-09T19:08:59Z

On Wed, Dec 24, 2025 at 09:56:02AM +0530, Sriharsha Basavapatna wrote:
> +static struct ib_umem *bnxt_re_dv_umem_get(struct bnxt_re_dev *rdev,
> + struct ib_ucontext *ib_uctx,
> + int dmabuf_fd,
> + u64 addr, u64 size,
> + struct bnxt_qplib_sg_info *sg)
> +{
> + int access = IB_ACCESS_LOCAL_WRITE;
> + struct ib_umem *umem;
> + int umem_pgs, rc;
> +
> + if (dmabuf_fd) {
> + struct ib_umem_dmabuf *umem_dmabuf;
> +
> + umem_dmabuf = ib_umem_dmabuf_get_pinned(&rdev->ibdev, addr, size,
> + dmabuf_fd, access);
> + if (IS_ERR(umem_dmabuf)) {
> + rc = PTR_ERR(umem_dmabuf);
> + goto umem_err;
> + }
> + umem = &umem_dmabuf->umem;
> + } else {
> + umem = ib_umem_get(&rdev->ibdev, addr, size, access);
> + if (IS_ERR(umem)) {
> + rc = PTR_ERR(umem);
> + goto umem_err;
> + }
> + }
> +
> + umem_pgs = ib_umem_num_dma_blocks(umem, PAGE_SIZE);

I should never see PAGE_SIZE passed to dma_blocks, and you can't call
dma_blocks without previously calling ib_umem_find_best_pgsz() to
validate that the umem is compatible.

I assume you want to use SZ_4K here, as any sizing of the umem should
be derived from absolute hardware capability, never PAGE_SIZE.

Jason