Skip to contentSkip to conversation

app/testpmd: add IPv4 length field matching

PATCH Superseded Bing Zhao 3 participants 4 messages Jul 1, 2023 – Jul 6, 2023

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/1 app/testpmd: add IPv4 length field matching

In the command line, the total length field translation support is added to pass the value to the rte_flow API.

---
 app/test-pmd/cmdline_flow.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
app/test-pmd/cmdline_flow.c +10 -0
index bd626e2347..738ecf2a40 100644
@@ -313,6 +313,7 @@ enum index {
 	ITEM_IPV4,
 	ITEM_IPV4_VER_IHL,
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_LENGTH,
 	ITEM_IPV4_ID,
 	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
@@ -1604,6 +1605,7 @@ static const enum index item_vlan[] = {
 static const enum index item_ipv4[] = {
 	ITEM_IPV4_VER_IHL,
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_LENGTH,
 	ITEM_IPV4_ID,
 	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
@@ -4229,6 +4231,14 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
 					     hdr.type_of_service)),
 	},
+	[ITEM_IPV4_LENGTH] = {
+		.name = "length",
+		.help = "total length",
+		.next = NEXT(item_ipv4, NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
+					     hdr.total_length)),
+	},
 	[ITEM_IPV4_ID] = {
 		.name = "packet_id",
 		.help = "fragment packet id",
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/1 app/testpmd: add IP length field matching

Added support of parsing IPv4 total length and IPv6 payload length in the command line. The value of L3 length can be passed to the rte_flow API for testing.

---
 app/test-pmd/cmdline_flow.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
app/test-pmd/cmdline_flow.c +20 -0
index bd626e2347..cc47d6cb80 100644
@@ -313,6 +313,7 @@ enum index {
 	ITEM_IPV4,
 	ITEM_IPV4_VER_IHL,
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_LENGTH,
 	ITEM_IPV4_ID,
 	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
@@ -322,6 +323,7 @@ enum index {
 	ITEM_IPV6,
 	ITEM_IPV6_TC,
 	ITEM_IPV6_FLOW,
+	ITEM_IPV6_LEN,
 	ITEM_IPV6_PROTO,
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
@@ -1604,6 +1606,7 @@ static const enum index item_vlan[] = {
 static const enum index item_ipv4[] = {
 	ITEM_IPV4_VER_IHL,
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_LENGTH,
 	ITEM_IPV4_ID,
 	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
@@ -1617,6 +1620,7 @@ static const enum index item_ipv4[] = {
 static const enum index item_ipv6[] = {
 	ITEM_IPV6_TC,
 	ITEM_IPV6_FLOW,
+	ITEM_IPV6_LEN,
 	ITEM_IPV6_PROTO,
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
@@ -4229,6 +4233,14 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
 					     hdr.type_of_service)),
 	},
+	[ITEM_IPV4_LENGTH] = {
+		.name = "length",
+		.help = "total length",
+		.next = NEXT(item_ipv4, NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
+					     hdr.total_length)),
+	},
 	[ITEM_IPV4_ID] = {
 		.name = "packet_id",
 		.help = "fragment packet id",
@@ -4302,6 +4314,14 @@ static const struct token token_list[] = {
 						  hdr.vtc_flow,
 						  "\x00\x0f\xff\xff")),
 	},
+	[ITEM_IPV6_LEN] = {
+		.name = "length",
+		.help = "payload length",
+		.next = NEXT(item_ipv6, NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6,
+					     hdr.payload_len)),
+	},
 	[ITEM_IPV6_PROTO] = {
 		.name = "proto",
 		.help = "protocol (next header)",
Signature · 1 line
2.34.1
Acked-by on v2 1/1
#2 lore raw

RE: [PATCH v2] app/testpmd: add IP length field matching

Quoted 7 lines

-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Saturday, July 1, 2023 12:27 PM
Subject: [PATCH v2] app/testpmd: add IP length field matching

Quoted 6 lines

Added support of parsing IPv4 total length and IPv6 payload length in the command line. The value of L3 length can be passed to the rte_flow API for testing.

---

Best,
Ori

Applied
#3 lore raw

Re: [PATCH v2] app/testpmd: add IP length field matching

Quoted 7 lines · Ori Kam
Quoted 7 lines

-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Saturday, July 1, 2023 12:27 PM
Subject: [PATCH v2] app/testpmd: add IP length field matching

Quoted 9 lines
Quoted 6 lines

Added support of parsing IPv4 total length and IPv6 payload length in the command line. The value of L3 length can be passed to the rte_flow API for testing.

---

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