vhost_net.h (1653B)
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 unsigned int nvqs; 18 void *opaque; 19} VhostNetOptions; 20 21uint64_t vhost_net_get_max_queues(VHostNetState *net); 22struct vhost_net *vhost_net_init(VhostNetOptions *options); 23 24int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, int total_queues); 25void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, int total_queues); 26 27void vhost_net_cleanup(VHostNetState *net); 28 29uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features); 30void vhost_net_ack_features(VHostNetState *net, uint64_t features); 31 32int vhost_net_get_config(struct vhost_net *net, uint8_t *config, 33 uint32_t config_len); 34 35int vhost_net_set_config(struct vhost_net *net, const uint8_t *data, 36 uint32_t offset, uint32_t size, uint32_t flags); 37bool vhost_net_virtqueue_pending(VHostNetState *net, int n); 38void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev, 39 int idx, bool mask); 40int vhost_net_notify_migration_done(VHostNetState *net, char* mac_addr); 41VHostNetState *get_vhost_net(NetClientState *nc); 42 43int vhost_set_vring_enable(NetClientState * nc, int enable); 44 45uint64_t vhost_net_get_acked_features(VHostNetState *net); 46 47int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu); 48 49#endif