diff --git a/lib/bdev/virtio/rte_virtio/virtio_pci.c b/lib/bdev/virtio/rte_virtio/virtio_pci.c index 080768aa8..9bc831df8 100644 --- a/lib/bdev/virtio/rte_virtio/virtio_pci.c +++ b/lib/bdev/virtio/rte_virtio/virtio_pci.c @@ -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); diff --git a/lib/bdev/virtio/rte_virtio/virtio_pci.h b/lib/bdev/virtio/rte_virtio/virtio_pci.h index c098e8a22..e6cb89d9f 100644 --- a/lib/bdev/virtio/rte_virtio/virtio_pci.h +++ b/lib/bdev/virtio/rte_virtio/virtio_pci.h @@ -38,12 +38,17 @@ #include #include +#include #include #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 {