1#ifndef _LINUX_VIRTIO_RING_H
2#define _LINUX_VIRTIO_RING_H
3
4#include <linux/irqreturn.h>
5#include <uapi/linux/virtio_ring.h>
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23static inline void virtio_mb(bool weak_barriers)
24{
25#ifdef CONFIG_SMP
26 if (weak_barriers)
27 smp_mb();
28 else
29#endif
30 mb();
31}
32
33static inline void virtio_rmb(bool weak_barriers)
34{
35 if (weak_barriers)
36 dma_rmb();
37 else
38 rmb();
39}
40
41static inline void virtio_wmb(bool weak_barriers)
42{
43 if (weak_barriers)
44 dma_wmb();
45 else
46 wmb();
47}
48
49struct virtio_device;
50struct virtqueue;
51
52
53
54
55
56
57
58struct virtqueue *vring_create_virtqueue(unsigned int index,
59 unsigned int num,
60 unsigned int vring_align,
61 struct virtio_device *vdev,
62 bool weak_barriers,
63 bool may_reduce_num,
64 bool (*notify)(struct virtqueue *vq),
65 void (*callback)(struct virtqueue *vq),
66 const char *name);
67
68
69struct virtqueue *__vring_new_virtqueue(unsigned int index,
70 struct vring vring,
71 struct virtio_device *vdev,
72 bool weak_barriers,
73 bool (*notify)(struct virtqueue *),
74 void (*callback)(struct virtqueue *),
75 const char *name);
76
77
78
79
80
81struct virtqueue *vring_new_virtqueue(unsigned int index,
82 unsigned int num,
83 unsigned int vring_align,
84 struct virtio_device *vdev,
85 bool weak_barriers,
86 void *pages,
87 bool (*notify)(struct virtqueue *vq),
88 void (*callback)(struct virtqueue *vq),
89 const char *name);
90
91
92
93
94
95void vring_del_virtqueue(struct virtqueue *vq);
96
97
98void vring_transport_features(struct virtio_device *vdev);
99
100irqreturn_t vring_interrupt(int irq, void *_vq);
101#endif
102