virtio_ring: add new function virtqueue_is_broken()
authorHeinz Graalfs <graalfs@linux.vnet.ibm.com>
Mon, 28 Oct 2013 23:10:19 +0000 (09:40 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 29 Oct 2013 00:58:17 +0000 (11:28 +1030)
Add new function virtqueue_is_broken(). Callers of virtqueue_get_buf()
should check for a broken queue.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/virtio/virtio_ring.c
include/linux/virtio.h

index b47142723119440945af4149e551a2bc0c282cba..f47777582ce51c7ee05b5d8624754653c18e3222 100644 (file)
@@ -851,4 +851,12 @@ unsigned int virtqueue_get_vring_size(struct virtqueue *_vq)
 }
 EXPORT_SYMBOL_GPL(virtqueue_get_vring_size);
 
+bool virtqueue_is_broken(struct virtqueue *_vq)
+{
+       struct vring_virtqueue *vq = to_vvq(_vq);
+
+       return vq->broken;
+}
+EXPORT_SYMBOL_GPL(virtqueue_is_broken);
+
 MODULE_LICENSE("GPL");
index 9b4de15fcb2ff5099723c70368bcc49705881da2..e4abb84199bea7599940a4fe4ee026ee40f6a48d 100644 (file)
@@ -73,6 +73,8 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq);
 
 unsigned int virtqueue_get_vring_size(struct virtqueue *vq);
 
+bool virtqueue_is_broken(struct virtqueue *vq);
+
 /**
  * virtio_device - representation of a device using virtio
  * @index: unique position on the virtio bus