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

rte_virtio: disable legacy PCI for dpdk < 17.05-rc4



17.05-rc4 is the version e.g.
rte_pci_ioport_read function was
introduced in. The bdev_virtio
module previously did not compile
with older DPDK versions.

Change-Id: Ib96d5d7934166acc552515b02bfba25b71929438
Signed-off-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382829


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 901aafe6
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -71,12 +71,6 @@ check_vq_phys_addr_ok(struct virtqueue *vq)
	return 1;
}

static struct rte_pci_ioport *
vtpci_io(struct virtio_dev *vdev)
{
	return &g_virtio_driver.internal[vdev->id].io;
}

static void
free_virtio_hw(struct virtio_dev *dev)
{
@@ -94,6 +88,14 @@ free_virtio_hw(struct virtio_dev *dev)
	free(hw);
}

#ifdef PCI_LEGACY_SUPPORT

static struct rte_pci_ioport *
vtpci_io(struct virtio_dev *vdev)
{
	return &g_virtio_driver.internal[vdev->id].io;
}

/*
 * Since we are in legacy mode:
 * http://ozlabs.org/~rusty/virtio-spec/virtio-0.9.5.pdf
@@ -275,6 +277,8 @@ const struct virtio_pci_ops legacy_ops = {
	.dump_json_config = pci_dump_json_config,
};

#endif /* PCI_LEGACY_SUPPORT */

static inline void
io_write64_twopart(uint64_t val, uint32_t *lo, uint32_t *hi)
{
@@ -695,6 +699,7 @@ pci_enum_virtio_probe_cb(void *ctx, struct spdk_pci_device *pci_dev)
		return 0;
	}

#ifdef PCI_LEGACY_SUPPORT
#if 0
	PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
	if (rte_pci_ioport_map(dev, 0, vtpci_io(hw)) < 0) {
@@ -717,6 +722,7 @@ pci_enum_virtio_probe_cb(void *ctx, struct spdk_pci_device *pci_dev)
	vdev->modern = 0;
	virtio_dev_pci_init(vdev);
	return 0;
#endif

err:
	free_virtio_hw(vdev);
+7 −0
Original line number Diff line number Diff line
@@ -38,12 +38,17 @@
#include <linux/virtio_config.h>
#include <linux/virtio_pci.h>

#include <rte_version.h>
#include <rte_pci.h>

#include "spdk/env.h"
#include "spdk/json.h"
#include "virtio_dev.h"

#if RTE_VERSION >= RTE_VERSION_NUM(17, 05, 0, 4)
#define PCI_LEGACY_SUPPORT
#endif

struct virtqueue;

#define VIRTIO_MAX_DEVICES 128
@@ -119,7 +124,9 @@ struct virtio_hw {
 */
struct vtpci_internal {
	const struct virtio_pci_ops *vtpci_ops;
#ifdef PCI_LEGACY_SUPPORT
	struct rte_pci_ioport io;
#endif
};

struct virtio_driver {