aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2011-05-19 19:11:14 -0400
committerRusty Russell <rusty@rustcorp.com.au>2011-05-29 21:44:16 -0400
commit7ab358c23cbf15cea08129cd722d1ce77433a94d (patch)
tree713d38823efda30222230314bcae26b919782f16 /include/linux
parent4423fe40b03f32b11e72ecfa03077e702e55d5a9 (diff)
virtio: add api for delayed callbacks
Add an API that tells the other side that callbacks should be delayed until a lot of work has been done. Implement using the new event_idx feature. Note: it might seem advantageous to let the drivers ask for a callback after a specific capacity has been reached. However, as a single head can free many entries in the descriptor table, we don't really have a clue about capacity until get_buf is called. The API is the simplest to implement at the moment, we'll see what kind of hints drivers can pass when there's more than one user of the feature. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/virtio.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index aff5b4f74041..710885749605 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -51,6 +51,13 @@ struct virtqueue {
51 * This re-enables callbacks; it returns "false" if there are pending 51 * This re-enables callbacks; it returns "false" if there are pending
52 * buffers in the queue, to detect a possible race between the driver 52 * buffers in the queue, to detect a possible race between the driver
53 * checking for more work, and enabling callbacks. 53 * checking for more work, and enabling callbacks.
54 * virtqueue_enable_cb_delayed: restart callbacks after disable_cb.
55 * vq: the struct virtqueue we're talking about.
56 * This re-enables callbacks but hints to the other side to delay
57 * interrupts until most of the available buffers have been processed;
58 * it returns "false" if there are many pending buffers in the queue,
59 * to detect a possible race between the driver checking for more work,
60 * and enabling callbacks.
54 * virtqueue_detach_unused_buf: detach first unused buffer 61 * virtqueue_detach_unused_buf: detach first unused buffer
55 * vq: the struct virtqueue we're talking about. 62 * vq: the struct virtqueue we're talking about.
56 * Returns NULL or the "data" token handed to add_buf 63 * Returns NULL or the "data" token handed to add_buf
@@ -86,6 +93,8 @@ void virtqueue_disable_cb(struct virtqueue *vq);
86 93
87bool virtqueue_enable_cb(struct virtqueue *vq); 94bool virtqueue_enable_cb(struct virtqueue *vq);
88 95
96bool virtqueue_enable_cb_delayed(struct virtqueue *vq);
97
89void *virtqueue_detach_unused_buf(struct virtqueue *vq); 98void *virtqueue_detach_unused_buf(struct virtqueue *vq);
90 99
91/** 100/**