All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Alexander Kozyrev <akozyrev@nvidia.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>, <rasland@nvidia.com>,
	<bingz@nvidia.com>, <orika@nvidia.com>
Subject: Re: [PATCH] app/testpmd: use table ID for jump to matcher action
Date: Mon, 15 Sep 2025 11:05:08 -0700	[thread overview]
Message-ID: <20250915110508.7a1413bd@hermes.local> (raw)
In-Reply-To: <20250819144508.722653-1-akozyrev@nvidia.com>

On Tue, 19 Aug 2025 17:45:05 +0300
Alexander Kozyrev <akozyrev@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.




  parent reply	other threads:[~2025-09-15 18:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-19 14:45 [PATCH] app/testpmd: use table ID for jump to matcher action Alexander Kozyrev
2025-08-19 14:50 ` Bing Zhao
2025-09-15 18:05 ` Stephen Hemminger [this message]
2025-09-25 19:37 ` Stephen Hemminger
2025-09-26 12:30 ` [PATCH v2] " Alexander Kozyrev
2025-10-18 16:18   ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250915110508.7a1413bd@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=akozyrev@nvidia.com \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.