app/testpmd: fix template action mask parsing

Message ID 20230220191824.2393-1-getelson@nvidia.com (mailing list archive)
State Rejected, archived
Headers
Series app/testpmd: fix template action mask parsing |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Gregory Etelson Feb. 20, 2023, 7:18 p.m. UTC
  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@dpdk.org

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

Patch

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));