[virtio] Simplify virtqueue shutdown

This commit introduces virtnet_free_virtqueues called on all virtqueue
error and shutdown paths. vpm_find_vqs no longer cleans up after itself
and instead expects virtnet_free_virtqueues to be always called to undo
its effect.

Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Ladi Prosek
2016-12-16 13:31:22 +01:00
committed by Michael Brown
parent e45451c699
commit b782a56be7
2 changed files with 20 additions and 19 deletions

View File

@@ -391,7 +391,7 @@ int vpm_find_vqs(struct virtio_pci_modern_device *vdev,
off * notify_offset_multiplier, 2,
&vq->notification);
if (err) {
goto err_map_notify;
return err;
}
}
@@ -405,11 +405,4 @@ int vpm_find_vqs(struct virtio_pci_modern_device *vdev,
vpm_iowrite16(vdev, &vdev->common, 1, COMMON_OFFSET(queue_enable));
}
return 0;
err_map_notify:
/* Undo the virtio_pci_map_capability calls. */
while (i-- > 0) {
virtio_pci_unmap_capability(&vqs[i].notification);
}
return err;
}