diff options
author | Jason Wang <jasowang@redhat.com> | 2013-01-30 19:12:37 +0800 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-02-01 11:03:03 -0600 |
commit | e78a2b4285f6cc125dc7a514bebef97d9af1d812 (patch) | |
tree | 34227ae90a31eb1fc68d8112385ad09dfae3a6ed /hw/virtio.c | |
parent | f23fd811ac4f49f482058cad3b465dc5dc0edc11 (diff) | |
download | qemu-e78a2b4285f6cc125dc7a514bebef97d9af1d812.zip qemu-e78a2b4285f6cc125dc7a514bebef97d9af1d812.tar.gz qemu-e78a2b4285f6cc125dc7a514bebef97d9af1d812.tar.bz2 |
virtio: add a queue_index to VirtQueue
Add a queue_index to VirtQueue and a helper to fetch it, this could be used by
multiqueue supported device.
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio.c')
-rw-r--r-- | hw/virtio.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/virtio.c b/hw/virtio.c index d8c77b0..e259348 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -73,6 +73,8 @@ struct VirtQueue /* Notification enabled? */ bool notification; + uint16_t queue_index; + int inuse; uint16_t vector; @@ -931,6 +933,7 @@ void virtio_init(VirtIODevice *vdev, const char *name, for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) { vdev->vq[i].vector = VIRTIO_NO_VECTOR; vdev->vq[i].vdev = vdev; + vdev->vq[i].queue_index = i; } vdev->name = name; @@ -1018,6 +1021,11 @@ VirtQueue *virtio_get_queue(VirtIODevice *vdev, int n) return vdev->vq + n; } +uint16_t virtio_get_queue_index(VirtQueue *vq) +{ + return vq->queue_index; +} + static void virtio_queue_guest_notifier_read(EventNotifier *n) { VirtQueue *vq = container_of(n, VirtQueue, guest_notifier); |