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

Stephen Hemminger stephen at networkplumber.org
Mon Sep 15 20:05:08 CEST 2025


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

> +/** 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;

This creates a possibly unaligned memory access. Is that OK?

Other code in cmdline_flow.c like parse_action is using memcpy
to avoid this.





More information about the stable mailing list