Skip to contentSkip to conversation

virtio virt-queue and virt-ring

Qemu-devel Yaodong Yang 2 participants 2 messages Dec 1, 2013 – Dec 3, 2013

lore
Share & tools
lore
#0 lore raw

Inside file ./hw/virtio/virtio.c, The following structs are defined. I understood that for each virtual disk, there is a corresponding queue and this queue is implemented by a ring. My questions is what is the meaning of each element inside struct VRing?

Thanks a lot!

typedef struct VRing
{
    unsigned int num;
    hwaddr desc;
    hwaddr avail;
    hwaddr used;
} VRing;

struct VirtQueue
{
    VRing vring;
    hwaddr pa;
    uint16_t last_avail_idx;
    /* Last used index value we have signalled on */ uint16_t signalled_used;

    /* Last used index value we have signalled on */ bool signalled_used_valid;

    /* Notification enabled? */
    bool notification;

    uint16_t queue_index;

    int inuse;

    uint16_t vector;
    void (*handle_output)(VirtIODevice *vdev, VirtQueue *vq); VirtIODevice *vdev;
    EventNotifier guest_notifier;
    EventNotifier host_notifier;
};

#1 lore raw
Quoted 1 line · Yaodong Yang

Inside file ./hw/virtio/virtio.c, The following structs are defined. I understood that for each virtual disk, there is a corresponding queue and this queue is implemented by a ring. My questions is what is the meaning of each element inside struct VRing?

Please see the virtio specification:
https://github.com/rustyrussell/virtio-spec

It defines the virtio-blk device.

Stefan