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 <rongw...@nvidia.com>
Fixes: 00e579166cc0 ("net/mlx5: support IPv6 routing extension matching")
Cc: sta...@dpdk.org

Reviewed-by: Erez Shitrit <ere...@nvidia.com>
Acked-by: Suanming Mou <suanmi...@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(-)

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);
-- 
2.27.0

Reply via email to