Merge branch 'for-4.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj...
[deliverable/linux.git] / tools / virtio / linux / virtio.h
CommitLineData
4e53f78e
MT
1#ifndef LINUX_VIRTIO_H
2#define LINUX_VIRTIO_H
61d0b5a4
RR
3#include <linux/scatterlist.h>
4#include <linux/kernel.h>
4e53f78e 5
4e53f78e
MT
6struct virtio_device {
7 void *dev;
d0254773 8 u64 features;
4e53f78e
MT
9};
10
11struct virtqueue {
12 /* TODO: commented as list macros are empty stubs for now.
13 * Broken but enough for virtio_ring.c
14 * struct list_head list; */
15 void (*callback)(struct virtqueue *vq);
16 const char *name;
17 struct virtio_device *vdev;
73640c99
MT
18 unsigned int index;
19 unsigned int num_free;
4e53f78e
MT
20 void *priv;
21};
22
4e53f78e 23/* Interfaces exported by virtio_ring. */
13816c76
RR
24int virtqueue_add_sgs(struct virtqueue *vq,
25 struct scatterlist *sgs[],
26 unsigned int out_sgs,
27 unsigned int in_sgs,
28 void *data,
29 gfp_t gfp);
30
e538ebaf
RR
31int virtqueue_add_outbuf(struct virtqueue *vq,
32 struct scatterlist sg[], unsigned int num,
33 void *data,
34 gfp_t gfp);
35
36int virtqueue_add_inbuf(struct virtqueue *vq,
37 struct scatterlist sg[], unsigned int num,
38 void *data,
39 gfp_t gfp);
40
d1b8c4c2 41bool virtqueue_kick(struct virtqueue *vq);
4e53f78e
MT
42
43void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
44
45void virtqueue_disable_cb(struct virtqueue *vq);
46
47bool virtqueue_enable_cb(struct virtqueue *vq);
64d09888 48bool virtqueue_enable_cb_delayed(struct virtqueue *vq);
4e53f78e
MT
49
50void *virtqueue_detach_unused_buf(struct virtqueue *vq);
73640c99
MT
51struct virtqueue *vring_new_virtqueue(unsigned int index,
52 unsigned int num,
4e53f78e
MT
53 unsigned int vring_align,
54 struct virtio_device *vdev,
7b21e34f 55 bool weak_barriers,
4e53f78e 56 void *pages,
d1b8c4c2 57 bool (*notify)(struct virtqueue *vq),
4e53f78e
MT
58 void (*callback)(struct virtqueue *vq),
59 const char *name);
60void vring_del_virtqueue(struct virtqueue *vq);
61
62#endif
This page took 0.230841 seconds and 5 git commands to generate.