[PATCH net-next 0/2] tun: AF_XDP Rx zero-copy support

From: Yunjian Wang
Date: Wed Jan 24 2024 - 04:37:47 EST


Now, some drivers support the zero-copy feature of AF_XDP sockets,
which can significantly reduce CPU utilization for XDP programs.

This patch set enables tun to also support the AF_XDP Rx zero-copy
feature, with the following changes:
1. The unnecessary 'dma_page' check has been removed when binding
the AF_XDP socket to the device, as it is not needed for the vNIC.
2. A check has been added when consuming the buffer in
vhost_net_buf_produce(), as the vq's rx_array may be empty after
AF_XDP Rx zero-copy is enabled.
3. The peek_len function is now used to consume a xsk->desc and
retrieve its length.
4. AF_XDP Rx zero-copy support has been added for tun.

This patchset is based on Linux 6.4.0+(openEuler 23.09) and has
successfully passed Netperf and Netserver stress testing with
multiple streams between VM A and VM B, using AF_XDP and OVS.

With this patch applied, the system CPU usage for OVS' PMD has
decreased from 59.8% to 8.8% while forwarding 700000pps.

Yunjian Wang (2):
xsk: Remove non-zero 'dma_page' check in xp_assign_dev
tun: AF_XDP Rx zero-copy support

drivers/net/tun.c | 165 +++++++++++++++++++++++++++++++++++++++-
drivers/vhost/net.c | 18 +++--
net/xdp/xsk_buff_pool.c | 7 --
3 files changed, 176 insertions(+), 14 deletions(-)

--
2.33.0