[PATCH] app/testpmd: fix template action mask parsing

Gregory Etelson getelson at nvidia.com
Mon Feb 20 20:18:24 CET 2023


In the flow template API, non-masked action must set its configuration
to NULL.

If flow action defined a configuration structure, then
testpmd *always* provided the action with configuration buffer.
Testpmd also implicitly assigned 0 to all action configuration
members that were not mentioned in a flow rule.
As the result, testpmd configured non-masked flow action as masked
with all parameters set to 0.

The patch fixes testpmd parsing. If flow action token is followed
by the actions separator character `/` in template masks section,
testpmd will not assign action configuration buffer.

Fixes: ecdc927b99f2 ("app/testpmd: add async flow create/destroy operations")

Cc: stable at dpdk.org

Signed-off-by: Gregory Etelson <getelson at nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index f1991a5a9a..134b316c18 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -7490,6 +7490,14 @@ parse_vc(struct context *ctx, const struct token *token,
 			out->args.vc.actions + out->args.vc.actions_n;
 
 		data_size = priv->size; /* configuration */
+		if (out->args.vc.masks) {
+			while (!isspace(*str))
+				str++; /* skip current token */
+			while (isspace(*str))
+				str++; /* skip blanks */
+			if (str[0] == '/')
+				data_size = 0;
+		}
 		data = (void *)RTE_ALIGN_FLOOR((uintptr_t)
 					       (out->args.vc.data - data_size),
 					       sizeof(double));
-- 
2.34.1



More information about the dev mailing list