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. v1: 1. introduce new struct virtio_dma_head to replace the scatterlist 2. fix some small problems 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 | 145 +++++++++++++++++++---- drivers/net/virtio/virtio_net.h | 2 + drivers/virtio/virtio_ring.c | 196 +++++++++++++++++++++----------- include/linux/virtio.h | 21 +++- 4 files changed, 277 insertions(+), 87 deletions(-) -- 2.32.0.3.g01195cf9f