diff options
author | Xuan Zhuo <xuanzhuo@linux.alibaba.com> | 2022-08-01 08:38:44 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2022-08-11 10:06:40 +0200 |
commit | c790e8e1817f1a17c05e64f1c4f16f231b8529d5 (patch) | |
tree | 415b01b4ab5bd794d4266ebf4509bb53adb41afa /include | |
parent | virtio_ring: packed: introduce virtqueue_resize_packed() (diff) | |
download | linux-c790e8e1817f1a17c05e64f1c4f16f231b8529d5.tar.xz linux-c790e8e1817f1a17c05e64f1c4f16f231b8529d5.zip |
virtio_ring: introduce virtqueue_resize()
Introduce virtqueue_resize() to implement the resize of vring.
Based on these, the driver can dynamically adjust the size of the vring.
For example: ethtool -G.
virtqueue_resize() implements resize based on the vq reset function. In
case of failure to allocate a new vring, it will give up resize and use
the original vring.
During this process, if the re-enable reset vq fails, the vq can no
longer be used. Although the probability of this situation is not high.
The parameter recycle is used to recycle the buffer that is no longer
used.
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-25-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/virtio.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 129bde7521e3..62e31bca5602 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h @@ -91,6 +91,9 @@ dma_addr_t virtqueue_get_desc_addr(struct virtqueue *vq); dma_addr_t virtqueue_get_avail_addr(struct virtqueue *vq); dma_addr_t virtqueue_get_used_addr(struct virtqueue *vq); +int virtqueue_resize(struct virtqueue *vq, u32 num, + void (*recycle)(struct virtqueue *vq, void *buf)); + /** * virtio_device - representation of a device using virtio * @index: unique position on the virtio bus |