Skip to content

virtio_net: introduce api to enable/disable premapped mode for sq

Xuan Zhuo bpf netdev virtualization 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5virtio_ring: introduce vring_need_unmap_bufferdrivers/virtio/virtio_ring.c+12 -150 replies
2/5virtio_ring: introduce dma map api for pagedrivers/virtio/virtio_ring.c include/linux/virtio.h+59 -00 replies
3/5virtio_ring: introduce virtqueue_dma_map_sg_attrsdrivers/virtio/virtio_ring.c include/linux/virtio.h+35 -00 replies
4/5virtio_ring: virtqueue_set_dma_premapped() support to disabledrivers/net/virtio_net.c drivers/virtio/virtio_ring.c include/linux/virtio.h+6 -50 replies
5/5virtio_net: sq support premapped modedrivers/net/virtio_net.c+207 -30 replies

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchJason Wang
1/5A-b
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH vhost 0/5] virtio_net: introduce api to enable/disable premapped mode for sq

As discussed:

http://lore.kernel.org/all/CACGkMEvq0No8QGC46U4mGsMtuD44fD_cfLcPaVmJ3rHYqRZxYg@mail.gmail.com

If virtio is in pre-mapped mode, the driver should manage the DMA info itself.

However, due to the indirect feature, the virtio-net driver may need to maintain an excessive amount of DMA info. Therefore, we only enable pre-mapped mode for the send queue (SQ) when af-xdp is bound to it. We have set a limit on the amount of DMA info we manage. If the kernel stack or xdp tx/redirect attempts to use more descriptors than this limit, virtnet_add_outbuf() will return an -ENOMEM error. However, AF-XDP can continue working.

The last patch aims to demonstrate the logic of enabling pre-mapped mode when af-xdp is bound to the SQ, and we can discuss it further.

Although the APIs are not used, this patch might belong in the final patch set (virtio-net supports AF_XDP). But I hope the first four patches can be merged first to reduce the number of patches in the final set.

Thanks.

Xuan Zhuo (5):
virtio_ring: introduce vring_need_unmap_buffer
virtio_ring: introduce dma map api for page
virtio_ring: introduce virtqueue_dma_map_sg_attrs
virtio_ring: virtqueue_set_dma_premapped() support to disable
virtio_net: sq support premapped mode

 drivers/net/virtio_net.c     | 212 ++++++++++++++++++++++++++++++++++-
 drivers/virtio/virtio_ring.c | 118 ++++++++++++++++---
 include/linux/virtio.h       |  12 +-
 3 files changed, 319 insertions(+), 23 deletions(-)

--
2.32.0.3.g01195cf9f