The branch main has been updated by kib:

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

commit a2703fef5cbe66be3bff971bcbdd9d328b3029ef
Author:     Ariel Ehrenberg <[email protected]>
AuthorDate: 2026-07-28 12:02:54 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2026-09-16 14:12:10 +0000

    fixup! verbs/mlxs: mlx5: Add tunnel offloads support in direct verbs
    
    Fix is based on upstream rdma-core commit ee54f9d5348f ("mlx5: Add
    loopback flags to QP creation").
    
    Validate create_flags against a supported-flags mask instead of rejecting
    anything that is not MLX5DV_QP_CREATE_TUNNEL_OFFLOADS.  A create_flags of
    0 is now accepted, unknown bits are rejected, and the vendor flag is OR-ed
    in rather than assigned.  The loopback flags that commit also adds do not
    exist in this tree, so only the validation is taken.
    
    Sponsored by:   NVidia networking
    MFC after:      1 month
---
 contrib/ofed/libmlx5/verbs.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/contrib/ofed/libmlx5/verbs.c b/contrib/ofed/libmlx5/verbs.c
index 5e91dcaf5f7a..a0c6111ff107 100644
--- a/contrib/ofed/libmlx5/verbs.c
+++ b/contrib/ofed/libmlx5/verbs.c
@@ -1265,6 +1265,11 @@ enum {
        MLX5_DV_CREATE_QP_SUP_COMP_MASK = 
MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS
 };
 
+enum {
+       MLX5DV_QP_CREATE_SUP_FLAGS =
+               (MLX5DV_QP_CREATE_TUNNEL_OFFLOADS),
+};
+
 enum {
        MLX5_CREATE_QP_EX2_COMP_MASK = (IBV_QP_INIT_ATTR_CREATE_FLAGS |
                                        IBV_QP_INIT_ATTR_MAX_TSO_HEADER |
@@ -1318,15 +1323,17 @@ static struct ibv_qp *create_qp(struct ibv_context 
*context,
 
                if (mlx5_qp_attr->comp_mask &
                    MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS) {
-                       if (mlx5_qp_attr->create_flags &
-                           MLX5DV_QP_CREATE_TUNNEL_OFFLOADS) {
-                               mlx5_create_flags = 
MLX5_QP_FLAG_TUNNEL_OFFLOADS;
-                       } else {
+                       if (!check_comp_mask(mlx5_qp_attr->create_flags,
+                                            MLX5DV_QP_CREATE_SUP_FLAGS)) {
                                mlx5_dbg(fp, MLX5_DBG_QP,
                                         "Unsupported creation flags requested 
for create_qp\n");
                                errno = EINVAL;
                                goto err;
                        }
+                       if (mlx5_qp_attr->create_flags &
+                           MLX5DV_QP_CREATE_TUNNEL_OFFLOADS) {
+                               mlx5_create_flags |= 
MLX5_QP_FLAG_TUNNEL_OFFLOADS;
+                       }
                }
        }
 

Reply via email to