Blame SOURCES/0002-mlx5-Report-Multi-Packet-RQ-capabilities-through-mlx.patch

95af3a
From 868a69e7de67e10fc96436ec41dd9e0343053581 Mon Sep 17 00:00:00 2001
95af3a
From: Noa Osherovich <noaos@mellanox.com>
95af3a
Date: Thu, 3 Aug 2017 10:00:14 +0300
95af3a
Subject: [PATCH rdma-core 2/3] mlx5: Report Multi-Packet RQ capabilities
95af3a
 through mlx5 direct verbs
95af3a
95af3a
A Multi-Packet RQ is a receive queue where multiple packets are
95af3a
written to the same WQE. Each message starts in the beginning of a
95af3a
stride. The total size of the scatter elements of each WQE is
95af3a
determined upon RQ creation and all the posted WQEs should meet the
95af3a
determined size.
95af3a
95af3a
A Multi-Packet RQ reduces the number of needed post-recv operations
95af3a
thus increasing performance.
95af3a
95af3a
It reduces memory footprint by allowing each packet to consume a
95af3a
different number of strides instead of the whole WR.
95af3a
95af3a
Signed-off-by: Noa Osherovich <noaos@mellanox.com>
95af3a
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
95af3a
(cherry picked from commit ec8ec52698c7cbd6d06bd8f3e54b673a52cb4d30)
95af3a
---
95af3a
 providers/mlx5/man/mlx5dv_query_device.3 | 19 +++++++++++++++++++
95af3a
 providers/mlx5/mlx5-abi.h                | 11 +++++++++++
95af3a
 providers/mlx5/mlx5.c                    |  5 +++++
95af3a
 providers/mlx5/mlx5.h                    |  1 +
95af3a
 providers/mlx5/mlx5dv.h                  | 13 ++++++++++++-
95af3a
 providers/mlx5/verbs.c                   |  1 +
95af3a
 6 files changed, 49 insertions(+), 1 deletion(-)
95af3a
95af3a
diff --git a/providers/mlx5/man/mlx5dv_query_device.3 b/providers/mlx5/man/mlx5dv_query_device.3
95af3a
index c2fe9a3e..bb047454 100644
95af3a
--- a/providers/mlx5/man/mlx5dv_query_device.3
95af3a
+++ b/providers/mlx5/man/mlx5dv_query_device.3
95af3a
@@ -21,6 +21,25 @@ of the internal hardware structures that mlx5dv.h represents. Additions of new f
95af3a
 structures are handled by comp_mask field.
95af3a
 .PP
95af3a
 .nf
95af3a
+struct mlx5dv_sw_parsing_caps {
95af3a
+.in +8
95af3a
+uint32_t sw_parsing_offloads; /* Use enum mlx5dv_sw_parsing_offloads */
95af3a
+uint32_t supported_qpts;
95af3a
+.in -8
95af3a
+};
95af3a
+.PP
95af3a
+.nf
95af3a
+struct mlx5dv_striding_rq_caps {
95af3a
+.in +8
95af3a
+uint32_t min_single_stride_log_num_of_bytes; /* min log size of each stride */
95af3a
+uint32_t max_single_stride_log_num_of_bytes; /* max log size of each stride */
95af3a
+uint32_t min_single_wqe_log_num_of_strides; /* min log number of strides per WQE */
95af3a
+uint32_t max_single_wqe_log_num_of_strides; /* max log number of strides per WQE */
95af3a
+uint32_t supported_qpts;
95af3a
+.in -8
95af3a
+};
95af3a
+.PP
95af3a
+.nf
95af3a
 struct mlx5dv_context {
95af3a
 .in +8
95af3a
 uint8_t         version;
95af3a
diff --git a/providers/mlx5/mlx5-abi.h b/providers/mlx5/mlx5-abi.h
95af3a
index bce9e559..da7d54f2 100644
95af3a
--- a/providers/mlx5/mlx5-abi.h
95af3a
+++ b/providers/mlx5/mlx5-abi.h
95af3a
@@ -279,6 +279,16 @@ enum mlx5_mpw_caps {
95af3a
 	MLX5_SUPPORT_EMPW	= 1 << 2,
95af3a
 };
95af3a
 
95af3a
+enum mlx5_query_dev_resp_flags {
95af3a
+	MLX5_QUERY_DEV_RESP_FLAGS_CQE_128B_COMP	= 1 << 0,
95af3a
+	MLX5_QUERY_DEV_RESP_FLAGS_CQE_128B_PAD	= 1 << 1,
95af3a
+};
95af3a
+
95af3a
+struct mlx5_striding_rq_caps {
95af3a
+	struct mlx5dv_striding_rq_caps	caps;
95af3a
+	__u32				reserved;
95af3a
+};
95af3a
+
95af3a
 struct mlx5_query_device_ex_resp {
95af3a
 	struct ibv_query_device_resp_ex ibv_resp;
95af3a
 	__u32				comp_mask;
95af3a
@@ -289,6 +299,7 @@ struct mlx5_query_device_ex_resp {
95af3a
 	struct mlx5_packet_pacing_caps	packet_pacing_caps;
95af3a
 	__u32				support_multi_pkt_send_wqe;
95af3a
 	__u32				reserved;
95af3a
+	struct mlx5_striding_rq_caps	striding_rq_caps;
95af3a
 };
95af3a
 
95af3a
 #endif /* MLX5_ABI_H */
95af3a
diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c
95af3a
index e7adf148..88287536 100644
95af3a
--- a/providers/mlx5/mlx5.c
95af3a
+++ b/providers/mlx5/mlx5.c
95af3a
@@ -636,6 +636,11 @@ int mlx5dv_query_device(struct ibv_context *ctx_in,
95af3a
 	if (mctx->vendor_cap_flags & MLX5_VENDOR_CAP_FLAGS_ENHANCED_MPW)
95af3a
 		attrs_out->flags |= MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW;
95af3a
 
95af3a
+	if (attrs_out->comp_mask & MLX5DV_CONTEXT_MASK_STRIDING_RQ) {
95af3a
+		attrs_out->striding_rq_caps = mctx->striding_rq_caps;
95af3a
+		comp_mask_out |= MLX5DV_CONTEXT_MASK_STRIDING_RQ;
95af3a
+	}
95af3a
+
95af3a
 	attrs_out->comp_mask = comp_mask_out;
95af3a
 
95af3a
 	return 0;
95af3a
diff --git a/providers/mlx5/mlx5.h b/providers/mlx5/mlx5.h
95af3a
index 46fce282..1e8b45be 100644
95af3a
--- a/providers/mlx5/mlx5.h
95af3a
+++ b/providers/mlx5/mlx5.h
95af3a
@@ -272,6 +272,7 @@ struct mlx5_context {
95af3a
 	uint64_t			vendor_cap_flags; /* Use enum mlx5_vendor_cap_flags */
95af3a
 	struct mlx5dv_cqe_comp_caps	cqe_comp_caps;
95af3a
 	struct mlx5dv_ctx_allocators	extern_alloc;
95af3a
+	struct mlx5dv_striding_rq_caps	striding_rq_caps;
95af3a
 };
95af3a
 
95af3a
 struct mlx5_bitmap {
95af3a
diff --git a/providers/mlx5/mlx5dv.h b/providers/mlx5/mlx5dv.h
95af3a
index ffe2c555..0a7fe4d6 100644
95af3a
--- a/providers/mlx5/mlx5dv.h
95af3a
+++ b/providers/mlx5/mlx5dv.h
95af3a
@@ -58,7 +58,9 @@ enum {
95af3a
 
95af3a
 enum mlx5dv_context_comp_mask {
95af3a
 	MLX5DV_CONTEXT_MASK_CQE_COMPRESION	= 1 << 0,
95af3a
-	MLX5DV_CONTEXT_MASK_RESERVED		= 1 << 1,
95af3a
+	MLX5DV_CONTEXT_MASK_SWP			= 1 << 1,
95af3a
+	MLX5DV_CONTEXT_MASK_STRIDING_RQ		= 1 << 2,
95af3a
+	MLX5DV_CONTEXT_MASK_RESERVED		= 1 << 3,
95af3a
 };
95af3a
 
95af3a
 struct mlx5dv_cqe_comp_caps {
95af3a
@@ -66,6 +68,14 @@ struct mlx5dv_cqe_comp_caps {
95af3a
 	uint32_t supported_format; /* enum mlx5dv_cqe_comp_res_format */
95af3a
 };
95af3a
 
95af3a
+struct mlx5dv_striding_rq_caps {
95af3a
+	uint32_t min_single_stride_log_num_of_bytes;
95af3a
+	uint32_t max_single_stride_log_num_of_bytes;
95af3a
+	uint32_t min_single_wqe_log_num_of_strides;
95af3a
+	uint32_t max_single_wqe_log_num_of_strides;
95af3a
+	uint32_t supported_qpts;
95af3a
+};
95af3a
+
95af3a
 /*
95af3a
  * Direct verbs device-specific attributes
95af3a
  */
95af3a
@@ -74,6 +84,7 @@ struct mlx5dv_context {
95af3a
 	uint64_t	flags;
95af3a
 	uint64_t	comp_mask;
95af3a
 	struct mlx5dv_cqe_comp_caps	cqe_comp_caps;
95af3a
+	struct mlx5dv_striding_rq_caps striding_rq_caps;
95af3a
 };
95af3a
 
95af3a
 enum mlx5dv_context_flags {
95af3a
diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
95af3a
index 6506bc36..e9414c64 100644
95af3a
--- a/providers/mlx5/verbs.c
95af3a
+++ b/providers/mlx5/verbs.c
95af3a
@@ -2003,6 +2003,7 @@ int mlx5_query_device_ex(struct ibv_context *context,
95af3a
 		mctx->vendor_cap_flags |= MLX5_VENDOR_CAP_FLAGS_ENHANCED_MPW;
95af3a
 
95af3a
 	mctx->cqe_comp_caps = resp.cqe_comp_caps;
95af3a
+	mctx->striding_rq_caps = resp.striding_rq_caps.caps;
95af3a
 
95af3a
 	major     = (raw_fw_ver >> 32) & 0xffff;
95af3a
 	minor     = (raw_fw_ver >> 16) & 0xffff;
95af3a
-- 
95af3a
2.12.1
95af3a