Re: Is It Possible to RX/Process/TX packets concurrently with AF_XDP?

Vincent Li <[email protected]> Wed, 14 Dec 2022 12:40:28 -0800
Newsgroups org.kernel.vger.xdp-newbies
Message-ID <CAK3+h2yda5-wN+-Dzj+QwcyaR__OeFaVenOhXWZ2+SJb4SbMKw@mail.gmail.com>
On Wed, Dec 7, 2022 at 2:54 PM Zhaoxi Zhu <[email protected]> wrote:
>
> Hi All,
>
> Thank you very much for reading this email. My name is Rio.
>
> I recently started looking into the XDP technology, especially AF_XDP, and I really love it. I started studying and modifying this AF_XDP example(https://github.com/xdp-project/xdp-tutorial/blob/master/advanced03-AF_XDP/af_xdp_user.c) to meet my need, and it has been working fine.
>
> However, one thing I notice is that this user space application is single threaded. I wonder if it is feasible to multi-threading to the RX/packet processing/TX parts of the program, in order to utilize other cores and possibly make my application faster?
>
>
> One challenge I face now is, as I tried different places to add multi-threading, the program does not work properly. Symptoms such as `assert(xsk->umem_frame_free < NUM_FRAMES);` failed; ICMP ping packets doesn’t arrive destination until seconds later and TCP connection generated by `iperf` cannot be established occurs as I tried different places to add multi-threading to my code.
>
> So, my question is, does AF_XDP applications support multi-threading during RX/packet processing/TX? If so, what is a proper way to modify the AF_XDP example code to let it run properly?
>

I used to use mTCP with DPDK https://github.com/mtcp-stack/mtcp, then
I thought why not mTCP on top of AF_XDP and I found this
https://github.com/mcabranches/mtcp, it is multi-thread and a learning
example, maybe we can exchange notes since I am learning AF_XDP too :)

> Thank you again for reading this email. I look forward to hearing from you.
>
> Best,
> Rio Zhu
>
>