1#ifndef VHOST_NET_H
2#define VHOST_NET_H
3
4#include "net/net.h"
5#include "hw/virtio/vhost-backend.h"
6
7#define VHOST_NET_INIT_FAILED \
8 "vhost-net requested but could not be initialized"
9
10struct vhost_net;
11typedef struct vhost_net VHostNetState;
12
13typedef struct VhostNetOptions {
14 VhostBackendType backend_type;
15 NetClientState *net_backend;
16 uint32_t busyloop_timeout;
17 void *opaque;
18} VhostNetOptions;
19
20uint64_t vhost_net_get_max_queues(VHostNetState *net);
21struct vhost_net *vhost_net_init(VhostNetOptions *options);
22
23int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, int total_queues);
24void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, int total_queues);
25
26void vhost_net_cleanup(VHostNetState *net);
27
28uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features);
29void vhost_net_ack_features(VHostNetState *net, uint64_t features);
30
31bool vhost_net_virtqueue_pending(VHostNetState *net, int n);
32void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
33 int idx, bool mask);
34int vhost_net_notify_migration_done(VHostNetState *net, char* mac_addr);
35VHostNetState *get_vhost_net(NetClientState *nc);
36
37int vhost_set_vring_enable(NetClientState * nc, int enable);
38
39uint64_t vhost_net_get_acked_features(VHostNetState *net);
40
41int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu);
42
43#endif
44