DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1 0/2] fix IPv6 routing extension mismatching
@ 2023-11-09  8:40 Rongwei Liu
  2023-11-09  8:40 ` [PATCH v1 1/2] net/mlx5/hws: disable IPv6 routing extension relaxed mode Rongwei Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rongwei Liu @ 2023-11-09  8:40 UTC (permalink / raw)
  To: dev, matan, viacheslavo, orika, suanmingm, thomas

Fix potential mismatching when IPv6 routing extension item enabled.

Rongwei Liu (2):
  net/mlx5/hws: disable IPv6 routing extension relaxed mode
  net/mlx5/hws: fix srv6 mismatching

 drivers/net/mlx5/hws/mlx5dr_definer.c | 24 ++++++++++++++++--------
 drivers/net/mlx5/hws/mlx5dr_definer.h |  1 +
 2 files changed, 17 insertions(+), 8 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 1/2] net/mlx5/hws: disable IPv6 routing extension relaxed mode
  2023-11-09  8:40 [PATCH v1 0/2] fix IPv6 routing extension mismatching Rongwei Liu
@ 2023-11-09  8:40 ` Rongwei Liu
  2023-11-09  8:40 ` [PATCH v1 2/2] net/mlx5/hws: fix srv6 mismatching Rongwei Liu
  2023-11-12 14:26 ` [PATCH v1 0/2] fix IPv6 routing extension mismatching Raslan Darawsheh
  2 siblings, 0 replies; 4+ messages in thread
From: Rongwei Liu @ 2023-11-09  8:40 UTC (permalink / raw)
  To: dev, matan, viacheslavo, orika, suanmingm, thomas; +Cc: stable, Erez Shitrit

When relaxed mode is set, definer only programs the fields with
mask in the pattern template.

Assume a template like "ipv6_routing_ext ext_next_hdr mask 0xff ext_type
mask 0xff  / udp dst mask 0xffff" and rule like "ipv6_routing_ext
ext_next_hdr spec 17 ext_next_hdr mask 0xff ext_type spec 4 ext_type
mask 0xff / udp dst spec 100 dst mask 0xffff", there is a potential
mis-matching.

1. User sends first packet as:
   Ether()/IPv6()/IPv6ExtHdrSegmentRouting()/UDP(sport=100,dport=200)
   Miss due to unexpected UDP dport.
2. User sends 2nd packet as:
   Ether()/IPv6()/UDP(sport=100,dport=100)
   Packet hit. Hardware cached the IPv6 routing extension information
   in the 1st packet and plus the UDP dport in the 2nd packet, it
   matches the rule by mistake.

Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
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 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 7dffbfb9b9..c0ccde64e1 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -2143,6 +2143,9 @@ mlx5dr_definer_conv_item_ipv6_routing_ext(struct mlx5dr_definer_conv_data *cd,
 			fc->tag_mask_set = &mlx5dr_definer_ones_set;
 			DR_CALC_SET(fc, eth_l3, protocol_next_header, inner);
 		}
+	} else {
+		rte_errno = ENOTSUP;
+		return rte_errno;
 	}
 
 	if (!m)
-- 
2.27.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 2/2] net/mlx5/hws: fix srv6 mismatching
  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
  2023-11-12 14:26 ` [PATCH v1 0/2] fix IPv6 routing extension mismatching Raslan Darawsheh
  2 siblings, 0 replies; 4+ messages in thread
From: Rongwei Liu @ 2023-11-09  8:40 UTC (permalink / raw)
  To: dev, matan, viacheslavo, orika, suanmingm, thomas
  Cc: stable, Erez Shitrit, Alex Vesker

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v1 0/2] fix IPv6 routing extension mismatching
  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 ` [PATCH v1 2/2] net/mlx5/hws: fix srv6 mismatching Rongwei Liu
@ 2023-11-12 14:26 ` Raslan Darawsheh
  2 siblings, 0 replies; 4+ messages in thread
From: Raslan Darawsheh @ 2023-11-12 14:26 UTC (permalink / raw)
  To: Rongwei Liu, dev, Matan Azrad, Slava Ovsiienko, Ori Kam,
	Suanming Mou, NBU-Contact-Thomas Monjalon (EXTERNAL)

Hi,

> -----Original Message-----
> From: Rongwei Liu <rongweil@nvidia.com>
> Sent: Thursday, November 9, 2023 10:41 AM
> To: dev@dpdk.org; Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>; Suanming Mou
> <suanmingm@nvidia.com>; NBU-Contact-Thomas Monjalon (EXTERNAL)
> <thomas@monjalon.net>
> Subject: [PATCH v1 0/2] fix IPv6 routing extension mismatching
> 
> Fix potential mismatching when IPv6 routing extension item enabled.
> 
> Rongwei Liu (2):
>   net/mlx5/hws: disable IPv6 routing extension relaxed mode
>   net/mlx5/hws: fix srv6 mismatching
> 
>  drivers/net/mlx5/hws/mlx5dr_definer.c | 24 ++++++++++++++++--------
> drivers/net/mlx5/hws/mlx5dr_definer.h |  1 +
>  2 files changed, 17 insertions(+), 8 deletions(-)
> 
> --
> 2.27.0

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-12 14:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v1 2/2] net/mlx5/hws: fix srv6 mismatching Rongwei Liu
2023-11-12 14:26 ` [PATCH v1 0/2] fix IPv6 routing extension mismatching Raslan Darawsheh

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