Skip to content

virtio-net: support xdp socket zero copy

Xuan Zhuo bpf netdev oe-kbuild-all virtualization 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest15 patches 26 repliesIn review
  2. v410 patches 10 repliesSuperseded
  3. v38 patches 8 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v27 patches6 repliesSuperseded
v15 patches4 repliesSuperseded

Changes in v5 from the cover letter

support rx

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/15netdevice: priv_flags extend to 64bitinclude/linux/netdevice.h net/8021q/vlanproc.c+73 -690 replies
2/15netdevice: add priv_flags IFF_NOT_USE_DMA_ADDRinclude/linux/netdevice.h+3 -00 replies
3/15virtio-net: add priv_flags IFF_NOT_USE_DMA_ADDRdrivers/net/virtio_net.c+1 -12 replies
4/15xsk: XDP_SETUP_XSK_POOL support option IFF_NOT_USE_DMA_ADDRnet/xdp/xsk_buff_pool.c+1 -10 replies
5/15virtio: support virtqueue_detach_unused_buf_ctxdrivers/virtio/virtio_ring.c include/linux/virtio.h+17 -70 replies
6/15virtio-net: unify the code for recycling the xmit ptrdrivers/net/virtio_net.c+38 -481 reply
7/15virtio-net: standalone virtnet_aloc_frag functiondrivers/net/virtio_net.c+20 -91 reply
8/15virtio-net: split the receive_mergeable functiondrivers/net/virtio_net.c+111 -702 replies
9/15virtio-net: virtnet_poll_tx support budget checkdrivers/net/virtio_net.c+4 -20 replies
10/15virtio-net: independent directoryMAINTAINERS drivers/net/Kconfig drivers/net/Makefile +3 more+20 -91 reply
11/15virtio-net: move to virtio_net.hdrivers/net/virtio/virtio_net.c drivers/net/virtio/virtio_net.h+232 -2231 reply
12/15virtio-net: support AF_XDP zc txdrivers/net/virtio/Makefile drivers/net/virtio/virtio_net.c drivers/net/virtio/virtio_net.h +2 more+497 -66 replies
13/15virtio-net: support AF_XDP zc rxdrivers/net/virtio/virtio_net.c drivers/net/virtio/virtio_net.h drivers/net/virtio/xsk.c +1 more+678 -585 replies
14/15virtio-net: xsk direct xmit inside xsk wakeupdrivers/net/virtio/xsk.c+23 -53 replies
15/15virtio-net: xsk zero copy xmit kick by thresholddrivers/net/virtio/virtio_net.c drivers/net/virtio/xsk.c drivers/net/virtio/xsk.h+19 -24 replies

Reviews trailers per patch

8 of 15 patches have a Reviewed-by or Acked-by.

PatchDust LiMagnus KarlssonJason Wang
1/15
2/15
3/15
4/15R-b A-b
5/15
6/15A-b
7/15A-b
8/15
9/15A-b
10/15A-b
11/15A-b
12/15R-b
13/15
14/15
15/15R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v5 thread

Cover letter [PATCH net-next v5 00/15] virtio-net: support xdp socket zero copy

XDP socket is an excellent by pass kernel network transmission framework. The zero copy feature of xsk (XDP socket) needs to be supported by the driver. The performance of zero copy is very good. mlx5 and intel ixgbe already support this feature, This patch set allows virtio-net to support xsk's zerocopy xmit feature.

Compared with other drivers, the trouble with virtio-net is that when we bind the channel to xsk, we cannot directly disable/enable the channel. So we have to consider the buf that has been placed in the vq after the xsk is released by the upper layer.

My solution is to add a ctx to each buf placed in vq to record the page used, and add a reference to the page. So when the upper xsk is released, these pages are still safe in vq. We will process these bufs when we recycle buf or receive new data.

In the case of rx, it will be more complicated, because we may encounter the buf of xsk, or it may be a normal buf. Especially in the case of merge, we may receive multiple bufs, and these bufs may be xsk buf and normal are mixed together.

v5:
support rx

v4:
1. add priv_flags IFF_NOT_USE_DMA_ADDR
2. more reasonable patch split

Xuan Zhuo (15):
netdevice: priv_flags extend to 64bit
netdevice: add priv_flags IFF_NOT_USE_DMA_ADDR
virtio-net: add priv_flags IFF_NOT_USE_DMA_ADDR
xsk: XDP_SETUP_XSK_POOL support option IFF_NOT_USE_DMA_ADDR
virtio: support virtqueue_detach_unused_buf_ctx
virtio-net: unify the code for recycling the xmit ptr
virtio-net: standalone virtnet_aloc_frag function
virtio-net: split the receive_mergeable function
virtio-net: virtnet_poll_tx support budget check
virtio-net: independent directory
virtio-net: move to virtio_net.h
virtio-net: support AF_XDP zc tx
virtio-net: support AF_XDP zc rx
virtio-net: xsk direct xmit inside xsk wakeup
virtio-net: xsk zero copy xmit kick by threshold

 MAINTAINERS                           |   2 +-
 drivers/net/Kconfig                   |   8 +-
 drivers/net/Makefile                  |   2 +-
 drivers/net/virtio/Kconfig            |  11 +
 drivers/net/virtio/Makefile           |   7 +
 drivers/net/{ => virtio}/virtio_net.c | 670 +++++++++++-----------
 drivers/net/virtio/virtio_net.h       | 288 ++++++++++
 drivers/net/virtio/xsk.c              | 766 ++++++++++++++++++++++++++
 drivers/net/virtio/xsk.h              | 176 ++++++
 drivers/virtio/virtio_ring.c          |  22 +-
 include/linux/netdevice.h             | 143 ++---
 include/linux/virtio.h                |   2 +
 net/8021q/vlanproc.c                  |   2 +-
 net/xdp/xsk_buff_pool.c               |   2 +-
 14 files changed, 1664 insertions(+), 437 deletions(-)
 create mode 100644 drivers/net/virtio/Kconfig
 create mode 100644 drivers/net/virtio/Makefile
 rename drivers/net/{ => virtio}/virtio_net.c (92%)
 create mode 100644 drivers/net/virtio/virtio_net.h
 create mode 100644 drivers/net/virtio/xsk.c
 create mode 100644 drivers/net/virtio/xsk.h

--
2.31.0