virtio_ring: perform premapped operations based on per-buffer
authorXuan Zhuo <xuanzhuo@linux.alibaba.com>
Tue, 12 Nov 2024 01:29:19 +0000 (09:29 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 16 Nov 2024 02:46:55 +0000 (18:46 -0800)
commitc7e1b422afac5385832297af8ad86e63742c6e40
tree4b093775ec5898b411f403359907b461417d5b9f
parentaaa789843a93faa7e2bb309b7647f1cc0a083158
virtio_ring: perform premapped operations based on per-buffer

The current configuration sets the virtqueue (vq) to premapped mode,
implying that all buffers submitted to this queue must be mapped ahead
of time. This presents a challenge for the virtnet send queue (sq): the
virtnet driver would be required to keep track of dma information for vq
size * 17, which can be substantial. However, if the premapped mode were
applied on a per-buffer basis, the complexity would be greatly reduced.
With AF_XDP enabled, AF_XDP buffers would become premapped, while kernel
skb buffers could remain unmapped.

And consider that some sgs are not generated by the virtio driver,
that may be passed from the block stack. So we can not change the
sgs, new APIs are the better way.

So we pass the new argument 'premapped' to indicate the buffers
submitted to virtio are premapped in advance. Additionally,
DMA unmap operations for these buffers will be bypassed.

Suggested-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://patch.msgid.link/20241112012928.102478-5-xuanzhuo@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/virtio/virtio_ring.c