[RFC,v2,1/1] app/testpmd: distinguish ICMP identifier fields in packet

Message ID 20200909033434.31059-1-lizh@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [RFC,v2,1/1] app/testpmd: distinguish ICMP identifier fields in packet |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Li Zhang Sept. 9, 2020, 3:34 a.m. UTC
  From: lizh <lizh@nvidia.com>

Ability to distinguish ICMP identifier fields in packets.
Dstinguish ICMP sequence number field too.
Already supports ICMP code and type fields in current version.
Existing fields in ICMP header contain the required information.
ICMP header already is supported and no code change in RTE FLOW.
Extend testpmd CLI to include the fields of ident and sequence number.
One example:
flow create 0 ingress pattern eth / ipv4 /
 icmp code is 1 ident is 5 seq is 6 /
 end actions count / queue index 0 / end
The ICMP packet with code 1, identifier 5 and
sequence number 6 will be matched.
It will implement action counter and forward to queue 0.

Signed-off-by: Li Zhang <lizh@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
  

Comments

Ferruh Yigit Sept. 22, 2020, 3:38 p.m. UTC | #1
On 9/9/2020 4:34 AM, Li Zhang wrote:
> From: lizh <lizh@nvidia.com>
> 
> Ability to distinguish ICMP identifier fields in packets.
> Dstinguish ICMP sequence number field too.
> Already supports ICMP code and type fields in current version.
> Existing fields in ICMP header contain the required information.
> ICMP header already is supported and no code change in RTE FLOW.
> Extend testpmd CLI to include the fields of ident and sequence number.
> One example:
> flow create 0 ingress pattern eth / ipv4 /
>   icmp code is 1 ident is 5 seq is 6 /
>   end actions count / queue index 0 / end
> The ICMP packet with code 1, identifier 5 and
> sequence number 6 will be matched.
> It will implement action counter and forward to queue 0.
> 

Overall looks good. @Ori, any objection?

@Li, is there any PMD implementation planned to use these icmp fields?

> Signed-off-by: Li Zhang <lizh@nvidia.com>
> ---
>   app/test-pmd/cmdline_flow.c | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 6263d307ed..6e04d538ea 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -143,6 +143,8 @@ enum index {
>   	ITEM_ICMP,
>   	ITEM_ICMP_TYPE,
>   	ITEM_ICMP_CODE,
> +	ITEM_ICMP_IDENT,
> +	ITEM_ICMP_SEQ,
>   	ITEM_UDP,
>   	ITEM_UDP_SRC,
>   	ITEM_UDP_DST,
> @@ -893,6 +895,8 @@ static const enum index item_ipv6[] = {
>   static const enum index item_icmp[] = {
>   	ITEM_ICMP_TYPE,
>   	ITEM_ICMP_CODE,
> +	ITEM_ICMP_IDENT,
> +	ITEM_ICMP_SEQ,
>   	ITEM_NEXT,
>   	ZERO,
>   };
> @@ -2193,6 +2197,20 @@ static const struct token token_list[] = {
>   		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp,
>   					     hdr.icmp_code)),
>   	},
> +	[ITEM_ICMP_IDENT] = {
> +		.name = "ident",
> +		.help = "ICMP packet identifier",
> +		.next = NEXT(item_icmp, NEXT_ENTRY(UNSIGNED), item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp,
> +					     hdr.icmp_ident)),
> +	},
> +	[ITEM_ICMP_SEQ] = {
> +		.name = "seq",
> +		.help = "ICMP packet sequence number",
> +		.next = NEXT(item_icmp, NEXT_ENTRY(UNSIGNED), item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp,
> +					     hdr.icmp_seq_nb)),
> +	},
>   	[ITEM_UDP] = {
>   		.name = "udp",
>   		.help = "match UDP header",
>
  
Li Zhang Sept. 23, 2020, 2:39 a.m. UTC | #2
Yes, There is PMD code change to support it.
https://patchwork.dpdk.org/patch/78488/

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Ferruh Yigit
Sent: Tuesday, September 22, 2020 11:38 PM
To: Li Zhang <lizh@nvidia.com>; Dekel Peled <dekelp@nvidia.com>; Ori Kam <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>
Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>; Raslan Darawsheh <rasland@nvidia.com>
Subject: Re: [dpdk-dev] [RFC v2 1/1] app/testpmd: distinguish ICMP identifier fields in packet

External email: Use caution opening links or attachments


On 9/9/2020 4:34 AM, Li Zhang wrote:
> From: lizh <lizh@nvidia.com>
>
> Ability to distinguish ICMP identifier fields in packets.
> Dstinguish ICMP sequence number field too.
> Already supports ICMP code and type fields in current version.
> Existing fields in ICMP header contain the required information.
> ICMP header already is supported and no code change in RTE FLOW.
> Extend testpmd CLI to include the fields of ident and sequence number.
> One example:
> flow create 0 ingress pattern eth / ipv4 /
>   icmp code is 1 ident is 5 seq is 6 /
>   end actions count / queue index 0 / end The ICMP packet with code 1, 
> identifier 5 and sequence number 6 will be matched.
> It will implement action counter and forward to queue 0.
>

Overall looks good. @Ori, any objection?

@Li, is there any PMD implementation planned to use these icmp fields?

> Signed-off-by: Li Zhang <lizh@nvidia.com>
> ---
>   app/test-pmd/cmdline_flow.c | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
>
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 6263d307ed..6e04d538ea 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -143,6 +143,8 @@ enum index {
>       ITEM_ICMP,
>       ITEM_ICMP_TYPE,
>       ITEM_ICMP_CODE,
> +     ITEM_ICMP_IDENT,
> +     ITEM_ICMP_SEQ,
>       ITEM_UDP,
>       ITEM_UDP_SRC,
>       ITEM_UDP_DST,
> @@ -893,6 +895,8 @@ static const enum index item_ipv6[] = {
>   static const enum index item_icmp[] = {
>       ITEM_ICMP_TYPE,
>       ITEM_ICMP_CODE,
> +     ITEM_ICMP_IDENT,
> +     ITEM_ICMP_SEQ,
>       ITEM_NEXT,
>       ZERO,
>   };
> @@ -2193,6 +2197,20 @@ static const struct token token_list[] = {
>               .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp,
>                                            hdr.icmp_code)),
>       },
> +     [ITEM_ICMP_IDENT] = {
> +             .name = "ident",
> +             .help = "ICMP packet identifier",
> +             .next = NEXT(item_icmp, NEXT_ENTRY(UNSIGNED), item_param),
> +             .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp,
> +                                          hdr.icmp_ident)),
> +     },
> +     [ITEM_ICMP_SEQ] = {
> +             .name = "seq",
> +             .help = "ICMP packet sequence number",
> +             .next = NEXT(item_icmp, NEXT_ENTRY(UNSIGNED), item_param),
> +             .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp,
> +                                          hdr.icmp_seq_nb)),
> +     },
>       [ITEM_UDP] = {
>               .name = "udp",
>               .help = "match UDP header",
>
  
Ferruh Yigit Sept. 23, 2020, 9:04 a.m. UTC | #3
On 9/9/2020 4:34 AM, Li Zhang wrote:
> From: lizh <lizh@nvidia.com>
> 
> Ability to distinguish ICMP identifier fields in packets.
> Dstinguish ICMP sequence number field too.
> Already supports ICMP code and type fields in current version.
> Existing fields in ICMP header contain the required information.
> ICMP header already is supported and no code change in RTE FLOW.
> Extend testpmd CLI to include the fields of ident and sequence number.
> One example:
> flow create 0 ingress pattern eth / ipv4 /
>   icmp code is 1 ident is 5 seq is 6 /
>   end actions count / queue index 0 / end
> The ICMP packet with code 1, identifier 5 and
> sequence number 6 will be matched.
> It will implement action counter and forward to queue 0.
> 
> Signed-off-by: Li Zhang <lizh@nvidia.com> >

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  
Ferruh Yigit Sept. 30, 2020, 3:30 p.m. UTC | #4
On 9/23/2020 10:04 AM, Ferruh Yigit wrote:
> On 9/9/2020 4:34 AM, Li Zhang wrote:
>> From: lizh <lizh@nvidia.com>
>>
>> Ability to distinguish ICMP identifier fields in packets.
>> Dstinguish ICMP sequence number field too.
>> Already supports ICMP code and type fields in current version.
>> Existing fields in ICMP header contain the required information.
>> ICMP header already is supported and no code change in RTE FLOW.
>> Extend testpmd CLI to include the fields of ident and sequence number.
>> One example:
>> flow create 0 ingress pattern eth / ipv4 /
>>   icmp code is 1 ident is 5 seq is 6 /
>>   end actions count / queue index 0 / end
>> The ICMP packet with code 1, identifier 5 and
>> sequence number 6 will be matched.
>> It will implement action counter and forward to queue 0.
>>
>> Signed-off-by: Li Zhang <lizh@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 6263d307ed..6e04d538ea 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -143,6 +143,8 @@  enum index {
 	ITEM_ICMP,
 	ITEM_ICMP_TYPE,
 	ITEM_ICMP_CODE,
+	ITEM_ICMP_IDENT,
+	ITEM_ICMP_SEQ,
 	ITEM_UDP,
 	ITEM_UDP_SRC,
 	ITEM_UDP_DST,
@@ -893,6 +895,8 @@  static const enum index item_ipv6[] = {
 static const enum index item_icmp[] = {
 	ITEM_ICMP_TYPE,
 	ITEM_ICMP_CODE,
+	ITEM_ICMP_IDENT,
+	ITEM_ICMP_SEQ,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -2193,6 +2197,20 @@  static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp,
 					     hdr.icmp_code)),
 	},
+	[ITEM_ICMP_IDENT] = {
+		.name = "ident",
+		.help = "ICMP packet identifier",
+		.next = NEXT(item_icmp, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp,
+					     hdr.icmp_ident)),
+	},
+	[ITEM_ICMP_SEQ] = {
+		.name = "seq",
+		.help = "ICMP packet sequence number",
+		.next = NEXT(item_icmp, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_icmp,
+					     hdr.icmp_seq_nb)),
+	},
 	[ITEM_UDP] = {
 		.name = "udp",
 		.help = "match UDP header",