|SUCCESS| [v1,1/1] app/testpmd: allow appending to flow dump file
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Thu Apr 30 18:56:16 CEST 2026
Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/163471
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-04-30
Review of DPDK patch: app/testpmd: allow appending to flow dump file
git sha: 711f81af5087b82e7ebc27e6ef69e9c497ad8c63
Author: Anatoly Burakov <anatoly.burakov at intel.com>
Subject: [PATCH v1 1/1] app/testpmd: allow appending to flow dump file
This patch adds an append mode option to the flow dump command in
testpmd, allowing users to append flow information to an existing file
rather than overwriting it.
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index ebc036b14b..67f200f2e3 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
[ ... ]
> @@ -1263,8 +1266,9 @@ struct buffer {
> } destroy; /**< Destroy arguments. */
> struct {
> char file[128];
> - bool mode;
> + bool dump_all;
> uint64_t rule;
> + bool append_to_file;
> bool is_user_id;
> } dump; /**< Dump arguments. */
> struct {
[ ... ]
> @@ -4296,6 +4299,27 @@ static const struct token token_list[] = {
> .next = NEXT(next_dump_subcmd),
> .call = parse_dump,
> },
> + [DUMP_FILE_PATH] = {
> + .name = "{file path}",
> + .type = "STRING",
> + .help = "file path",
> + .next = NEXT(NEXT_ENTRY(DUMP_WRITE, DUMP_APPEND, END)),
> + .args = ARGS(ARGS_ENTRY(struct buffer, args.dump.file)),
> + .call = parse_string0,
> + .comp = comp_none,
> + },
> + [DUMP_WRITE] = {
> + .name = "write",
> + .help = "open file in write mode (default)",
> + .next = NEXT(NEXT_ENTRY(END)),
> + .call = parse_dump,
> + },
> + [DUMP_APPEND] = {
> + .name = "append",
> + .help = "open file in append mode",
> + .next = NEXT(NEXT_ENTRY(END)),
> + .call = parse_dump,
> + },
The command syntax appears to allow both "write" and "append" keywords
to be specified simultaneously due to the NEXT_ENTRY() in DUMP_FILE_PATH
accepting both options. Can the last keyword specified override the
previous one, or does this create ambiguity in the command parsing?
> @@ -10733,7 +10757,9 @@ parse_dump(struct context *ctx, const struct token *token,
> switch (ctx->curr) {
> case DUMP_ALL:
> case DUMP_ONE:
> - out->args.dump.mode = (ctx->curr == DUMP_ALL) ? true : false;
> + out->args.dump.dump_all = (ctx->curr == DUMP_ALL) ? true : false;
> + /* don't append to file by default */
> + out->args.dump.append_to_file = false;
Does setting append_to_file to false here get overridden if the user
subsequently specifies "append" in the command? The initialization in
DUMP_ALL/DUMP_ONE occurs before processing DUMP_APPEND, correct?
> @@ -10742,6 +10768,12 @@ parse_dump(struct context *ctx, const struct token *token,
> case DUMP_IS_USER_ID:
> out->args.dump.is_user_id = true;
> return len;
> + case DUMP_WRITE:
> + out->args.dump.append_to_file = false;
> + return len;
> + case DUMP_APPEND:
> + out->args.dump.append_to_file = true;
> + return len;
[ ... ]
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 32c885de0b..c950793aaf 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -4162,7 +4162,7 @@ port_flow_flush(portid_t port_id)
> /** Dump flow rules. */
> int
> port_flow_dump(portid_t port_id, bool dump_all, uint64_t rule_id,
> - const char *file_name, bool is_user_id)
> + const char *file_name, bool is_user_id, bool append_to_file)
[ ... ]
> @@ -4198,7 +4198,7 @@ port_flow_dump(portid_t port_id, bool dump_all, uint64_t rule_id,
> }
>
> if (file_name && strlen(file_name)) {
> - file = fopen(file_name, "w");
> + file = fopen(file_name, append_to_file ? "a" : "w");
> if (!file) {
> fprintf(stderr, "Failed to create file %s: %s\n",
> file_name, strerror(errno));
[ ... ]
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index 9b60ebd7fc..1a54535470 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -1085,7 +1085,7 @@ int port_flow_update(portid_t port_id, uint32_t rule,
> int port_flow_flush(portid_t port_id);
> int port_flow_dump(portid_t port_id, bool dump_all,
> uint64_t rule, const char *file_name,
> - bool is_user_id);
> + bool is_user_id, bool file_mode);
The parameter is named file_mode in the function declaration but
append_to_file in the function definition. Does this inconsistency cause
compilation issues or confusion?
More information about the test-report
mailing list