[v3,4/5] app/testpmd: support for NSH flow item

Message ID 20230925080746.16438-5-haifeil@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series support item NSH matching |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Haifei Luo Sept. 25, 2023, 8:07 a.m. UTC
  Add support for item NSH. The CLI is: nsh
Example:
flow create 0 transfer group 1
     pattern eth / ipv6 / udp dst is 4790 /
             vxlan-gpe / nsh / eth / ipv4 / tcp / end
     actions port_id id 1 / end

Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
  

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index d25f941259..bf93d649e1 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -525,6 +525,7 @@  enum index {
 	ITEM_IB_BTH_PSN,
 	ITEM_IPV6_PUSH_REMOVE_EXT,
 	ITEM_IPV6_PUSH_REMOVE_EXT_TYPE,
+	ITEM_NSH,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -1562,6 +1563,7 @@  static const enum index next_item[] = {
 	ITEM_AGGR_AFFINITY,
 	ITEM_TX_QUEUE,
 	ITEM_IB_BTH,
+	ITEM_NSH,
 	END_SET,
 	ZERO,
 };
@@ -2081,6 +2083,11 @@  static const enum index item_ib_bth[] = {
 	ZERO,
 };
 
+static const enum index item_nsh[] = {
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -5837,6 +5844,15 @@  static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ib_bth,
 						 hdr.psn)),
 	},
+	[ITEM_NSH] = {
+		.name = "nsh",
+		.help = "match NSH header",
+		.priv = PRIV_ITEM(NSH,
+				  sizeof(struct rte_flow_item_nsh)),
+		.next = NEXT(item_nsh),
+		.call = parse_vc,
+	},
+
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",