ib_core: Add udata argument to alloc_shpd()
Add udata argument to shared pd interface alloc_shpd()
consistent with evolution of other similar ib_core
interfaces so providers that wish to support it can use it.
For providers (like current Mellanox driver code) that
do not expect user user data, we assert a warning.
Orabug:
21884873
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
down_write(&shuobj->mutex);
/* alloc shared pd from device driver */
- shpd = file->device->ib_dev->alloc_shpd(file->device->ib_dev, pd);
+ shpd = file->device->ib_dev->alloc_shpd(file->device->ib_dev, pd,
+ &udata);
if (IS_ERR(shpd)) {
ret = PTR_ERR(shpd);
goto err_shobj;
}
static struct ib_shpd *mlx4_ib_alloc_shpd(struct ib_device *ibdev,
- struct ib_pd *pd)
+ struct ib_pd *pd,
+ struct ib_udata *udata)
{
struct mlx4_ib_shpd *shpd;
+ /*
+ * Warn if we get udata which is not expected from the
+ * mellanox provider.
+ */
+ WARN_ON(udata && udata->inlen > 0);
+
shpd = kzalloc(sizeof(*shpd), GFP_KERNEL);
if (!shpd)
return ERR_PTR(-ENOMEM);
int (*check_mr_status)(struct ib_mr *mr, u32 check_mask,
struct ib_mr_status *mr_status);
struct ib_shpd *(*alloc_shpd)(struct ib_device *ibdev,
- struct ib_pd *pd);
+ struct ib_pd *pd
+#ifndef __GENKSYMS__
+ ,
+ struct ib_udata *udata
+#endif
+ );
struct ib_pd *(*share_pd)(struct ib_device *ibdev,
struct ib_ucontext *context,
struct ib_udata *udata,