Hi, The testpmd maintainers should also take a look.
> -----Original Message----- > From: Alexander Kozyrev <akozy...@nvidia.com> > Sent: Tuesday, August 19, 2025 10:45 PM > To: dev@dpdk.org > Cc: sta...@dpdk.org; Raslan Darawsheh <rasl...@nvidia.com>; Bing Zhao > <bi...@nvidia.com>; Ori Kam <or...@nvidia.com> > Subject: [PATCH] app/testpmd: use table ID for jump to matcher action > > Current implementation requires specifying the pointer to the table you > want to jump to in the jump to matcher action. It is inconvenient since > there is no table pointer shown anywhere in the table management. > Table creation/destruction uses the standard table ID for that purpose. > Use the table ID in the jump to matcher action as well. > > Signed-off-by: Alexander Kozyrev <akozy...@nvidia.com> > --- > app/test-pmd/cmdline_flow.c | 59 +++++++++++++++++++++++++++++++++++-- > 1 file changed, 57 insertions(+), 2 deletions(-) > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index 38e751f3f3..5d9c8f04f2 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -788,6 +788,7 @@ enum index { > ACTION_NAT64_MODE, > ACTION_JUMP_TO_TABLE_INDEX, > ACTION_JUMP_TO_TABLE_INDEX_TABLE, > + ACTION_JUMP_TO_TABLE_INDEX_TABLE_VALUE, > ACTION_JUMP_TO_TABLE_INDEX_INDEX, > }; > > @@ -2864,6 +2865,9 @@ static int parse_table(struct context *, const > struct token *, static int parse_table_destroy(struct context *, const > struct token *, > const char *, unsigned int, > void *, unsigned int); > +static int parse_jump_table_id(struct context *, const struct token *, > + const char *, unsigned int, > + void *, unsigned int); > static int parse_qo(struct context *, const struct token *, > const char *, unsigned int, > void *, unsigned int); > @@ -7634,11 +7638,19 @@ static const struct token token_list[] = { > }, > [ACTION_JUMP_TO_TABLE_INDEX_TABLE] = { > .name = "table", > - .help = "table to redirect traffic to", > - .next = NEXT(action_jump_to_table_index, > NEXT_ENTRY(COMMON_UNSIGNED)), > + .help = "table id to redirect traffic to", > + .next = NEXT(action_jump_to_table_index, > + NEXT_ENTRY(ACTION_JUMP_TO_TABLE_INDEX_TABLE_VALUE)), > .args = ARGS(ARGS_ENTRY(struct > rte_flow_action_jump_to_table_index, table)), > .call = parse_vc_conf, > }, > + [ACTION_JUMP_TO_TABLE_INDEX_TABLE_VALUE] = { > + .name = "{table_id}", > + .type = "TABLE_ID", > + .help = "table id for jump action", > + .call = parse_jump_table_id, > + .comp = comp_table_id, > + }, > [ACTION_JUMP_TO_TABLE_INDEX_INDEX] = { > .name = "index", > .help = "rule index to redirect traffic to", @@ -11182,6 > +11194,49 @@ parse_table_destroy(struct context *ctx, const struct token > *token, > return len; > } > > +/** Parse table id and convert to table pointer for jump_to_table_index > +action. */ static int parse_jump_table_id(struct context *ctx, const > +struct token *token, > + const char *str, unsigned int len, > + void *buf, unsigned int size) > +{ > + struct buffer *out = buf; > + struct rte_port *port; > + struct port_table *pt; > + uint32_t table_id; > + const struct arg *arg; > + void *entry_ptr; > + > + /* Get the arg before parse_int consumes it */ > + arg = pop_args(ctx); > + if (!arg) > + return -1; > + /* Push it back and do the standard integer parsing */ > + if (push_args(ctx, arg) < 0) > + return -1; > + if (parse_int(ctx, token, str, len, buf, size) < 0) > + return -1; > + /* Nothing else to do if there is no buffer */ > + if (!out || !ctx->object) > + return len; > + /* Get the parsed table ID from where parse_int stored it */ > + entry_ptr = (uint8_t *)ctx->object + arg->offset; > + table_id = *(uint32_t *)entry_ptr; > + /* Look up the table using table ID */ > + port = &ports[ctx->port]; > + for (pt = port->table_list; pt != NULL; pt = pt->next) { > + if (pt->id == table_id) > + break; > + } > + if (!pt || !pt->table) { > + printf("Table #%u not found on port %u\n", table_id, ctx- > >port); > + return -1; > + } > + /* Replace the table ID with the table pointer */ > + *(struct rte_flow_template_table **)entry_ptr = pt->table; > + return len; > +} > + > /** Parse tokens for queue create commands. */ static int > parse_qo(struct context *ctx, const struct token *token, > -- > 2.43.0 Reviewed-by: Bing Zhao <bi...@nvidia.com>