diff mbox

[rdma-core,07/20] mlx5: Do not use internal ABI structures in place of kernel ABI

Message ID 20180320211850.10090-8-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 kernel ABI structs should always be used, even if they happen
to match todays ABI struct out of the library. This prevents future
bugs if someone decides to modify the library ABI.

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

Patch

diff --git a/providers/mlx5/mlx5-abi.h b/providers/mlx5/mlx5-abi.h
index d5bb4c7191b3f4..23f3cc4cda574c 100644
--- a/providers/mlx5/mlx5-abi.h
+++ b/providers/mlx5/mlx5-abi.h
@@ -225,23 +225,18 @@  struct mlx5_query_device_ex {
 	struct ibv_query_device_ex	ibv_cmd;
 };
 
-struct mlx5_striding_rq_caps {
-	struct mlx5dv_striding_rq_caps	caps;
-	__u32				reserved;
-};
-
 struct mlx5_query_device_ex_resp {
 	struct ib_uverbs_ex_query_device_resp ibv_resp;
 	__u32				comp_mask;
 	__u32				response_length;
-	struct ibv_tso_caps		tso_caps;
+	struct mlx5_ib_tso_caps		tso_caps;
 	struct mlx5_ib_rss_caps            rss_caps; /* vendor data channel */
-	struct mlx5dv_cqe_comp_caps	cqe_comp_caps;
+	struct mlx5_ib_cqe_comp_caps	cqe_comp_caps;
 	struct mlx5_packet_pacing_caps	packet_pacing_caps;
 	__u32				support_multi_pkt_send_wqe;
 	__u32				flags; /* Use enum mlx5_query_dev_resp_flags */
-	struct mlx5dv_sw_parsing_caps	sw_parsing_caps;
-	struct mlx5_striding_rq_caps	striding_rq_caps;
+	struct mlx5_ib_sw_parsing_caps	sw_parsing_caps;
+	struct mlx5_ib_striding_rq_caps	striding_rq_caps;
 	__u32				tunnel_offloads_caps;
 	__u32				reserved;
 };
diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
index cbdb76978d56ea..e2b010f5e826ff 100644
--- a/providers/mlx5/verbs.c
+++ b/providers/mlx5/verbs.c
@@ -2617,7 +2617,8 @@  int mlx5_query_device_ex(struct ibv_context *context,
 	if (err)
 		return err;
 
-	attr->tso_caps = resp.tso_caps;
+	attr->tso_caps.max_tso = resp.tso_caps.max_tso;
+	attr->tso_caps.supported_qpts = resp.tso_caps.supported_qpts;
 	attr->rss_caps.rx_hash_fields_mask = resp.rss_caps.rx_hash_fields_mask;
 	attr->rss_caps.rx_hash_function = resp.rss_caps.rx_hash_function;
 	attr->packet_pacing_caps.qp_rate_limit_min =
@@ -2633,9 +2634,22 @@  int mlx5_query_device_ex(struct ibv_context *context,
 	if (resp.support_multi_pkt_send_wqe & MLX5_IB_SUPPORT_EMPW)
 		mctx->vendor_cap_flags |= MLX5_VENDOR_CAP_FLAGS_ENHANCED_MPW;
 
-	mctx->cqe_comp_caps = resp.cqe_comp_caps;
-	mctx->sw_parsing_caps = resp.sw_parsing_caps;
-	mctx->striding_rq_caps = resp.striding_rq_caps.caps;
+	mctx->cqe_comp_caps.max_num = resp.cqe_comp_caps.max_num;
+	mctx->cqe_comp_caps.supported_format = resp.cqe_comp_caps.supported_format;
+	mctx->sw_parsing_caps.sw_parsing_offloads =
+		resp.sw_parsing_caps.sw_parsing_offloads;
+	mctx->sw_parsing_caps.supported_qpts =
+		resp.sw_parsing_caps.supported_qpts;
+	mctx->striding_rq_caps.min_single_stride_log_num_of_bytes =
+		resp.striding_rq_caps.min_single_stride_log_num_of_bytes;
+	mctx->striding_rq_caps.max_single_stride_log_num_of_bytes =
+		resp.striding_rq_caps.max_single_stride_log_num_of_bytes;
+	mctx->striding_rq_caps.min_single_wqe_log_num_of_strides =
+		resp.striding_rq_caps.min_single_wqe_log_num_of_strides;
+	mctx->striding_rq_caps.max_single_wqe_log_num_of_strides =
+		resp.striding_rq_caps.max_single_wqe_log_num_of_strides;
+	mctx->striding_rq_caps.supported_qpts =
+		resp.striding_rq_caps.supported_qpts;
 	mctx->tunnel_offloads_caps = resp.tunnel_offloads_caps;
 	mctx->packet_pacing_caps = resp.packet_pacing_caps;