aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatan Barak <matanb@mellanox.com>2016-02-29 11:05:29 -0500
committerDoug Ledford <dledford@redhat.com>2016-03-01 11:18:53 -0500
commitb2a239df4e65fe35240ddf3e5f9f31335c90589b (patch)
treede805a91e124ad7beb7f28d3bbab0f947473c80d
parenta606b0f6691daf861482f8b77326f672238ffbfd (diff)
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 <matanb@mellanox.com> Reviewed-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c8
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c3
-rw-r--r--drivers/infiniband/hw/cxgb4/iw_cxgb4.h3
-rw-r--r--drivers/infiniband/hw/cxgb4/mem.c4
-rw-r--r--drivers/infiniband/hw/mlx4/mlx4_ib.h3
-rw-r--r--drivers/infiniband/hw/mlx4/mr.c4
-rw-r--r--drivers/infiniband/hw/nes/nes_verbs.c3
-rw-r--r--include/rdma/ib_verbs.h3
8 files changed, 23 insertions, 8 deletions
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 6ffc9c4e93af..2bf751ecad15 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -1174,6 +1174,7 @@ ssize_t ib_uverbs_alloc_mw(struct ib_uverbs_file *file,
1174 struct ib_uobject *uobj; 1174 struct ib_uobject *uobj;
1175 struct ib_pd *pd; 1175 struct ib_pd *pd;
1176 struct ib_mw *mw; 1176 struct ib_mw *mw;
1177 struct ib_udata udata;
1177 int ret; 1178 int ret;
1178 1179
1179 if (out_len < sizeof(resp)) 1180 if (out_len < sizeof(resp))
@@ -1195,7 +1196,12 @@ ssize_t ib_uverbs_alloc_mw(struct ib_uverbs_file *file,
1195 goto err_free; 1196 goto err_free;
1196 } 1197 }
1197 1198
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);
1199 if (IS_ERR(mw)) { 1205 if (IS_ERR(mw)) {
1200 ret = PTR_ERR(mw); 1206 ret = PTR_ERR(mw);
1201 goto err_put; 1207 goto err_put;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 2734820d291b..42a7b8952d13 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -657,7 +657,8 @@ err:
657 return ERR_PTR(err); 657 return ERR_PTR(err);
658} 658}
659 659
660static struct ib_mw *iwch_alloc_mw(struct ib_pd *pd, enum ib_mw_type type) 660static struct ib_mw *iwch_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
661 struct ib_udata *udata)
661{ 662{
662 struct iwch_dev *rhp; 663 struct iwch_dev *rhp;
663 struct iwch_pd *php; 664 struct iwch_pd *php;
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
index fb2de75a0392..423a3a91bf41 100644
--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
+++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
@@ -961,7 +961,8 @@ int c4iw_map_mr_sg(struct ib_mr *ibmr,
961 struct scatterlist *sg, 961 struct scatterlist *sg,
962 int sg_nents); 962 int sg_nents);
963int c4iw_dealloc_mw(struct ib_mw *mw); 963int c4iw_dealloc_mw(struct ib_mw *mw);
964struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type); 964struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
965 struct ib_udata *udata);
965struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, 966struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start,
966 u64 length, u64 virt, int acc, 967 u64 length, u64 virt, int acc,
967 struct ib_udata *udata); 968 struct ib_udata *udata);
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
index 7849890c4781..766d39cff06c 100644
--- a/drivers/infiniband/hw/cxgb4/mem.c
+++ b/drivers/infiniband/hw/cxgb4/mem.c
@@ -34,6 +34,7 @@
34#include <linux/moduleparam.h> 34#include <linux/moduleparam.h>
35#include <rdma/ib_umem.h> 35#include <rdma/ib_umem.h>
36#include <linux/atomic.h> 36#include <linux/atomic.h>
37#include <rdma/ib_user_verbs.h>
37 38
38#include "iw_cxgb4.h" 39#include "iw_cxgb4.h"
39 40
@@ -552,7 +553,8 @@ err:
552 return ERR_PTR(err); 553 return ERR_PTR(err);
553} 554}
554 555
555struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type) 556struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
557 struct ib_udata *udata)
556{ 558{
557 struct c4iw_dev *rhp; 559 struct c4iw_dev *rhp;
558 struct c4iw_pd *php; 560 struct c4iw_pd *php;
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h
index 52ce7b000044..1eca01cebe51 100644
--- a/drivers/infiniband/hw/mlx4/mlx4_ib.h
+++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h
@@ -711,7 +711,8 @@ struct ib_mr *mlx4_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
711 u64 virt_addr, int access_flags, 711 u64 virt_addr, int access_flags,
712 struct ib_udata *udata); 712 struct ib_udata *udata);
713int mlx4_ib_dereg_mr(struct ib_mr *mr); 713int mlx4_ib_dereg_mr(struct ib_mr *mr);
714struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type); 714struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
715 struct ib_udata *udata);
715int mlx4_ib_dealloc_mw(struct ib_mw *mw); 716int mlx4_ib_dealloc_mw(struct ib_mw *mw);
716struct ib_mr *mlx4_ib_alloc_mr(struct ib_pd *pd, 717struct ib_mr *mlx4_ib_alloc_mr(struct ib_pd *pd,
717 enum ib_mr_type mr_type, 718 enum ib_mr_type mr_type,
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c
index 242b94ec105b..ce0b5aa8eb9b 100644
--- a/drivers/infiniband/hw/mlx4/mr.c
+++ b/drivers/infiniband/hw/mlx4/mr.c
@@ -32,6 +32,7 @@
32 */ 32 */
33 33
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <rdma/ib_user_verbs.h>
35 36
36#include "mlx4_ib.h" 37#include "mlx4_ib.h"
37 38
@@ -334,7 +335,8 @@ int mlx4_ib_dereg_mr(struct ib_mr *ibmr)
334 return 0; 335 return 0;
335} 336}
336 337
337struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type) 338struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
339 struct ib_udata *udata)
338{ 340{
339 struct mlx4_ib_dev *dev = to_mdev(pd->device); 341 struct mlx4_ib_dev *dev = to_mdev(pd->device);
340 struct mlx4_ib_mw *mw; 342 struct mlx4_ib_mw *mw;
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index 8c4daf7f22ec..5af19b4cde51 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -56,7 +56,8 @@ static int nes_dereg_mr(struct ib_mr *ib_mr);
56/** 56/**
57 * nes_alloc_mw 57 * nes_alloc_mw
58 */ 58 */
59static struct ib_mw *nes_alloc_mw(struct ib_pd *ibpd, enum ib_mw_type type) 59static struct ib_mw *nes_alloc_mw(struct ib_pd *ibpd, enum ib_mw_type type,
60 struct ib_udata *udata)
60{ 61{
61 struct nes_pd *nespd = to_nespd(ibpd); 62 struct nes_pd *nespd = to_nespd(ibpd);
62 struct nes_vnic *nesvnic = to_nesvnic(ibpd->device); 63 struct nes_vnic *nesvnic = to_nesvnic(ibpd->device);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 284b00c8fea4..3f79070de547 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1808,7 +1808,8 @@ struct ib_device {
1808 struct scatterlist *sg, 1808 struct scatterlist *sg,
1809 int sg_nents); 1809 int sg_nents);
1810 struct ib_mw * (*alloc_mw)(struct ib_pd *pd, 1810 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);
1812 int (*dealloc_mw)(struct ib_mw *mw); 1813 int (*dealloc_mw)(struct ib_mw *mw);
1813 struct ib_fmr * (*alloc_fmr)(struct ib_pd *pd, 1814 struct ib_fmr * (*alloc_fmr)(struct ib_pd *pd,
1814 int mr_access_flags, 1815 int mr_access_flags,