Re: XDP-REDIRECT cpu affinity

Zvi Effron <[email protected]> Thu, 4 May 2023 12:28:54 -0700
Newsgroups org.kernel.vger.xdp-newbies
Message-ID <CAC1LvL33F_U6Ktm3nvF=D3KpF487uO=CtotL6xM-3G_8Skr7oQ@mail.gmail.com>
On Thu, May 4, 2023 at 11:28 AM Sanjay Rao <[email protected]> wrote:
>
> I am looking at the implementation of ndo_xdp_xmit() in
> mlx5/core/en/xdp.c (most other drivers also have similar
> implementations). This function is called for XDP-REDIRECT.
>
> int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame
> **frames, u32 flags)
> {
> ------
> ------
>
> sq_num = smp_processor_id();
> if (unlikely(sq_num >= priv->channels.num))
> return -ENXIO;
>
> --------
> }
>
>
> Doesn't this restrict all ports to be bound to the same CPUs via
> smp_affinity? In my setup, one port has CPUs 1-63 and the other has
> 65-127 for a 63 queue configuration. XDP_REDIRECT will fail because
> 65-127 will exceed the channel count. Is that by design, or am I
> missing something? We can find a similar implementation for the i40e
> driver as well.

We had previously brought this up for the i40e driver[0]. My take on the
resulting conversation is that this behavior being a bug, but there is no clear
idea of how to solve it without introducing locks, which would be an
unacceptable performance hit.

>
> Regards,
> Sanjay

--Zvi

[0]: https://lore.kernel.org/xdp-newbies/CAC1LvL1NHj6n+RNYRmja2YDhkcCwREuhjaBz_k255rU1jdO8Sw@mail.gmail.com/