[PATCH v2] app/testpmd: set srv6 header without any TLV
Rongwei Liu
rongweil at nvidia.com
Tue Mar 28 14:27:42 CEST 2023
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.
Signed-off-by: Rongwei Liu <rongweil at nvidia.com>
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(+)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 5fbc450849..09f417b76e 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -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
--- a/lib/net/rte_ip.h
+++ b/lib/net/rte_ip.h
@@ -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
More information about the dev
mailing list