Skip to content

Commit b352aa3

Browse files
Mukesh KackerSantoshShilimkar
authored andcommitted
ib_core: Add udata argument to alloc_shpd()
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 <[email protected]> Reviewed-by: Yuval Shaia <[email protected]>
1 parent 825878a commit b352aa3

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,8 @@ ssize_t ib_uverbs_alloc_shpd(struct ib_uverbs_file *file,
768768
down_write(&shuobj->mutex);
769769

770770
/* alloc shared pd from device driver */
771-
shpd = file->device->ib_dev->alloc_shpd(file->device->ib_dev, pd);
771+
shpd = file->device->ib_dev->alloc_shpd(file->device->ib_dev, pd,
772+
&udata);
772773
if (IS_ERR(shpd)) {
773774
ret = PTR_ERR(shpd);
774775
goto err_shobj;

drivers/infiniband/hw/mlx4/main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,10 +766,17 @@ static struct ib_pd *mlx4_ib_alloc_pd(struct ib_device *ibdev,
766766
}
767767

768768
static struct ib_shpd *mlx4_ib_alloc_shpd(struct ib_device *ibdev,
769-
struct ib_pd *pd)
769+
struct ib_pd *pd,
770+
struct ib_udata *udata)
770771
{
771772
struct mlx4_ib_shpd *shpd;
772773

774+
/*
775+
* Warn if we get udata which is not expected from the
776+
* mellanox provider.
777+
*/
778+
WARN_ON(udata && udata->inlen > 0);
779+
773780
shpd = kzalloc(sizeof(*shpd), GFP_KERNEL);
774781
if (!shpd)
775782
return ERR_PTR(-ENOMEM);

include/rdma/ib_verbs.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,12 @@ struct ib_device {
16691669
int (*check_mr_status)(struct ib_mr *mr, u32 check_mask,
16701670
struct ib_mr_status *mr_status);
16711671
struct ib_shpd *(*alloc_shpd)(struct ib_device *ibdev,
1672-
struct ib_pd *pd);
1672+
struct ib_pd *pd
1673+
#ifndef __GENKSYMS__
1674+
,
1675+
struct ib_udata *udata
1676+
#endif
1677+
);
16731678
struct ib_pd *(*share_pd)(struct ib_device *ibdev,
16741679
struct ib_ucontext *context,
16751680
struct ib_udata *udata,

0 commit comments

Comments
 (0)