lkml.org 
[lkml]   [2021]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH rdma-next 7/7] RDMA/core: Create clean QP creations interface for uverbs
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

\
 
 \ /
  Last update: 2021-07-21 09:09    [W:0.071 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site