aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/virtio_ring.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/virtio_ring.h')
-rw-r--r--include/linux/virtio_ring.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 1a4ed49f6478..abe481ed990e 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -15,9 +15,13 @@
15/* This marks a buffer as write-only (otherwise read-only). */ 15/* This marks a buffer as write-only (otherwise read-only). */
16#define VRING_DESC_F_WRITE 2 16#define VRING_DESC_F_WRITE 2
17 17
18/* This means don't notify other side when buffer added. */ 18/* The Host uses this in used->flags to advise the Guest: don't kick me when
19 * you add a buffer. It's unreliable, so it's simply an optimization. Guest
20 * will still kick if it's out of buffers. */
19#define VRING_USED_F_NO_NOTIFY 1 21#define VRING_USED_F_NO_NOTIFY 1
20/* This means don't interrupt guest when buffer consumed. */ 22/* The Guest uses this in avail->flags to advise the Host: don't interrupt me
23 * when you consume a buffer. It's unreliable, so it's simply an
24 * optimization. */
21#define VRING_AVAIL_F_NO_INTERRUPT 1 25#define VRING_AVAIL_F_NO_INTERRUPT 1
22 26
23/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ 27/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */
@@ -89,7 +93,7 @@ struct vring {
89 * }; 93 * };
90 */ 94 */
91static inline void vring_init(struct vring *vr, unsigned int num, void *p, 95static inline void vring_init(struct vring *vr, unsigned int num, void *p,
92 unsigned int pagesize) 96 unsigned long pagesize)
93{ 97{
94 vr->num = num; 98 vr->num = num;
95 vr->desc = p; 99 vr->desc = p;
@@ -98,7 +102,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p,
98 & ~(pagesize - 1)); 102 & ~(pagesize - 1));
99} 103}
100 104
101static inline unsigned vring_size(unsigned int num, unsigned int pagesize) 105static inline unsigned vring_size(unsigned int num, unsigned long pagesize)
102{ 106{
103 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num) 107 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num)
104 + pagesize - 1) & ~(pagesize - 1)) 108 + pagesize - 1) & ~(pagesize - 1))
@@ -114,7 +118,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
114 struct virtio_device *vdev, 118 struct virtio_device *vdev,
115 void *pages, 119 void *pages,
116 void (*notify)(struct virtqueue *vq), 120 void (*notify)(struct virtqueue *vq),
117 bool (*callback)(struct virtqueue *vq)); 121 void (*callback)(struct virtqueue *vq));
118void vring_del_virtqueue(struct virtqueue *vq); 122void vring_del_virtqueue(struct virtqueue *vq);
119 123
120irqreturn_t vring_interrupt(int irq, void *_vq); 124irqreturn_t vring_interrupt(int irq, void *_vq);