summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/virtio_pci_modern.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/devices/virtio/virtio_pci_modern.c')
-rw-r--r--src/vnet/devices/virtio/virtio_pci_modern.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/vnet/devices/virtio/virtio_pci_modern.c b/src/vnet/devices/virtio/virtio_pci_modern.c
index 1934f98003d..8e090ffed3a 100644
--- a/src/vnet/devices/virtio/virtio_pci_modern.c
+++ b/src/vnet/devices/virtio/virtio_pci_modern.c
@@ -268,24 +268,39 @@ static u8
virtio_pci_modern_setup_queue (vlib_main_t * vm, virtio_if_t * vif,
u16 queue_id, void *p)
{
- vring_t vr;
+ u64 desc, avail, used;
u16 queue_size = 0;
virtio_pci_modern_set_queue_select (vif, queue_id);
queue_size = virtio_pci_modern_get_queue_size (vm, vif, queue_id);
- vring_init (&vr, queue_size, p, VIRTIO_PCI_VRING_ALIGN);
- u64 desc = vlib_physmem_get_pa (vm, vr.desc);
+ if (vif->is_packed)
+ {
+ virtio_vring_t *vring = (virtio_vring_t *) p;
+
+ desc = vlib_physmem_get_pa (vm, vring->packed_desc);
+ avail = vlib_physmem_get_pa (vm, vring->driver_event);
+ used = vlib_physmem_get_pa (vm, vring->device_event);
+ }
+ else
+ {
+ vring_t vr;
+
+ vring_init (&vr, queue_size, p, VIRTIO_PCI_VRING_ALIGN);
+
+ desc = vlib_physmem_get_pa (vm, vr.desc);
+ avail = vlib_physmem_get_pa (vm, vr.avail);
+ used = vlib_physmem_get_pa (vm, vr.used);
+ }
+
virtio_pci_modern_set_queue_desc (vif, desc);
if (desc != virtio_pci_modern_get_queue_desc (vif))
return 1;
- u64 avail = vlib_physmem_get_pa (vm, vr.avail);
virtio_pci_modern_set_queue_driver (vif, avail);
if (avail != virtio_pci_modern_get_queue_driver (vif))
return 1;
- u64 used = vlib_physmem_get_pa (vm, vr.used);
virtio_pci_modern_set_queue_device (vif, used);
if (used != virtio_pci_modern_get_queue_device (vif))
return 1;