app/testpmd: add item any to flow command
authorAdrien Mazarguil <adrien.mazarguil@6wind.com>
Wed, 21 Dec 2016 14:51:33 +0000 (15:51 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 23 Dec 2016 09:26:02 +0000 (10:26 +0100)
This pattern item matches any protocol in place of the current layer and
has two properties:

- min: minimum number of layers covered (0 or more).
- max: maximum number of layers covered (0 means infinity).

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
app/test-pmd/cmdline_flow.c

index fc4d824..7504fc7 100644 (file)
@@ -99,6 +99,8 @@ enum index {
        ITEM_END,
        ITEM_VOID,
        ITEM_INVERT,
+       ITEM_ANY,
+       ITEM_ANY_NUM,
 
        /* Validate/create actions. */
        ACTIONS,
@@ -282,7 +284,6 @@ static const enum index next_list_attr[] = {
        ZERO,
 };
 
-__rte_unused
 static const enum index item_param[] = {
        ITEM_PARAM_IS,
        ITEM_PARAM_SPEC,
@@ -296,6 +297,13 @@ static const enum index next_item[] = {
        ITEM_END,
        ITEM_VOID,
        ITEM_INVERT,
+       ITEM_ANY,
+       ZERO,
+};
+
+static const enum index item_any[] = {
+       ITEM_ANY_NUM,
+       ITEM_NEXT,
        ZERO,
 };
 
@@ -580,6 +588,19 @@ static const struct token token_list[] = {
                .next = NEXT(NEXT_ENTRY(ITEM_NEXT)),
                .call = parse_vc,
        },
+       [ITEM_ANY] = {
+               .name = "any",
+               .help = "match any protocol for the current layer",
+               .priv = PRIV_ITEM(ANY, sizeof(struct rte_flow_item_any)),
+               .next = NEXT(item_any),
+               .call = parse_vc,
+       },
+       [ITEM_ANY_NUM] = {
+               .name = "num",
+               .help = "number of layers covered",
+               .next = NEXT(item_any, NEXT_ENTRY(UNSIGNED), item_param),
+               .args = ARGS(ARGS_ENTRY(struct rte_flow_item_any, num)),
+       },
        /* Validate/create actions. */
        [ACTIONS] = {
                .name = "actions",