]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ib_core: Add udata argument to alloc_shpd()
authorMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 22 Sep 2015 08:31:31 +0000 (01:31 -0700)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Thu, 10 Dec 2015 02:07:25 +0000 (18:07 -0800)
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>
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/hw/mlx4/main.c
include/rdma/ib_verbs.h

index 10fa5b8466734a983f83c7670562ef8c54a80828..12b766512ade3447b213ce0e82c415fc82f962f8 100644 (file)
@@ -768,7 +768,8 @@ ssize_t ib_uverbs_alloc_shpd(struct ib_uverbs_file *file,
        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;
index 76afca050e0accf0c4544158a76cb23b4a3b506e..4feb311d4eaef57c2e678192c887fe5a67d27674 100644 (file)
@@ -766,10 +766,17 @@ static struct ib_pd *mlx4_ib_alloc_pd(struct ib_device *ibdev,
 }
 
 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);
index f4264cce207797e06df2a5842104ac7d6e1a1680..302d5e9b672684366107c730fbb72f44e945b5da 100644 (file)
@@ -1669,7 +1669,12 @@ struct ib_device {
        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,