virtio: introduce virtio_del_queue()
Some device (such as virtio-net) needs the ability to destroy or re-order the virtqueues, this patch adds a helper to do this. Signed-off-by: Jason Wang <jasowang> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
a9f98bb5eb
commit
f23fd811ac
|
@ -701,6 +701,15 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
|
||||||
return &vdev->vq[i];
|
return &vdev->vq[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void virtio_del_queue(VirtIODevice *vdev, int n)
|
||||||
|
{
|
||||||
|
if (n < 0 || n >= VIRTIO_PCI_QUEUE_MAX) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
vdev->vq[n].vring.num = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void virtio_irq(VirtQueue *vq)
|
void virtio_irq(VirtQueue *vq)
|
||||||
{
|
{
|
||||||
trace_virtio_irq(vq);
|
trace_virtio_irq(vq);
|
||||||
|
|
|
@ -181,6 +181,8 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
|
||||||
void (*handle_output)(VirtIODevice *,
|
void (*handle_output)(VirtIODevice *,
|
||||||
VirtQueue *));
|
VirtQueue *));
|
||||||
|
|
||||||
|
void virtio_del_queue(VirtIODevice *vdev, int n);
|
||||||
|
|
||||||
void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
|
void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
|
||||||
unsigned int len);
|
unsigned int len);
|
||||||
void virtqueue_flush(VirtQueue *vq, unsigned int count);
|
void virtqueue_flush(VirtQueue *vq, unsigned int count);
|
||||||
|
|
Loading…
Reference in a new issue