net/virtio-user: support control VQ for packed
[dpdk.git] / drivers / net / virtio / virtio_user / virtio_user_dev.h
index 672a816..c57b298 100644 (file)
 #include "../virtio_ring.h"
 #include "vhost.h"
 
+struct virtio_user_queue {
+       uint16_t used_idx;
+       bool avail_wrap_counter;
+       bool used_wrap_counter;
+};
+
 struct virtio_user_dev {
        /* for vhost_user backend */
        int             vhostfd;
@@ -39,7 +45,12 @@ struct virtio_user_dev {
        uint16_t        port_id;
        uint8_t         mac_addr[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];
+
        struct virtio_user_backend_ops *ops;
        pthread_mutex_t mutex;
        bool            started;
@@ -53,5 +64,7 @@ int virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
                         int mrg_rxbuf, int in_order, int packed_vq);
 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);
 #endif