[PATCH rdma-core 6/6] cxgb3: Move cxgb3 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/cxgb3/iwch-abi.h    | 60 +++++++++----------------------------------
 providers/cxgb3/verbs.c       | 10 ++++----
 3 files changed, 18 insertions(+), 53 deletions(-)

diff --git a/kernel-headers/CMakeLists.txt b/kernel-headers/CMakeLists.txt
index e59ffd9e0c29db..d07ff64da7f7ab 100644
--- a/kernel-headers/CMakeLists.txt
+++ b/kernel-headers/CMakeLists.txt
@@ -56,6 +56,7 @@ endfunction()
 # Transform the kernel ABIs used by the providers
 rdma_kernel_provider_abi(
   rdma/bnxt_re-abi.h
+  rdma/cxgb3-abi.h
   rdma/cxgb4-abi.h
   rdma/hns-abi.h
   rdma/i40iw-abi.h
diff --git a/providers/cxgb3/iwch-abi.h b/providers/cxgb3/iwch-abi.h
index 81a76638c12e4d..047f84b7ab635d 100644
--- a/providers/cxgb3/iwch-abi.h
+++ b/providers/cxgb3/iwch-abi.h
@@ -35,53 +35,17 @@
 #include <stdint.h>
 #include <infiniband/kern-abi.h>
 #include <rdma/cxgb3-abi.h>
+#include <kernel-abi/cxgb3-abi.h>
+
+DECLARE_DRV_CMD(uiwch_alloc_pd, IB_USER_VERBS_CMD_ALLOC_PD,
+		empty, iwch_alloc_pd_resp);
+DECLARE_DRV_CMD(uiwch_create_cq, IB_USER_VERBS_CMD_CREATE_CQ,
+		iwch_create_cq_req, iwch_create_cq_resp);
+DECLARE_DRV_CMD(uiwch_create_qp, IB_USER_VERBS_CMD_CREATE_QP,
+		empty, iwch_create_qp_resp);
+DECLARE_DRV_CMD(uiwch_alloc_ucontext, IB_USER_VERBS_CMD_GET_CONTEXT,
+		empty, empty);
+DECLARE_DRV_CMD(uiwch_reg_mr, IB_USER_VERBS_CMD_REG_MR,
+		empty, iwch_reg_user_mr_resp);
 
-struct uiwch_alloc_ucontext_resp {
-	struct ib_uverbs_get_context_resp ibv_resp;
-};
-
-struct uiwch_alloc_pd_resp {
-	struct ib_uverbs_alloc_pd_resp ibv_resp;
-	uint32_t pdid;
-};
-
-struct uiwch_create_cq {
-	struct ibv_create_cq ibv_cmd;
-	uint64_t user_rptr_addr;
-};
-
-struct uiwch_reg_mr_resp {
-	struct ib_uverbs_reg_mr_resp ibv_resp;
-	uint32_t pbl_addr;
-};
-
-struct uiwch_create_cq_resp_v0 {
-	struct ib_uverbs_create_cq_resp ibv_resp;
-	uint64_t physaddr;
-	uint32_t cqid;
-	uint32_t size_log2;
-};
-
-struct uiwch_create_cq_resp_v1 {
-	struct ib_uverbs_create_cq_resp ibv_resp;
-	uint64_t physaddr;
-	uint32_t cqid;
-	uint32_t size_log2;
-	uint32_t memsize;
-	uint32_t reserved; /* for proper alignment */
-};
-
-struct uiwch_create_qp {
-	struct ibv_create_qp ibv_cmd;
-};
-
-struct uiwch_create_qp_resp {
-	struct ib_uverbs_create_qp_resp ibv_resp;
-	uint64_t physaddr;
-	uint64_t doorbell;
-	uint32_t qpid;
-	uint32_t size_log2;
-	uint32_t sq_size_log2;
-	uint32_t rq_size_log2;
-};
 #endif				/* IWCH_ABI_H */
diff --git a/providers/cxgb3/verbs.c b/providers/cxgb3/verbs.c
index 676dde96f8838e..04241043b9378a 100644
--- a/providers/cxgb3/verbs.c
+++ b/providers/cxgb3/verbs.c
@@ -169,7 +169,7 @@ struct ibv_cq *iwch_create_cq(struct ibv_context *context, int cqe,
 			      struct ibv_comp_channel *channel, int comp_vector)
 {
 	struct uiwch_create_cq cmd;
-	struct uiwch_create_cq_resp_v1 resp;
+	struct uiwch_create_cq_resp resp;
 	struct iwch_cq *chp;
 	struct iwch_device *dev = to_iwch_dev(context->device);
 	int ret;
@@ -197,7 +197,7 @@ struct ibv_cq *iwch_create_cq(struct ibv_context *context, int cqe,
 		chp->cq.memsize = resp.memsize;
 	chp->cq.queue = mmap(NULL, t3_cq_memsize(&chp->cq),
 			     PROT_READ|PROT_WRITE, MAP_SHARED, context->cmd_fd,
-			     resp.physaddr);
+			     resp.key);
 	if (chp->cq.queue == MAP_FAILED)
 		goto err2;
 
@@ -318,14 +318,14 @@ struct ibv_qp *iwch_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr)
 	qhp->wq.rq_size_log2 = resp.rq_size_log2;
 	pthread_spin_init(&qhp->lock, PTHREAD_PROCESS_PRIVATE);
 	dbva = mmap(NULL, iwch_page_size, PROT_WRITE, MAP_SHARED, 
-		    pd->context->cmd_fd, resp.doorbell & ~(iwch_page_mask));
+		    pd->context->cmd_fd, resp.db_key & ~(iwch_page_mask));
 	if (dbva == MAP_FAILED)
 		goto err3;
 
-	qhp->wq.doorbell = dbva + (resp.doorbell & (iwch_page_mask));
+	qhp->wq.doorbell = dbva + (resp.db_key & (iwch_page_mask));
 	qhp->wq.queue = mmap(NULL, t3_wq_memsize(&qhp->wq),
 			    PROT_READ|PROT_WRITE, MAP_SHARED, 
-			    pd->context->cmd_fd, resp.physaddr);
+			    pd->context->cmd_fd, resp.key);
 	if (qhp->wq.queue == MAP_FAILED)
 		goto err4;
 
-- 
2.16.2

--
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