]> git.droids-corp.org - dpdk.git/commitdiff
app/testpmd: fix flow rule creation parsing
authorAlexander Kozyrev <akozyrev@nvidia.com>
Tue, 1 Mar 2022 22:47:39 +0000 (00:47 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 3 Mar 2022 13:30:21 +0000 (14:30 +0100)
A pattern template creation shares the parsing mechanism with
a simple flow creation. The pattern template creation only consists
of pattern items while the flow creation continues with actions.
The parsing mechanism now accommodates both cases and allows to stop
at the item end token, which should not happen for the flow creation.
Fix parsing mechanism to differentiate between these two cases.

Bugzilla ID: 941
Fixes: 04cc665fab38 ("app/testpmd: add flow template management")
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Tested-by: Zhimin Huang <zhiminx.huang@intel.com>
app/test-pmd/cmdline_flow.c

index 4f7a9f17f9083c1e6beca87cb4d22c2820aabb36..fc4a6d9cca4f6d5d1d7014d66b84ff49d4ec96af 100644 (file)
@@ -6864,6 +6864,14 @@ parse_vc(struct context *ctx, const struct token *token,
                ctx->object = out->args.vc.pattern;
                ctx->objmask = NULL;
                return len;
+       case ITEM_END:
+               if ((out->command == VALIDATE || out->command == CREATE) &&
+                   ctx->last)
+                       return -1;
+               if (out->command == PATTERN_TEMPLATE_CREATE &&
+                   !ctx->last)
+                       return -1;
+               break;
        case ACTIONS:
                out->args.vc.actions =
                        (void *)RTE_ALIGN_CEIL((uintptr_t)