git: 966d4c21b186 - main - fixup! IB/mlx5: Expose GRE flow spec to user-kernel ABI header

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

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

commit 966d4c21b186dfafda58d3d586fbe7f02299fb5e
Author:     Ariel Ehrenberg <aehrenberg@nvidia.com>
AuthorDate: 2026-07-28 12:02:55 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-09-16 14:12:10 +0000

    fixup! IB/mlx5: Expose GRE flow spec to user-kernel ABI header
    
    Import Linux upstream commit a93b632c4531 ("IB/mlx5: Fix GRE flow
    specification").
    
    Honour the user-supplied GRE protocol mask instead of hard-coding 0xffff,
    so wildcard and partial masks work.
    
    Also give flow_spec_data[] 8-byte alignment, so this userspace copy of
    struct ib_uverbs_flow_spec_hdr matches the kernel UAPI on 32-bit builds.
    The kernel header has always used __aligned_u64 here and only our copy
    diverged, so there is no upstream commit for that half.  The attribute is
    spelled out instead of introducing an __aligned_u64 macro, which
    <infiniband/types.h> does not provide and which libbnxtre already defines
    for itself.
    
    Sponsored by:   NVidia networking
    MFC after:      1 month
---
 contrib/ofed/libibverbs/kern-abi.h  | 2 +-
 sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/ofed/libibverbs/kern-abi.h b/contrib/ofed/libibverbs/kern-abi.h
index 74cf407840e9..d5ed405d08c7 100644
--- a/contrib/ofed/libibverbs/kern-abi.h
+++ b/contrib/ofed/libibverbs/kern-abi.h
@@ -960,7 +960,7 @@ struct __ib_uverbs_flow_spec_hdr {
 	__u16 size;
 	__u16 reserved;
 	/* followed by flow_spec */
-	__u64 flow_spec_data[0];
+	__u64 __attribute__((aligned(8))) flow_spec_data[0];
 };
 
 /* Define in rdma/ib_user_verbs.h after refactoring OFED - start */
diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
index f9c2c2a1b310..306116a7eee7 100644
--- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
+++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
@@ -2209,7 +2209,7 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v,
 			 IPPROTO_GRE);
 
 		MLX5_SET(fte_match_set_misc, misc_params_c, gre_protocol,
-			 0xffff);
+			 ntohs(ib_spec->gre.mask.protocol));
 		MLX5_SET(fte_match_set_misc, misc_params_v, gre_protocol,
 			 ntohs(ib_spec->gre.val.protocol));