summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2018-04-20 20:22:40 +0300
committerSasha Levin <alexander.levin@microsoft.com>2018-05-22 21:36:37 -0400
commit851c5371237bd1826790c16d9a639af56360cad6 (patch)
treecbf7b3ffee5b29a39143b80d78f2f52af596061d
parented5fb8b333d6c4e4c6f2a0b06f5078761b9ea4ba (diff)
downloadlinux-stable-851c5371237bd1826790c16d9a639af56360cad6.tar.gz
virtio: add ability to iterate over vqs
[ Upstream commit 24a7e4d20783c0514850f24a5c41ede46ab058f0 ] For cleanup it's helpful to be able to simply scan all vqs and discard all data. Add an iterator to do that. Cc: stable@vger.kernel.org Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
-rw-r--r--include/linux/virtio.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 8f4d4bfa6d46..d7844d215381 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -124,6 +124,9 @@ int virtio_device_freeze(struct virtio_device *dev);
int virtio_device_restore(struct virtio_device *dev);
#endif
+#define virtio_device_for_each_vq(vdev, vq) \
+ list_for_each_entry(vq, &vdev->vqs, list)
+
/**
* virtio_driver - operations for a virtio I/O driver
* @driver: underlying device driver (populate name and owner).