]> git.proxmox.com Git - mirror_qemu.git/commitdiff
virtio: introduce virtio_del_queue()
authorJason Wang <jasowang@redhat.com>
Wed, 30 Jan 2013 11:12:36 +0000 (19:12 +0800)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 1 Feb 2013 17:03:02 +0000 (11:03 -0600)
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>
hw/virtio.c
hw/virtio.h

index ca170c319ef6b1d840f57ccef43d72d87e3adc4a..d8c77b054d45498b82b99c241e58cceb30744bde 100644 (file)
@@ -701,6 +701,15 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
     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)
 {
     trace_virtio_irq(vq);
index 9cc7b85671ed737807a94d827c54372643550555..d3da1d25df42688db149dffa0dfcf15a08c80cfd 100644 (file)
@@ -181,6 +181,8 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
                             void (*handle_output)(VirtIODevice *,
                                                   VirtQueue *));
 
+void virtio_del_queue(VirtIODevice *vdev, int n);
+
 void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
                     unsigned int len);
 void virtqueue_flush(VirtQueue *vq, unsigned int count);