diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-20 11:37:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-20 11:37:05 -0500 |
commit | b7dfde956daee23f4439d0c8562a5e38b43e79d9 (patch) | |
tree | 2ed71fb5c5eac6957fd1e1ad0a67be6c3282167a /include | |
parent | 03c850ec327c42a97e44c448b75983e12da417d9 (diff) | |
parent | 1b6370463e88b0c1c317de16d7b962acc1dab4f2 (diff) |
Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull virtio update from Rusty Russell:
"Some nice cleanups, and even a patch my wife did as a "live" demo for
Latinoware 2012.
There's a slightly non-trivial merge in virtio-net, as we cleaned up
the virtio add_buf interface while DaveM accepted the mq virtio-net
patches."
* tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (27 commits)
virtio_console: Add support for remoteproc serial
virtio_console: Merge struct buffer_token into struct port_buffer
virtio: add drv_to_virtio to make code clearly
virtio: use dev_to_virtio wrapper in virtio
virtio-mmio: Fix irq parsing in command line parameter
virtio_console: Free buffers from out-queue upon close
virtio: Convert dev_printk(KERN_<LEVEL> to dev_<level>(
virtio_console: Use kmalloc instead of kzalloc
virtio_console: Free buffer if splice fails
virtio: tools: make it clear that virtqueue_add_buf() no longer returns > 0
virtio: scsi: make it clear that virtqueue_add_buf() no longer returns > 0
virtio: rpmsg: make it clear that virtqueue_add_buf() no longer returns > 0
virtio: net: make it clear that virtqueue_add_buf() no longer returns > 0
virtio: console: make it clear that virtqueue_add_buf() no longer returns > 0
virtio: make virtqueue_add_buf() returning 0 on success, not capacity.
virtio: console: don't rely on virtqueue_add_buf() returning capacity.
virtio_net: don't rely on virtqueue_add_buf() returning capacity.
virtio-net: remove unused skb_vnet_hdr->num_sg field
virtio-net: correct capacity math on ring full
virtio: move queue_index and num_free fields into core struct virtqueue.
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/virtio.h | 25 | ||||
-rw-r--r-- | include/linux/virtio_scsi.h | 28 | ||||
-rw-r--r-- | include/uapi/linux/virtio_ids.h | 1 |
3 files changed, 50 insertions, 4 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 533b1157f22e..cf8adb1f5b2c 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
@@ -16,12 +16,20 @@ | |||
16 | * @name: the name of this virtqueue (mainly for debugging) | 16 | * @name: the name of this virtqueue (mainly for debugging) |
17 | * @vdev: the virtio device this queue was created for. | 17 | * @vdev: the virtio device this queue was created for. |
18 | * @priv: a pointer for the virtqueue implementation to use. | 18 | * @priv: a pointer for the virtqueue implementation to use. |
19 | * @index: the zero-based ordinal number for this queue. | ||
20 | * @num_free: number of elements we expect to be able to fit. | ||
21 | * | ||
22 | * A note on @num_free: with indirect buffers, each buffer needs one | ||
23 | * element in the queue, otherwise a buffer will need one element per | ||
24 | * sg element. | ||
19 | */ | 25 | */ |
20 | struct virtqueue { | 26 | struct virtqueue { |
21 | struct list_head list; | 27 | struct list_head list; |
22 | void (*callback)(struct virtqueue *vq); | 28 | void (*callback)(struct virtqueue *vq); |
23 | const char *name; | 29 | const char *name; |
24 | struct virtio_device *vdev; | 30 | struct virtio_device *vdev; |
31 | unsigned int index; | ||
32 | unsigned int num_free; | ||
25 | void *priv; | 33 | void *priv; |
26 | }; | 34 | }; |
27 | 35 | ||
@@ -50,7 +58,11 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq); | |||
50 | 58 | ||
51 | unsigned int virtqueue_get_vring_size(struct virtqueue *vq); | 59 | unsigned int virtqueue_get_vring_size(struct virtqueue *vq); |
52 | 60 | ||
53 | int virtqueue_get_queue_index(struct virtqueue *vq); | 61 | /* FIXME: Obsolete accessor, but required for virtio_net merge. */ |
62 | static inline unsigned int virtqueue_get_queue_index(struct virtqueue *vq) | ||
63 | { | ||
64 | return vq->index; | ||
65 | } | ||
54 | 66 | ||
55 | /** | 67 | /** |
56 | * virtio_device - representation of a device using virtio | 68 | * virtio_device - representation of a device using virtio |
@@ -73,7 +85,11 @@ struct virtio_device { | |||
73 | void *priv; | 85 | void *priv; |
74 | }; | 86 | }; |
75 | 87 | ||
76 | #define dev_to_virtio(dev) container_of(dev, struct virtio_device, dev) | 88 | static inline struct virtio_device *dev_to_virtio(struct device *_dev) |
89 | { | ||
90 | return container_of(_dev, struct virtio_device, dev); | ||
91 | } | ||
92 | |||
77 | int register_virtio_device(struct virtio_device *dev); | 93 | int register_virtio_device(struct virtio_device *dev); |
78 | void unregister_virtio_device(struct virtio_device *dev); | 94 | void unregister_virtio_device(struct virtio_device *dev); |
79 | 95 | ||
@@ -103,6 +119,11 @@ struct virtio_driver { | |||
103 | #endif | 119 | #endif |
104 | }; | 120 | }; |
105 | 121 | ||
122 | static inline struct virtio_driver *drv_to_virtio(struct device_driver *drv) | ||
123 | { | ||
124 | return container_of(drv, struct virtio_driver, driver); | ||
125 | } | ||
126 | |||
106 | int register_virtio_driver(struct virtio_driver *drv); | 127 | int register_virtio_driver(struct virtio_driver *drv); |
107 | void unregister_virtio_driver(struct virtio_driver *drv); | 128 | void unregister_virtio_driver(struct virtio_driver *drv); |
108 | #endif /* _LINUX_VIRTIO_H */ | 129 | #endif /* _LINUX_VIRTIO_H */ |
diff --git a/include/linux/virtio_scsi.h b/include/linux/virtio_scsi.h index d6b4440387b7..4195b97a3def 100644 --- a/include/linux/virtio_scsi.h +++ b/include/linux/virtio_scsi.h | |||
@@ -1,7 +1,31 @@ | |||
1 | /* | ||
2 | * This header is BSD licensed so anyone can use the definitions to implement | ||
3 | * compatible drivers/servers. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * 1. Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * 2. Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
17 | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE | ||
18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
24 | * SUCH DAMAGE. | ||
25 | */ | ||
26 | |||
1 | #ifndef _LINUX_VIRTIO_SCSI_H | 27 | #ifndef _LINUX_VIRTIO_SCSI_H |
2 | #define _LINUX_VIRTIO_SCSI_H | 28 | #define _LINUX_VIRTIO_SCSI_H |
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. */ | ||
5 | 29 | ||
6 | #define VIRTIO_SCSI_CDB_SIZE 32 | 30 | #define VIRTIO_SCSI_CDB_SIZE 32 |
7 | #define VIRTIO_SCSI_SENSE_SIZE 96 | 31 | #define VIRTIO_SCSI_SENSE_SIZE 96 |
diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h index 270fb22c5811..a7630d04029f 100644 --- a/include/uapi/linux/virtio_ids.h +++ b/include/uapi/linux/virtio_ids.h | |||
@@ -37,5 +37,6 @@ | |||
37 | #define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */ | 37 | #define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */ |
38 | #define VIRTIO_ID_SCSI 8 /* virtio scsi */ | 38 | #define VIRTIO_ID_SCSI 8 /* virtio scsi */ |
39 | #define VIRTIO_ID_9P 9 /* 9p virtio console */ | 39 | #define VIRTIO_ID_9P 9 /* 9p virtio console */ |
40 | #define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */ | ||
40 | 41 | ||
41 | #endif /* _LINUX_VIRTIO_IDS_H */ | 42 | #endif /* _LINUX_VIRTIO_IDS_H */ |