git: e4bdc092db2f - main - fixup! libmlx5: Report if kernel allows using MPW in SQ

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 16 Sep 2026 14:13:11 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=e4bdc092db2f318a80772a7f18d3055dd5170a88

commit e4bdc092db2f318a80772a7f18d3055dd5170a88
Author:     Ariel Ehrenberg <aehrenberg@nvidia.com>
AuthorDate: 2026-07-28 10:39:05 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-09-16 14:12:08 +0000

    fixup! libmlx5: Report if kernel allows using MPW in SQ
    
    Interpret the kernel's raw multi_pkt_send_wqe value (0, 1 or 3) instead of
    masking it against a bitmask the kernel never emits, which silently
    disabled MPW.
    
    Sponsored by:   NVidia networking
    MFC after:      1 month
---
 contrib/ofed/libmlx5/verbs.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/contrib/ofed/libmlx5/verbs.c b/contrib/ofed/libmlx5/verbs.c
index ae09281931e7..95a90b253899 100644
--- a/contrib/ofed/libmlx5/verbs.c
+++ b/contrib/ofed/libmlx5/verbs.c
@@ -1992,10 +1992,17 @@ int mlx5_query_device_ex(struct ibv_context *context,
 	attr->rss_caps.rx_hash_function = resp.rss_caps.rx_hash_function;
 	attr->packet_pacing_caps = resp.packet_pacing_caps.caps;
 
-	if (resp.support_multi_pkt_send_wqe & MLX5_ALLOW_MPW)
+	/*
+	 * The kernel reports the raw two-bit 'multi_pkt_send_wqe' HW
+	 * capability (0 = unsupported, 1 = MPW allowed, 3 = enhanced MPW),
+	 * not the MLX5_ALLOW_MPW / MLX5_SUPPORT_EMPW bitmask that upstream
+	 * libmlx5 expects.  Interpret the raw value so MPW is not silently
+	 * disabled on kernels that report the legacy encoding.
+	 */
+	if (resp.support_multi_pkt_send_wqe)
 		mctx->vendor_cap_flags |= MLX5_VENDOR_CAP_FLAGS_MPW_ALLOWED;
 
-	if (resp.support_multi_pkt_send_wqe & MLX5_SUPPORT_EMPW)
+	if (resp.support_multi_pkt_send_wqe == 3)
 		mctx->vendor_cap_flags |= MLX5_VENDOR_CAP_FLAGS_ENHANCED_MPW;
 
 	mctx->cqe_comp_caps = resp.cqe_comp_caps;