mlx5 AF_XDP busy polling

Federico Parola <[email protected]> Fri, 23 Dec 2022 15:16:32 +0100
Newsgroups org.kernel.vger.xdp-newbies
Message-ID <[email protected]>
Hello everyone,
I'm not able to make AF_XDP busy polling work correctly on a ConnectX-4 
NIC. Whenever I run the xdpsock application in busy polling mode (-B 
flag), in either l2fwd or rx-drop mode, the NIC keeps generating 
interrupts and processing rate is very low. I'm on kernel 5.13.
Is this a known problem?

By looking at the code I might have a possible explanation for this 
behavior:
- To perform a busy loop on the socket, a valid napi id must be stored 
in the sk_napi_id field of the socket structure 
(https://elixir.bootlin.com/linux/latest/source/include/net/busy_poll.h#L109)
- The sk_napi_id field of the socket is populated when the first packet 
is redirected to the socket, and the value is taken from the rxq 
associated to the packet xdp_buff 
(https://elixir.bootlin.com/linux/latest/source/include/net/busy_poll.h#L173)
- mlx5 appears to always assign the napi_id 0 to xsk queues, that is not 
a valid napi_id 
(https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c#L74)

Does this make sense?

Thank you,
Federico