linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
	Mark Zhang <markz@mellanox.com>
Subject: Re: [PATCH rdma-next 7/7] RDMA/core: Create clean QP creations interface for uverbs
Date: Wed, 21 Jul 2021 10:06:06 +0300	[thread overview]
Message-ID: <YPfHXpFtB1RJ4yjU@unreal> (raw)
In-Reply-To: <YPfDUN6CaOdGZLPS@infradead.org>

On Wed, Jul 21, 2021 at 07:48:48AM +0100, Christoph Hellwig wrote:
> > +struct ib_qp *ib_create_qp_user(struct ib_device *dev, struct ib_pd *pd,
> > +				struct ib_qp_init_attr *attr,
> > +				struct ib_udata *udata,
> > +				struct ib_uqp_object *uobj, const char *caller);
> > +static inline struct ib_qp *ib_create_qp_uverbs(struct ib_device *dev,
> > +						struct ib_pd *pd,
> > +						struct ib_qp_init_attr *attr,
> > +						struct ib_udata *udata,
> > +						struct ib_uqp_object *uobj)
> > +{
> > +	if (attr->qp_type == IB_QPT_XRC_TGT)
> > +		return ib_create_qp_user(dev, pd, attr, NULL, uobj,
> > +					 KBUILD_MODNAME);
> > +
> > +	return ib_create_qp_user(dev, pd, attr, udata, uobj, NULL);
> 
> Why not always pass along the udata and caller and just not use them
> in the low-level code?

You will need to add some sort of "if qp tpye" for ib_create_qp_uverbs() callers,
because they always provide udata != NULL. 

After this series, the callers look like this:

 1438         qp = ib_create_qp_uverbs(device, pd, &attr, &attrs->driver_udata, obj);
                                                          ^^^^^^^^^ not NULL

So instead of bothering callers, I implemented it here with one "if".

Thanks

  reply	other threads:[~2021-07-21  7:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21  6:12 [PATCH rdma-next 0/7] Separate user/kernel QP creation logic Leon Romanovsky
2021-07-21  6:13 ` [PATCH rdma-next 1/7] RDMA/mlx5: Delete not-available udata check Leon Romanovsky
2021-07-21  6:13 ` [PATCH rdma-next 2/7] RDMA/core: Delete duplicated and unreachable code Leon Romanovsky
2021-07-21  6:13 ` [PATCH rdma-next 3/7] RDMA/core: Remove protection from wrong in-kernel API usage Leon Romanovsky
2021-07-21  6:41   ` Christoph Hellwig
2021-07-21  6:56     ` Leon Romanovsky
2021-07-21  6:13 ` [PATCH rdma-next 4/7] RDMA/core: Reorganize create QP low-level functions Leon Romanovsky
2021-07-21  6:45   ` Christoph Hellwig
2021-07-21  6:58     ` Leon Romanovsky
2021-07-21  7:47   ` Mark Zhang
2021-07-21  7:49     ` Leon Romanovsky
2021-07-21  6:13 ` [PATCH rdma-next 5/7] RDMA/core: Configure selinux QP during creation Leon Romanovsky
2021-07-21  6:13 ` [PATCH rdma-next 6/7] RDMA/core: Properly increment and decrement QP usecnts Leon Romanovsky
2021-07-21  6:13 ` [PATCH rdma-next 7/7] RDMA/core: Create clean QP creations interface for uverbs Leon Romanovsky
2021-07-21  6:48   ` Christoph Hellwig
2021-07-21  7:06     ` Leon Romanovsky [this message]
2021-07-21  7:12       ` Christoph Hellwig
2021-07-21  7:20         ` Christoph Hellwig
2021-07-21  7:31           ` Leon Romanovsky
2021-07-21  7:30         ` Leon Romanovsky

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=YPfHXpFtB1RJ4yjU@unreal \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=hch@infradead.org \
    --cc=jgg@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=markz@mellanox.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;
as well as URLs for NNTP newsgroup(s).