Skip to contentSkip to conversation

app/testpmd: set srv6 header without any TLV

PATCH Superseded Rongwei Liu 4 participants 6 messages Mar 28, 2023 – Jun 2, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: set srv6 header without any TLV

When the type field of the IPv6 routing extension is 4, it means segment routing header.

In this case, set the last_entry to be segment_left minus 1 if the user doesn't specify the header length explicitly.

---
 app/test-pmd/cmdline_flow.c | 3 +++
 1 file changed, 3 insertions(+)
app/test-pmd/cmdline_flow.c +3 -0
index 5fbc450849..64549c037d 100644
@@ -12817,6 +12817,9 @@ cmd_set_raw_parsed(const struct buffer *in)
 				size = sizeof(struct rte_ipv6_routing_ext) +
 					(ext->hdr.segments_left << 4);
 				ext->hdr.hdr_len = ext->hdr.segments_left << 1;
+				/* Srv6 without TLV. */
+				if (ext->hdr.type == 4)
+					ext->hdr.last_entry = ext->hdr.segments_left - 1;
 			} else {
 				size = sizeof(struct rte_ipv6_routing_ext) +
 					(ext->hdr.hdr_len << 3);
Signature · 1 line
2.27.0
#1 lore raw

28/03/2023 11:36, Rongwei Liu:

Quoted 2 lines

When the type field of the IPv6 routing extension is 4, it means segment routing header.

Can we replace this raw value with a #define in lib/net/ ?

#2 lore raw

PATCH v2 1/1 app/testpmd: set srv6 header without any TLV

When the type field of the IPv6 routing extension is 4, it means segment routing header.

In this case, set the last_entry to be segment_left minus 1 if the user doesn't specify the header length explicitly.

v2: add macro definition for segment routing header.

---
 app/test-pmd/cmdline_flow.c | 3 +++
 lib/net/rte_ip.h            | 3 +++
 2 files changed, 6 insertions(+)
app/test-pmd/cmdline_flow.c +3 -0
index 5fbc450849..09f417b76e 100644
@@ -12817,6 +12817,9 @@ cmd_set_raw_parsed(const struct buffer *in)
 				size = sizeof(struct rte_ipv6_routing_ext) +
 					(ext->hdr.segments_left << 4);
 				ext->hdr.hdr_len = ext->hdr.segments_left << 1;
+				/* Srv6 without TLV. */
+				if (ext->hdr.type == RTE_IPV6_SRCRT_TYPE_4)
+					ext->hdr.last_entry = ext->hdr.segments_left - 1;
 			} else {
 				size = sizeof(struct rte_ipv6_routing_ext) +
 					(ext->hdr.hdr_len << 3);
lib/net/rte_ip.h +3 -0
index 337fad15d7..cfdbfb86ba 100644
@@ -540,6 +540,9 @@ struct rte_ipv6_hdr {
 	uint8_t  dst_addr[16];	/**< IP address of destination host(s). */
 } __rte_packed;
 
+/* IPv6 routing extension type definition. */
+#define RTE_IPV6_SRCRT_TYPE_4 4
+
 /**
  * IPv6 Routing Extension Header
  */
Signature · 1 line
2.27.0
#3 lore raw

HI @Ori Kam @NBU-Contact-Thomas Monjalon (EXTERNAL) @Andrew Rybchenko
Can you share some comments on this?
Thanks.

BR
Rongwei

Quoted 57 lines

-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Tuesday, March 28, 2023 20:28
To: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; NBU-Contact- Thomas Monjalon (EXTERNAL) <[email protected]>
Cc: Aman Singh <[email protected]>; Yuying Zhang <[email protected]>; Olivier Matz <[email protected]>
Subject: [PATCH v2] app/testpmd: set srv6 header without any TLV

External email: Use caution opening links or attachments

When the type field of the IPv6 routing extension is 4, it means segment routing header.

In this case, set the last_entry to be segment_left minus 1 if the user doesn't specify the header length explicitly.

v2: add macro definition for segment routing header.

---
 app/test-pmd/cmdline_flow.c | 3 +++
 lib/net/rte_ip.h            | 3 +++
 2 files changed, 6 insertions(+)
app/test-pmd/cmdline_flow.c +4 -0
index 5fbc450849..09f417b76e 100644
@@ -12817,6 +12817,9 @@ cmd_set_raw_parsed(const struct buffer *in)
                                size = sizeof(struct rte_ipv6_routing_ext) +
                                        (ext->hdr.segments_left << 4);
                                ext->hdr.hdr_len = ext->hdr.segments_left << 1;
+                               /* Srv6 without TLV. */
+                               if (ext->hdr.type == RTE_IPV6_SRCRT_TYPE_4)
+                                       ext->hdr.last_entry =
+ ext->hdr.segments_left - 1;
                        } else {
                                size = sizeof(struct rte_ipv6_routing_ext) +
                                        (ext->hdr.hdr_len << 3); diff --git a/lib/net/rte_ip.h

b/lib/net/rte_ip.h index 337fad15d7..cfdbfb86ba 100644

lib/net/rte_ip.h +3 -1
@@ -540,6 +540,9 @@ struct rte_ipv6_hdr {
        uint8_t  dst_addr[16];  /**< IP address of destination host(s). */  }
 __rte_packed;
 
+/* IPv6 routing extension type definition. */ #define
+RTE_IPV6_SRCRT_TYPE_4 4
+
 /**
  * IPv6 Routing Extension Header
  */
--

2.27.0

Acked-by
#4 lore raw

Hi Rongwei,

Quoted 62 lines

-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Friday, May 26, 2023 6:22 AM

HI @Ori Kam @NBU-Contact-Thomas Monjalon (EXTERNAL) @Andrew Rybchenko
Can you share some comments on this? Thanks.

BR
Rongwei

Quoted 10 lines

-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Tuesday, March 28, 2023 20:28
To: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; NBU-Contact- Thomas Monjalon (EXTERNAL) <[email protected]>
Cc: Aman Singh <[email protected]>; Yuying Zhang <[email protected]>; Olivier Matz <[email protected]>
Subject: [PATCH v2] app/testpmd: set srv6 header without any TLV

Quoted 7 lines

External email: Use caution opening links or attachments

When the type field of the IPv6 routing extension is 4, it means segment routing header.

In this case, set the last_entry to be segment_left minus 1 if the user

doesn't

Quoted 32 lines

specify the header length explicitly.

v2: add macro definition for segment routing header.

---
 app/test-pmd/cmdline_flow.c | 3 +++
 lib/net/rte_ip.h            | 3 +++
 2 files changed, 6 insertions(+)
app/test-pmd/cmdline_flow.c +4 -0
index 5fbc450849..09f417b76e 100644
@@ -12817,6 +12817,9 @@ cmd_set_raw_parsed(const struct buffer *in)
                                size = sizeof(struct rte_ipv6_routing_ext) +
                                        (ext->hdr.segments_left << 4);
                                ext->hdr.hdr_len = ext->hdr.segments_left << 1;
+                               /* Srv6 without TLV. */
+                               if (ext->hdr.type == RTE_IPV6_SRCRT_TYPE_4)
+                                       ext->hdr.last_entry =
+ ext->hdr.segments_left - 1;
                        } else {
                                size = sizeof(struct rte_ipv6_routing_ext) +
                                        (ext->hdr.hdr_len << 3); diff --git a/lib/net/rte_ip.h

b/lib/net/rte_ip.h index 337fad15d7..cfdbfb86ba 100644

lib/net/rte_ip.h +0 -0
@@ -540,6 +540,9 @@ struct rte_ipv6_hdr {
        uint8_t  dst_addr[16];  /**< IP address of destination host(s). */  }
 __rte_packed;
 
Quoted 8 lines
Quoted 8 lines
lib/net/rte_ip.h +3 -1
+/* IPv6 routing extension type definition. */ #define
+RTE_IPV6_SRCRT_TYPE_4 4
+
 /**
  * IPv6 Routing Extension Header
  */
--

2.27.0

Best,
Ori

Applied
#5 lore raw
Quoted 4 lines · Ori Kam
Quoted 4 lines
Quoted 4 lines

When the type field of the IPv6 routing extension is 4, it means segment routing header.

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

In this case, set the last_entry to be segment_left minus 1 if the user

doesn't

Quoted 4 lines

specify the header length explicitly.

Applied to dpdk-next-net/main, thanks.