test mbuf attach
[dpdk.git] / examples / vhost_blk / vhost_blk.h
index 933e2b7..540998e 100644 (file)
@@ -30,23 +30,23 @@ struct vring_packed_desc {
 #endif
 
 struct vhost_blk_queue {
-       struct rte_vhost_vring vq;
-       struct rte_vhost_ring_inflight inflight_vq;
+       struct rte_vhost_vring vring;
+       struct rte_vhost_ring_inflight inflight_ring;
+
        uint16_t last_avail_idx;
        uint16_t last_used_idx;
+       uint16_t id;
+
        bool avail_wrap_counter;
        bool used_wrap_counter;
+       bool packed_ring;
+
+       struct vhost_blk_task *tasks;
 };
 
 #define NUM_OF_BLK_QUEUES 1
 
-#define min(a, b) (((a) < (b)) ? (a) : (b))
-
 struct vhost_block_dev {
-       /** ID for vhost library. */
-       int vid;
-       /** Queues for the block device */
-       struct vhost_blk_queue queues[NUM_OF_BLK_QUEUES];
        /** Unique name for this block device. */
        char name[64];
 
@@ -68,8 +68,10 @@ struct vhost_block_dev {
 
 struct vhost_blk_ctrlr {
        uint8_t started;
-       uint8_t packed_ring;
-       uint8_t need_restart;
+       /** ID for vhost library. */
+       int vid;
+       /** Queues for the block device */
+       struct vhost_blk_queue queues[NUM_OF_BLK_QUEUES];
        /** Only support 1 LUN for the example */
        struct vhost_block_dev *bdev;
        /** VM memory region */
@@ -85,35 +87,24 @@ enum blk_data_dir {
 };
 
 struct vhost_blk_task {
-       uint8_t readtype;
        uint8_t req_idx;
-       uint16_t head_idx;
-       uint16_t last_idx;
+       uint16_t chain_num;
        uint16_t inflight_idx;
        uint16_t buffer_id;
        uint32_t dxfer_dir;
        uint32_t data_len;
-       struct virtio_blk_outhdr *req;
 
+       struct virtio_blk_outhdr *req;
        volatile uint8_t *status;
-
        struct iovec iovs[VHOST_BLK_MAX_IOVS];
        uint32_t iovs_cnt;
-       struct vring_packed_desc *desc_packed;
-       struct vring_desc *desc_split;
-       struct rte_vhost_vring *vq;
-       struct vhost_block_dev *bdev;
-       struct vhost_blk_ctrlr *ctrlr;
-};
 
-struct inflight_blk_task {
-       struct vhost_blk_task blk_task;
-       struct rte_vhost_inflight_desc_packed *inflight_desc;
-       struct rte_vhost_inflight_info_packed *inflight_packed;
+       struct vhost_blk_queue *vq;
+       struct vhost_blk_ctrlr *ctrlr;
 };
 
-struct vhost_blk_ctrlr *g_vhost_ctrlr;
-struct vhost_device_ops vhost_blk_device_ops;
+extern struct vhost_blk_ctrlr *g_vhost_ctrlr;
+extern struct vhost_device_ops vhost_blk_device_ops;
 
 int vhost_bdev_process_blk_commands(struct vhost_block_dev *bdev,
                                     struct vhost_blk_task *task);