Commit 4913e854 authored by Xuan Zhuo's avatar Xuan Zhuo Committed by Michael S. Tsirkin

virtio_ring: struct virtqueue introduce reset

Introduce a new member reset to the structure virtqueue to determine
whether the current vq is in the reset state. Subsequent patches will
use it.
Signed-off-by: default avatarXuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-29-xuanzhuo@linux.alibaba.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent d94587b5
...@@ -1996,6 +1996,7 @@ static struct virtqueue *vring_create_virtqueue_packed( ...@@ -1996,6 +1996,7 @@ static struct virtqueue *vring_create_virtqueue_packed(
vq->vq.vdev = vdev; vq->vq.vdev = vdev;
vq->vq.name = name; vq->vq.name = name;
vq->vq.index = index; vq->vq.index = index;
vq->vq.reset = false;
vq->we_own_ring = true; vq->we_own_ring = true;
vq->notify = notify; vq->notify = notify;
vq->weak_barriers = weak_barriers; vq->weak_barriers = weak_barriers;
...@@ -2481,6 +2482,7 @@ static struct virtqueue *__vring_new_virtqueue(unsigned int index, ...@@ -2481,6 +2482,7 @@ static struct virtqueue *__vring_new_virtqueue(unsigned int index,
vq->vq.vdev = vdev; vq->vq.vdev = vdev;
vq->vq.name = name; vq->vq.name = name;
vq->vq.index = index; vq->vq.index = index;
vq->vq.reset = false;
vq->we_own_ring = false; vq->we_own_ring = false;
vq->notify = notify; vq->notify = notify;
vq->weak_barriers = weak_barriers; vq->weak_barriers = weak_barriers;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* @index: the zero-based ordinal number for this queue. * @index: the zero-based ordinal number for this queue.
* @num_free: number of elements we expect to be able to fit. * @num_free: number of elements we expect to be able to fit.
* @num_max: the maximum number of elements supported by the device. * @num_max: the maximum number of elements supported by the device.
* @reset: vq is in reset state or not.
* *
* A note on @num_free: with indirect buffers, each buffer needs one * A note on @num_free: with indirect buffers, each buffer needs one
* element in the queue, otherwise a buffer will need one element per * element in the queue, otherwise a buffer will need one element per
...@@ -34,6 +35,7 @@ struct virtqueue { ...@@ -34,6 +35,7 @@ struct virtqueue {
unsigned int num_free; unsigned int num_free;
unsigned int num_max; unsigned int num_max;
void *priv; void *priv;
bool reset;
}; };
int virtqueue_add_outbuf(struct virtqueue *vq, int virtqueue_add_outbuf(struct virtqueue *vq,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment