xref: /qemu/include/net/vhost_net.h (revision 69e87b32680a41d9761191443587c595b6f5fc3f)
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;
13*69e87b32SJason Wang     uint32_t busyloop_timeout;
1481647a65SNikolay Nikolaev     void *opaque;
1581647a65SNikolay Nikolaev } VhostNetOptions;
1681647a65SNikolay Nikolaev 
17e2051e9eSYuanhan Liu uint64_t vhost_net_get_max_queues(VHostNetState *net);
1881647a65SNikolay Nikolaev struct vhost_net *vhost_net_init(VhostNetOptions *options);
19d5970055SMichael S. Tsirkin 
20a9f98bb5SJason Wang int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, int total_queues);
21a9f98bb5SJason Wang void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, int total_queues);
22d5970055SMichael S. Tsirkin 
23d5970055SMichael S. Tsirkin void vhost_net_cleanup(VHostNetState *net);
24d5970055SMichael S. Tsirkin 
259a2ba823SCornelia Huck uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features);
269a2ba823SCornelia Huck void vhost_net_ack_features(VHostNetState *net, uint64_t features);
27d5970055SMichael S. Tsirkin 
28f56a1247SMichael S. Tsirkin bool vhost_net_virtqueue_pending(VHostNetState *net, int n);
29f56a1247SMichael S. Tsirkin void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
30f56a1247SMichael S. Tsirkin                               int idx, bool mask);
313e866365SThibaut Collet int vhost_net_notify_migration_done(VHostNetState *net, char* mac_addr);
32ed8b4afeSNikolay Nikolaev VHostNetState *get_vhost_net(NetClientState *nc);
337263a0adSChangchun Ouyang 
347263a0adSChangchun Ouyang int vhost_set_vring_enable(NetClientState * nc, int enable);
35a463215bSMarc-André Lureau 
36a463215bSMarc-André Lureau uint64_t vhost_net_get_acked_features(VHostNetState *net);
37a463215bSMarc-André Lureau 
38d5970055SMichael S. Tsirkin #endif
39