diff mbox

[rdma-core,02/20] rxe: Move rxe to exclusively use the kernel uapi headers

Message ID 20180320211850.10090-3-jgg@ziepe.ca (mailing list archive)
State Not Applicable
Headers show

Commit Message

Jason Gunthorpe March 20, 2018, 9:18 p.m. UTC
From: Jason Gunthorpe <jgg@mellanox.com>

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

Only mmap_info needed to be renamed, using this script:

$ sed -i \
 -e 's/struct[ \t]mmap_info\([ \t,]\)/struct mminfo\1/g'\
 `git ls-files`

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 kernel-headers/CMakeLists.txt |  1 +
 providers/rxe/rxe-abi.h       | 46 ++++++++++++-------------------------------
 providers/rxe/rxe.c           |  4 ++--
 providers/rxe/rxe.h           |  8 ++++----
 4 files changed, 20 insertions(+), 39 deletions(-)
diff mbox

Patch

diff --git a/kernel-headers/CMakeLists.txt b/kernel-headers/CMakeLists.txt
index e8fb9a2464ead9..365b4c57cd7095 100644
--- a/kernel-headers/CMakeLists.txt
+++ b/kernel-headers/CMakeLists.txt
@@ -57,4 +57,5 @@  endfunction()
 rdma_kernel_provider_abi(
   rdma/ib_user_verbs.h
   rdma/qedr-abi.h
+  rdma/rdma_user_rxe.h
   )
diff --git a/providers/rxe/rxe-abi.h b/providers/rxe/rxe-abi.h
index 78535a59014cf6..b4680a24dd16b5 100644
--- a/providers/rxe/rxe-abi.h
+++ b/providers/rxe/rxe-abi.h
@@ -36,38 +36,18 @@ 
 #define RXE_ABI_H
 
 #include <infiniband/kern-abi.h>
-
-struct mmap_info {
-	__u64 offset;
-	__u32 size;
-	__u32 pad;
-};
-
-struct urxe_create_cq_resp {
-	struct ib_uverbs_create_cq_resp ibv_resp;
-	struct mmap_info mi;
-};
-
-struct urxe_resize_cq_resp {
-	struct ib_uverbs_resize_cq_resp ibv_resp;
-	struct mmap_info mi;
-};
-
-struct urxe_create_qp_resp {
-	struct ib_uverbs_create_qp_resp ibv_resp;
-	struct mmap_info rq_mi;
-	struct mmap_info sq_mi;
-};
-
-struct urxe_create_srq_resp {
-	struct ib_uverbs_create_srq_resp ibv_resp;
-	struct mmap_info mi;
-	__u32 srq_num;
-};
-
-struct urxe_modify_srq_cmd {
-	struct ibv_modify_srq ibv_cmd;
-	__u64 mmap_info_addr;
-};
+#include <rdma/rdma_user_rxe.h>
+#include <kernel-abi/rdma_user_rxe.h>
+
+DECLARE_DRV_CMD(urxe_create_cq, IB_USER_VERBS_CMD_CREATE_CQ,
+		empty, rxe_create_cq_resp);
+DECLARE_DRV_CMD(urxe_create_qp, IB_USER_VERBS_CMD_CREATE_QP,
+		empty, rxe_create_qp_resp);
+DECLARE_DRV_CMD(urxe_create_srq, IB_USER_VERBS_CMD_CREATE_SRQ,
+		empty, rxe_create_srq_resp);
+DECLARE_DRV_CMD(urxe_modify_srq, IB_USER_VERBS_CMD_MODIFY_SRQ,
+		rxe_modify_srq_cmd, empty);
+DECLARE_DRV_CMD(urxe_resize_cq, IB_USER_VERBS_CMD_RESIZE_CQ,
+		empty, rxe_resize_cq_resp);
 
 #endif /* RXE_ABI_H */
diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c
index dbb8f94274ca32..1ced15be45c928 100644
--- a/providers/rxe/rxe.c
+++ b/providers/rxe/rxe.c
@@ -308,9 +308,9 @@  static int rxe_modify_srq(struct ibv_srq *ibsrq,
 		   struct ibv_srq_attr *attr, int attr_mask)
 {
 	struct rxe_srq *srq = to_rsrq(ibsrq);
-	struct urxe_modify_srq_cmd cmd;
+	struct urxe_modify_srq cmd;
 	int rc = 0;
-	struct mmap_info mi;
+	struct mminfo mi;
 
 	mi.offset = 0;
 	mi.size = 0;
diff --git a/providers/rxe/rxe.h b/providers/rxe/rxe.h
index 3fc0436127e432..96f4ee9cfba213 100644
--- a/providers/rxe/rxe.h
+++ b/providers/rxe/rxe.h
@@ -59,7 +59,7 @@  struct rxe_context {
 
 struct rxe_cq {
 	struct ibv_cq		ibv_cq;
-	struct mmap_info	mmap_info;
+	struct mminfo		mmap_info;
 	struct rxe_queue		*queue;
 	pthread_spinlock_t	lock;
 };
@@ -78,9 +78,9 @@  struct rxe_wq {
 
 struct rxe_qp {
 	struct ibv_qp		ibv_qp;
-	struct mmap_info	rq_mmap_info;
+	struct mminfo		rq_mmap_info;
 	struct rxe_wq		rq;
-	struct mmap_info	sq_mmap_info;
+	struct mminfo		sq_mmap_info;
 	struct rxe_wq		sq;
 	unsigned int		ssn;
 };
@@ -89,7 +89,7 @@  struct rxe_qp {
 
 struct rxe_srq {
 	struct ibv_srq		ibv_srq;
-	struct mmap_info	mmap_info;
+	struct mminfo		mmap_info;
 	struct rxe_wq		rq;
 	uint32_t		srq_num;
 };