[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <176362a7-5ad1-4639-9690-b6f375daf917@bytedance.com>
Date: Fri, 31 Oct 2025 12:54:55 -0700
From: Zijian Zhang <zijianzhang@...edance.com>
To: Jakub Kicinski <kuba@...nel.org>
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 10/31/25 11:40 AM, Jakub Kicinski wrote:
> 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?
Thanks for pointing this out, I will add a lock here.
Powered by blists - more mailing lists