[PATCH rdma-core 10/20] nes: Move nes to exclusively use the kernel uapi headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>

Using the driver support macros we can now directly create the
required driver structs automatically.

Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
---
 kernel-headers/CMakeLists.txt |  1 +
 providers/nes/nes-abi.h       | 73 +++++++------------------------------------
 providers/nes/nes_umain.c     |  2 +-
 providers/nes/nes_uverbs.c    |  4 +--
 4 files changed, 16 insertions(+), 64 deletions(-)

diff --git a/kernel-headers/CMakeLists.txt b/kernel-headers/CMakeLists.txt
index 768cc32167cf29..b884e68b1f20a0 100644
--- a/kernel-headers/CMakeLists.txt
+++ b/kernel-headers/CMakeLists.txt
@@ -58,6 +58,7 @@ rdma_kernel_provider_abi(
   rdma/ib_user_verbs.h
   rdma/mlx4-abi.h
   rdma/mlx5-abi.h
+  rdma/nes-abi.h
   rdma/qedr-abi.h
   rdma/rdma_user_rxe.h
   )
diff --git a/providers/nes/nes-abi.h b/providers/nes/nes-abi.h
index 54e8708cbf6471..0a531230b06273 100644
--- a/providers/nes/nes-abi.h
+++ b/providers/nes/nes-abi.h
@@ -36,66 +36,17 @@
 
 #include <infiniband/kern-abi.h>
 #include <rdma/nes-abi.h>
-
-struct nes_get_context {
-	struct ibv_get_context cmd;
-	__u32 reserved32;
-	__u8 userspace_ver;
-	__u8 reserved8[3];
-};
-
-
-struct nes_ualloc_ucontext_resp {
-	struct ib_uverbs_get_context_resp ibv_resp;
-	__u32 max_pds; 	/* maximum pds allowed for this user process */
-	__u32 max_qps; 	/* maximum qps allowed for this user process */
-	__u32 wq_size; 	/* defines the size of the WQs (sq+rq) allocated to the mmaped area */
-	__u8 virtwq;
-	__u8 kernel_ver;
-	__u8 reserved[2];
-};
-
-struct nes_ualloc_pd_resp {
-	struct ib_uverbs_alloc_pd_resp ibv_resp;
-	__u32 pd_id;
-	__u32 db_index;
-};
-
-struct nes_ucreate_cq {
-	struct ibv_create_cq ibv_cmd;
-	__u64 user_cq_buffer;
-	__u32 mcrqf;
-	__u8 reserved[4];
-};
-
-struct nes_ucreate_cq_resp {
-	struct ib_uverbs_create_cq_resp ibv_resp;
-	__u32 cq_id;
-	__u32 cq_size;
-	__u32 mmap_db_index;
-	__u32 reserved;
-};
-
-struct nes_ureg_mr {
-	struct ibv_reg_mr ibv_cmd;
-	__u32 reg_type;	/* indicates if id is memory, QP or CQ */
-	__u32 reserved;
-};
-
-struct nes_ucreate_qp {
-	struct ibv_create_qp ibv_cmd;
-	__u64	user_sq_buffer;
-	__u64   user_qp_buffer;
-};
-
-struct nes_ucreate_qp_resp {
-	struct ib_uverbs_create_qp_resp ibv_resp;
-	__u32 qp_id;
-	__u32 actual_sq_size;
-	__u32 actual_rq_size;
-	__u32 mmap_sq_db_index;
-	__u32 mmap_rq_db_index;
-	__u32 nes_drv_opt;
-};
+#include <kernel-abi/nes-abi.h>
+
+DECLARE_DRV_CMD(nes_ualloc_pd, IB_USER_VERBS_CMD_ALLOC_PD,
+		empty, nes_alloc_pd_resp);
+DECLARE_DRV_CMD(nes_ucreate_cq, IB_USER_VERBS_CMD_CREATE_CQ,
+		nes_create_cq_req, nes_create_cq_resp);
+DECLARE_DRV_CMD(nes_ucreate_qp, IB_USER_VERBS_CMD_CREATE_QP,
+		nes_create_qp_req, nes_create_qp_resp);
+DECLARE_DRV_CMD(nes_get_context, IB_USER_VERBS_CMD_GET_CONTEXT,
+		nes_alloc_ucontext_req, nes_alloc_ucontext_resp);
+DECLARE_DRV_CMD(nes_ureg_mr, IB_USER_VERBS_CMD_REG_MR,
+		nes_mem_reg_req, empty);
 
 #endif			/* nes_ABI_H */
diff --git a/providers/nes/nes_umain.c b/providers/nes/nes_umain.c
index 1a7913271af8ba..dce46e6b867a16 100644
--- a/providers/nes/nes_umain.c
+++ b/providers/nes/nes_umain.c
@@ -103,7 +103,7 @@ static struct verbs_context *nes_ualloc_context(struct ibv_device *ibdev,
 	struct ibv_pd *ibv_pd;
 	struct nes_uvcontext *nesvctx;
 	struct nes_get_context cmd;
-	struct nes_ualloc_ucontext_resp resp;
+	struct nes_get_context_resp resp;
 	char value[16];
 	uint32_t nes_drv_opt = 0;
 
diff --git a/providers/nes/nes_uverbs.c b/providers/nes/nes_uverbs.c
index be3b057c5bf7b4..5f13c1b11ada06 100644
--- a/providers/nes/nes_uverbs.c
+++ b/providers/nes/nes_uverbs.c
@@ -127,7 +127,7 @@ struct ibv_pd *nes_ualloc_pd(struct ibv_context *context)
 		return NULL;
 	}
 	nesupd->pd_id = resp.pd_id;
-	nesupd->db_index = resp.db_index;
+	nesupd->db_index = resp.mmap_db_index;
 
 	nesupd->udoorbell = mmap(NULL, page_size, PROT_WRITE | PROT_READ, MAP_SHARED,
 			context->cmd_fd, nesupd->db_index * page_size);
@@ -967,7 +967,7 @@ static int nes_vmapped_qp(struct nes_uqp *nesuqp, struct ibv_pd *pd, struct ibv_
         }
 	// So now the memory has been registered..
 	memset (&cmd, 0, sizeof(cmd) );
-	cmd.user_sq_buffer = (__u64) ((uintptr_t) nesuqp->sq_vbase);
+	cmd.user_wqe_buffers = (__u64) ((uintptr_t) nesuqp->sq_vbase);
 	cmd.user_qp_buffer = (__u64) ((uintptr_t) nesuqp);
 	ret = ibv_cmd_create_qp(pd, &nesuqp->ibv_qp, attr, &cmd.ibv_cmd, sizeof cmd,
 				&resp->ibv_resp, sizeof (struct nes_ucreate_qp_resp) );
-- 
2.16.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux