Skip to contentSkip to conversation

app/testpmd: fix flow tunnel create command

PATCH Superseded Gregory Etelson 3 participants 6 messages Nov 15, 2020 – Nov 19, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix flow tunnel create command

testpmd provides commands to test tunnel offload rte_flow capabilities. A command that creates a tunnel had a syntax bug that allowed to spesify the 'create' command part several times.

Current patch fixed that fault. Correct syntax for tunnel cretion is:
testpmd> flow tunnel create <port> type <tunnel type>

---
 app/test-pmd/cmdline_flow.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
app/test-pmd/cmdline_flow.c +4 -4
index 457f74078d..bf00ba0acb 100644
@@ -812,8 +812,7 @@ static const enum index next_vc_attr[] = {
 	ZERO,
 };
 
-static const enum index tunnel_create_attr[] = {
-	TUNNEL_CREATE,
+static const enum index tunnel_create_type_attr[] = {
 	TUNNEL_CREATE_TYPE,
 	END,
 	ZERO,
@@ -2009,14 +2008,15 @@ static const struct token token_list[] = {
 	[TUNNEL_CREATE] = {
 		.name = "create",
 		.help = "create new tunnel object",
-		.next = NEXT(tunnel_create_attr, NEXT_ENTRY(PORT_ID)),
+		.next = NEXT(NEXT_ENTRY(TUNNEL_CREATE_TYPE),
+			     NEXT_ENTRY(PORT_ID)),
 		.args = ARGS(ARGS_ENTRY(struct buffer, port)),
 		.call = parse_tunnel,
 	},
 	[TUNNEL_CREATE_TYPE] = {
 		.name = "type",
 		.help = "create new tunnel",
-		.next = NEXT(tunnel_create_attr, NEXT_ENTRY(FILE_PATH)),
+		.next = NEXT(tunnel_create_type_attr, NEXT_ENTRY(FILE_PATH)),
 		.args = ARGS(ARGS_ENTRY(struct tunnel_ops, type)),
 		.call = parse_tunnel,
 	},
Signature · 1 line
2.29.2
#1 lore raw
Quoted 7 lines · Gregory Etelson

testpmd provides commands to test tunnel offload rte_flow capabilities. A command that creates a tunnel had a syntax bug that allowed to spesify the 'create' command part several times.

Current patch fixed that fault. Correct syntax for tunnel cretion is:
testpmd> flow tunnel create <port> type <tunnel type>

multiple times 'type' still supported, is it intentional:
flow tunnel create 0 type "a" type "b" type "c"

Also 'list' and 'destroy' can be issued multiple times, is it a valid usage:
flow tunnel list 0 list 0 list 0
flow tunnel destroy 0 destroy 0 destroy 0
flow tunnel destroy 0 id 0 id 1 id 2
flow tunnel destroy 0 id 0 destroy 0 id 1 id 2 destroy 0

Quoted 39 lines
---
  app/test-pmd/cmdline_flow.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
app/test-pmd/cmdline_flow.c +4 -4
index 457f74078d..bf00ba0acb 100644
@@ -812,8 +812,7 @@ static const enum index next_vc_attr[] = {
  	ZERO,
  };
 
-static const enum index tunnel_create_attr[] = {
-	TUNNEL_CREATE,
+static const enum index tunnel_create_type_attr[] = {
  	TUNNEL_CREATE_TYPE,
  	END,
  	ZERO,
@@ -2009,14 +2008,15 @@ static const struct token token_list[] = {
  	[TUNNEL_CREATE] = {
  		.name = "create",
  		.help = "create new tunnel object",
-		.next = NEXT(tunnel_create_attr, NEXT_ENTRY(PORT_ID)),
+		.next = NEXT(NEXT_ENTRY(TUNNEL_CREATE_TYPE),
+			     NEXT_ENTRY(PORT_ID)),
  		.args = ARGS(ARGS_ENTRY(struct buffer, port)),
  		.call = parse_tunnel,
  	},
  	[TUNNEL_CREATE_TYPE] = {
  		.name = "type",
  		.help = "create new tunnel",
-		.next = NEXT(tunnel_create_attr, NEXT_ENTRY(FILE_PATH)),
+		.next = NEXT(tunnel_create_type_attr, NEXT_ENTRY(FILE_PATH)),
  		.args = ARGS(ARGS_ENTRY(struct tunnel_ops, type)),
  		.call = parse_tunnel,
  	},
#2 lore raw

Hello Ferruh,

Quoted 9 lines · Gregory Etelson
Quoted 7 lines

testpmd provides commands to test tunnel offload rte_flow capabilities. A command that creates a tunnel had a syntax bug that allowed to spesify the 'create' command part several times.

Current patch fixed that fault. Correct syntax for tunnel cretion is:
testpmd> flow tunnel create <port> type <tunnel type>

Quoted 9 lines

multiple times 'type' still supported, is it intentional:
flow tunnel create 0 type "a" type "b" type "c"

Also 'list' and 'destroy' can be issued multiple times, is it a valid usage:
flow tunnel list 0 list 0 list 0
flow tunnel destroy 0 destroy 0 destroy 0 flow tunnel destroy 0 id 0 id 1 id 2 flow tunnel destroy 0 id 0 destroy 0 id 1 id 2 destroy 0

I'll post a new patch with a fix.

Regards,
Gregory

Quoted 40 lines
Quoted 40 lines
---
  app/test-pmd/cmdline_flow.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
app/test-pmd/cmdline_flow.c +5 -4
index 457f74078d..bf00ba0acb 100644
@@ -812,8 +812,7 @@ static const enum index next_vc_attr[] = {
      ZERO,
  };
 
-static const enum index tunnel_create_attr[] = {
-     TUNNEL_CREATE,
+static const enum index tunnel_create_type_attr[] = {
      TUNNEL_CREATE_TYPE,
      END,
      ZERO,
@@ -2009,14 +2008,15 @@ static const struct token token_list[] = {
      [TUNNEL_CREATE] = {
              .name = "create",
              .help = "create new tunnel object",
-             .next = NEXT(tunnel_create_attr, NEXT_ENTRY(PORT_ID)),
+             .next = NEXT(NEXT_ENTRY(TUNNEL_CREATE_TYPE),
+                          NEXT_ENTRY(PORT_ID)),
              .args = ARGS(ARGS_ENTRY(struct buffer, port)),
              .call = parse_tunnel,
      },
      [TUNNEL_CREATE_TYPE] = {
              .name = "type",
              .help = "create new tunnel",
-             .next = NEXT(tunnel_create_attr, NEXT_ENTRY(FILE_PATH)),
+             .next = NEXT(tunnel_create_type_attr,
+ NEXT_ENTRY(FILE_PATH)),
              .args = ARGS(ARGS_ENTRY(struct tunnel_ops, type)),
              .call = parse_tunnel,
      },
#3 lore raw

PATCH v2 1/1 app/testpmd: fix flow tunnel commands

In reply to Gregory Etelson

testpmd provides commands to test tunnel offload rte_flow capabilities. Testpmd tunnel commands allow to configure new ofloaded tunnel types, list existing offloaded tunnels and destroy existing offloaded tunnels.
Tunnel offload commands allowed parameters repetition. For example, the following commands were accepted:
testpmd> flow tunnel create 0 create 1 type vxlan
or
testpmd> flow tunnel list 0 list 1

Current patch fixed that fault. Correct tunnel commands syntax is:
testpmd> flow tunnel create <port> type <tunnel type> testpmd> flow tunnel list <port>
testpmd> flow tunnel destroy <port> id <tunnel id>

Fixes 1b9f274623b8 ("app/testpmd: add commands for tunnel offload")
---
 app/test-pmd/cmdline_flow.c | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)
app/test-pmd/cmdline_flow.c +7 -25
index 457f74078d..585cab98b4 100644
@@ -812,26 +812,6 @@ static const enum index next_vc_attr[] = {
 	ZERO,
 };
 
-static const enum index tunnel_create_attr[] = {
-	TUNNEL_CREATE,
-	TUNNEL_CREATE_TYPE,
-	END,
-	ZERO,
-};
-
-static const enum index tunnel_destroy_attr[] = {
-	TUNNEL_DESTROY,
-	TUNNEL_DESTROY_ID,
-	END,
-	ZERO,
-};
-
-static const enum index tunnel_list_attr[] = {
-	TUNNEL_LIST,
-	END,
-	ZERO,
-};
-
 static const enum index next_destroy_attr[] = {
 	DESTROY_RULE,
 	END,
@@ -2009,35 +1989,37 @@ static const struct token token_list[] = {
 	[TUNNEL_CREATE] = {
 		.name = "create",
 		.help = "create new tunnel object",
-		.next = NEXT(tunnel_create_attr, NEXT_ENTRY(PORT_ID)),
+		.next = NEXT(NEXT_ENTRY(TUNNEL_CREATE_TYPE),
+			     NEXT_ENTRY(PORT_ID)),
 		.args = ARGS(ARGS_ENTRY(struct buffer, port)),
 		.call = parse_tunnel,
 	},
 	[TUNNEL_CREATE_TYPE] = {
 		.name = "type",
 		.help = "create new tunnel",
-		.next = NEXT(tunnel_create_attr, NEXT_ENTRY(FILE_PATH)),
+		.next = NEXT(NEXT_ENTRY(FILE_PATH)),
 		.args = ARGS(ARGS_ENTRY(struct tunnel_ops, type)),
 		.call = parse_tunnel,
 	},
 	[TUNNEL_DESTROY] = {
 		.name = "destroy",
 		.help = "destroy tunel",
-		.next = NEXT(tunnel_destroy_attr, NEXT_ENTRY(PORT_ID)),
+		.next = NEXT(NEXT_ENTRY(TUNNEL_DESTROY_ID),
+			     NEXT_ENTRY(PORT_ID)),
 		.args = ARGS(ARGS_ENTRY(struct buffer, port)),
 		.call = parse_tunnel,
 	},
 	[TUNNEL_DESTROY_ID] = {
 		.name = "id",
 		.help = "tunnel identifier to testroy",
-		.next = NEXT(tunnel_destroy_attr, NEXT_ENTRY(UNSIGNED)),
+		.next = NEXT(NEXT_ENTRY(UNSIGNED)),
 		.args = ARGS(ARGS_ENTRY(struct tunnel_ops, id)),
 		.call = parse_tunnel,
 	},
 	[TUNNEL_LIST] = {
 		.name = "list",
 		.help = "list existing tunnels",
-		.next = NEXT(tunnel_list_attr, NEXT_ENTRY(PORT_ID)),
+		.next = NEXT(NEXT_ENTRY(PORT_ID)),
 		.args = ARGS(ARGS_ENTRY(struct buffer, port)),
 		.call = parse_tunnel,
 	},
Signature · 1 line
2.29.2
Acked-by on v2 1/1
#4 lore raw

Re: [dpdk-dev] [PATCH v2] app/testpmd: fix flow tunnel commands

Hi Gregory,

Quoted 102 lines

-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Thursday, November 19, 2020 1:10 PM
Subject: [PATCH v2] app/testpmd: fix flow tunnel commands

testpmd provides commands to test tunnel offload rte_flow capabilities. Testpmd tunnel commands allow to configure new ofloaded tunnel types, list existing offloaded tunnels and destroy existing offloaded tunnels.
Tunnel offload commands allowed parameters repetition. For example, the following commands were accepted:
testpmd> flow tunnel create 0 create 1 type vxlan
or
testpmd> flow tunnel list 0 list 1

Current patch fixed that fault. Correct tunnel commands syntax is:
testpmd> flow tunnel create <port> type <tunnel type> testpmd> flow tunnel list <port>
testpmd> flow tunnel destroy <port> id <tunnel id>

Fixes 1b9f274623b8 ("app/testpmd: add commands for tunnel offload")
---
 app/test-pmd/cmdline_flow.c | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)
app/test-pmd/cmdline_flow.c +7 -26
index 457f74078d..585cab98b4 100644
@@ -812,26 +812,6 @@ static const enum index next_vc_attr[] = {
 	ZERO,
 };
 
-static const enum index tunnel_create_attr[] = {
-	TUNNEL_CREATE,
-	TUNNEL_CREATE_TYPE,
-	END,
-	ZERO,
-};
-
-static const enum index tunnel_destroy_attr[] = {
-	TUNNEL_DESTROY,
-	TUNNEL_DESTROY_ID,
-	END,
-	ZERO,
-};
-
-static const enum index tunnel_list_attr[] = {
-	TUNNEL_LIST,
-	END,
-	ZERO,
-};
-
 static const enum index next_destroy_attr[] = {
 	DESTROY_RULE,
 	END,
@@ -2009,35 +1989,37 @@ static const struct token token_list[] = {
 	[TUNNEL_CREATE] = {
 		.name = "create",
 		.help = "create new tunnel object",
-		.next = NEXT(tunnel_create_attr, NEXT_ENTRY(PORT_ID)),
+		.next = NEXT(NEXT_ENTRY(TUNNEL_CREATE_TYPE),
+			     NEXT_ENTRY(PORT_ID)),
 		.args = ARGS(ARGS_ENTRY(struct buffer, port)),
 		.call = parse_tunnel,
 	},
 	[TUNNEL_CREATE_TYPE] = {
 		.name = "type",
 		.help = "create new tunnel",
-		.next = NEXT(tunnel_create_attr, NEXT_ENTRY(FILE_PATH)),
+		.next = NEXT(NEXT_ENTRY(FILE_PATH)),
 		.args = ARGS(ARGS_ENTRY(struct tunnel_ops, type)),
 		.call = parse_tunnel,
 	},
 	[TUNNEL_DESTROY] = {
 		.name = "destroy",
 		.help = "destroy tunel",
-		.next = NEXT(tunnel_destroy_attr, NEXT_ENTRY(PORT_ID)),
+		.next = NEXT(NEXT_ENTRY(TUNNEL_DESTROY_ID),
+			     NEXT_ENTRY(PORT_ID)),
 		.args = ARGS(ARGS_ENTRY(struct buffer, port)),
 		.call = parse_tunnel,
 	},
 	[TUNNEL_DESTROY_ID] = {
 		.name = "id",
 		.help = "tunnel identifier to testroy",
-		.next = NEXT(tunnel_destroy_attr, NEXT_ENTRY(UNSIGNED)),
+		.next = NEXT(NEXT_ENTRY(UNSIGNED)),
 		.args = ARGS(ARGS_ENTRY(struct tunnel_ops, id)),
 		.call = parse_tunnel,
 	},
 	[TUNNEL_LIST] = {
 		.name = "list",
 		.help = "list existing tunnels",
-		.next = NEXT(tunnel_list_attr, NEXT_ENTRY(PORT_ID)),
+		.next = NEXT(NEXT_ENTRY(PORT_ID)),
 		.args = ARGS(ARGS_ENTRY(struct buffer, port)),
 		.call = parse_tunnel,
 	},
--
Quoted 1 line

2.29.2

Best,
Ori

Reviewed-by Applied
#5 lore raw

Re: [dpdk-dev] [PATCH v2] app/testpmd: fix flow tunnel commands

Quoted 22 lines · Ori Kam

Hi Gregory,

Quoted 20 lines

-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Thursday, November 19, 2020 1:10 PM
Subject: [PATCH v2] app/testpmd: fix flow tunnel commands

testpmd provides commands to test tunnel offload rte_flow capabilities. Testpmd tunnel commands allow to configure new ofloaded tunnel types, list existing offloaded tunnels and destroy existing offloaded tunnels.
Tunnel offload commands allowed parameters repetition. For example, the following commands were accepted:
testpmd> flow tunnel create 0 create 1 type vxlan
or
testpmd> flow tunnel list 0 list 1

Current patch fixed that fault. Correct tunnel commands syntax is:
testpmd> flow tunnel create <port> type <tunnel type> testpmd> flow tunnel list <port>
testpmd> flow tunnel destroy <port> id <tunnel id>

Quoted 6 lines
Quoted 3 lines
Fixes 1b9f274623b8 ("app/testpmd: add commands for tunnel offload")

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