Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / include / net / vhost_net.h
blobc6a5361a2ae45faeb6dc97b507c50af6de5a5d52
1 #ifndef VHOST_NET_H
2 #define VHOST_NET_H
4 #include "net/net.h"
5 #include "hw/virtio/vhost-backend.h"
7 struct vhost_net;
8 typedef struct vhost_net VHostNetState;
10 typedef struct VhostNetOptions {
11 VhostBackendType backend_type;
12 NetClientState *net_backend;
13 uint32_t busyloop_timeout;
14 unsigned int nvqs;
15 void *opaque;
16 } VhostNetOptions;
18 uint64_t vhost_net_get_max_queues(VHostNetState *net);
19 struct vhost_net *vhost_net_init(VhostNetOptions *options);
21 int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
22 int data_queue_pairs, int cvq);
23 void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs,
24 int data_queue_pairs, int cvq);
26 void vhost_net_cleanup(VHostNetState *net);
28 uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features);
29 void vhost_net_ack_features(VHostNetState *net, uint64_t features);
31 int vhost_net_get_config(struct vhost_net *net, uint8_t *config,
32 uint32_t config_len);
34 int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
35 uint32_t offset, uint32_t size, uint32_t flags);
36 bool vhost_net_virtqueue_pending(VHostNetState *net, int n);
37 void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
38 int idx, bool mask);
39 bool vhost_net_config_pending(VHostNetState *net);
40 void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask);
41 int vhost_net_notify_migration_done(VHostNetState *net, char* mac_addr);
42 VHostNetState *get_vhost_net(NetClientState *nc);
44 int vhost_set_vring_enable(NetClientState * nc, int enable);
46 uint64_t vhost_net_get_acked_features(VHostNetState *net);
48 int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu);
50 void vhost_net_virtqueue_reset(VirtIODevice *vdev, NetClientState *nc,
51 int vq_index);
52 int vhost_net_virtqueue_restart(VirtIODevice *vdev, NetClientState *nc,
53 int vq_index);
55 void vhost_net_save_acked_features(NetClientState *nc);
56 #endif