diff options
Diffstat (limited to 'include/linux/virtio.h')
| -rw-r--r-- | include/linux/virtio.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 5b0fce0d2aa2..aff5b4f74041 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <linux/spinlock.h> | 7 | #include <linux/spinlock.h> |
| 8 | #include <linux/device.h> | 8 | #include <linux/device.h> |
| 9 | #include <linux/mod_devicetable.h> | 9 | #include <linux/mod_devicetable.h> |
| 10 | #include <linux/gfp.h> | ||
| 10 | 11 | ||
| 11 | /** | 12 | /** |
| 12 | * virtqueue - a queue to register buffers for sending or receiving. | 13 | * virtqueue - a queue to register buffers for sending or receiving. |
| @@ -32,6 +33,7 @@ struct virtqueue { | |||
| 32 | * out_num: the number of sg readable by other side | 33 | * out_num: the number of sg readable by other side |
| 33 | * in_num: the number of sg which are writable (after readable ones) | 34 | * in_num: the number of sg which are writable (after readable ones) |
| 34 | * data: the token identifying the buffer. | 35 | * data: the token identifying the buffer. |
| 36 | * gfp: how to do memory allocations (if necessary). | ||
| 35 | * Returns remaining capacity of queue (sg segments) or a negative error. | 37 | * Returns remaining capacity of queue (sg segments) or a negative error. |
| 36 | * virtqueue_kick: update after add_buf | 38 | * virtqueue_kick: update after add_buf |
| 37 | * vq: the struct virtqueue | 39 | * vq: the struct virtqueue |
| @@ -60,11 +62,21 @@ struct virtqueue { | |||
| 60 | * All operations can be called in any context. | 62 | * All operations can be called in any context. |
| 61 | */ | 63 | */ |
| 62 | 64 | ||
| 63 | int virtqueue_add_buf(struct virtqueue *vq, | 65 | int virtqueue_add_buf_gfp(struct virtqueue *vq, |
| 64 | struct scatterlist sg[], | 66 | struct scatterlist sg[], |
| 65 | unsigned int out_num, | 67 | unsigned int out_num, |
| 66 | unsigned int in_num, | 68 | unsigned int in_num, |
| 67 | void *data); | 69 | void *data, |
| 70 | gfp_t gfp); | ||
| 71 | |||
| 72 | static inline int virtqueue_add_buf(struct virtqueue *vq, | ||
| 73 | struct scatterlist sg[], | ||
| 74 | unsigned int out_num, | ||
| 75 | unsigned int in_num, | ||
| 76 | void *data) | ||
| 77 | { | ||
| 78 | return virtqueue_add_buf_gfp(vq, sg, out_num, in_num, data, GFP_ATOMIC); | ||
| 79 | } | ||
| 68 | 80 | ||
| 69 | void virtqueue_kick(struct virtqueue *vq); | 81 | void virtqueue_kick(struct virtqueue *vq); |
| 70 | 82 | ||
