1d5970055SMichael S. Tsirkin #ifndef VHOST_NET_H 2d5970055SMichael S. Tsirkin #define VHOST_NET_H 3d5970055SMichael S. Tsirkin 41422e32dSPaolo Bonzini #include "net/net.h" 51a1bfac9SNikolay Nikolaev #include "hw/virtio/vhost-backend.h" 6d5970055SMichael S. Tsirkin 7d5970055SMichael S. Tsirkin struct vhost_net; 8d5970055SMichael S. Tsirkin typedef struct vhost_net VHostNetState; 9d5970055SMichael S. Tsirkin 1081647a65SNikolay Nikolaev typedef struct VhostNetOptions { 111a1bfac9SNikolay Nikolaev VhostBackendType backend_type; 1281647a65SNikolay Nikolaev NetClientState *net_backend; 1369e87b32SJason Wang uint32_t busyloop_timeout; 146a756d14SJason Wang unsigned int nvqs; 1581647a65SNikolay Nikolaev void *opaque; 1681647a65SNikolay Nikolaev } VhostNetOptions; 1781647a65SNikolay Nikolaev 18e2051e9eSYuanhan Liu uint64_t vhost_net_get_max_queues(VHostNetState *net); 1981647a65SNikolay Nikolaev struct vhost_net *vhost_net_init(VhostNetOptions *options); 20d5970055SMichael S. Tsirkin 2105ba3f63SJason Wang int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, 2205ba3f63SJason Wang int data_queue_pairs, int cvq); 2305ba3f63SJason Wang void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, 2405ba3f63SJason Wang int data_queue_pairs, int cvq); 25d5970055SMichael S. Tsirkin 26d5970055SMichael S. Tsirkin void vhost_net_cleanup(VHostNetState *net); 27d5970055SMichael S. Tsirkin 289a2ba823SCornelia Huck uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features); 299a2ba823SCornelia Huck void vhost_net_ack_features(VHostNetState *net, uint64_t features); 30d5970055SMichael S. Tsirkin 3138140cc4SCindy Lu int vhost_net_get_config(struct vhost_net *net, uint8_t *config, 3238140cc4SCindy Lu uint32_t config_len); 3338140cc4SCindy Lu 3438140cc4SCindy Lu int vhost_net_set_config(struct vhost_net *net, const uint8_t *data, 3538140cc4SCindy Lu uint32_t offset, uint32_t size, uint32_t flags); 36f56a1247SMichael S. Tsirkin bool vhost_net_virtqueue_pending(VHostNetState *net, int n); 37f56a1247SMichael S. Tsirkin void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev, 38f56a1247SMichael S. Tsirkin int idx, bool mask); 39*8aab0d1dSCindy Lu bool vhost_net_config_pending(VHostNetState *net); 40*8aab0d1dSCindy Lu void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask); 413e866365SThibaut Collet int vhost_net_notify_migration_done(VHostNetState *net, char* mac_addr); 42ed8b4afeSNikolay Nikolaev VHostNetState *get_vhost_net(NetClientState *nc); 437263a0adSChangchun Ouyang 447263a0adSChangchun Ouyang int vhost_set_vring_enable(NetClientState * nc, int enable); 45a463215bSMarc-André Lureau 46a463215bSMarc-André Lureau uint64_t vhost_net_get_acked_features(VHostNetState *net); 47a463215bSMarc-André Lureau 4845a368adSMaxime Coquelin int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu); 4945a368adSMaxime Coquelin 50c2daa08eSKangjie Xu void vhost_net_virtqueue_reset(VirtIODevice *vdev, NetClientState *nc, 51c2daa08eSKangjie Xu int vq_index); 5210f8a115SKangjie Xu int vhost_net_virtqueue_restart(VirtIODevice *vdev, NetClientState *nc, 5310f8a115SKangjie Xu int vq_index); 54c9bdc449SHyman Huang(黄勇) 55c9bdc449SHyman Huang(黄勇) void vhost_net_save_acked_features(NetClientState *nc); 56d5970055SMichael S. Tsirkin #endif 57