DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rongwei Liu <rongweil@nvidia.com>
To: <dev@dpdk.org>, <matan@nvidia.com>, <viacheslavo@nvidia.com>,
	<orika@nvidia.com>, <suanmingm@nvidia.com>, <thomas@monjalon.net>
Cc: <stable@dpdk.org>, Erez Shitrit <erezsh@nvidia.com>,
	Alex Vesker <valex@nvidia.com>
Subject: [PATCH v1 2/2] net/mlx5/hws: fix srv6 mismatching
Date: Thu, 9 Nov 2023 10:40:57 +0200	[thread overview]
Message-ID: <20231109084057.452476-3-rongweil@nvidia.com> (raw)
In-Reply-To: <20231109084057.452476-1-rongweil@nvidia.com>

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(-)

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


  parent reply	other threads:[~2023-11-09  8:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09  8:40 [PATCH v1 0/2] fix IPv6 routing extension mismatching Rongwei Liu
2023-11-09  8:40 ` [PATCH v1 1/2] net/mlx5/hws: disable IPv6 routing extension relaxed mode Rongwei Liu
2023-11-09  8:40 ` Rongwei Liu [this message]
2023-11-12 14:26 ` [PATCH v1 0/2] fix IPv6 routing extension mismatching Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231109084057.452476-3-rongweil@nvidia.com \
    --to=rongweil@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=erezsh@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=valex@nvidia.com \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).