summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drivers/bus/virtio-pci.c8
-rw-r--r--src/include/ipxe/virtio-ring.h6
2 files changed, 10 insertions, 4 deletions
diff --git a/src/drivers/bus/virtio-pci.c b/src/drivers/bus/virtio-pci.c
index 3311595fb..1fcf9bae0 100644
--- a/src/drivers/bus/virtio-pci.c
+++ b/src/drivers/bus/virtio-pci.c
@@ -358,12 +358,18 @@ int vpm_find_vqs(struct virtio_pci_modern_device *vdev,
return -EINVAL;
}
+ if (size > MAX_QUEUE_NUM) {
+ /* iPXE networking tends to be not perf critical so there's no
+ * need to accept large queue sizes.
+ */
+ size = MAX_QUEUE_NUM;
+ }
+
vq = &vqs[i];
vq->queue_index = i;
/* get offset of notification word for this vq */
off = vpm_ioread16(vdev, &vdev->common, COMMON_OFFSET(queue_notify_off));
- vq->vring.num = size;
vring_init(&vq->vring, size, (unsigned char *)vq->queue);
diff --git a/src/include/ipxe/virtio-ring.h b/src/include/ipxe/virtio-ring.h
index 6ba550b5a..d2ded3007 100644
--- a/src/include/ipxe/virtio-ring.h
+++ b/src/include/ipxe/virtio-ring.h
@@ -95,7 +95,7 @@ static inline void vring_init(struct vring *vr,
unsigned int i;
unsigned long pa;
- vr->num = num;
+ vr->num = num;
/* physical address of desc must be page aligned */
@@ -103,13 +103,13 @@ static inline void vring_init(struct vring *vr,
pa = (pa + PAGE_MASK) & ~PAGE_MASK;
vr->desc = phys_to_virt(pa);
- vr->avail = (struct vring_avail *)&vr->desc[num];
+ vr->avail = (struct vring_avail *)&vr->desc[num];
/* physical address of used must be page aligned */
pa = virt_to_phys(&vr->avail->ring[num]);
pa = (pa + PAGE_MASK) & ~PAGE_MASK;
- vr->used = phys_to_virt(pa);
+ vr->used = phys_to_virt(pa);
for (i = 0; i < num - 1; i++)
vr->desc[i].next = i + 1;