Skip to contentSkip to conversation

app/testpmd: parse flow command line for AH

dpdk-dev Applied Xiao Zhang 4 participants 6 messages Feb 13, 2020 – Mar 2, 2020

lore
Share & tools
lore

Xiao Zhang

author
#0 lore raw

add ITEM_AH
add ITEM_AH_SPI

---
 app/test-pmd/cmdline_flow.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
app/test-pmd/cmdline_flow.c +29 -0
index c2cc4c5..680cb1c 100644
@@ -220,6 +220,8 @@ enum index {
 	ITEM_L2TPV3OIP_SESSION_ID,
 	ITEM_ESP,
 	ITEM_ESP_SPI,
+	ITEM_AH,
+	ITEM_AH_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -768,6 +770,7 @@ static const enum index next_item[] = {
 	ITEM_TAG,
 	ITEM_L2TPV3OIP,
 	ITEM_ESP,
+	ITEM_AH,
 	END_SET,
 	ZERO,
 };
@@ -1046,6 +1049,12 @@ static const enum index item_esp[] = {
 	ZERO,
 };
 
+static const enum index item_ah[] = {
+	ITEM_AH_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2699,6 +2708,19 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
 				hdr.spi)),
 	},
+	[ITEM_AH] = {
+		.name = "ah",
+		.help = "match AH header",
+		.priv = PRIV_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+		.next = NEXT(item_ah),
+		.call = parse_vc,
+	},
+	[ITEM_AH_SPI] = {
+		.name = "spi",
+		.help = "security parameters index",
+		.next = NEXT(item_ah, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ah, spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
@@ -6444,6 +6466,9 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
+	case RTE_FLOW_ITEM_TYPE_AH:
+		mask = &rte_flow_item_ah_mask;
+		break;
 	default:
 		break;
 	}
@@ -6541,6 +6566,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 			size = sizeof(struct rte_flow_item_esp);
 			proto = 0x32;
 			break;
+		case RTE_FLOW_ITEM_TYPE_AH:
+			size = sizeof(struct rte_flow_item_ah);
+			proto = 0x33;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
Signature · 1 line
2.7.4
#1 lore raw

Hi, Xiao

Quoted 2 lines · Xiao Zhang

add ITEM_AH
add ITEM_AH_SPI

Better to add some descriptive sentence about this patch in commit log instead of some simple bullets.

Thanks,
Xiaolong

Quoted 84 lines

---
app/test-pmd/cmdline_flow.c | 29 +++++++++++++++++++++++++++++

1 file changed, 29 insertions(+)
app/test-pmd/cmdline_flow.c +29 -0
index c2cc4c5..680cb1c 100644
@@ -220,6 +220,8 @@ enum index {
 	ITEM_L2TPV3OIP_SESSION_ID,
 	ITEM_ESP,
 	ITEM_ESP_SPI,
+	ITEM_AH,
+	ITEM_AH_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -768,6 +770,7 @@ static const enum index next_item[] = {
 	ITEM_TAG,
 	ITEM_L2TPV3OIP,
 	ITEM_ESP,
+	ITEM_AH,
 	END_SET,
 	ZERO,
 };
@@ -1046,6 +1049,12 @@ static const enum index item_esp[] = {
 	ZERO,
 };
 
+static const enum index item_ah[] = {
+	ITEM_AH_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2699,6 +2708,19 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
 				hdr.spi)),
 	},
+	[ITEM_AH] = {
+		.name = "ah",
+		.help = "match AH header",
+		.priv = PRIV_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+		.next = NEXT(item_ah),
+		.call = parse_vc,
+	},
+	[ITEM_AH_SPI] = {
+		.name = "spi",
+		.help = "security parameters index",
+		.next = NEXT(item_ah, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ah, spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
@@ -6444,6 +6466,9 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
+	case RTE_FLOW_ITEM_TYPE_AH:
+		mask = &rte_flow_item_ah_mask;
+		break;
 	default:
 		break;
 	}
@@ -6541,6 +6566,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 			size = sizeof(struct rte_flow_item_esp);
 			proto = 0x32;
 			break;
+		case RTE_FLOW_ITEM_TYPE_AH:
+			size = sizeof(struct rte_flow_item_ah);
+			proto = 0x33;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
Signature · 1 line
2.7.4
#2 lore raw
Quoted 11 lines

-----Original Message-----
From: Ye, Xiaolong <[email protected]>
Sent: Thursday, February 13, 2020 2:46 PM
To: Zhang, Xiao <[email protected]>
Cc: [email protected]; [email protected]; Zhang, Qi Z <[email protected]>; Su, Simei <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: Re: [dpdk-dev] app/testpmd: parse flow command line for AH

Quoted 8 lines

Hi, Xiao

Quoted 2 lines · Xiao Zhang

add ITEM_AH
add ITEM_AH_SPI

Better to add some descriptive sentence about this patch in commit log instead of some simple bullets.

Yes, added more description in v2 patch.

Thanks,
Xiao

Quoted 90 lines

Thanks,
Xiaolong

Quoted 46 lines

---
app/test-pmd/cmdline_flow.c | 29 +++++++++++++++++++++++++++++

1 file changed, 29 insertions(+)
app/test-pmd/cmdline_flow.c +11 -0
index c2cc4c5..680cb1c 100644
@@ -220,6 +220,8 @@ enum index {
 	ITEM_L2TPV3OIP_SESSION_ID,
 	ITEM_ESP,
 	ITEM_ESP_SPI,
+	ITEM_AH,
+	ITEM_AH_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -768,6 +770,7 @@ static const enum index next_item[] = {
 	ITEM_TAG,
 	ITEM_L2TPV3OIP,
 	ITEM_ESP,
+	ITEM_AH,
 	END_SET,
 	ZERO,
 };
@@ -1046,6 +1049,12 @@ static const enum index item_esp[] = {
 	ZERO,
 };
 
+static const enum index item_ah[] = {
+	ITEM_AH_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2699,6 +2708,19 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
 				hdr.spi)),
 	},
+	[ITEM_AH] = {
+		.name = "ah",

app/test-pmd/cmdline_flow.c static const struct token token_list[] = { · line 2722

Quoted 10 lines
app/test-pmd/cmdline_flow.c +10 -0
+		.help = "match AH header",
+		.priv = PRIV_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+		.next = NEXT(item_ah),
+		.call = parse_vc,
+	},
+	[ITEM_AH_SPI] = {
+		.name = "spi",
+		.help = "security parameters index",
+		.next = NEXT(item_ah, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ah,

spi)),

app/test-pmd/cmdline_flow.c flow_item_default_mask(const struct rte_flow_item

Quoted 5 lines
app/test-pmd/cmdline_flow.c +1 -0
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
@@ -6444,6 +6466,9 @@ flow_item_default_mask(const struct rte_flow_item

*item)

Quoted 23 lines
app/test-pmd/cmdline_flow.c +7 -1
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
+	case RTE_FLOW_ITEM_TYPE_AH:
+		mask = &rte_flow_item_ah_mask;
+		break;
 	default:
 		break;
 	}
@@ -6541,6 +6566,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 			size = sizeof(struct rte_flow_item_esp);
 			proto = 0x32;
 			break;
+		case RTE_FLOW_ITEM_TYPE_AH:
+			size = sizeof(struct rte_flow_item_ah);
+			proto = 0x33;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
--

2.7.4

author
#3 lore raw

PATCH v2 1/1 app/testpmd: parse flow command line for AH

In reply to Xiao Zhang

Add AH and AH SPI to testpmd rte flow command line. Add note and sample AH rules in testpmd guide.

---
v2 Add sample rules in testpmd guide.

---
 app/test-pmd/cmdline_flow.c                 | 29 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 18 ++++++++++++++++++
 2 files changed, 47 insertions(+)
app/test-pmd/cmdline_flow.c +29 -0
index c2cc4c5..680cb1c 100644
@@ -220,6 +220,8 @@ enum index {
 	ITEM_L2TPV3OIP_SESSION_ID,
 	ITEM_ESP,
 	ITEM_ESP_SPI,
+	ITEM_AH,
+	ITEM_AH_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -768,6 +770,7 @@ static const enum index next_item[] = {
 	ITEM_TAG,
 	ITEM_L2TPV3OIP,
 	ITEM_ESP,
+	ITEM_AH,
 	END_SET,
 	ZERO,
 };
@@ -1046,6 +1049,12 @@ static const enum index item_esp[] = {
 	ZERO,
 };
 
+static const enum index item_ah[] = {
+	ITEM_AH_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2699,6 +2708,19 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
 				hdr.spi)),
 	},
+	[ITEM_AH] = {
+		.name = "ah",
+		.help = "match AH header",
+		.priv = PRIV_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+		.next = NEXT(item_ah),
+		.call = parse_vc,
+	},
+	[ITEM_AH_SPI] = {
+		.name = "spi",
+		.help = "security parameters index",
+		.next = NEXT(item_ah, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ah, spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
@@ -6444,6 +6466,9 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
+	case RTE_FLOW_ITEM_TYPE_AH:
+		mask = &rte_flow_item_ah_mask;
+		break;
 	default:
 		break;
 	}
@@ -6541,6 +6566,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 			size = sizeof(struct rte_flow_item_esp);
 			proto = 0x32;
 			break;
+		case RTE_FLOW_ITEM_TYPE_AH:
+			size = sizeof(struct rte_flow_item_ah);
+			proto = 0x33;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
doc/guides/testpmd_app_ug/testpmd_funcs.rst +18 -0
index 5103ff9..95f4f06 100644
@@ -3987,6 +3987,10 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
 
+- ``ah``: match AH header.
+
+  - ``spi {unsigned}``: security parameters index.
+
 Actions list
 ^^^^^^^^^^^^
 
@@ -4822,6 +4826,20 @@ ESP rules can be created by the following commands::
  testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
         actions queue index 3 / end
 
+Sample AH rules
+~~~~~~~~~~~~~~~~
+
+AH rules can be created by the following commands::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / ah spi is 1 / end actions
+        queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / ah spi is 1 / end
+        actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / ah spi is 1 / end actions
+        queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / udp / ah spi is 1 / end
+        actions queue index 3 / end
+
 BPF Functions
 --------------
 
Signature · 1 line
2.7.4
Acked-by on v2 1/1
#4 lore raw
Quoted 135 lines

-----Original Message-----
From: Xiao Zhang <[email protected]>
Subject: [v2] app/testpmd: parse flow command line for AH

Add AH and AH SPI to testpmd rte flow command line. Add note and sample AH rules in testpmd guide.

---
v2 Add sample rules in testpmd guide.

---
 app/test-pmd/cmdline_flow.c                 | 29
+++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 18 ++++++++++++++++++
 2 files changed, 47 insertions(+)
app/test-pmd/cmdline_flow.c +22 -0
index c2cc4c5..680cb1c 100644
@@ -220,6 +220,8 @@ enum index {
 	ITEM_L2TPV3OIP_SESSION_ID,
 	ITEM_ESP,
 	ITEM_ESP_SPI,
+	ITEM_AH,
+	ITEM_AH_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -768,6 +770,7 @@ static const enum index next_item[] = {
 	ITEM_TAG,
 	ITEM_L2TPV3OIP,
 	ITEM_ESP,
+	ITEM_AH,
 	END_SET,
 	ZERO,
 };
@@ -1046,6 +1049,12 @@ static const enum index item_esp[] = {
 	ZERO,
 };
 
+static const enum index item_ah[] = {
+	ITEM_AH_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2699,6 +2708,19 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
 				hdr.spi)),
 	},
+	[ITEM_AH] = {
+		.name = "ah",
+		.help = "match AH header",
+		.priv = PRIV_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+		.next = NEXT(item_ah),
+		.call = parse_vc,
+	},
+	[ITEM_AH_SPI] = {
+		.name = "spi",
+		.help = "security parameters index",
+		.next = NEXT(item_ah, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ah,
 spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
app/test-pmd/cmdline_flow.c +3 -0
 		.name = "actions",
@@ -6444,6 +6466,9 @@ flow_item_default_mask(const struct rte_flow_item
 *item)
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
+	case RTE_FLOW_ITEM_TYPE_AH:
+		mask = &rte_flow_item_ah_mask;
+		break;
 	default:
 		break;
app/test-pmd/cmdline_flow.c +4 -0
 	}
@@ -6541,6 +6566,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 			size = sizeof(struct rte_flow_item_esp);
 			proto = 0x32;
 			break;
+		case RTE_FLOW_ITEM_TYPE_AH:
+			size = sizeof(struct rte_flow_item_ah);
+			proto = 0x33;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
doc/guides/testpmd_app_ug/testpmd_funcs.rst +0 -0
index 5103ff9..95f4f06 100644
@@ -3987,6 +3987,10 @@ This section lists supported pattern items and their

attributes, if any.

- ``session_id {unsigned}``: L2TPv3 over IP session identifier.

+- ``ah``: match AH header.

doc/guides/testpmd_app_ug/testpmd_funcs.rst +3 -0
+
+  - ``spi {unsigned}``: security parameters index.
+
 Actions list
 ^^^^^^^^^^^^
@@ -4822,6 +4826,20 @@ ESP rules can be created by the following

commands::
testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
actions queue index 3 / end

doc/guides/testpmd_app_ug/testpmd_funcs.rst +14 -1
+Sample AH rules
+~~~~~~~~~~~~~~~~
+
+AH rules can be created by the following commands::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / ah spi is 1 / end actions
+        queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / ah spi is 1 / end
+        actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / ah spi is 1 / end actions
+        queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / udp / ah spi is 1 / end
+        actions queue index 3 / end
+
 BPF Functions
 --------------
 
--
Quoted 1 line

2.7.4

Best,
Ori Kam

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

-----Original Message-----
From: Xiao Zhang <[email protected]>
Subject: [v2] app/testpmd: parse flow command line for AH

Quoted 6 lines
Quoted 3 lines

Add AH and AH SPI to testpmd rte flow command line. Add note and sample AH rules in testpmd guide.

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