5 #include "hw/virtio/vhost-backend.h"
7 #define VHOST_NET_INIT_FAILED \
8 "vhost-net requested but could not be initialized"
11 typedef struct vhost_net VHostNetState
;
13 typedef struct VhostNetOptions
{
14 VhostBackendType backend_type
;
15 NetClientState
*net_backend
;
16 uint32_t busyloop_timeout
;
21 uint64_t vhost_net_get_max_queues(VHostNetState
*net
);
22 struct vhost_net
*vhost_net_init(VhostNetOptions
*options
);
24 int vhost_net_start(VirtIODevice
*dev
, NetClientState
*ncs
,
25 int data_queue_pairs
, int cvq
);
26 void vhost_net_stop(VirtIODevice
*dev
, NetClientState
*ncs
,
27 int data_queue_pairs
, int cvq
);
29 void vhost_net_cleanup(VHostNetState
*net
);
31 uint64_t vhost_net_get_features(VHostNetState
*net
, uint64_t features
);
32 void vhost_net_ack_features(VHostNetState
*net
, uint64_t features
);
34 int vhost_net_get_config(struct vhost_net
*net
, uint8_t *config
,
37 int vhost_net_set_config(struct vhost_net
*net
, const uint8_t *data
,
38 uint32_t offset
, uint32_t size
, uint32_t flags
);
39 bool vhost_net_virtqueue_pending(VHostNetState
*net
, int n
);
40 void vhost_net_virtqueue_mask(VHostNetState
*net
, VirtIODevice
*dev
,
42 bool vhost_net_config_pending(VHostNetState
*net
);
43 void vhost_net_config_mask(VHostNetState
*net
, VirtIODevice
*dev
, bool mask
);
44 int vhost_net_notify_migration_done(VHostNetState
*net
, char* mac_addr
);
45 VHostNetState
*get_vhost_net(NetClientState
*nc
);
47 int vhost_set_vring_enable(NetClientState
* nc
, int enable
);
49 uint64_t vhost_net_get_acked_features(VHostNetState
*net
);
51 int vhost_net_set_mtu(struct vhost_net
*net
, uint16_t mtu
);
53 void vhost_net_virtqueue_reset(VirtIODevice
*vdev
, NetClientState
*nc
,
55 int vhost_net_virtqueue_restart(VirtIODevice
*vdev
, NetClientState
*nc
,
58 void vhost_net_save_acked_features(NetClientState
*nc
);