diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-02-04 23:49:57 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-02-04 07:49:58 -0500 |
commit | 18445c4d501b9ab4336f66ef46b092661ddaf336 (patch) | |
tree | 9d23185f207d912942890cf047d1d3200806b401 /include | |
parent | a586d4f6016f7139d8c26df0e6927131168d3b5b (diff) |
virtio: explicit enable_cb/disable_cb rather than callback return.
It seems that virtio_net wants to disable callbacks (interrupts) before
calling netif_rx_schedule(), so we can't use the return value to do so.
Rename "restart" to "cb_enable" and introduce "cb_disable" hook: callback
now returns void, rather than a boolean.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/virtio.h | 11 | ||||
-rw-r--r-- | include/linux/virtio_config.h | 2 | ||||
-rw-r--r-- | include/linux/virtio_ring.h | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 14e1379876d3..951d81747b42 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 | */ |
20 | struct virtqueue | 18 | struct 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,7 +39,9 @@ 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. |
@@ -65,7 +65,8 @@ struct virtqueue_ops { | |||
65 | 65 | ||
66 | void *(*get_buf)(struct virtqueue *vq, unsigned int *len); | 66 | void *(*get_buf)(struct virtqueue *vq, unsigned int *len); |
67 | 67 | ||
68 | bool (*restart)(struct virtqueue *vq); | 68 | void (*disable_cb)(struct virtqueue *vq); |
69 | bool (*enable_cb)(struct virtqueue *vq); | ||
69 | 70 | ||
70 | void (*shutdown)(struct virtqueue *vq); | 71 | void (*shutdown)(struct virtqueue *vq); |
71 | }; | 72 | }; |
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index 70bb26062d76..81f828ac8f47 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h | |||
@@ -61,7 +61,7 @@ struct virtio_config_ops | |||
61 | void (*set_status)(struct virtio_device *vdev, u8 status); | 61 | void (*set_status)(struct virtio_device *vdev, u8 status); |
62 | struct virtqueue *(*find_vq)(struct virtio_device *vdev, | 62 | struct virtqueue *(*find_vq)(struct virtio_device *vdev, |
63 | unsigned index, | 63 | unsigned index, |
64 | bool (*callback)(struct virtqueue *)); | 64 | void (*callback)(struct virtqueue *)); |
65 | void (*del_vq)(struct virtqueue *vq); | 65 | void (*del_vq)(struct virtqueue *vq); |
66 | }; | 66 | }; |
67 | 67 | ||
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index 1a4ed49f6478..8cde10e792c4 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h | |||
@@ -114,7 +114,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int num, | |||
114 | struct virtio_device *vdev, | 114 | struct virtio_device *vdev, |
115 | void *pages, | 115 | void *pages, |
116 | void (*notify)(struct virtqueue *vq), | 116 | void (*notify)(struct virtqueue *vq), |
117 | bool (*callback)(struct virtqueue *vq)); | 117 | void (*callback)(struct virtqueue *vq)); |
118 | void vring_del_virtqueue(struct virtqueue *vq); | 118 | void vring_del_virtqueue(struct virtqueue *vq); |
119 | 119 | ||
120 | irqreturn_t vring_interrupt(int irq, void *_vq); | 120 | irqreturn_t vring_interrupt(int irq, void *_vq); |