[PATCH] app/testpmd: use table ID for jump to matcher action

Stephen Hemminger stephen at networkplumber.org
Thu Sep 25 21:37:59 CEST 2025


On Tue, 19 Aug 2025 17:45:05 +0300
Alexander Kozyrev <akozyrev at nvidia.com> wrote:

> 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 <akozyrev at nvidia.com>

The cmdline code doesn't guarantee that the space in the
context will be aligned. Therefore using memcpy like this
(untested) would be safer. Please review this as possiblity
and resubmit if needed.

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 5d9c8f04f2..04d3dbbdca 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -11221,7 +11221,7 @@ parse_jump_table_id(struct context *ctx, const struct token *token,
                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;
+       memcpy(&table_id, entry_ptr, sizeof(uint32_t));
        /* Look up the table using table ID */
        port = &ports[ctx->port];
        for (pt = port->table_list; pt != NULL; pt = pt->next) {
@@ -11233,7 +11233,7 @@ parse_jump_table_id(struct context *ctx, const struct token *token,
                return -1;
        }
        /* Replace the table ID with the table pointer */
-       *(struct rte_flow_template_table **)entry_ptr = pt->table;
+       memcpy(entry_ptr, &pt->table, sizeof(struct rte_flow_template_table *));
        return len;
 }
 


More information about the dev mailing list