diff mbox

[rdma-core,3/6] ocrdma: Use kernel uapi headers

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

Commit Message

Jason Gunthorpe March 27, 2018, 10:03 p.m. UTC
From: Jason Gunthorpe <jgg@mellanox.com>

There are a few constants that are shared, and the struct names all
conflict, but otherwise fairly simple.

Confusingly ocrdma has all kinds of non uapi stuff in its uapi header,
not clear what that is about.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 providers/ocrdma/ocrdma_abi.h   | 29 +++++++++++++----------------
 providers/ocrdma/ocrdma_main.c  |  4 ++--
 providers/ocrdma/ocrdma_verbs.c | 18 +++++++++---------
 3 files changed, 24 insertions(+), 27 deletions(-)
diff mbox

Patch

diff --git a/providers/ocrdma/ocrdma_abi.h b/providers/ocrdma/ocrdma_abi.h
index f45707632a5a7f..b5ac0991abb331 100644
--- a/providers/ocrdma/ocrdma_abi.h
+++ b/providers/ocrdma/ocrdma_abi.h
@@ -37,6 +37,7 @@ 
 
 #include <stdint.h>
 #include <infiniband/kern-abi.h>
+#include <rdma/ocrdma-abi.h>
 
 #define OCRDMA_ABI_VERSION	2
 
@@ -61,11 +62,11 @@  enum {
 /* solicited bit */
 #define OCRDMA_DB_CQ_SOLICIT_SHIFT		(31)	/* bit 31 */
 
-struct ocrdma_get_context {
+struct uocrdma_get_context {
 	struct ibv_get_context cmd;
 };
 
-struct ocrdma_alloc_ucontext_resp {
+struct uocrdma_alloc_ucontext_resp {
 	struct ib_uverbs_get_context_resp ibv_resp;
 	uint32_t dev_id;
 	uint32_t wqe_size;
@@ -79,12 +80,12 @@  struct ocrdma_alloc_ucontext_resp {
 	uint64_t rsvd2;
 };
 
-struct ocrdma_alloc_pd_req {
+struct uocrdma_alloc_pd_req {
 	struct ibv_alloc_pd cmd;
 	uint64_t rsvd;
 };
 
-struct ocrdma_alloc_pd_resp {
+struct uocrdma_alloc_pd_resp {
 	struct ib_uverbs_alloc_pd_resp ibv_resp;
 	uint32_t id;
 	uint32_t dpp_enabled;
@@ -93,14 +94,13 @@  struct ocrdma_alloc_pd_resp {
 	uint64_t rsvd;
 };
 
-struct ocrdma_create_cq_req {
+struct uocrdma_create_cq_req {
 	struct ibv_create_cq ibv_cmd;
 	uint32_t dpp_cq;
 	uint32_t rsvd;
 };
 
-#define MAX_CQ_PAGES 8
-struct ocrdma_create_cq_resp {
+struct uocrdma_create_cq_resp {
 	struct ib_uverbs_create_cq_resp ibv_resp;
 	uint32_t cq_id;
 	uint32_t size;
@@ -114,15 +114,15 @@  struct ocrdma_create_cq_resp {
 	uint64_t rsvd2;
 };
 
-struct ocrdma_reg_mr {
+struct uocrdma_reg_mr {
 	struct ibv_reg_mr ibv_cmd;
 };
 
-struct ocrdma_reg_mr_resp {
+struct uocrdma_reg_mr_resp {
 	struct ib_uverbs_reg_mr_resp ibv_resp;
 };
 
-struct ocrdma_create_qp_cmd {
+struct uocrdma_create_qp_cmd {
 	struct ibv_create_qp ibv_cmd;
 	uint8_t enable_dpp_cq;
 	uint8_t rsvd;
@@ -130,10 +130,7 @@  struct ocrdma_create_qp_cmd {
 	uint32_t rsvd1;		/* pad */
 };
 
-#define MAX_QP_PAGES 8
-#define MAX_UD_HDR_PAGES 8
-
-struct ocrdma_create_qp_uresp {
+struct uocrdma_create_qp_uresp {
 	struct ib_uverbs_create_qp_resp ibv_resp;
 	uint16_t qp_id;
 	uint16_t sq_dbid;
@@ -157,11 +154,11 @@  struct ocrdma_create_qp_uresp {
 	uint64_t rsvd[11]; /* 8*8 + 4*4 + 8 */
 };
 
-struct ocrdma_create_srq_cmd {
+struct uocrdma_create_srq_cmd {
 	struct ibv_create_srq ibv_cmd;
 };
 
-struct ocrdma_create_srq_resp {
+struct uocrdma_create_srq_resp {
 	struct ib_uverbs_create_srq_resp ibv_resp;
 	uint16_t rq_dbid;
 	uint16_t resv0;
diff --git a/providers/ocrdma/ocrdma_main.c b/providers/ocrdma/ocrdma_main.c
index 76c3b30eaf9168..ee67f4d07d5139 100644
--- a/providers/ocrdma/ocrdma_main.c
+++ b/providers/ocrdma/ocrdma_main.c
@@ -109,8 +109,8 @@  static struct verbs_context *ocrdma_alloc_context(struct ibv_device *ibdev,
 						  int cmd_fd)
 {
 	struct ocrdma_devctx *ctx;
-	struct ocrdma_get_context cmd;
-	struct ocrdma_alloc_ucontext_resp resp;
+	struct uocrdma_get_context cmd;
+	struct uocrdma_alloc_ucontext_resp resp;
 
 	ctx = verbs_init_and_alloc_context(ibdev, cmd_fd, ctx, ibv_ctx,
 					   RDMA_DRIVER_OCRDMA);
diff --git a/providers/ocrdma/ocrdma_verbs.c b/providers/ocrdma/ocrdma_verbs.c
index dd7035ddc28d86..223ad9c690fd0a 100644
--- a/providers/ocrdma/ocrdma_verbs.c
+++ b/providers/ocrdma/ocrdma_verbs.c
@@ -133,8 +133,8 @@  static void ocrdma_free_ah_tbl_id(struct ocrdma_devctx *ctx, int idx)
  */
 struct ibv_pd *ocrdma_alloc_pd(struct ibv_context *context)
 {
-	struct ocrdma_alloc_pd_req cmd;
-	struct ocrdma_alloc_pd_resp resp;
+	struct uocrdma_alloc_pd_req cmd;
+	struct uocrdma_alloc_pd_resp resp;
 	struct ocrdma_pd *pd;
 	uint64_t map_address = 0;
 
@@ -191,7 +191,7 @@  struct ibv_mr *ocrdma_reg_mr(struct ibv_pd *pd, void *addr,
 {
 	struct ocrdma_mr *mr;
 	struct ibv_reg_mr cmd;
-	struct ocrdma_reg_mr_resp resp;
+	struct uocrdma_reg_mr_resp resp;
 	uint64_t hca_va = (uintptr_t) addr;
 
 	mr = malloc(sizeof *mr);
@@ -230,8 +230,8 @@  static struct ibv_cq *ocrdma_create_cq_common(struct ibv_context *context,
 					      int comp_vector, int dpp_cq)
 {
 	int status;
-	struct ocrdma_create_cq_req cmd;
-	struct ocrdma_create_cq_resp resp;
+	struct uocrdma_create_cq_req cmd;
+	struct uocrdma_create_cq_resp resp;
 	struct ocrdma_cq *cq;
 	struct ocrdma_device *dev = get_ocrdma_dev(context->device);
 	void *map_addr;
@@ -354,8 +354,8 @@  struct ibv_srq *ocrdma_create_srq(struct ibv_pd *pd,
 {
 	int status = 0;
 	struct ocrdma_srq *srq;
-	struct ocrdma_create_srq_cmd cmd;
-	struct ocrdma_create_srq_resp resp;
+	struct uocrdma_create_srq_cmd cmd;
+	struct uocrdma_create_srq_resp resp;
 	void *map_addr;
 
 	srq = calloc(1, sizeof *srq);
@@ -464,8 +464,8 @@  struct ibv_qp *ocrdma_create_qp(struct ibv_pd *pd,
 				struct ibv_qp_init_attr *attrs)
 {
 	int status = 0;
-	struct ocrdma_create_qp_cmd cmd;
-	struct ocrdma_create_qp_uresp resp;
+	struct uocrdma_create_qp_cmd cmd;
+	struct uocrdma_create_qp_uresp resp;
 	struct ocrdma_qp *qp;
 	void *map_addr;
 #ifdef DPP_CQ_SUPPORT