[v2] app/testpmd: fix flow tunnel commands

Message ID 20201119111024.7989-1-getelson@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v2] app/testpmd: fix flow tunnel commands |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing warning Testing issues

Commit Message

Gregory Etelson Nov. 19, 2020, 11:10 a.m. UTC
  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")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)
  

Comments

Ori Kam Nov. 19, 2020, 4:50 p.m. UTC | #1
Hi Gregory,

> -----Original Message-----
> From: Gregory Etelson <getelson@nvidia.com>
> 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")
> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> ---
>  app/test-pmd/cmdline_flow.c | 32 +++++++-------------------------
>  1 file changed, 7 insertions(+), 25 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 457f74078d..585cab98b4 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -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,
>  	},
> --
> 2.29.2

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
  
Ferruh Yigit Nov. 19, 2020, 5:29 p.m. UTC | #2
On 11/19/2020 4:50 PM, Ori Kam wrote:
> Hi Gregory,
> 
>> -----Original Message-----
>> From: Gregory Etelson <getelson@nvidia.com>
>> 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")
>>
>> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> 
> Acked-by: Ori Kam <orika@nvidia.com>
> 

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

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

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 457f74078d..585cab98b4 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -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,
 	},