Re: [PATCH v1 08/24] IB/verbs: Prototype of HW object clone callback

Jason Gunthorpe
2019-08-21T14:59:21Z

On Wed, Aug 21, 2019 at 05:21:09PM +0300, Yuval Shaia wrote:
> From: Shamir Rabinovitch <shamir.rabinovitch@oracle.com>
>
> Define prototype for clone callback. The clone callback is used
> by the driver layer to supply the uverbs a way to clone IB HW
> object driver data to rdma-core user space provider. The clone
> callback is used when new IB HW object is created and every time
> it is imported to some ib_ucontext. Drivers that wish to enable
> share of some IB HW object (ib_pd, ib_mr, etc..) must supply valid
> clone callback for that type.
>
> Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com>
> Signed-off-by: Shamir Rabinovitch <srabinov7@gmail.com>
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> include/rdma/ib_verbs.h | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index 7e69866fc419..542b3cb2d943 100644
> +++ b/include/rdma/ib_verbs.h
> @@ -2265,6 +2265,18 @@ struct iw_cm_conn_param;
>
> #define DECLARE_RDMA_OBJ_SIZE(ib_struct) size_t size_##ib_struct
>
> +/*
> + * Prototype for IB HW object clone callback
> + *
> + * Define prototype for clone callback. The clone callback is used
> + * by the driver layer to supply the uverbs a way to clone IB HW
> + * object driver data to rdma-core user space provider. The clone
> + * callback is used when new IB HW object is created and every time
> + * it is imported to some ib_ucontext.
> + */
> +#define clone_callback(ib_type) \
> + int (*clone_##ib_type)(struct ib_udata *udata, struct ib_type *obj)

Don't like the idea of clone at all.

If the userspace driver needs to learn information about a HW object
it just imported, like some HW specific PDN, then the correct verb for
that is QUERY not clone.

And we already have a wide ranging infrastructure for drivers to add
their own driver specific query interfaces.

Jason