[PATCH] net/mlx5: fix next L3 protocol fetching

Dariusz Sosnowski dsosnowski at nvidia.com
Thu Mar 14 11:59:02 CET 2024


During flow pattern validation in DV, the next protocol type
should be calculated if and only if protocol mask is defined.

Fixes: 1d7b7ec3a236 ("net/mlx5: remove code duplications")
Cc: getelson at nvidia.com

Signed-off-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
Acked-by: Ori Kam <orika at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 815f74ec5c..d434c678c8 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7524,9 +7524,9 @@ mlx5_flow_l3_next_protocol(const struct rte_flow_item *l3_item,
 	uint8_t next_protocol;
 
 	if (l3_item->mask != NULL && l3_item->spec != NULL) {
-		next_protocol = MLX5_L3_NEXT_PROTOCOL(l3_item, spec);
+		next_protocol = MLX5_L3_NEXT_PROTOCOL(l3_item, mask);
 		if (next_protocol)
-			next_protocol &= MLX5_L3_NEXT_PROTOCOL(l3_item, mask);
+			next_protocol &= MLX5_L3_NEXT_PROTOCOL(l3_item, spec);
 		else
 			next_protocol = 0xff;
 	} else if (key_type == MLX5_SET_MATCHER_HS_M && l3_item->mask != NULL) {
-- 
2.39.2



More information about the dev mailing list