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: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382829
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-10-17 19:44:27 +02:00 committed by Daniel Verkamp
parent 901aafe675
commit fb99e9e644
2 changed files with 19 additions and 6 deletions

View File

@ -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);

View File

@ -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 {