[v1,2/2] net/mlx5/hws: fix srv6 mismatching

Message ID 20231109084057.452476-3-rongweil@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series fix IPv6 routing extension mismatching |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

Rongwei Liu Nov. 9, 2023, 8:40 a.m. UTC
  When matching srv6 packets, the IPv6 protocol is set to
0x2b by srv6 callback in fc[IP_PROTO].

In the next layer, TCP/UDP callback reset the fc again to
the corresponding values: 0x11/0x6.

Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Fixes: 00e579166cc0 ("net/mlx5: support IPv6 routing extension matching")
Cc: stable@dpdk.org

Reviewed-by: Erez Shitrit <erezsh@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 21 +++++++++++++--------
 drivers/net/mlx5/hws/mlx5dr_definer.h |  1 +
 2 files changed, 14 insertions(+), 8 deletions(-)
  

Patch

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index c0ccde64e1..0b60479406 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -1069,10 +1069,12 @@  mlx5dr_definer_conv_item_udp(struct mlx5dr_definer_conv_data *cd,
 	/* Set match on L4 type UDP */
 	if (!cd->relaxed) {
 		fc = &cd->fc[DR_CALC_FNAME(IP_PROTOCOL, inner)];
-		fc->item_idx = item_idx;
-		fc->tag_set = &mlx5dr_definer_udp_protocol_set;
-		fc->tag_mask_set = &mlx5dr_definer_ones_set;
-		DR_CALC_SET(fc, eth_l2, l4_type_bwc, inner);
+		if (!fc->not_overwrite) {
+			fc->item_idx = item_idx;
+			fc->tag_set = &mlx5dr_definer_udp_protocol_set;
+			fc->tag_mask_set = &mlx5dr_definer_ones_set;
+			DR_CALC_SET(fc, eth_l2, l4_type_bwc, inner);
+		}
 	}
 
 	if (!m)
@@ -1115,10 +1117,12 @@  mlx5dr_definer_conv_item_tcp(struct mlx5dr_definer_conv_data *cd,
 	/* Overwrite match on L4 type TCP */
 	if (!cd->relaxed) {
 		fc = &cd->fc[DR_CALC_FNAME(IP_PROTOCOL, inner)];
-		fc->item_idx = item_idx;
-		fc->tag_set = &mlx5dr_definer_tcp_protocol_set;
-		fc->tag_mask_set = &mlx5dr_definer_ones_set;
-		DR_CALC_SET(fc, eth_l2, l4_type_bwc, inner);
+		if (!fc->not_overwrite) {
+			fc->item_idx = item_idx;
+			fc->tag_set = &mlx5dr_definer_tcp_protocol_set;
+			fc->tag_mask_set = &mlx5dr_definer_ones_set;
+			DR_CALC_SET(fc, eth_l2, l4_type_bwc, inner);
+		}
 	}
 
 	if (!m)
@@ -2141,6 +2145,7 @@  mlx5dr_definer_conv_item_ipv6_routing_ext(struct mlx5dr_definer_conv_data *cd,
 			fc->item_idx = item_idx;
 			fc->tag_set = &mlx5dr_definer_ipv6_routing_hdr_set;
 			fc->tag_mask_set = &mlx5dr_definer_ones_set;
+			fc->not_overwrite = 1;
 			DR_CALC_SET(fc, eth_l3, protocol_next_header, inner);
 		}
 	} else {
diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.h b/drivers/net/mlx5/hws/mlx5dr_definer.h
index 791154a7dc..6f1c99e37a 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.h
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.h
@@ -166,6 +166,7 @@  struct mlx5dr_definer_fc {
 	int bit_off;
 	uint32_t bit_mask;
 	enum mlx5dr_definer_fname fname;
+	uint8_t not_overwrite;
 	void (*tag_set)(struct mlx5dr_definer_fc *fc,
 			const void *item_spec,
 			uint8_t *tag);