From 72ebd59086b7585af806f6ea94c7fe7a08e21396 Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Fri, 1 Sep 2017 09:30:31 +0200 Subject: [PATCH] rte_virtio: removed pci/user distinctions in common virtio_hw path This patch removes unnecessary if (hw->virtio_user_dev) conditions. It also makes vq_ring_mem explicitly a physical address. There's already a separate vq_ring_virt_mem field that's used for vhost-user. Change-Id: Ie8d97458744b4e3ae9d0e3d72b28d29f19179706 Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/376965 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp --- lib/bdev/virtio/rte_virtio/virtio_dev.c | 17 ++++++----------- lib/bdev/virtio/rte_virtio/virtio_queue.h | 5 ++--- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/bdev/virtio/rte_virtio/virtio_dev.c b/lib/bdev/virtio/rte_virtio/virtio_dev.c index b6bbd47e9..d07e6a092 100644 --- a/lib/bdev/virtio/rte_virtio/virtio_dev.c +++ b/lib/bdev/virtio/rte_virtio/virtio_dev.c @@ -180,14 +180,6 @@ virtio_init_queue(struct virtio_hw *hw, uint16_t vtpci_queue_idx) vq->mz = mz; - /* For virtio_user case (that is when hw->dev is NULL), we use - * virtual address. And we need properly set _offset_, please see - * VIRTIO_MBUF_DATA_DMA_ADDR in virtqueue.h for more information. - */ - if (hw->virtio_user_dev) { - vq->vq_ring_mem = (uintptr_t)mz->addr; - } - if (VTPCI_OPS(hw)->setup_queue(hw, vq) < 0) { PMD_INIT_LOG(ERR, "setup_queue failed"); return -EINVAL; @@ -312,9 +304,12 @@ virtio_init_device(struct virtio_hw *hw, uint64_t req_features) vtpci_read_dev_config(hw, offsetof(struct virtio_scsi_config, num_queues), &hw->max_queues, sizeof(hw->max_queues)); - if (!hw->virtio_user_dev) { - hw->max_queues = 3; - } + /* FIXME + * Hardcode num_queues to 3 until we add proper + * mutli-queue support. This value should be limited + * by number of cores assigned to SPDK + */ + hw->max_queues = 3; ret = virtio_alloc_queues(hw); if (ret < 0) diff --git a/lib/bdev/virtio/rte_virtio/virtio_queue.h b/lib/bdev/virtio/rte_virtio/virtio_queue.h index 2f6e114f5..8bca43719 100644 --- a/lib/bdev/virtio/rte_virtio/virtio_queue.h +++ b/lib/bdev/virtio/rte_virtio/virtio_queue.h @@ -83,13 +83,12 @@ struct virtqueue { uint16_t vq_free_cnt; /**< num of desc available */ uint16_t vq_avail_idx; /**< sync until needed */ - void *vq_ring_virt_mem; /**< linear address of vring*/ + void *vq_ring_virt_mem; /**< virtual address of vring */ unsigned int vq_ring_size; const struct rte_memzone *mz; /**< mem zone to populate TX ring. */ - phys_addr_t vq_ring_mem; /**< physical address of vring, - * or virtual address for virtio_user. */ + phys_addr_t vq_ring_mem; /**< physical address of vring */ /** * Head of the free chain in the descriptor table. If