diff mbox

[rdma-core,03/20] mlx4: Use kernel uapi headers

Message ID 20180320211850.10090-4-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>

The remaining copied enum constants are replaced with their versions
from the kernel headers, and the duplicate structs are dropped.

Duplicate structs were fixed with this script:

$ sed -i \
 -e 's/struct[ \t]mlx4_create_qp_drv_ex\([ \t,]\)/struct mlx4_ib_create_qp\1/g' \
 -e 's/struct[ \t]mlx4_create_qp_drv_ex_rss\([ \t,]\)/struct mlx4_ib_create_qp_rss\1/g' \
 -e 's/struct[ \t]mlx4_rss_caps\([ \t,]\)/struct mlx4_ib_rss_caps\1/g' \
 -e 's/struct[ \t]mlx4_drv_create_wq\([ \t,]\)/struct mlx4_ib_create_wq\1/g' \
 `git ls-files`

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 providers/mlx4/mlx4-abi.h | 57 +++++------------------------------------------
 providers/mlx4/mlx4.c     |  2 +-
 providers/mlx4/verbs.c    | 12 +++++-----
 3 files changed, 12 insertions(+), 59 deletions(-)
diff mbox

Patch

diff --git a/providers/mlx4/mlx4-abi.h b/providers/mlx4/mlx4-abi.h
index 47fd83db685d79..33453abb43b082 100644
--- a/providers/mlx4/mlx4-abi.h
+++ b/providers/mlx4/mlx4-abi.h
@@ -34,16 +34,13 @@ 
 #define MLX4_ABI_H
 
 #include <infiniband/kern-abi.h>
+#include <rdma/mlx4-abi.h>
 
 #define MLX4_UVERBS_MIN_ABI_VERSION	2
 #define MLX4_UVERBS_MAX_ABI_VERSION	4
 
 #define MLX4_UVERBS_NO_DEV_CAPS_ABI_VERSION	3
 
-enum {
-	MLX4_USER_DEV_CAP_64B_CQE	= 1L << 0
-};
-
 struct mlx4_alloc_ucontext_resp_v3 {
 	struct ib_uverbs_get_context_resp	ibv_resp;
 	__u32				qp_tab_size;
@@ -51,10 +48,6 @@  struct mlx4_alloc_ucontext_resp_v3 {
 	__u16				bf_regs_per_page;
 };
 
-enum mlx4_query_dev_ex_resp_mask {
-	MLX4_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0,
-};
-
 struct mlx4_alloc_ucontext_resp {
 	struct ib_uverbs_get_context_resp	ibv_resp;
 	__u32				dev_caps;
@@ -99,20 +92,6 @@  struct mlx4_resize_cq {
 	__u64				buf_addr;
 };
 
-struct mlx4_rss_caps {
-	__u64 rx_hash_fields_mask; /* enum ibv_rx_hash_fields */
-	__u8 rx_hash_function; /* enum ibv_rx_hash_function_flags */
-	__u8 reserved[7];
-};
-
-struct mlx4_ib_tso_caps {
-	__u32 max_tso; /* Maximum tso payload size in bytes */
-	/* Corresponding bit will be set if qp type from
-	 * 'enum ib_qp_type' is supported.
-	 */
-	__u32 supported_qpts;
-};
-
 struct mlx4_query_device_ex_resp {
 	struct ib_uverbs_ex_query_device_resp ibv_resp;
 	__u32				comp_mask;
@@ -121,7 +100,7 @@  struct mlx4_query_device_ex_resp {
 	__u32				max_inl_recv_sz;
 	/* Explicitly align the response to u64 */
 	__u32				reserved;
-	struct mlx4_rss_caps            rss_caps; /* vendor data channel */
+	struct mlx4_ib_rss_caps            rss_caps; /* vendor data channel */
 	struct mlx4_ib_tso_caps		tso_caps;
 };
 
@@ -158,49 +137,23 @@  struct mlx4_create_qp {
 	__u32				inl_recv_sz;
 };
 
-struct mlx4_create_qp_drv_ex_rss {
-	__u64		hash_fields_mask; /* enum ibv_rx_hash_fields */
-	__u8		hash_function; /* enum ibv_rx_hash_function_flags */
-	__u8		reserved[7];
-	__u8		hash_key[40];
-	__u32		comp_mask;
-	__u32		reserved1;
-};
-
 struct mlx4_create_qp_ex_rss {
 	struct ibv_create_qp_ex		 ibv_cmd;
-	struct mlx4_create_qp_drv_ex_rss drv_ex;
-};
-
-struct mlx4_create_qp_drv_ex {
-	__u64		buf_addr;
-	__u64		db_addr;
-	__u8		log_sq_bb_count;
-	__u8		log_sq_stride;
-	__u8		sq_no_prefetch;	/* was reserved in ABI 2 */
-	__u8		reserved[5];
+	struct mlx4_ib_create_qp_rss drv_ex;
 };
 
 struct mlx4_create_qp_ex {
 	struct ibv_create_qp_ex		ibv_cmd;
-	struct mlx4_create_qp_drv_ex	drv_ex;
+	struct mlx4_ib_create_qp	drv_ex;
 };
 
 struct mlx4_create_qp_resp_ex {
 	struct ib_uverbs_ex_create_qp_resp	ibv_resp;
 };
 
-struct mlx4_drv_create_wq {
-	__u64		buf_addr;
-	__u64		db_addr;
-	__u8		log_range_size;
-	__u8		reserved[3];
-	__u32		comp_mask;
-};
-
 struct mlx4_create_wq {
 	struct ibv_create_wq		ibv_cmd;
-	struct mlx4_drv_create_wq	drv;
+	struct mlx4_ib_create_wq	drv;
 };
 
 struct mlx4_modify_wq {
diff --git a/providers/mlx4/mlx4.c b/providers/mlx4/mlx4.c
index 1b9be1148928fe..9652762099699f 100644
--- a/providers/mlx4/mlx4.c
+++ b/providers/mlx4/mlx4.c
@@ -200,7 +200,7 @@  static struct verbs_context *mlx4_alloc_context(struct ibv_device *ibdev,
 
 		context->num_qps  = resp.qp_tab_size;
 		bf_reg_size	  = resp.bf_reg_size;
-		if (resp.dev_caps & MLX4_USER_DEV_CAP_64B_CQE)
+		if (resp.dev_caps & MLX4_USER_DEV_CAP_LARGE_CQE)
 			context->cqe_size = resp.cqe_size;
 		else
 			context->cqe_size = sizeof (struct mlx4_cqe);
diff --git a/providers/mlx4/verbs.c b/providers/mlx4/verbs.c
index 9d8d3403bb6394..034f7c4381e9b1 100644
--- a/providers/mlx4/verbs.c
+++ b/providers/mlx4/verbs.c
@@ -92,7 +92,7 @@  int mlx4_query_device_ex(struct ibv_context *context,
 	attr->tso_caps.max_tso = resp.tso_caps.max_tso;
 	attr->tso_caps.supported_qpts = resp.tso_caps.supported_qpts;
 
-	if (resp.comp_mask & MLX4_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET) {
+	if (resp.comp_mask & MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET) {
 		mctx->core_clock.offset = resp.hca_core_clock_offset;
 		mctx->core_clock.offset_valid = 1;
 	}
@@ -767,17 +767,17 @@  static int mlx4_cmd_create_qp_ex_rss(struct ibv_context *context,
 	int ret;
 
 	if (attr->rx_hash_conf.rx_hash_key_len !=
-	    sizeof(cmd_ex.drv_ex.hash_key)) {
+	    sizeof(cmd_ex.drv_ex.rx_hash_key)) {
 		errno = ENOTSUP;
 		return errno;
 	}
 
-	cmd_ex.drv_ex.hash_fields_mask =
+	cmd_ex.drv_ex.rx_hash_fields_mask =
 		attr->rx_hash_conf.rx_hash_fields_mask;
-	cmd_ex.drv_ex.hash_function =
+	cmd_ex.drv_ex.rx_hash_function =
 		attr->rx_hash_conf.rx_hash_function;
-	memcpy(cmd_ex.drv_ex.hash_key, attr->rx_hash_conf.rx_hash_key,
-	       sizeof(cmd_ex.drv_ex.hash_key));
+	memcpy(cmd_ex.drv_ex.rx_hash_key, attr->rx_hash_conf.rx_hash_key,
+	       sizeof(cmd_ex.drv_ex.rx_hash_key));
 
 	ret = ibv_cmd_create_qp_ex2(context, &qp->verbs_qp,
 				    sizeof(qp->verbs_qp), attr,