app/flow-perf: support ICMP matching
authorWisam Jaddo <wisamm@mellanox.com>
Sun, 30 Aug 2020 11:15:43 +0000 (11:15 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 18 Sep 2020 16:55:11 +0000 (18:55 +0200)
Start support matching on icmpv4 and icmpv6.

Usage:
--icmpv4: add icmp item to match on.
--icmpv6: add icmpv6 item to match on.

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
app/test-flow-perf/items_gen.c
app/test-flow-perf/main.c
doc/guides/rel_notes/release_20_11.rst
doc/guides/tools/flow-perf.rst

index 8277ac7..2b1ab41 100644 (file)
@@ -310,6 +310,38 @@ add_meta_tag(struct rte_flow_item *items,
        items[items_counter].mask = &tag_mask;
 }
 
+static void
+add_icmpv4(struct rte_flow_item *items,
+       uint8_t items_counter,
+       __rte_unused struct additional_para para)
+{
+       static struct rte_flow_item_icmp icmpv4_spec;
+       static struct rte_flow_item_icmp icmpv4_mask;
+
+       memset(&icmpv4_spec, 0, sizeof(struct rte_flow_item_icmp));
+       memset(&icmpv4_mask, 0, sizeof(struct rte_flow_item_icmp));
+
+       items[items_counter].type = RTE_FLOW_ITEM_TYPE_ICMP;
+       items[items_counter].spec = &icmpv4_spec;
+       items[items_counter].mask = &icmpv4_mask;
+}
+
+static void
+add_icmpv6(struct rte_flow_item *items,
+       uint8_t items_counter,
+       __rte_unused struct additional_para para)
+{
+       static struct rte_flow_item_icmp6 icmpv6_spec;
+       static struct rte_flow_item_icmp6 icmpv6_mask;
+
+       memset(&icmpv6_spec, 0, sizeof(struct rte_flow_item_icmp6));
+       memset(&icmpv6_mask, 0, sizeof(struct rte_flow_item_icmp6));
+
+       items[items_counter].type = RTE_FLOW_ITEM_TYPE_ICMP6;
+       items[items_counter].spec = &icmpv6_spec;
+       items[items_counter].mask = &icmpv6_mask;
+}
+
 void
 fill_items(struct rte_flow_item *items,
        uint64_t *flow_items, uint32_t outer_ip_src)
@@ -381,7 +413,14 @@ fill_items(struct rte_flow_item *items,
                        .mask = RTE_FLOW_ITEM_TYPE_GTP,
                        .funct = add_gtp,
                },
-
+               {
+                       .mask = RTE_FLOW_ITEM_TYPE_ICMP,
+                       .funct = add_icmpv4,
+               },
+               {
+                       .mask = RTE_FLOW_ITEM_TYPE_ICMP6,
+                       .funct = add_icmpv6,
+               },
        };
 
        for (j = 0; j < MAX_ITEMS_NUM; j++) {
index 18199c6..c420da6 100644 (file)
@@ -130,6 +130,8 @@ usage(char *progname)
        printf("  --gtp: add gtp layer in flow items\n");
        printf("  --meta: add meta layer in flow items\n");
        printf("  --tag: add tag layer in flow items\n");
+       printf("  --icmpv4: add icmpv4 layer in flow items\n");
+       printf("  --icmpv6: add icmpv6 layer in flow items\n");
 
        printf("To set flow actions:\n");
        printf("  --port-id: add port-id action in flow actions\n");
@@ -284,6 +286,18 @@ args_parse(int argc, char **argv)
                        .map = &flow_items[0],
                        .map_idx = &items_idx
                },
+               {
+                       .str = "icmpv4",
+                       .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ICMP),
+                       .map = &flow_items[0],
+                       .map_idx = &items_idx
+               },
+               {
+                       .str = "icmpv6",
+                       .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ICMP6),
+                       .map = &flow_items[0],
+                       .map_idx = &items_idx
+               },
                {
                        .str = "ingress",
                        .mask = INGRESS,
@@ -538,6 +552,8 @@ args_parse(int argc, char **argv)
                { "gtp",                        0, 0, 0 },
                { "meta",                       0, 0, 0 },
                { "tag",                        0, 0, 0 },
+               { "icmpv4",                     0, 0, 0 },
+               { "icmpv6",                     0, 0, 0 },
                /* Actions */
                { "port-id",                    0, 0, 0 },
                { "rss",                        0, 0, 0 },
index 2a7c077..15cfefb 100644 (file)
@@ -66,6 +66,7 @@ New Features
   * Added flag action.
   * Added raw encap/decap actions.
   * Added VXLAN encap/decap actions.
+  * Added ICMP and ICMP6 matching items.
   * Added option to set port mask for insertion/deletion:
     ``--portmask=N``
     where N represents the hexadecimal bitmask of ports used.
index bbefc97..7e5dc0c 100644 (file)
@@ -175,6 +175,12 @@ Items:
        under ``TAG_INDEX`` with full mask, default value = 0.
        Other fields are open mask.
 
+*      ``--icmpv4``
+       Add icmpv4 item to all flows items, This item have open mask.
+
+*      ``--icmpv6``
+       Add icmpv6 item to all flows items, This item have open mask.
+
 
 Actions: