git: 35763e9689a1 - main - libmlx5: Report Multi-Packet RQ capabilities through mlx5 direct verbs
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Sep 2026 14:13:23 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=35763e9689a19d0febe7a4b13b1e5b15c62a5b02
commit 35763e9689a19d0febe7a4b13b1e5b15c62a5b02
Author: Vag Singh <vag.singh@oneconvergence.com>
AuthorDate: 2025-08-14 06:54:32 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-09-16 14:12:09 +0000
libmlx5: Report Multi-Packet RQ capabilities through mlx5 direct verbs
[PATCH 26/31] FreeBSD OFED support for DPDK MLX5 PMD
A Multi-Packet RQ is a receive queue where multiple packets are
written to the same WQE. Each message starts in the beginning of a
stride. The total size of the scatter elements of each WQE is
determined upon RQ creation and all the posted WQEs should meet the
determined size.
A Multi-Packet RQ reduces the number of needed post-recv operations
thus increasing performance.
It reduces memory footprint by allowing each packet to consume a
different number of strides instead of the whole WR.
Differential revision: https://reviews.freebsd.org/D32201
MFC after: 1 month
---
contrib/ofed/libmlx5/mlx5-abi.h | 6 ++++++
contrib/ofed/libmlx5/mlx5.c | 6 ++++++
contrib/ofed/libmlx5/mlx5.h | 1 +
contrib/ofed/libmlx5/mlx5dv.h | 12 +++++++++++-
contrib/ofed/libmlx5/mlx5dv_query_device.3 | 31 ++++++++++++++++++++++++++++++
contrib/ofed/libmlx5/verbs.c | 1 +
6 files changed, 56 insertions(+), 1 deletion(-)
diff --git a/contrib/ofed/libmlx5/mlx5-abi.h b/contrib/ofed/libmlx5/mlx5-abi.h
index d1e8b9d88ae7..817ae252382d 100644
--- a/contrib/ofed/libmlx5/mlx5-abi.h
+++ b/contrib/ofed/libmlx5/mlx5-abi.h
@@ -279,6 +279,11 @@ enum mlx5_mpw_caps {
MLX5_SUPPORT_EMPW = 1 << 2,
};
+struct mlx5_striding_rq_caps {
+ struct mlx5dv_striding_rq_caps caps;
+ __u32 reserved;
+};
+
struct mlx5_query_device_ex_resp {
struct ibv_query_device_resp_ex ibv_resp;
__u32 comp_mask;
@@ -290,6 +295,7 @@ struct mlx5_query_device_ex_resp {
__u32 support_multi_pkt_send_wqe;
__u32 reserved;
struct mlx5dv_sw_parsing_caps sw_parsing_caps;
+ struct mlx5_striding_rq_caps striding_rq_caps;
};
#endif /* MLX5_ABI_H */
diff --git a/contrib/ofed/libmlx5/mlx5.c b/contrib/ofed/libmlx5/mlx5.c
index 56560c9d59c0..c2daf25287f8 100644
--- a/contrib/ofed/libmlx5/mlx5.c
+++ b/contrib/ofed/libmlx5/mlx5.c
@@ -666,6 +666,12 @@ int mlx5dv_query_device(struct ibv_context *ctx_in,
comp_mask_out |= MLX5DV_CONTEXT_MASK_SWP;
}
+ if (attrs_out->comp_mask & MLX5DV_CONTEXT_MASK_STRIDING_RQ) {
+ attrs_out->striding_rq_caps = mctx->striding_rq_caps;
+ comp_mask_out |= MLX5DV_CONTEXT_MASK_STRIDING_RQ;
+ }
+
+
attrs_out->comp_mask = comp_mask_out;
return 0;
diff --git a/contrib/ofed/libmlx5/mlx5.h b/contrib/ofed/libmlx5/mlx5.h
index d8d5b48fc618..e65847b37e31 100644
--- a/contrib/ofed/libmlx5/mlx5.h
+++ b/contrib/ofed/libmlx5/mlx5.h
@@ -273,6 +273,7 @@ struct mlx5_context {
struct mlx5dv_cqe_comp_caps cqe_comp_caps;
struct mlx5dv_ctx_allocators extern_alloc;
struct mlx5dv_sw_parsing_caps sw_parsing_caps;
+ struct mlx5dv_striding_rq_caps striding_rq_caps;
};
struct mlx5_bitmap {
diff --git a/contrib/ofed/libmlx5/mlx5dv.h b/contrib/ofed/libmlx5/mlx5dv.h
index 53cf5416c071..7dc7424b7f90 100644
--- a/contrib/ofed/libmlx5/mlx5dv.h
+++ b/contrib/ofed/libmlx5/mlx5dv.h
@@ -59,7 +59,8 @@ enum {
enum mlx5dv_context_comp_mask {
MLX5DV_CONTEXT_MASK_CQE_COMPRESION = 1 << 0,
MLX5DV_CONTEXT_MASK_SWP = 1 << 1,
- MLX5DV_CONTEXT_MASK_RESERVED = 1 << 2,
+ MLX5DV_CONTEXT_MASK_STRIDING_RQ = 1 << 2,
+ MLX5DV_CONTEXT_MASK_RESERVED = 1 << 3,
};
struct mlx5dv_cqe_comp_caps {
@@ -72,6 +73,14 @@ struct mlx5dv_sw_parsing_caps {
uint32_t supported_qpts;
};
+struct mlx5dv_striding_rq_caps {
+ uint32_t min_single_stride_log_num_of_bytes;
+ uint32_t max_single_stride_log_num_of_bytes;
+ uint32_t min_single_wqe_log_num_of_strides;
+ uint32_t max_single_wqe_log_num_of_strides;
+ uint32_t supported_qpts;
+};
+
/*
* Direct verbs device-specific attributes
*/
@@ -81,6 +90,7 @@ struct mlx5dv_context {
uint64_t comp_mask;
struct mlx5dv_cqe_comp_caps cqe_comp_caps;
struct mlx5dv_sw_parsing_caps sw_parsing_caps;
+ struct mlx5dv_striding_rq_caps striding_rq_caps;
};
enum mlx5dv_context_flags {
diff --git a/contrib/ofed/libmlx5/mlx5dv_query_device.3 b/contrib/ofed/libmlx5/mlx5dv_query_device.3
index b29085545253..2e6d45b32c27 100644
--- a/contrib/ofed/libmlx5/mlx5dv_query_device.3
+++ b/contrib/ofed/libmlx5/mlx5dv_query_device.3
@@ -21,6 +21,25 @@ of the internal hardware structures that mlx5dv.h represents. Additions of new f
structures are handled by comp_mask field.
.PP
.nf
+struct mlx5dv_sw_parsing_caps {
+.in +8
+uint32_t sw_parsing_offloads; /* Use enum mlx5dv_sw_parsing_offloads */
+uint32_t supported_qpts;
+.in -8
+};
+.PP
+.nf
+struct mlx5dv_striding_rq_caps {
+.in +8
+uint32_t min_single_stride_log_num_of_bytes; /* min log size of each stride */
+uint32_t max_single_stride_log_num_of_bytes; /* max log size of each stride */
+uint32_t min_single_wqe_log_num_of_strides; /* min log number of strides per WQE */
+uint32_t max_single_wqe_log_num_of_strides; /* max log number of strides per WQE */
+uint32_t supported_qpts;
+.in -8
+};
+.PP
+.nf
struct mlx5dv_context {
.in +8
uint8_t version;
@@ -49,6 +68,18 @@ enum mlx5dv_context_flags {
MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW = (1 << 3), /* Enhanced multi packet WQE is supported or not */
.in -8
};
+
+.PP
+.nf
+enum mlx5dv_context_comp_mask {
+.in +8
+ MLX5DV_CONTEXT_MASK_CQE_COMPRESION = 1 << 0,
+ MLX5DV_CONTEXT_MASK_SWP = 1 << 1,
+ MLX5DV_CONTEXT_MASK_STRIDING_RQ = 1 << 2,
+ MLX5DV_CONTEXT_MASK_RESERVED = 1 << 3,
+.in -8
+};
+
.fi
.SH "RETURN VALUE"
0 on success or the value of errno on failure (which indicates the failure reason).
diff --git a/contrib/ofed/libmlx5/verbs.c b/contrib/ofed/libmlx5/verbs.c
index f591b177b599..bbc670e7acdd 100644
--- a/contrib/ofed/libmlx5/verbs.c
+++ b/contrib/ofed/libmlx5/verbs.c
@@ -2122,6 +2122,7 @@ int mlx5_query_device_ex(struct ibv_context *context,
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;
major = (raw_fw_ver >> 32) & 0xffff;
minor = (raw_fw_ver >> 16) & 0xffff;