Skip to contentSkip to conversation

app/testpmd: fix template action mask parsing

PATCH New Gregory Etelson 1 participant 1 message Feb 20, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix template action mask parsing

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")
---
 app/test-pmd/cmdline_flow.c | 8 ++++++++
 1 file changed, 8 insertions(+)
app/test-pmd/cmdline_flow.c +8 -0
index f1991a5a9a..134b316c18 100644
@@ -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));
Signature · 1 line
2.34.1