aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-06-13 00:16:35 -0400
committerRusty Russell <rusty@rustcorp.com.au>2009-06-12 08:46:36 -0400
commit9499f5e7ed5224c40706f0cec6542a9916bc7606 (patch)
tree3e4e1b36d3d549ea356e88e6e44359a887c6ee01 /include/linux
parentef688e151c00e5d529703be9a04fd506df8bc54e (diff)
virtio: add names to virtqueue struct, mapping from devices to queues.
Add a linked list of all virtqueues for a virtio device: this helps for debugging and is also needed for upcoming interface change. Also, add a "name" field for clearer debug messages. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/virtio.h12
-rw-r--r--include/linux/virtio_config.h6
-rw-r--r--include/linux/virtio_ring.h3
3 files changed, 14 insertions, 7 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 9410394bbf96..4fca4f5440ba 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -10,14 +10,17 @@
10 10
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 * @list: the chain of virtqueues for this device
13 * @callback: the function to call when buffers are consumed (can be NULL). 14 * @callback: the function to call when buffers are consumed (can be NULL).
15 * @name: the name of this virtqueue (mainly for debugging)
14 * @vdev: the virtio device this queue was created for. 16 * @vdev: the virtio device this queue was created for.
15 * @vq_ops: the operations for this virtqueue (see below). 17 * @vq_ops: the operations for this virtqueue (see below).
16 * @priv: a pointer for the virtqueue implementation to use. 18 * @priv: a pointer for the virtqueue implementation to use.
17 */ 19 */
18struct virtqueue 20struct virtqueue {
19{ 21 struct list_head list;
20 void (*callback)(struct virtqueue *vq); 22 void (*callback)(struct virtqueue *vq);
23 const char *name;
21 struct virtio_device *vdev; 24 struct virtio_device *vdev;
22 struct virtqueue_ops *vq_ops; 25 struct virtqueue_ops *vq_ops;
23 void *priv; 26 void *priv;
@@ -76,15 +79,16 @@ struct virtqueue_ops {
76 * @dev: underlying device. 79 * @dev: underlying device.
77 * @id: the device type identification (used to match it with a driver). 80 * @id: the device type identification (used to match it with a driver).
78 * @config: the configuration ops for this device. 81 * @config: the configuration ops for this device.
82 * @vqs: the list of virtqueues for this device.
79 * @features: the features supported by both driver and device. 83 * @features: the features supported by both driver and device.
80 * @priv: private pointer for the driver's use. 84 * @priv: private pointer for the driver's use.
81 */ 85 */
82struct virtio_device 86struct virtio_device {
83{
84 int index; 87 int index;
85 struct device dev; 88 struct device dev;
86 struct virtio_device_id id; 89 struct virtio_device_id id;
87 struct virtio_config_ops *config; 90 struct virtio_config_ops *config;
91 struct list_head vqs;
88 /* Note that this is a Linux set_bit-style bitmap. */ 92 /* Note that this is a Linux set_bit-style bitmap. */
89 unsigned long features[1]; 93 unsigned long features[1];
90 void *priv; 94 void *priv;
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index bf8ec283b232..9fae274751e0 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -55,7 +55,8 @@
55 * @find_vq: find a virtqueue and instantiate it. 55 * @find_vq: find a virtqueue and instantiate it.
56 * vdev: the virtio_device 56 * vdev: the virtio_device
57 * index: the 0-based virtqueue number in case there's more than one. 57 * index: the 0-based virtqueue number in case there's more than one.
58 * callback: the virqtueue callback 58 * callback: the virtqueue callback
59 * name: the virtqueue name (mainly for debugging)
59 * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT). 60 * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT).
60 * @del_vq: free a virtqueue found by find_vq(). 61 * @del_vq: free a virtqueue found by find_vq().
61 * @get_features: get the array of feature bits for this device. 62 * @get_features: get the array of feature bits for this device.
@@ -77,7 +78,8 @@ struct virtio_config_ops
77 void (*reset)(struct virtio_device *vdev); 78 void (*reset)(struct virtio_device *vdev);
78 struct virtqueue *(*find_vq)(struct virtio_device *vdev, 79 struct virtqueue *(*find_vq)(struct virtio_device *vdev,
79 unsigned index, 80 unsigned index,
80 void (*callback)(struct virtqueue *)); 81 void (*callback)(struct virtqueue *),
82 const char *name);
81 void (*del_vq)(struct virtqueue *vq); 83 void (*del_vq)(struct virtqueue *vq);
82 u32 (*get_features)(struct virtio_device *vdev); 84 u32 (*get_features)(struct virtio_device *vdev);
83 void (*finalize_features)(struct virtio_device *vdev); 85 void (*finalize_features)(struct virtio_device *vdev);
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 71e03722fb59..166c519689de 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -119,7 +119,8 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
119 struct virtio_device *vdev, 119 struct virtio_device *vdev,
120 void *pages, 120 void *pages,
121 void (*notify)(struct virtqueue *vq), 121 void (*notify)(struct virtqueue *vq),
122 void (*callback)(struct virtqueue *vq)); 122 void (*callback)(struct virtqueue *vq),
123 const char *name);
123void vring_del_virtqueue(struct virtqueue *vq); 124void vring_del_virtqueue(struct virtqueue *vq);
124/* Filter out transport-specific feature bits. */ 125/* Filter out transport-specific feature bits. */
125void vring_transport_features(struct virtio_device *vdev); 126void vring_transport_features(struct virtio_device *vdev);