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

Message ID 20231008031029.30850-5-haifeil@nvidia.com (mailing list archive)
State Accepted, 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 Oct. 8, 2023, 3:10 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 ++++++++++++++++
 doc/guides/nics/features/mlx5.ini |  1 +
 2 files changed, 17 insertions(+)
  

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 8a4e06c50a..84de3a2506 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -526,6 +526,7 @@  enum index {
 	ITEM_IB_BTH_PSN,
 	ITEM_IPV6_PUSH_REMOVE_EXT,
 	ITEM_IPV6_PUSH_REMOVE_EXT_TYPE,
+	ITEM_NSH,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -1563,6 +1564,7 @@  static const enum index next_item[] = {
 	ITEM_AGGR_AFFINITY,
 	ITEM_TX_QUEUE,
 	ITEM_IB_BTH,
+	ITEM_NSH,
 	END_SET,
 	ZERO,
 };
@@ -2083,6 +2085,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,
@@ -5846,6 +5853,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",
diff --git a/doc/guides/nics/features/mlx5.ini b/doc/guides/nics/features/mlx5.ini
index c0e0b779cf..fc67415c6c 100644
--- a/doc/guides/nics/features/mlx5.ini
+++ b/doc/guides/nics/features/mlx5.ini
@@ -82,6 +82,7 @@  mark                 = Y
 meta                 = Y
 meter_color          = Y
 mpls                 = Y
+nsh                  = Y
 nvgre                = Y
 port_id              = Y
 port_representor     = Y