[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251031114058.29d635c5@kernel.org>
Date: Fri, 31 Oct 2025 11:40:58 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Zijian Zhang <zijianzhang@...edance.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, pabeni@...hat.com,
edumazet@...gle.com, andrew+netdev@...n.ch, saeedm@...dia.com,
gal@...dia.com, leonro@...dia.com, witu@...dia.com, parav@...dia.com,
tariqt@...dia.com
Subject: Re: [PATCH net-next] net/mlx5e: Modify mlx5e_xdp_xmit sq selection
On Thu, 30 Oct 2025 17:42:50 -0700 Zijian Zhang wrote:
> When performing XDP_REDIRECT from one mlnx device to another, using
> smp_processor_id() to select the queue may go out-of-range.
>
> Assume eth0 is redirecting a packet to eth1, eth1 is configured
> with only 8 channels, while eth0 has its RX queues pinned to
> higher-numbered CPUs (e.g. CPU 12). When a packet is received on
> such a CPU and redirected to eth1, the driver uses smp_processor_id()
> as the SQ index. Since the CPU ID is larger than the number of queues
> on eth1, the lookup (priv->channels.c[sq_num]) goes out of range and
> the redirect fails.
>
> This patch fixes the issue by mapping the CPU ID to a valid channel
> index using modulo arithmetic:
>
> sq_num = smp_processor_id() % priv->channels.num;
>
> With this change, XDP_REDIRECT works correctly even when the source
> device uses high CPU affinities and the target device has fewer TX
> queues.
And what if you have 8 queues and CPUs 0 and 8 try to Xmit at the same
time? Is there any locking here?
--
pw-bot: cr
Powered by blists - more mailing lists