[PATCH] net/mlx5: fix matcher flags in counter offset detection

Dariusz Sosnowski dsosnowski at nvidia.com
Wed Aug 20 10:45:21 CEST 2025


This patch fixes a bug in
mlx5_flow_dv_discover_counter_offset_support()
uncovered by a warning reported by MSVC:

    ../drivers/net/mlx5/mlx5_flow_dv.c(19636): warning C5287:
        operands are different enum types 'ibv_flow_attr_type' and
        'ibv_flow_flags';
        use an explicit cast to silence this warning

IBV_FLOW_ATTR_FLAGS_EGRESS was incorrectly passed in to
type field of mlx5dv_flow_matcher_attr struct,
instead of flags field.
As a result counter offset support discovery returned a false positive
result on application with old rdma-core.

Bugzilla ID: 1758
Fixes: 4fd5e1484887 ("net/mlx5: fix counter offset detection")
Cc: suanmingm at nvidia.com
Cc: stable at dpdk.org

Reported-by: Andre Muezerie <andremue at linux.microsoft.com>
Signed-off-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 7b9e5018b8..4a6f9d63fb 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -19652,7 +19652,8 @@ mlx5_flow_dv_discover_counter_offset_support(struct rte_eth_dev *dev)
 		.size = sizeof(value.buf),
 	};
 	struct mlx5dv_flow_matcher_attr dv_attr = {
-		.type = IBV_FLOW_ATTR_NORMAL | IBV_FLOW_ATTR_FLAGS_EGRESS,
+		.type = IBV_FLOW_ATTR_NORMAL,
+		.flags = IBV_FLOW_ATTR_FLAGS_EGRESS,
 		.priority = 0,
 		.match_criteria_enable = 0,
 		.match_mask = (void *)&mask,
--
2.39.5



More information about the dev mailing list