app/testpmd: fix flow tunnel create command

Message ID 20201115112341.30617-1-getelson@nvidia.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series app/testpmd: fix flow tunnel create command |

Checks

Context Check Description
ci/checkpatch warning coding style issues
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-testing success Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Gregory Etelson Nov. 15, 2020, 11:23 a.m. UTC
  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>

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Ferruh Yigit Nov. 17, 2020, 12:51 p.m. UTC | #1
On 11/15/2020 11:23 AM, Gregory Etelson wrote:
> 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

> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Acked-by: Ori Kam <orika@nvidia.com>
> ---
>   app/test-pmd/cmdline_flow.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 457f74078d..bf00ba0acb 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -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,
>   	},
>
  
Gregory Etelson Nov. 17, 2020, 1:46 p.m. UTC | #2
Hello Ferruh,

> On 11/15/2020 11:23 AM, Gregory Etelson wrote:
> > 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
> 

I'll post a new patch with a fix.

Regards,
Gregory

> > Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> > Acked-by: Ori Kam <orika@nvidia.com>
> > ---
> >   app/test-pmd/cmdline_flow.c | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> > index 457f74078d..bf00ba0acb 100644
> > --- a/app/test-pmd/cmdline_flow.c
> > +++ b/app/test-pmd/cmdline_flow.c
> > @@ -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,
> >       },
> >
  

Patch

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