app/testpmd: extend ICMP flow matching fields
authorLi Zhang <lizh@nvidia.com>
Wed, 9 Sep 2020 03:34:34 +0000 (06:34 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 30 Sep 2020 17:19:15 +0000 (19:19 +0200)
Ability to distinguish ICMP identifier fields in packets.
Distinguish 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>
app/test-pmd/cmdline_flow.c

index 6263d30..6e04d53 100644 (file)
@@ -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",