Commit 72ebd590 authored by Dariusz Stojaczyk's avatar Dariusz Stojaczyk Committed by Daniel Verkamp
Browse files

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: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/376965


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent de2ecd9d
Loading
Loading
Loading
Loading
+6 −11
Original line number Diff line number Diff line
@@ -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) {
	/* 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)
+2 −3
Original line number Diff line number Diff line
@@ -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