Thread (36 messages) 36 messages, 4 authors, 2024-09-13

Re: [PATCH net-next 04/13] virtio_ring: perform premapped operations based on per-buffer

From: Jason Wang <hidden>
Date: 2024-09-13 03:36:47
Also in: bpf, virtualization

On Thu, Sep 12, 2024 at 3:43 PM Xuan Zhuo [off-list ref] wrote:
On Wed, 11 Sep 2024 11:54:25 +0800, Jason Wang [off-list ref] wrote:
quoted
On Tue, Aug 20, 2024 at 3:33 PM Xuan Zhuo [off-list ref] wrote:
quoted
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.
Is this only applied to TX or both TX and RX.

For rx, if you mean per-buffer dma buffer, I think it is yes,
rx can reuse this. If you mean should we do premapped for the
normal rx buffers, I think we should, that can reduce the
dma map operations.

quoted
quoted
We can distinguish them by sg_page(sg), When sg_page(sg) is NULL, this
indicates that the driver has performed DMA mapping in advance, allowing
the Virtio core to directly utilize sg_dma_address(sg) without
conducting any internal DMA mapping.
This seems conflict with the code below?

#define sg_is_premapped(sg) (!sg_page(sg))
Sorry, I do not get for you.

The key point is that the sg->page is setted by driver.
Ok, I forget that but let's document this assumption in the changelog.
So I mean if the driver sets sg->page = NULL, then for this sg,
the virtio core can skip dma mapping. If the driver sets
sg->page to the page of the buffer, then the virtio core should
do dma mapping for this sg.
Ok, let's describe this in the changelog.

Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help