For the virtio net send queue, if it supports premapped mode, then we need to collect the dma info of every desc of this buf to do unmap inside the driver. The key is that one xmit may contains multiple dma address. (A skb may contain 19 dma address) Here I introduce a new helper to resolve this. And we also need to consider the virtqueue_resize and free the unused buffers. For on the same page of the API design before other job, I post this RFC patch set. Thanks. Xuan Zhuo (4): virtio_ring: introduce virtqueue_get_buf_ctx_dma() virtio_ring: virtqueue_disable_and_recycle let the callback detach bufs virtio_ring: introduce virtqueue_detach_unused_buf_premapped virtio_net: sq support premapped mode drivers/net/virtio/main.c | 143 ++++++++++++++++++++---- drivers/net/virtio/virtio_net.h | 2 + drivers/virtio/virtio_ring.c | 187 ++++++++++++++++++++++++-------- include/linux/virtio.h | 7 +- 4 files changed, 268 insertions(+), 71 deletions(-) -- 2.32.0.3.g01195cf9f