X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fvirtio%2Fvirtio_user%2Fvirtio_user_dev.h;h=1c8c98b1cd5aa333c617dee26ab2999664455d23;hb=44102e6298e788e4736befaa69cfd3d6f126830a;hp=d2d4cb8258755e7c363a53ad63cc5166dc712dde;hpb=201a41651715741de201269c6f76c6a684f790d1;p=dpdk.git diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h index d2d4cb8258..1c8c98b1cd 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h @@ -9,9 +9,22 @@ #include #include "../virtio_pci.h" #include "../virtio_ring.h" -#include "vhost.h" + +enum virtio_user_backend_type { + VIRTIO_USER_BACKEND_UNKNOWN, + VIRTIO_USER_BACKEND_VHOST_USER, + VIRTIO_USER_BACKEND_VHOST_KERNEL, + VIRTIO_USER_BACKEND_VHOST_VDPA, +}; + +struct virtio_user_queue { + uint16_t used_idx; + bool avail_wrap_counter; + bool used_wrap_counter; +}; struct virtio_user_dev { + enum virtio_user_backend_type backend_type; /* for vhost_user backend */ int vhostfd; int listenfd; /* listening fd */ @@ -33,22 +46,40 @@ struct virtio_user_dev { * and will be sync with device */ uint64_t device_features; /* supported features by device */ + uint64_t frontend_features; /* enabled frontend features */ + uint64_t unsupported_features; /* unsupported features mask */ + uint64_t protocol_features; /* negotiated protocol features + * (Vhost-user only) + */ uint8_t status; + uint16_t net_status; uint16_t port_id; - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; char path[PATH_MAX]; - struct vring vrings[VIRTIO_MAX_VIRTQUEUES]; + union { + struct vring vrings[VIRTIO_MAX_VIRTQUEUES]; + struct vring_packed packed_vrings[VIRTIO_MAX_VIRTQUEUES]; + }; + struct virtio_user_queue packed_queues[VIRTIO_MAX_VIRTQUEUES]; + bool qp_enabled[VIRTIO_MAX_VIRTQUEUE_PAIRS]; + struct virtio_user_backend_ops *ops; pthread_mutex_t mutex; bool started; }; -int is_vhost_user_by_type(const char *path); int virtio_user_start_device(struct virtio_user_dev *dev); int virtio_user_stop_device(struct virtio_user_dev *dev); int virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, - int cq, int queue_size, const char *mac, char **ifname); + int cq, int queue_size, const char *mac, char **ifname, + int server, int mrg_rxbuf, int in_order, + int packed_vq, + enum virtio_user_backend_type backend_type); void virtio_user_dev_uninit(struct virtio_user_dev *dev); void virtio_user_handle_cq(struct virtio_user_dev *dev, uint16_t queue_idx); +void virtio_user_handle_cq_packed(struct virtio_user_dev *dev, + uint16_t queue_idx); uint8_t virtio_user_handle_mq(struct virtio_user_dev *dev, uint16_t q_pairs); +int virtio_user_send_status_update(struct virtio_user_dev *dev, uint8_t status); +int virtio_user_update_status(struct virtio_user_dev *dev); #endif