aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/virtio.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/virtio.h')
-rw-r--r--include/linux/virtio.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 14e1379876d..260d1fcf29a 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -11,15 +11,13 @@
11/** 11/**
12 * virtqueue - a queue to register buffers for sending or receiving. 12 * virtqueue - a queue to register buffers for sending or receiving.
13 * @callback: the function to call when buffers are consumed (can be NULL). 13 * @callback: the function to call when buffers are consumed (can be NULL).
14 * If this returns false, callbacks are suppressed until vq_ops->restart
15 * is called.
16 * @vdev: the virtio device this queue was created for. 14 * @vdev: the virtio device this queue was created for.
17 * @vq_ops: the operations for this virtqueue (see below). 15 * @vq_ops: the operations for this virtqueue (see below).
18 * @priv: a pointer for the virtqueue implementation to use. 16 * @priv: a pointer for the virtqueue implementation to use.
19 */ 17 */
20struct virtqueue 18struct virtqueue
21{ 19{
22 bool (*callback)(struct virtqueue *vq); 20 void (*callback)(struct virtqueue *vq);
23 struct virtio_device *vdev; 21 struct virtio_device *vdev;
24 struct virtqueue_ops *vq_ops; 22 struct virtqueue_ops *vq_ops;
25 void *priv; 23 void *priv;
@@ -41,13 +39,12 @@ struct virtqueue
41 * vq: the struct virtqueue we're talking about. 39 * vq: the struct virtqueue we're talking about.
42 * len: the length written into the buffer 40 * len: the length written into the buffer
43 * Returns NULL or the "data" token handed to add_buf. 41 * Returns NULL or the "data" token handed to add_buf.
44 * @restart: restart callbacks after callback returned false. 42 * @disable_cb: disable callbacks
43 * vq: the struct virtqueue we're talking about.
44 * @enable_cb: restart callbacks after disable_cb.
45 * vq: the struct virtqueue we're talking about. 45 * vq: the struct virtqueue we're talking about.
46 * This returns "false" (and doesn't re-enable) if there are pending 46 * This returns "false" (and doesn't re-enable) if there are pending
47 * buffers in the queue, to avoid a race. 47 * buffers in the queue, to avoid a race.
48 * @shutdown: "unadd" all buffers.
49 * vq: the struct virtqueue we're talking about.
50 * Remove everything from the queue.
51 * 48 *
52 * Locking rules are straightforward: the driver is responsible for 49 * Locking rules are straightforward: the driver is responsible for
53 * locking. No two operations may be invoked simultaneously. 50 * locking. No two operations may be invoked simultaneously.
@@ -65,9 +62,8 @@ struct virtqueue_ops {
65 62
66 void *(*get_buf)(struct virtqueue *vq, unsigned int *len); 63 void *(*get_buf)(struct virtqueue *vq, unsigned int *len);
67 64
68 bool (*restart)(struct virtqueue *vq); 65 void (*disable_cb)(struct virtqueue *vq);
69 66 bool (*enable_cb)(struct virtqueue *vq);
70 void (*shutdown)(struct virtqueue *vq);
71}; 67};
72 68
73/** 69/**
@@ -97,12 +93,15 @@ void unregister_virtio_device(struct virtio_device *dev);
97 * @probe: the function to call when a device is found. Returns a token for 93 * @probe: the function to call when a device is found. Returns a token for
98 * remove, or PTR_ERR(). 94 * remove, or PTR_ERR().
99 * @remove: the function when a device is removed. 95 * @remove: the function when a device is removed.
96 * @config_changed: optional function to call when the device configuration
97 * changes; may be called in interrupt context.
100 */ 98 */
101struct virtio_driver { 99struct virtio_driver {
102 struct device_driver driver; 100 struct device_driver driver;
103 const struct virtio_device_id *id_table; 101 const struct virtio_device_id *id_table;
104 int (*probe)(struct virtio_device *dev); 102 int (*probe)(struct virtio_device *dev);
105 void (*remove)(struct virtio_device *dev); 103 void (*remove)(struct virtio_device *dev);
104 void (*config_changed)(struct virtio_device *dev);
106}; 105};
107 106
108int register_virtio_driver(struct virtio_driver *drv); 107int register_virtio_driver(struct virtio_driver *drv);