diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-03-17 13:08:17 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-04-01 13:56:43 -0500 |
commit | d59700553ecbf052cce1e099e8f4dae2704fe424 (patch) | |
tree | f0f4d3afd94d374920b450ec14c18775762fcadb /hw/vhost.h | |
parent | ade80dc84527ae7418e9fcaf33e09574da0d2b29 (diff) |
vhost: vhost net support
This adds vhost net device support in qemu. Will be tied to tap device
and virtio by following patches. Raw backend is currently missing,
will be worked on/submitted separately.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/vhost.h')
-rw-r--r-- | hw/vhost.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/hw/vhost.h b/hw/vhost.h new file mode 100644 index 0000000000..86dd834dbe --- /dev/null +++ b/hw/vhost.h @@ -0,0 +1,48 @@ +#ifndef VHOST_H +#define VHOST_H + +#include "hw/hw.h" +#include "hw/virtio.h" + +/* Generic structures common for any vhost based device. */ +struct vhost_virtqueue { + int kick; + int call; + void *desc; + void *avail; + void *used; + int num; + unsigned long long used_phys; + unsigned used_size; + void *ring; + unsigned long long ring_phys; + unsigned ring_size; +}; + +typedef unsigned long vhost_log_chunk_t; +#define VHOST_LOG_PAGE 0x1000 +#define VHOST_LOG_BITS (8 * sizeof(vhost_log_chunk_t)) +#define VHOST_LOG_CHUNK (VHOST_LOG_PAGE * VHOST_LOG_BITS) + +struct vhost_memory; +struct vhost_dev { + CPUPhysMemoryClient client; + int control; + struct vhost_memory *mem; + struct vhost_virtqueue *vqs; + int nvqs; + unsigned long long features; + unsigned long long acked_features; + unsigned long long backend_features; + bool started; + bool log_enabled; + vhost_log_chunk_t *log; + unsigned long long log_size; +}; + +int vhost_dev_init(struct vhost_dev *hdev, int devfd); +void vhost_dev_cleanup(struct vhost_dev *hdev); +int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev); +void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev); + +#endif |