git: 3c4338089e38 - main - fixup! verbs/mlx5: Expose tag matching capabilities

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

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

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

    fixup! verbs/mlx5: Expose tag matching capabilities
    
    Reject TM-SRQ creation when tm_cap.max_ops is 0, so the internal command
    QP's send queue is not sized to zero work-queue entries.
    
    Sponsored by:   NVidia networking
    MFC after:      1 month
---
 contrib/ofed/libmlx5/verbs.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/contrib/ofed/libmlx5/verbs.c b/contrib/ofed/libmlx5/verbs.c
index 450ec5d6bb65..2fdf985b0092 100644
--- a/contrib/ofed/libmlx5/verbs.c
+++ b/contrib/ofed/libmlx5/verbs.c
@@ -1839,6 +1839,15 @@ create_cmd_qp(struct ibv_context *context,
 	int port = 1;
 	int ret;
 
+	/*
+	 * The command QP send WQ is sized from tm_cap.max_ops; a value of 0
+	 * would create a zero-length WQ, so reject it explicitly.
+	 */
+	if (srq_attr->tm_cap.max_ops == 0) {
+		errno = EINVAL;
+		return NULL;
+	}
+
 	ret = ibv_cmd_query_port(context, port, &port_attr,
 				 &pcmd, sizeof(pcmd));
 	if (ret) {