Blame view
include/linux/virtio.h
3.45 KB
ec3d41c4d Virtio interface |
1 2 3 4 5 6 7 8 9 |
#ifndef _LINUX_VIRTIO_H #define _LINUX_VIRTIO_H /* Everything a virtio driver needs to work with any particular virtio * implementation. */ #include <linux/types.h> #include <linux/scatterlist.h> #include <linux/spinlock.h> #include <linux/device.h> #include <linux/mod_devicetable.h> |
bbd603efb virtio: add_buf_gfp |
10 |
#include <linux/gfp.h> |
ec3d41c4d Virtio interface |
11 12 13 |
/** * virtqueue - a queue to register buffers for sending or receiving. |
9499f5e7e virtio: add names... |
14 |
* @list: the chain of virtqueues for this device |
ec3d41c4d Virtio interface |
15 |
* @callback: the function to call when buffers are consumed (can be NULL). |
9499f5e7e virtio: add names... |
16 |
* @name: the name of this virtqueue (mainly for debugging) |
ec3d41c4d Virtio interface |
17 |
* @vdev: the virtio device this queue was created for. |
ec3d41c4d Virtio interface |
18 19 |
* @priv: a pointer for the virtqueue implementation to use. */ |
9499f5e7e virtio: add names... |
20 21 |
struct virtqueue { struct list_head list; |
18445c4d5 virtio: explicit ... |
22 |
void (*callback)(struct virtqueue *vq); |
9499f5e7e virtio: add names... |
23 |
const char *name; |
ec3d41c4d Virtio interface |
24 |
struct virtio_device *vdev; |
ec3d41c4d Virtio interface |
25 26 |
void *priv; }; |
f96fde41f virtio: rename vi... |
27 28 29 30 31 32 |
int virtqueue_add_buf(struct virtqueue *vq, struct scatterlist sg[], unsigned int out_num, unsigned int in_num, void *data, gfp_t gfp); |
ec3d41c4d Virtio interface |
33 |
|
7c5e9ed0c virtio_ring: remo... |
34 |
void virtqueue_kick(struct virtqueue *vq); |
ec3d41c4d Virtio interface |
35 |
|
41f0377f7 virtio: support u... |
36 37 38 |
bool virtqueue_kick_prepare(struct virtqueue *vq); void virtqueue_notify(struct virtqueue *vq); |
7c5e9ed0c virtio_ring: remo... |
39 |
void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len); |
316f25f5b virtio: add virtq... |
40 |
|
7c5e9ed0c virtio_ring: remo... |
41 |
void virtqueue_disable_cb(struct virtqueue *vq); |
316f25f5b virtio: add virtq... |
42 |
|
7c5e9ed0c virtio_ring: remo... |
43 |
bool virtqueue_enable_cb(struct virtqueue *vq); |
316f25f5b virtio: add virtq... |
44 |
|
7ab358c23 virtio: add api f... |
45 |
bool virtqueue_enable_cb_delayed(struct virtqueue *vq); |
7c5e9ed0c virtio_ring: remo... |
46 |
void *virtqueue_detach_unused_buf(struct virtqueue *vq); |
316f25f5b virtio: add virtq... |
47 |
|
8f9f4668b Add ethtool -g su... |
48 |
unsigned int virtqueue_get_vring_size(struct virtqueue *vq); |
ec3d41c4d Virtio interface |
49 50 51 52 53 54 |
/** * virtio_device - representation of a device using virtio * @index: unique position on the virtio bus * @dev: underlying device. * @id: the device type identification (used to match it with a driver). * @config: the configuration ops for this device. |
9499f5e7e virtio: add names... |
55 |
* @vqs: the list of virtqueues for this device. |
c45a6816c virtio: explicit ... |
56 |
* @features: the features supported by both driver and device. |
ec3d41c4d Virtio interface |
57 58 |
* @priv: private pointer for the driver's use. */ |
9499f5e7e virtio: add names... |
59 |
struct virtio_device { |
ec3d41c4d Virtio interface |
60 61 62 63 |
int index; struct device dev; struct virtio_device_id id; struct virtio_config_ops *config; |
9499f5e7e virtio: add names... |
64 |
struct list_head vqs; |
c45a6816c virtio: explicit ... |
65 66 |
/* Note that this is a Linux set_bit-style bitmap. */ unsigned long features[1]; |
ec3d41c4d Virtio interface |
67 68 |
void *priv; }; |
86c843738 net/9p: Add sysfs... |
69 |
#define dev_to_virtio(dev) container_of(dev, struct virtio_device, dev) |
ec3d41c4d Virtio interface |
70 71 72 73 74 75 76 |
int register_virtio_device(struct virtio_device *dev); void unregister_virtio_device(struct virtio_device *dev); /** * virtio_driver - operations for a virtio I/O driver * @driver: underlying device driver (populate name and owner). * @id_table: the ids serviced by this driver. |
5f41f8bfc virtio.h: correct... |
77 |
* @feature_table: an array of feature numbers supported by this driver. |
c45a6816c virtio: explicit ... |
78 |
* @feature_table_size: number of entries in the feature table array. |
20f77f565 virtio: fix obsol... |
79 |
* @probe: the function to call when a device is found. Returns 0 or -errno. |
5f41f8bfc virtio.h: correct... |
80 |
* @remove: the function to call when a device is removed. |
f957d1f05 virtio: configura... |
81 82 |
* @config_changed: optional function to call when the device configuration * changes; may be called in interrupt context. |
ec3d41c4d Virtio interface |
83 84 85 86 |
*/ struct virtio_driver { struct device_driver driver; const struct virtio_device_id *id_table; |
c45a6816c virtio: explicit ... |
87 88 |
const unsigned int *feature_table; unsigned int feature_table_size; |
ec3d41c4d Virtio interface |
89 90 |
int (*probe)(struct virtio_device *dev); void (*remove)(struct virtio_device *dev); |
f957d1f05 virtio: configura... |
91 |
void (*config_changed)(struct virtio_device *dev); |
f0fe6f115 virtio: pci: add ... |
92 93 94 95 96 |
#ifdef CONFIG_PM int (*freeze)(struct virtio_device *dev); int (*thaw)(struct virtio_device *dev); int (*restore)(struct virtio_device *dev); #endif |
ec3d41c4d Virtio interface |
97 98 99 100 101 |
}; int register_virtio_driver(struct virtio_driver *drv); void unregister_virtio_driver(struct virtio_driver *drv); #endif /* _LINUX_VIRTIO_H */ |