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 <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/376965
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-09-01 09:30:31 +02:00 committed by Daniel Verkamp
parent de2ecd9db1
commit 72ebd59086
2 changed files with 8 additions and 14 deletions

View File

@ -180,14 +180,6 @@ virtio_init_queue(struct virtio_hw *hw, uint16_t vtpci_queue_idx)
vq->mz = mz; 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) { if (VTPCI_OPS(hw)->setup_queue(hw, vq) < 0) {
PMD_INIT_LOG(ERR, "setup_queue failed"); PMD_INIT_LOG(ERR, "setup_queue failed");
return -EINVAL; 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), vtpci_read_dev_config(hw, offsetof(struct virtio_scsi_config, num_queues),
&hw->max_queues, sizeof(hw->max_queues)); &hw->max_queues, sizeof(hw->max_queues));
if (!hw->virtio_user_dev) { /* FIXME
hw->max_queues = 3; * 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); ret = virtio_alloc_queues(hw);
if (ret < 0) if (ret < 0)

View File

@ -83,13 +83,12 @@ struct virtqueue {
uint16_t vq_free_cnt; /**< num of desc available */ uint16_t vq_free_cnt; /**< num of desc available */
uint16_t vq_avail_idx; /**< sync until needed */ 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; unsigned int vq_ring_size;
const struct rte_memzone *mz; /**< mem zone to populate TX ring. */ const struct rte_memzone *mz; /**< mem zone to populate TX ring. */
phys_addr_t vq_ring_mem; /**< physical address of vring, phys_addr_t vq_ring_mem; /**< physical address of vring */
* or virtual address for virtio_user. */
/** /**
* Head of the free chain in the descriptor table. If * Head of the free chain in the descriptor table. If