From: Jason Gunthorpe <jgg@ziepe.ca>
To: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Cc: leon@kernel.org, linux-rdma@vger.kernel.org,
andrew.gospodarek@broadcom.com, selvin.xavier@broadcom.com,
kalesh-anakkur.purayil@broadcom.com
Subject: Re: [PATCH rdma-next v11 4/6] RDMA/bnxt_re: Refactor bnxt_re_create_cq()
Date: Tue, 10 Feb 2026 15:07:50 -0400 [thread overview]
Message-ID: <20260210190750.GD750753@ziepe.ca> (raw)
In-Reply-To: <20260210165939.41625-5-sriharsha.basavapatna@broadcom.com>
On Tue, Feb 10, 2026 at 10:29:37PM +0530, Sriharsha Basavapatna wrote:
> +static int bnxt_re_setup_sginfo(struct bnxt_re_dev *rdev,
> + struct ib_umem *umem,
> + struct bnxt_qplib_sg_info *sginfo)
> +{
> + unsigned long page_size;
> +
> + if (!umem)
> + return -EINVAL;
> +
> + page_size = ib_umem_find_best_pgsz(umem, SZ_4K, 0);
> + if (!page_size || page_size != SZ_4K)
> + return -EINVAL;
> +
> + sginfo->umem = umem;
> + sginfo->npages = ib_umem_num_dma_blocks(umem, page_size);
This ends up doing ib_umem_num_dma_blocks() twice:
bnxt_qplib_alloc_init_hwq()
bnxt_qplib_create_cq()
bnxt_re_create_cq()
And then again for a third time:
static int __alloc_pbl(struct bnxt_qplib_res *res,
struct bnxt_qplib_pbl *pbl,
struct bnxt_qplib_sg_info *sginfo)
if (sginfo->umem)
pages = ib_umem_num_dma_blocks(sginfo->umem, sginfo->pgsize);
else
pages = sginfo->npages;
etc. :\
It looks to me like npages is only expected to be used in kernel mode
where there is no umem.
So maybe don't add another num_dma_blocks here and make a note to go
and clean up this code properly as a followup? Properly means the
function that allocates the memory for the sginfo fills it in
completely instead of sprinkling it all over.
Jason
next prev parent reply other threads:[~2026-02-10 19:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-10 16:59 [PATCH rdma-next v11 0/6] RDMA/bnxt_re: Support uapi extensions Sriharsha Basavapatna
2026-02-10 16:59 ` [PATCH rdma-next v11 1/6] RDMA/bnxt_re: Move the UAPI methods to a dedicated file Sriharsha Basavapatna
2026-02-10 16:59 ` [PATCH rdma-next v11 2/6] RDMA/bnxt_re: Refactor bnxt_qplib_create_qp() function Sriharsha Basavapatna
2026-02-10 16:59 ` [PATCH rdma-next v11 3/6] RDMA/bnxt_re: Support doorbell extensions Sriharsha Basavapatna
2026-02-10 16:59 ` [PATCH rdma-next v11 4/6] RDMA/bnxt_re: Refactor bnxt_re_create_cq() Sriharsha Basavapatna
2026-02-10 19:07 ` Jason Gunthorpe [this message]
2026-02-11 11:25 ` Sriharsha Basavapatna
2026-02-11 12:48 ` Jason Gunthorpe
2026-02-10 16:59 ` [PATCH rdma-next v11 5/6] RDMA/bnxt_re: Support dmabuf for CQ rings Sriharsha Basavapatna
2026-02-10 16:59 ` [PATCH rdma-next v11 6/6] RDMA/bnxt_re: Support application specific CQs Sriharsha Basavapatna
2026-02-10 19:14 ` Jason Gunthorpe
2026-02-11 11:24 ` Sriharsha Basavapatna
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260210190750.GD750753@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=andrew.gospodarek@broadcom.com \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=selvin.xavier@broadcom.com \
--cc=sriharsha.basavapatna@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox