Skip to content

Commit b2a239d

Browse files
matanb10dledford
authored andcommitted
IB/core: Add vendor's specific data to alloc mw
Passing udata to the vendor's driver in order to pass data from the user-space driver to the kernel-space driver. This data will be used in downstream patches. Signed-off-by: Matan Barak <[email protected]> Reviewed-by: Yishai Hadas <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent a606b0f commit b2a239d

File tree

8 files changed

+23
-8
lines changed

8 files changed

+23
-8
lines changed

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,7 @@ ssize_t ib_uverbs_alloc_mw(struct ib_uverbs_file *file,
11741174
struct ib_uobject *uobj;
11751175
struct ib_pd *pd;
11761176
struct ib_mw *mw;
1177+
struct ib_udata udata;
11771178
int ret;
11781179

11791180
if (out_len < sizeof(resp))
@@ -1195,7 +1196,12 @@ ssize_t ib_uverbs_alloc_mw(struct ib_uverbs_file *file,
11951196
goto err_free;
11961197
}
11971198

1198-
mw = pd->device->alloc_mw(pd, cmd.mw_type);
1199+
INIT_UDATA(&udata, buf + sizeof(cmd),
1200+
(unsigned long)cmd.response + sizeof(resp),
1201+
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
1202+
out_len - sizeof(resp));
1203+
1204+
mw = pd->device->alloc_mw(pd, cmd.mw_type, &udata);
11991205
if (IS_ERR(mw)) {
12001206
ret = PTR_ERR(mw);
12011207
goto err_put;

drivers/infiniband/hw/cxgb3/iwch_provider.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,8 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
657657
return ERR_PTR(err);
658658
}
659659

660-
static struct ib_mw *iwch_alloc_mw(struct ib_pd *pd, enum ib_mw_type type)
660+
static struct ib_mw *iwch_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
661+
struct ib_udata *udata)
661662
{
662663
struct iwch_dev *rhp;
663664
struct iwch_pd *php;

drivers/infiniband/hw/cxgb4/iw_cxgb4.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,8 @@ int c4iw_map_mr_sg(struct ib_mr *ibmr,
961961
struct scatterlist *sg,
962962
int sg_nents);
963963
int c4iw_dealloc_mw(struct ib_mw *mw);
964-
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
964+
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
965+
struct ib_udata *udata);
965966
struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start,
966967
u64 length, u64 virt, int acc,
967968
struct ib_udata *udata);

drivers/infiniband/hw/cxgb4/mem.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <linux/moduleparam.h>
3535
#include <rdma/ib_umem.h>
3636
#include <linux/atomic.h>
37+
#include <rdma/ib_user_verbs.h>
3738

3839
#include "iw_cxgb4.h"
3940

@@ -552,7 +553,8 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
552553
return ERR_PTR(err);
553554
}
554555

555-
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type)
556+
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
557+
struct ib_udata *udata)
556558
{
557559
struct c4iw_dev *rhp;
558560
struct c4iw_pd *php;

drivers/infiniband/hw/mlx4/mlx4_ib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,8 @@ struct ib_mr *mlx4_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
711711
u64 virt_addr, int access_flags,
712712
struct ib_udata *udata);
713713
int mlx4_ib_dereg_mr(struct ib_mr *mr);
714-
struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
714+
struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
715+
struct ib_udata *udata);
715716
int mlx4_ib_dealloc_mw(struct ib_mw *mw);
716717
struct ib_mr *mlx4_ib_alloc_mr(struct ib_pd *pd,
717718
enum ib_mr_type mr_type,

drivers/infiniband/hw/mlx4/mr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
*/
3333

3434
#include <linux/slab.h>
35+
#include <rdma/ib_user_verbs.h>
3536

3637
#include "mlx4_ib.h"
3738

@@ -334,7 +335,8 @@ int mlx4_ib_dereg_mr(struct ib_mr *ibmr)
334335
return 0;
335336
}
336337

337-
struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type)
338+
struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
339+
struct ib_udata *udata)
338340
{
339341
struct mlx4_ib_dev *dev = to_mdev(pd->device);
340342
struct mlx4_ib_mw *mw;

drivers/infiniband/hw/nes/nes_verbs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ static int nes_dereg_mr(struct ib_mr *ib_mr);
5656
/**
5757
* nes_alloc_mw
5858
*/
59-
static struct ib_mw *nes_alloc_mw(struct ib_pd *ibpd, enum ib_mw_type type)
59+
static struct ib_mw *nes_alloc_mw(struct ib_pd *ibpd, enum ib_mw_type type,
60+
struct ib_udata *udata)
6061
{
6162
struct nes_pd *nespd = to_nespd(ibpd);
6263
struct nes_vnic *nesvnic = to_nesvnic(ibpd->device);

include/rdma/ib_verbs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,8 @@ struct ib_device {
18081808
struct scatterlist *sg,
18091809
int sg_nents);
18101810
struct ib_mw * (*alloc_mw)(struct ib_pd *pd,
1811-
enum ib_mw_type type);
1811+
enum ib_mw_type type,
1812+
struct ib_udata *udata);
18121813
int (*dealloc_mw)(struct ib_mw *mw);
18131814
struct ib_fmr * (*alloc_fmr)(struct ib_pd *pd,
18141815
int mr_access_flags,

0 commit comments

Comments
 (0)