vhost_net.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef VHOST_NET_H
  2. #define VHOST_NET_H
  3. #include "net/net.h"
  4. #include "hw/virtio/vhost-backend.h"
  5. struct vhost_net;
  6. typedef struct vhost_net VHostNetState;
  7. typedef struct VhostNetOptions {
  8. VhostBackendType backend_type;
  9. NetClientState *net_backend;
  10. uint32_t busyloop_timeout;
  11. unsigned int nvqs;
  12. void *opaque;
  13. } VhostNetOptions;
  14. uint64_t vhost_net_get_max_queues(VHostNetState *net);
  15. struct vhost_net *vhost_net_init(VhostNetOptions *options);
  16. int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
  17. int data_queue_pairs, int cvq);
  18. void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs,
  19. int data_queue_pairs, int cvq);
  20. void vhost_net_cleanup(VHostNetState *net);
  21. uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features);
  22. void vhost_net_ack_features(VHostNetState *net, uint64_t features);
  23. int vhost_net_get_config(struct vhost_net *net, uint8_t *config,
  24. uint32_t config_len);
  25. int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
  26. uint32_t offset, uint32_t size, uint32_t flags);
  27. bool vhost_net_virtqueue_pending(VHostNetState *net, int n);
  28. void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
  29. int idx, bool mask);
  30. bool vhost_net_config_pending(VHostNetState *net);
  31. void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask);
  32. int vhost_net_notify_migration_done(VHostNetState *net, char* mac_addr);
  33. VHostNetState *get_vhost_net(NetClientState *nc);
  34. int vhost_set_vring_enable(NetClientState * nc, int enable);
  35. uint64_t vhost_net_get_acked_features(VHostNetState *net);
  36. int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu);
  37. void vhost_net_virtqueue_reset(VirtIODevice *vdev, NetClientState *nc,
  38. int vq_index);
  39. int vhost_net_virtqueue_restart(VirtIODevice *vdev, NetClientState *nc,
  40. int vq_index);
  41. void vhost_net_save_acked_features(NetClientState *nc);
  42. #endif