[v2,01/10] app/testpmd: parse flow command line for ESP
diff mbox series

Message ID 1576577756-648-2-git-send-email-bernard.iremonger@intel.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • [v2,01/10] app/testpmd: parse flow command line for ESP
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Iremonger, Bernard Dec. 17, 2019, 10:15 a.m. UTC
add ITEM_ESP
add ITEM_ESP_SPI
add debug to cmdline_flow.c

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test-pmd/cmdline_flow.c | 37 ++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)

Comments

Ori Kam Jan. 8, 2020, 2:43 p.m. UTC | #1
Hi just small comment inside.
Thanks,
Ori

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Bernard Iremonger
> Sent: Tuesday, December 17, 2019 12:16 PM
> To: dev@dpdk.org; beilei.xing@intel.com; qi.z.zhang@intel.com;
> declan.doherty@intel.com
> Cc: konstantin.ananyev@intel.com; bernard.iremonger@intel.com
> Subject: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command
> line for ESP
> 
> add ITEM_ESP
> add ITEM_ESP_SPI
> add debug to cmdline_flow.c
> 
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
>  app/test-pmd/cmdline_flow.c | 37
> ++++++++++++++++++++++++++++++++++---
>  1 file changed, 34 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 99dade7..f1b0610 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -213,6 +213,8 @@ enum index {
>  	ITEM_TAG,
>  	ITEM_TAG_DATA,
>  	ITEM_TAG_INDEX,
> +	ITEM_ESP,
> +	ITEM_ESP_SPI,
> 
>  	/* Validate/create actions. */
>  	ACTIONS,
> @@ -746,6 +748,7 @@ static const enum index next_item[] = {
>  	ITEM_PPPOE_PROTO_ID,
>  	ITEM_HIGIG2,
>  	ITEM_TAG,
> +	ITEM_ESP,
>  	END_SET,
>  	ZERO,
>  };
> @@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
>  	ZERO,
>  };
> 
> +static const enum index item_esp[] = {
> +	ITEM_ESP_SPI,
> +	ITEM_NEXT,
> +	ZERO,
> +};
> +
>  static const enum index next_set_raw[] = {
>  	SET_RAW_INDEX,
>  	ITEM_ETH,
> @@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
>  			     NEXT_ENTRY(ITEM_PARAM_IS)),
>  		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag,
> index)),
>  	},
> +	[ITEM_ESP] = {
> +		.name = "esp",
> +		.help = "match ESP header",
> +		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
> +		.next = NEXT(item_esp),
> +		.call = parse_vc,
> +	},
> +	[ITEM_ESP_SPI] = {
> +		.name = "spi",
> +		.help = "security policy index",
> +		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED),
> item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
> +				hdr.spi)),
> +	},
>  	/* Validate/create actions. */
>  	[ACTIONS] = {
>  		.name = "actions",
> @@ -6052,6 +6075,9 @@ cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,
>  static void
>  cmd_flow_parsed(const struct buffer *in)
>  {
> +	printf("Flow command line parsed successfully for
> command=%d.\n",
> +			in->command);
> +

Why adding this printf?

>  	switch (in->command) {
>  	case VALIDATE:
>  		port_flow_validate(in->port, &in->args.vc.attr,
> @@ -6230,14 +6256,15 @@ flow_item_default_mask(const struct
> rte_flow_item *item)
>  	case RTE_FLOW_ITEM_TYPE_GTP:
>  		mask = &rte_flow_item_gtp_mask;
>  		break;
> -	case RTE_FLOW_ITEM_TYPE_ESP:
> -		mask = &rte_flow_item_esp_mask;
> -		break;
>  	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
>  		mask = &rte_flow_item_gtp_psc_mask;
>  		break;
>  	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
>  		mask = &rte_flow_item_pppoe_proto_id_mask;
> +		break;
> +	case RTE_FLOW_ITEM_TYPE_ESP:
> +		mask = &rte_flow_item_esp_mask;
> +		break;
>  	default:
>  		break;
>  	}
> @@ -6327,6 +6354,10 @@ cmd_set_raw_parsed(const struct buffer *in)
>  		case RTE_FLOW_ITEM_TYPE_GENEVE:
>  			size = sizeof(struct rte_flow_item_geneve);
>  			break;
> +		case RTE_FLOW_ITEM_TYPE_ESP:
> +			size = sizeof(struct rte_flow_item_esp);
> +			proto = 0x32;
> +			break;
>  		default:
>  			printf("Error - Not supported item\n");
>  			*total_size = 0;
> --
> 2.7.4
Iremonger, Bernard Jan. 8, 2020, 4:16 p.m. UTC | #2
Hi Ori,

Thanks for the review.

<snip>

> Subject: RE: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow
> command line for ESP
> 
> Hi just small comment inside.
> Thanks,
> Ori
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Bernard Iremonger
> > Sent: Tuesday, December 17, 2019 12:16 PM
> > To: dev@dpdk.org; beilei.xing@intel.com; qi.z.zhang@intel.com;
> > declan.doherty@intel.com
> > Cc: konstantin.ananyev@intel.com; bernard.iremonger@intel.com
> > Subject: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command
> > line for ESP
> >
> > add ITEM_ESP
> > add ITEM_ESP_SPI
> > add debug to cmdline_flow.c
> >
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > ---
> >  app/test-pmd/cmdline_flow.c | 37
> > ++++++++++++++++++++++++++++++++++---
> >  1 file changed, 34 insertions(+), 3 deletions(-)
> >
> > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> > index 99dade7..f1b0610 100644
> > --- a/app/test-pmd/cmdline_flow.c
> > +++ b/app/test-pmd/cmdline_flow.c
> > @@ -213,6 +213,8 @@ enum index {
> >  	ITEM_TAG,
> >  	ITEM_TAG_DATA,
> >  	ITEM_TAG_INDEX,
> > +	ITEM_ESP,
> > +	ITEM_ESP_SPI,
> >
> >  	/* Validate/create actions. */
> >  	ACTIONS,
> > @@ -746,6 +748,7 @@ static const enum index next_item[] = {
> >  	ITEM_PPPOE_PROTO_ID,
> >  	ITEM_HIGIG2,
> >  	ITEM_TAG,
> > +	ITEM_ESP,
> >  	END_SET,
> >  	ZERO,
> >  };
> > @@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
> >  	ZERO,
> >  };
> >
> > +static const enum index item_esp[] = {
> > +	ITEM_ESP_SPI,
> > +	ITEM_NEXT,
> > +	ZERO,
> > +};
> > +
> >  static const enum index next_set_raw[] = {
> >  	SET_RAW_INDEX,
> >  	ITEM_ETH,
> > @@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
> >  			     NEXT_ENTRY(ITEM_PARAM_IS)),
> >  		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag,
> index)),
> >  	},
> > +	[ITEM_ESP] = {
> > +		.name = "esp",
> > +		.help = "match ESP header",
> > +		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
> > +		.next = NEXT(item_esp),
> > +		.call = parse_vc,
> > +	},
> > +	[ITEM_ESP_SPI] = {
> > +		.name = "spi",
> > +		.help = "security policy index",
> > +		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED),
> > item_param),
> > +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
> > +				hdr.spi)),
> > +	},
> >  	/* Validate/create actions. */
> >  	[ACTIONS] = {
> >  		.name = "actions",
> > @@ -6052,6 +6075,9 @@ cmd_flow_tok(cmdline_parse_token_hdr_t
> **hdr,
> > static void  cmd_flow_parsed(const struct buffer *in)  {
> > +	printf("Flow command line parsed successfully for
> > command=%d.\n",
> > +			in->command);
> > +
> 
> Why adding this printf?

It is useful to know that the parsing of the flow command line is successful before going into the PMD code.
I will remove in the v3 if you think it is too verbose.

> 
> >  	switch (in->command) {
> >  	case VALIDATE:
> >  		port_flow_validate(in->port, &in->args.vc.attr, @@ -6230,14
> > +6256,15 @@ flow_item_default_mask(const struct rte_flow_item *item)
> >  	case RTE_FLOW_ITEM_TYPE_GTP:
> >  		mask = &rte_flow_item_gtp_mask;
> >  		break;
> > -	case RTE_FLOW_ITEM_TYPE_ESP:
> > -		mask = &rte_flow_item_esp_mask;
> > -		break;
> >  	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
> >  		mask = &rte_flow_item_gtp_psc_mask;
> >  		break;
> >  	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
> >  		mask = &rte_flow_item_pppoe_proto_id_mask;
> > +		break;
> > +	case RTE_FLOW_ITEM_TYPE_ESP:
> > +		mask = &rte_flow_item_esp_mask;
> > +		break;
> >  	default:
> >  		break;
> >  	}
> > @@ -6327,6 +6354,10 @@ cmd_set_raw_parsed(const struct buffer *in)
> >  		case RTE_FLOW_ITEM_TYPE_GENEVE:
> >  			size = sizeof(struct rte_flow_item_geneve);
> >  			break;
> > +		case RTE_FLOW_ITEM_TYPE_ESP:
> > +			size = sizeof(struct rte_flow_item_esp);
> > +			proto = 0x32;
> > +			break;
> >  		default:
> >  			printf("Error - Not supported item\n");
> >  			*total_size = 0;
> > --
> > 2.7.4

Regards,

Bernard.
Ori Kam Jan. 9, 2020, 6:29 a.m. UTC | #3
Hi,


> -----Original Message-----
> From: Iremonger, Bernard <bernard.iremonger@intel.com>
> Sent: Wednesday, January 8, 2020 6:17 PM
> To: Ori Kam <orika@mellanox.com>; dev@dpdk.org; Xing, Beilei
> <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Doherty,
> Declan <declan.doherty@intel.com>
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow
> command line for ESP
> 
> Hi Ori,
> 
> Thanks for the review.
> 
> <snip>
> 
> > Subject: RE: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow
> > command line for ESP
> >
> > Hi just small comment inside.
> > Thanks,
> > Ori
> >
> > > -----Original Message-----
> > > From: dev <dev-bounces@dpdk.org> On Behalf Of Bernard Iremonger
> > > Sent: Tuesday, December 17, 2019 12:16 PM
> > > To: dev@dpdk.org; beilei.xing@intel.com; qi.z.zhang@intel.com;
> > > declan.doherty@intel.com
> > > Cc: konstantin.ananyev@intel.com; bernard.iremonger@intel.com
> > > Subject: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow
> command
> > > line for ESP
> > >
> > > add ITEM_ESP
> > > add ITEM_ESP_SPI
> > > add debug to cmdline_flow.c
> > >
> > > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > > ---
> > >  app/test-pmd/cmdline_flow.c | 37
> > > ++++++++++++++++++++++++++++++++++---
> > >  1 file changed, 34 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-
> pmd/cmdline_flow.c
> > > index 99dade7..f1b0610 100644
> > > --- a/app/test-pmd/cmdline_flow.c
> > > +++ b/app/test-pmd/cmdline_flow.c
> > > @@ -213,6 +213,8 @@ enum index {
> > >  	ITEM_TAG,
> > >  	ITEM_TAG_DATA,
> > >  	ITEM_TAG_INDEX,
> > > +	ITEM_ESP,
> > > +	ITEM_ESP_SPI,
> > >
> > >  	/* Validate/create actions. */
> > >  	ACTIONS,
> > > @@ -746,6 +748,7 @@ static const enum index next_item[] = {
> > >  	ITEM_PPPOE_PROTO_ID,
> > >  	ITEM_HIGIG2,
> > >  	ITEM_TAG,
> > > +	ITEM_ESP,
> > >  	END_SET,
> > >  	ZERO,
> > >  };
> > > @@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
> > >  	ZERO,
> > >  };
> > >
> > > +static const enum index item_esp[] = {
> > > +	ITEM_ESP_SPI,
> > > +	ITEM_NEXT,
> > > +	ZERO,
> > > +};
> > > +
> > >  static const enum index next_set_raw[] = {
> > >  	SET_RAW_INDEX,
> > >  	ITEM_ETH,
> > > @@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
> > >  			     NEXT_ENTRY(ITEM_PARAM_IS)),
> > >  		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag,
> > index)),
> > >  	},
> > > +	[ITEM_ESP] = {
> > > +		.name = "esp",
> > > +		.help = "match ESP header",
> > > +		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
> > > +		.next = NEXT(item_esp),
> > > +		.call = parse_vc,
> > > +	},
> > > +	[ITEM_ESP_SPI] = {
> > > +		.name = "spi",
> > > +		.help = "security policy index",
> > > +		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED),
> > > item_param),
> > > +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
> > > +				hdr.spi)),
> > > +	},
> > >  	/* Validate/create actions. */
> > >  	[ACTIONS] = {
> > >  		.name = "actions",
> > > @@ -6052,6 +6075,9 @@ cmd_flow_tok(cmdline_parse_token_hdr_t
> > **hdr,
> > > static void  cmd_flow_parsed(const struct buffer *in)  {
> > > +	printf("Flow command line parsed successfully for
> > > command=%d.\n",
> > > +			in->command);
> > > +
> >
> > Why adding this printf?
> 
> It is useful to know that the parsing of the flow command line is successful
> before going into the PMD code.
> I will remove in the v3 if you think it is too verbose.
> 

I think it is to verbose, due to the fact that in normal case the parsing will succeed,
Which means there will be a lot of print (In our testing we can have more then 200K commands). 
So I prefer to remove it, but if you think it is critical you can use the verbose_level with high value.
If you remove it feel free to add my ack on v3.

> >
> > >  	switch (in->command) {
> > >  	case VALIDATE:
> > >  		port_flow_validate(in->port, &in->args.vc.attr, @@ -6230,14
> > > +6256,15 @@ flow_item_default_mask(const struct rte_flow_item
> *item)
> > >  	case RTE_FLOW_ITEM_TYPE_GTP:
> > >  		mask = &rte_flow_item_gtp_mask;
> > >  		break;
> > > -	case RTE_FLOW_ITEM_TYPE_ESP:
> > > -		mask = &rte_flow_item_esp_mask;
> > > -		break;
> > >  	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
> > >  		mask = &rte_flow_item_gtp_psc_mask;
> > >  		break;
> > >  	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
> > >  		mask = &rte_flow_item_pppoe_proto_id_mask;
> > > +		break;
> > > +	case RTE_FLOW_ITEM_TYPE_ESP:
> > > +		mask = &rte_flow_item_esp_mask;
> > > +		break;
> > >  	default:
> > >  		break;
> > >  	}
> > > @@ -6327,6 +6354,10 @@ cmd_set_raw_parsed(const struct buffer *in)
> > >  		case RTE_FLOW_ITEM_TYPE_GENEVE:
> > >  			size = sizeof(struct rte_flow_item_geneve);
> > >  			break;
> > > +		case RTE_FLOW_ITEM_TYPE_ESP:
> > > +			size = sizeof(struct rte_flow_item_esp);
> > > +			proto = 0x32;
> > > +			break;
> > >  		default:
> > >  			printf("Error - Not supported item\n");
> > >  			*total_size = 0;
> > > --
> > > 2.7.4
> 
> Regards,
> 
> Bernard.
Iremonger, Bernard Jan. 9, 2020, 9:16 a.m. UTC | #4
Hi Ori,

<snip>

> > Subject: RE: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow
> > command line for ESP
> >
> > Hi Ori,
> >
> > Thanks for the review.
> >
> > <snip>
> >
> > > Subject: RE: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow
> > > command line for ESP
> > >
> > > Hi just small comment inside.
> > > Thanks,
> > > Ori
> > >
> > > > -----Original Message-----
> > > > From: dev <dev-bounces@dpdk.org> On Behalf Of Bernard Iremonger
> > > > Sent: Tuesday, December 17, 2019 12:16 PM
> > > > To: dev@dpdk.org; beilei.xing@intel.com; qi.z.zhang@intel.com;
> > > > declan.doherty@intel.com
> > > > Cc: konstantin.ananyev@intel.com; bernard.iremonger@intel.com
> > > > Subject: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow
> > command
> > > > line for ESP
> > > >
> > > > add ITEM_ESP
> > > > add ITEM_ESP_SPI
> > > > add debug to cmdline_flow.c
> > > >
> > > > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > > > ---
> > > >  app/test-pmd/cmdline_flow.c | 37
> > > > ++++++++++++++++++++++++++++++++++---
> > > >  1 file changed, 34 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-
> > pmd/cmdline_flow.c
> > > > index 99dade7..f1b0610 100644
> > > > --- a/app/test-pmd/cmdline_flow.c
> > > > +++ b/app/test-pmd/cmdline_flow.c
> > > > @@ -213,6 +213,8 @@ enum index {
> > > >  	ITEM_TAG,
> > > >  	ITEM_TAG_DATA,
> > > >  	ITEM_TAG_INDEX,
> > > > +	ITEM_ESP,
> > > > +	ITEM_ESP_SPI,
> > > >
> > > >  	/* Validate/create actions. */
> > > >  	ACTIONS,
> > > > @@ -746,6 +748,7 @@ static const enum index next_item[] = {
> > > >  	ITEM_PPPOE_PROTO_ID,
> > > >  	ITEM_HIGIG2,
> > > >  	ITEM_TAG,
> > > > +	ITEM_ESP,
> > > >  	END_SET,
> > > >  	ZERO,
> > > >  };
> > > > @@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
> > > >  	ZERO,
> > > >  };
> > > >
> > > > +static const enum index item_esp[] = {
> > > > +	ITEM_ESP_SPI,
> > > > +	ITEM_NEXT,
> > > > +	ZERO,
> > > > +};
> > > > +
> > > >  static const enum index next_set_raw[] = {
> > > >  	SET_RAW_INDEX,
> > > >  	ITEM_ETH,
> > > > @@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
> > > >  			     NEXT_ENTRY(ITEM_PARAM_IS)),
> > > >  		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag,
> > > index)),
> > > >  	},
> > > > +	[ITEM_ESP] = {
> > > > +		.name = "esp",
> > > > +		.help = "match ESP header",
> > > > +		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
> > > > +		.next = NEXT(item_esp),
> > > > +		.call = parse_vc,
> > > > +	},
> > > > +	[ITEM_ESP_SPI] = {
> > > > +		.name = "spi",
> > > > +		.help = "security policy index",
> > > > +		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED),
> > > > item_param),
> > > > +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
> > > > +				hdr.spi)),
> > > > +	},
> > > >  	/* Validate/create actions. */
> > > >  	[ACTIONS] = {
> > > >  		.name = "actions",
> > > > @@ -6052,6 +6075,9 @@ cmd_flow_tok(cmdline_parse_token_hdr_t
> > > **hdr,
> > > > static void  cmd_flow_parsed(const struct buffer *in)  {
> > > > +	printf("Flow command line parsed successfully for
> > > > command=%d.\n",
> > > > +			in->command);
> > > > +
> > >
> > > Why adding this printf?
> >
> > It is useful to know that the parsing of the flow command line is
> > successful before going into the PMD code.
> > I will remove in the v3 if you think it is too verbose.
> >
> 
> I think it is to verbose, due to the fact that in normal case the parsing will
> succeed, Which means there will be a lot of print (In our testing we can have
> more then 200K commands).
> So I prefer to remove it, but if you think it is critical you can use the
> verbose_level with high value.
> If you remove it feel free to add my ack on v3.

I will remove it and add your ack in v3.


> > >
> > > >  	switch (in->command) {
> > > >  	case VALIDATE:
> > > >  		port_flow_validate(in->port, &in->args.vc.attr, @@ -6230,14
> > > > +6256,15 @@ flow_item_default_mask(const struct rte_flow_item
> > *item)
> > > >  	case RTE_FLOW_ITEM_TYPE_GTP:
> > > >  		mask = &rte_flow_item_gtp_mask;
> > > >  		break;
> > > > -	case RTE_FLOW_ITEM_TYPE_ESP:
> > > > -		mask = &rte_flow_item_esp_mask;
> > > > -		break;
> > > >  	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
> > > >  		mask = &rte_flow_item_gtp_psc_mask;
> > > >  		break;
> > > >  	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
> > > >  		mask = &rte_flow_item_pppoe_proto_id_mask;
> > > > +		break;
> > > > +	case RTE_FLOW_ITEM_TYPE_ESP:
> > > > +		mask = &rte_flow_item_esp_mask;
> > > > +		break;
> > > >  	default:
> > > >  		break;
> > > >  	}
> > > > @@ -6327,6 +6354,10 @@ cmd_set_raw_parsed(const struct buffer
> *in)
> > > >  		case RTE_FLOW_ITEM_TYPE_GENEVE:
> > > >  			size = sizeof(struct rte_flow_item_geneve);
> > > >  			break;
> > > > +		case RTE_FLOW_ITEM_TYPE_ESP:
> > > > +			size = sizeof(struct rte_flow_item_esp);
> > > > +			proto = 0x32;
> > > > +			break;
> > > >  		default:
> > > >  			printf("Error - Not supported item\n");
> > > >  			*total_size = 0;
> > > > --
> > > > 2.7.4


Regards,

Bernard.

Patch
diff mbox series

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 99dade7..f1b0610 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -213,6 +213,8 @@  enum index {
 	ITEM_TAG,
 	ITEM_TAG_DATA,
 	ITEM_TAG_INDEX,
+	ITEM_ESP,
+	ITEM_ESP_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -746,6 +748,7 @@  static const enum index next_item[] = {
 	ITEM_PPPOE_PROTO_ID,
 	ITEM_HIGIG2,
 	ITEM_TAG,
+	ITEM_ESP,
 	END_SET,
 	ZERO,
 };
@@ -1017,6 +1020,12 @@  static const enum index item_higig2[] = {
 	ZERO,
 };
 
+static const enum index item_esp[] = {
+	ITEM_ESP_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2593,6 +2602,20 @@  static const struct token token_list[] = {
 			     NEXT_ENTRY(ITEM_PARAM_IS)),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag, index)),
 	},
+	[ITEM_ESP] = {
+		.name = "esp",
+		.help = "match ESP header",
+		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
+		.next = NEXT(item_esp),
+		.call = parse_vc,
+	},
+	[ITEM_ESP_SPI] = {
+		.name = "spi",
+		.help = "security policy index",
+		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
+				hdr.spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
@@ -6052,6 +6075,9 @@  cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,
 static void
 cmd_flow_parsed(const struct buffer *in)
 {
+	printf("Flow command line parsed successfully for command=%d.\n",
+			in->command);
+
 	switch (in->command) {
 	case VALIDATE:
 		port_flow_validate(in->port, &in->args.vc.attr,
@@ -6230,14 +6256,15 @@  flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_GTP:
 		mask = &rte_flow_item_gtp_mask;
 		break;
-	case RTE_FLOW_ITEM_TYPE_ESP:
-		mask = &rte_flow_item_esp_mask;
-		break;
 	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 		mask = &rte_flow_item_gtp_psc_mask;
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		mask = &rte_flow_item_esp_mask;
+		break;
 	default:
 		break;
 	}
@@ -6327,6 +6354,10 @@  cmd_set_raw_parsed(const struct buffer *in)
 		case RTE_FLOW_ITEM_TYPE_GENEVE:
 			size = sizeof(struct rte_flow_item_geneve);
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			size = sizeof(struct rte_flow_item_esp);
+			proto = 0x32;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;