[PATCH rdma-core 15/20] vmw_pvrdma: Use new kABI macros

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

 



From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>

This driver was using the kABI directly, just move it to use the
new macros and drop the 'udata' indirection.

Also rename the abi file to pvrdma-abi.h for consistency.

Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
---
 kernel-headers/CMakeLists.txt                      |  1 +
 providers/vmw_pvrdma/cq.c                          |  6 +--
 .../vmw_pvrdma/{pvrdma-abi-fix.h => pvrdma-abi.h}  | 45 ++++++----------------
 providers/vmw_pvrdma/pvrdma.h                      |  2 +-
 providers/vmw_pvrdma/pvrdma_main.c                 |  2 +-
 providers/vmw_pvrdma/qp.c                          | 16 ++++----
 providers/vmw_pvrdma/verbs.c                       |  2 +-
 7 files changed, 26 insertions(+), 48 deletions(-)
 rename providers/vmw_pvrdma/{pvrdma-abi-fix.h => pvrdma-abi.h} (74%)

diff --git a/kernel-headers/CMakeLists.txt b/kernel-headers/CMakeLists.txt
index c7ad8254e3448e..46147f5827c490 100644
--- a/kernel-headers/CMakeLists.txt
+++ b/kernel-headers/CMakeLists.txt
@@ -63,4 +63,5 @@ rdma_kernel_provider_abi(
   rdma/nes-abi.h
   rdma/qedr-abi.h
   rdma/rdma_user_rxe.h
+  rdma/vmw_pvrdma-abi.h
   )
diff --git a/providers/vmw_pvrdma/cq.c b/providers/vmw_pvrdma/cq.c
index 701f0522f7b0dd..885548204d8140 100644
--- a/providers/vmw_pvrdma/cq.c
+++ b/providers/vmw_pvrdma/cq.c
@@ -239,15 +239,15 @@ struct ibv_cq *pvrdma_create_cq(struct ibv_context *context, int cqe,
 
 	cq->ring_state = cq->buf.buf;
 
-	cmd.udata.buf_addr = (uintptr_t) cq->buf.buf;
-	cmd.udata.buf_size = cq->buf.length;
+	cmd.buf_addr = (uintptr_t) cq->buf.buf;
+	cmd.buf_size = cq->buf.length;
 	ret = ibv_cmd_create_cq(context, cqe, channel, comp_vector,
 				&cq->ibv_cq, &cmd.ibv_cmd, sizeof(cmd),
 				&resp.ibv_resp, sizeof(resp));
 	if (ret)
 		goto err_buf;
 
-	cq->cqn = resp.udata.cqn;
+	cq->cqn = resp.cqn;
 	cq->cqe_cnt = cq->ibv_cq.cqe;
 
 	return &cq->ibv_cq;
diff --git a/providers/vmw_pvrdma/pvrdma-abi-fix.h b/providers/vmw_pvrdma/pvrdma-abi.h
similarity index 74%
rename from providers/vmw_pvrdma/pvrdma-abi-fix.h
rename to providers/vmw_pvrdma/pvrdma-abi.h
index 7c028aeb6b7972..77db9ddd1bb700 100644
--- a/providers/vmw_pvrdma/pvrdma-abi-fix.h
+++ b/providers/vmw_pvrdma/pvrdma-abi.h
@@ -48,40 +48,17 @@
 
 #include <infiniband/kern-abi.h>
 #include <rdma/vmw_pvrdma-abi.h>
+#include <kernel-abi/vmw_pvrdma-abi.h>
 
-struct user_pvrdma_alloc_ucontext_resp {
-	struct ib_uverbs_get_context_resp		ibv_resp;
-	struct pvrdma_alloc_ucontext_resp	udata;
-};
-
-struct user_pvrdma_alloc_pd_resp {
-	struct ib_uverbs_alloc_pd_resp	ibv_resp;
-	struct pvrdma_alloc_pd_resp	udata;
-};
-
-struct user_pvrdma_create_cq {
-	struct ibv_create_cq		ibv_cmd;
-	struct pvrdma_create_cq		udata;
-};
-
-struct user_pvrdma_create_cq_resp {
-	struct ib_uverbs_create_cq_resp	ibv_resp;
-	struct pvrdma_create_cq_resp	udata;
-};
-
-struct user_pvrdma_create_srq {
-	struct ibv_create_srq		ibv_cmd;
-	struct pvrdma_create_srq	udata;
-};
-
-struct user_pvrdma_create_srq_resp {
-	struct ib_uverbs_create_srq_resp	ibv_resp;
-	struct pvrdma_create_srq_resp	udata;
-};
-
-struct user_pvrdma_create_qp {
-	struct ibv_create_qp		ibv_cmd;
-	struct pvrdma_create_qp		udata;
-};
+DECLARE_DRV_CMD(user_pvrdma_alloc_pd, IB_USER_VERBS_CMD_ALLOC_PD,
+		empty, pvrdma_alloc_pd_resp);
+DECLARE_DRV_CMD(user_pvrdma_create_cq, IB_USER_VERBS_CMD_CREATE_CQ,
+		pvrdma_create_cq, pvrdma_create_cq_resp);
+DECLARE_DRV_CMD(user_pvrdma_create_qp, IB_USER_VERBS_CMD_CREATE_QP,
+		pvrdma_create_qp, empty);
+DECLARE_DRV_CMD(user_pvrdma_create_srq, IB_USER_VERBS_CMD_CREATE_SRQ,
+		pvrdma_create_srq, pvrdma_create_srq_resp);
+DECLARE_DRV_CMD(user_pvrdma_alloc_ucontext, IB_USER_VERBS_CMD_GET_CONTEXT,
+		empty, pvrdma_alloc_ucontext_resp);
 
 #endif /* __PVRDMA_ABI_FIX_H__ */
diff --git a/providers/vmw_pvrdma/pvrdma.h b/providers/vmw_pvrdma/pvrdma.h
index b6f2772682778a..23c1e919a874ab 100644
--- a/providers/vmw_pvrdma/pvrdma.h
+++ b/providers/vmw_pvrdma/pvrdma.h
@@ -58,7 +58,7 @@
 #include <ccan/minmax.h>
 #include <util/compiler.h>
 
-#include "pvrdma-abi-fix.h"
+#include "pvrdma-abi.h"
 #include "pvrdma_ring.h"
 
 #define PFX "pvrdma: "
diff --git a/providers/vmw_pvrdma/pvrdma_main.c b/providers/vmw_pvrdma/pvrdma_main.c
index cbcc855660c4df..2c79094f9a0f84 100644
--- a/providers/vmw_pvrdma/pvrdma_main.c
+++ b/providers/vmw_pvrdma/pvrdma_main.c
@@ -116,7 +116,7 @@ static int pvrdma_init_context_shared(struct pvrdma_context *context,
 				&resp.ibv_resp, sizeof(resp)))
 		return errno;
 
-	context->qp_tbl = calloc(resp.udata.qp_tab_size & 0xFFFF,
+	context->qp_tbl = calloc(resp.qp_tab_size & 0xFFFF,
 				 sizeof(struct pvrdma_qp *));
 	if (!context->qp_tbl)
 		return -ENOMEM;
diff --git a/providers/vmw_pvrdma/qp.c b/providers/vmw_pvrdma/qp.c
index 4b9f897633dfa3..ef429db93a43f3 100644
--- a/providers/vmw_pvrdma/qp.c
+++ b/providers/vmw_pvrdma/qp.c
@@ -137,8 +137,8 @@ struct ibv_srq *pvrdma_create_srq(struct ibv_pd *pd,
 	pvrdma_init_srq_queue(srq);
 
 	memset(&cmd, 0, sizeof(cmd));
-	cmd.udata.buf_addr = (uintptr_t) srq->buf.buf;
-	cmd.udata.buf_size = srq->buf.length;
+	cmd.buf_addr = (uintptr_t) srq->buf.buf;
+	cmd.buf_size = srq->buf.length;
 
 	ret = ibv_cmd_create_srq(pd, &srq->ibv_srq, attr,
 				 &cmd.ibv_cmd, sizeof(cmd),
@@ -147,7 +147,7 @@ struct ibv_srq *pvrdma_create_srq(struct ibv_pd *pd,
 	if (ret)
 		goto err_free;
 
-	srq->srqn = resp.udata.srqn;
+	srq->srqn = resp.srqn;
 
 	return &srq->ibv_srq;
 
@@ -276,11 +276,11 @@ struct ibv_qp *pvrdma_create_qp(struct ibv_pd *pd,
 	pvrdma_init_qp_queue(qp);
 
 	memset(&cmd, 0, sizeof(cmd));
-	cmd.udata.sbuf_addr = (uintptr_t)qp->sbuf.buf;
-	cmd.udata.sbuf_size = qp->sbuf.length;
-	cmd.udata.rbuf_addr = (uintptr_t)qp->rbuf.buf;
-	cmd.udata.rbuf_size = qp->rbuf.length;
-	cmd.udata.qp_addr = (uintptr_t) qp;
+	cmd.sbuf_addr = (uintptr_t)qp->sbuf.buf;
+	cmd.sbuf_size = qp->sbuf.length;
+	cmd.rbuf_addr = (uintptr_t)qp->rbuf.buf;
+	cmd.rbuf_size = qp->rbuf.length;
+	cmd.qp_addr = (uintptr_t) qp;
 
 	ret = ibv_cmd_create_qp(pd, &qp->ibv_qp, attr,
 				&cmd.ibv_cmd, sizeof(cmd),
diff --git a/providers/vmw_pvrdma/verbs.c b/providers/vmw_pvrdma/verbs.c
index b1ba0d652c1cf2..86d55806b89abd 100644
--- a/providers/vmw_pvrdma/verbs.c
+++ b/providers/vmw_pvrdma/verbs.c
@@ -93,7 +93,7 @@ struct ibv_pd *pvrdma_alloc_pd(struct ibv_context *context)
 		return NULL;
 	}
 
-	pd->pdn = resp.udata.pdn;
+	pd->pdn = resp.pdn;
 
 	return &pd->ibv_pd;
 }
-- 
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