public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
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 v8 3/4] RDMA/bnxt_re: Direct Verbs: Support DBR verbs
Date: Tue, 20 Jan 2026 14:54:19 -0400	[thread overview]
Message-ID: <20260120185419.GU961572@ziepe.ca> (raw)
In-Reply-To: <20260117080052.43279-4-sriharsha.basavapatna@broadcom.com>

On Sat, Jan 17, 2026 at 01:30:51PM +0530, Sriharsha Basavapatna wrote:
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.h b/drivers/infiniband/hw/bnxt_re/ib_verbs.h
> index a11f56730a31..33e0f66b39eb 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.h
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.h
> @@ -164,6 +164,13 @@ struct bnxt_re_user_mmap_entry {
>  	u8 mmap_flag;
>  };
>  
> +struct bnxt_re_dbr_obj {
> +	struct bnxt_re_dev *rdev;
> +	struct bnxt_qplib_dpi dpi;
> +	struct bnxt_re_user_mmap_entry *entry;
> +	atomic_t usecnt; /* QPs using this dbr */
> +};

This added usecnt but it doesn't use it

It is supposed to prevent destroying the object by the user out of sequence.

> +static int bnxt_re_dv_dbr_cleanup(struct ib_uobject *uobject,
> +				  enum rdma_remove_reason why,
> +				  struct uverbs_attr_bundle *attrs)
> +{
> +	struct bnxt_re_dbr_obj *obj = uobject->object;
> +	struct bnxt_re_dev *rdev = obj->rdev;
> +
> +	rdma_user_mmap_entry_remove(&obj->entry->rdma_entry);
> +	bnxt_qplib_free_uc_dpi(&rdev->qplib_res, &obj->dpi);
> +	return 0;
> +}

For instance CQ did it in the above function:

static int uverbs_free_cq(struct ib_uobject *uobject,
			  enum rdma_remove_reason why,
			  struct uverbs_attr_bundle *attrs)
{
	ret = ib_destroy_cq_user(cq, &attrs->driver_udata);
	if (ret)
		return ret;

int ib_destroy_cq_user(struct ib_cq *cq, struct ib_udata *udata)
{
	if (atomic_read(&cq->usecnt))
		return -EBUSY;

So this patch should be doing the usecnt check as well, otherwise it
won't work right.

Jason

  reply	other threads:[~2026-01-20 18:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-17  8:00 [PATCH rdma-next v8 0/4] RDMA/bnxt_re: Support direct verbs Sriharsha Basavapatna
2026-01-17  8:00 ` [PATCH rdma-next v8 1/4] RDMA/bnxt_re: Move the UAPI methods to a dedicated file Sriharsha Basavapatna
2026-01-17  8:00 ` [PATCH rdma-next v8 2/4] RDMA/bnxt_re: Refactor bnxt_qplib_create_qp() function Sriharsha Basavapatna
2026-01-17  8:00 ` [PATCH rdma-next v8 3/4] RDMA/bnxt_re: Direct Verbs: Support DBR verbs Sriharsha Basavapatna
2026-01-20 18:54   ` Jason Gunthorpe [this message]
2026-01-21  2:02     ` Sriharsha Basavapatna
2026-01-21 16:52       ` Jason Gunthorpe
2026-01-21 17:34         ` Sriharsha Basavapatna
2026-01-22 14:08           ` Jason Gunthorpe
2026-01-17  8:00 ` [PATCH rdma-next v8 4/4] RDMA/bnxt_re: Direct Verbs: Support CQ and QP verbs 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=20260120185419.GU961572@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