aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/virtio
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-09-05 14:47:45 -0400
committerRusty Russell <rusty@rustcorp.com.au>2012-09-28 01:35:15 -0400
commit6457f126c888b3481fdae6f702e616cd0c79646e (patch)
treeeae794db0b3983d2a901ecf6471eda6e3f9ff26f /drivers/virtio
parent75a0a52be3c27b58654fbed2c8f2ff401482b9a4 (diff)
virtio: support reserved vqs
virtio network device multiqueue support reserves vq 3 for future use (useful both for future extensions and to make it pretty - this way receive vqs have even and transmit - odd numbers). Make it possible to skip initialization for specific vq numbers by specifying NULL for name. Document this usage as well as (existing) NULL callback. Drivers using this not coded up yet, so I simply tested with virtio-pci and verified that this patch does not break existing drivers. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/virtio')
-rw-r--r--drivers/virtio/virtio_mmio.c3
-rw-r--r--drivers/virtio/virtio_pci.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 008bf58bdaae..5d7fee385b70 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -306,6 +306,9 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev, unsigned index,
306 unsigned long flags, size; 306 unsigned long flags, size;
307 int err; 307 int err;
308 308
309 if (!name)
310 return NULL;
311
309 /* Select the queue we're interested in */ 312 /* Select the queue we're interested in */
310 writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); 313 writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL);
311 314
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index f5dfe6bdb959..42b20769d122 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -555,7 +555,10 @@ static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs,
555 vp_dev->per_vq_vectors = per_vq_vectors; 555 vp_dev->per_vq_vectors = per_vq_vectors;
556 allocated_vectors = vp_dev->msix_used_vectors; 556 allocated_vectors = vp_dev->msix_used_vectors;
557 for (i = 0; i < nvqs; ++i) { 557 for (i = 0; i < nvqs; ++i) {
558 if (!callbacks[i] || !vp_dev->msix_enabled) 558 if (!names[i]) {
559 vqs[i] = NULL;
560 continue;
561 } else if (!callbacks[i] || !vp_dev->msix_enabled)
559 msix_vec = VIRTIO_MSI_NO_VECTOR; 562 msix_vec = VIRTIO_MSI_NO_VECTOR;
560 else if (vp_dev->per_vq_vectors) 563 else if (vp_dev->per_vq_vectors)
561 msix_vec = allocated_vectors++; 564 msix_vec = allocated_vectors++;