public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>,
	linux-rdma@vger.kernel.org,
	Selvin Xavier <selvin.xavier@broadcom.com>,
	Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>,
	patches@lists.linux.dev
Subject: Re: [PATCH 07/10] RDMA/bnxt_re: Add compatibility checks to the uapi path for no data
Date: Fri, 13 Feb 2026 12:34:21 +0200	[thread overview]
Message-ID: <20260213103421.GM12887@unreal> (raw)
In-Reply-To: <7-v1-89ea7d615ba4+636-bnxt_re_uapi_jgg@nvidia.com>

On Thu, Feb 05, 2026 at 09:45:41PM -0400, Jason Gunthorpe wrote:
> If drivers ever want to go from an empty drvdata to something with them
> they need to have called ib_is_udata_in_empty(). Add the missing calls to
> all the system calls that don't have req structures.

This is also a good candidate for an AI review prompt.  
It is easy to overlook the need for `ib_is_udata_in_empty()`.

Thanks

> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c | 39 ++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index 2942ff44f6a547..485785fad1df63 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -187,6 +187,9 @@ int bnxt_re_query_device(struct ib_device *ibdev,
>  	struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev);
>  	struct bnxt_qplib_dev_attr *dev_attr = rdev->dev_attr;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return -EOPNOTSUPP;
> +
>  	memset(ib_attr, 0, sizeof(*ib_attr));
>  	memcpy(&ib_attr->fw_ver, dev_attr->fw_ver,
>  	       min(sizeof(dev_attr->fw_ver),
> @@ -676,6 +679,9 @@ int bnxt_re_dealloc_pd(struct ib_pd *ib_pd, struct ib_udata *udata)
>  	struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd);
>  	struct bnxt_re_dev *rdev = pd->rdev;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return -EOPNOTSUPP;
> +
>  	if (udata) {
>  		rdma_user_mmap_entry_remove(pd->pd_db_mmap);
>  		pd->pd_db_mmap = NULL;
> @@ -703,6 +709,9 @@ int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
>  	u32 active_pds;
>  	int rc = 0;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return -EOPNOTSUPP;
> +
>  	pd->rdev = rdev;
>  	if (bnxt_qplib_alloc_pd(&rdev->qplib_res, &pd->qplib_pd)) {
>  		ibdev_err(&rdev->ibdev, "Failed to allocate HW PD");
> @@ -817,6 +826,9 @@ int bnxt_re_create_ah(struct ib_ah *ib_ah, struct rdma_ah_init_attr *init_attr,
>  	u8 nw_type;
>  	int rc;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return -EOPNOTSUPP;
> +
>  	if (!(rdma_ah_get_ah_flags(ah_attr) & IB_AH_GRH)) {
>  		ibdev_err(&rdev->ibdev, "Failed to alloc AH: GRH not set");
>  		return -EINVAL;
> @@ -978,6 +990,9 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata)
>  	unsigned int flags;
>  	int rc;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return -EOPNOTSUPP;
> +
>  	bnxt_re_debug_rem_qpinfo(rdev, qp);
>  
>  	bnxt_qplib_flush_cqn_wq(&qp->qplib_qp);
> @@ -1828,6 +1843,9 @@ int bnxt_re_destroy_srq(struct ib_srq *ib_srq, struct ib_udata *udata)
>  	struct bnxt_re_dev *rdev = srq->rdev;
>  	struct bnxt_qplib_srq *qplib_srq = &srq->qplib_srq;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return -EOPNOTSUPP;
> +
>  	if (rdev->chip_ctx->modes.toggle_bits & BNXT_QPLIB_SRQ_TOGGLE_BIT) {
>  		free_page((unsigned long)srq->uctx_srq_page);
>  		hash_del(&srq->hash_entry);
> @@ -1977,6 +1995,9 @@ int bnxt_re_modify_srq(struct ib_srq *ib_srq, struct ib_srq_attr *srq_attr,
>  					       ib_srq);
>  	struct bnxt_re_dev *rdev = srq->rdev;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return -EOPNOTSUPP;
> +
>  	switch (srq_attr_mask) {
>  	case IB_SRQ_MAX_WR:
>  		/* SRQ resize is not supported */
> @@ -2093,6 +2114,9 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
>  	unsigned int flags;
>  	u8 nw_type;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return -EOPNOTSUPP;
> +
>  	if (qp_attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
>  		return -EOPNOTSUPP;
>  
> @@ -3111,6 +3135,9 @@ int bnxt_re_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata)
>  	nq = cq->qplib_cq.nq;
>  	cctx = rdev->chip_ctx;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return -EOPNOTSUPP;
> +
>  	if (cctx->modes.toggle_bits & BNXT_QPLIB_CQ_TOGGLE_BIT) {
>  		free_page((unsigned long)cq->uctx_cq_page);
>  		hash_del(&cq->hash_entry);
> @@ -4058,6 +4085,9 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata)
>  	struct bnxt_re_dev *rdev = mr->rdev;
>  	int rc;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return -EOPNOTSUPP;
> +
>  	rc = bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr);
>  	if (rc) {
>  		ibdev_err(&rdev->ibdev, "Dereg MR failed: %#x\n", rc);
> @@ -4166,6 +4196,9 @@ struct ib_mw *bnxt_re_alloc_mw(struct ib_pd *ib_pd, enum ib_mw_type type,
>  	u32 active_mws;
>  	int rc;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return ERR_PTR(-EOPNOTSUPP);
> +
>  	mw = kzalloc(sizeof(*mw), GFP_KERNEL);
>  	if (!mw)
>  		return ERR_PTR(-ENOMEM);
> @@ -4294,6 +4327,9 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length,
>  	struct ib_umem *umem;
>  	struct ib_mr *ib_mr;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return ERR_PTR(-EOPNOTSUPP);
> +
>  	if (dmah)
>  		return ERR_PTR(-EOPNOTSUPP);
>  
> @@ -4474,6 +4510,9 @@ struct ib_flow *bnxt_re_create_flow(struct ib_qp *ib_qp,
>  	struct bnxt_re_flow *flow;
>  	int rc;
>  
> +	if (!ib_is_udata_in_empty(udata))
> +		return ERR_PTR(-EOPNOTSUPP);
> +
>  	if (attr->type != IB_FLOW_ATTR_SNIFFER ||
>  	    !rdev->rcfw.roce_mirror)
>  		return ERR_PTR(-EOPNOTSUPP);
> -- 
> 2.43.0
> 
> 

  reply	other threads:[~2026-02-13 10:34 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06  1:45 [PATCH 00/10] Provide udata helpers and use them in bnxt_re Jason Gunthorpe
2026-02-06  1:45 ` [PATCH 01/10] RDMA: Add ib_copy_validate_udata_in() Jason Gunthorpe
2026-02-09  6:11   ` Junxian Huang
2026-02-09 14:06     ` Jason Gunthorpe
2026-02-06  1:45 ` [PATCH 02/10] RDMA: Add ib_copy_validate_udata_in_cm() Jason Gunthorpe
2026-02-06  1:45 ` [PATCH 03/10] RDMA: Add ib_respond_udata() Jason Gunthorpe
2026-02-13 10:10   ` Leon Romanovsky
2026-02-13 12:43     ` Jason Gunthorpe
2026-02-13 15:37       ` Leon Romanovsky
2026-02-13 15:48         ` Jason Gunthorpe
2026-02-16 23:14           ` Jason Gunthorpe
2026-02-17  7:48             ` Leon Romanovsky
2026-02-06  1:45 ` [PATCH 04/10] RDMA: Add ib_is_udata_in_empty() Jason Gunthorpe
2026-02-13 10:22   ` Leon Romanovsky
2026-02-13 12:56     ` Jason Gunthorpe
2026-02-06  1:45 ` [PATCH 05/10] RDMA: Provide documentation about the uABI compatibility rules Jason Gunthorpe
2026-02-13 10:23   ` Leon Romanovsky
2026-02-13 12:56     ` Jason Gunthorpe
2026-02-13 15:57       ` Leon Romanovsky
2026-02-18  0:01         ` Jason Gunthorpe
2026-02-06  1:45 ` [PATCH 06/10] RDMA/bnxt_re: Add compatibility checks to the uapi path Jason Gunthorpe
2026-02-08 19:29   ` Zhu Yanjun
2026-02-06  1:45 ` [PATCH 07/10] RDMA/bnxt_re: Add compatibility checks to the uapi path for no data Jason Gunthorpe
2026-02-13 10:34   ` Leon Romanovsky [this message]
2026-02-06  1:45 ` [PATCH 08/10] RDMA/bnxt_re: Add missing comp_mask validation Jason Gunthorpe
2026-02-06  1:45 ` [PATCH 09/10] RDMA/bnxt_re: Use ib_respond_udata() Jason Gunthorpe
2026-02-13 10:40   ` Leon Romanovsky
2026-02-13 12:42     ` Jason Gunthorpe
2026-02-13 15:39       ` Leon Romanovsky
2026-02-06  1:45 ` [PATCH 10/10] RDMA/bnxt_re: Add BNXT_RE_UCNTX_CMASK_UAPI_COMPAT_SUPPORTED Jason Gunthorpe
2026-02-06 12:20 ` [PATCH 00/10] Provide udata helpers and use them in bnxt_re Sriharsha Basavapatna
2026-02-06 19:11   ` Jason Gunthorpe
2026-02-09 12:28     ` 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=20260213103421.GM12887@unreal \
    --to=leon@kernel.org \
    --cc=jgg@nvidia.com \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --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