On Mon, Feb 11, 2019 at 05:59:54PM +0200, Gal Pressman wrote: > On 07-Feb-19 18:44, Shamir Rabinovitch wrote: > > Helper function to get driver's context out of ib_udata wrapped > > in uverbs_attr_bundle for uesr objects or NULL for kernel objects. > > > > Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@xxxxxxxxxx> > > include/rdma/ib_verbs.h | 14 ++++++++++++++ > > 1 file changed, 14 insertions(+) > > > > diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h > > index 600b3319f443..065640b415bd 100644 > > +++ b/include/rdma/ib_verbs.h > > @@ -4262,4 +4262,18 @@ static inline struct ib_device *rdma_device_to_ibdev(struct device *device) > > */ > > #define rdma_device_to_drv_device(dev, drv_dev_struct, ibdev_member) \ > > container_of(rdma_device_to_ibdev(dev), drv_dev_struct, ibdev_member) > > + > > +/** > > + * rdma_udata_to_drv_context - Helper macro to get the driver's context out of > > + * ib_udata which is embadded in uverbs_attr_bundle. > > Hi Shamir, > "embadded" -> "embedded". > > > + * > > + * If udata is not NULL this cannot fail. Otherwise a NULL udata will result > > + * in a NULL ucontext pointer. Callers can rely on !NULL ucontext to show the > > + * op is being called as part of a user system call. > > + */ > > This means that !rdma_udata_to_drv_context is the proper way to check for user > verbs vs kverbs calls (instead of !udata)? That's not entirely clear from the > next patch. It should be clarified, drivers should rely on udata and try not to call this with a null udata. Jason