virtio_pci: use queue idx instead of array idx to set up the vq
authorWei Wang <wei.w.wang@intel.com>
Fri, 28 Dec 2018 02:26:25 +0000 (10:26 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 15 Jan 2019 01:15:18 +0000 (20:15 -0500)
commitddbeac07a39a81d82331a312d0578fab94fccbf1
tree97d92ef828e7250d9114c56178dba8c71d0ad611
parentd1c1dad89e7a8be2cfdc7b92deca2c8048f0d263
virtio_pci: use queue idx instead of array idx to set up the vq

When find_vqs, there will be no vq[i] allocation if its corresponding
names[i] is NULL. For example, the caller may pass in names[i] (i=4)
with names[2] being NULL because the related feature bit is turned off,
so technically there are 3 queues on the device, and name[4] should
correspond to the 3rd queue on the device.

So we use queue_idx as the queue index, which is increased only when the
queue exists.

Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
drivers/virtio/virtio_pci_common.c