diff --git a/lib/env_dpdk/env.c b/lib/env_dpdk/env.c index a5238e54d..59d6965d0 100644 --- a/lib/env_dpdk/env.c +++ b/lib/env_dpdk/env.c @@ -33,7 +33,7 @@ #include "spdk/stdinc.h" -#include "spdk/env.h" +#include "env_internal.h" #include #include @@ -246,9 +246,7 @@ spdk_mempool_get_name(struct spdk_mempool *mp) void spdk_mempool_free(struct spdk_mempool *mp) { -#if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 1) rte_mempool_free((struct rte_mempool *)mp); -#endif } void * @@ -285,11 +283,7 @@ spdk_mempool_put_bulk(struct spdk_mempool *mp, void **ele_arr, size_t count) size_t spdk_mempool_count(const struct spdk_mempool *pool) { -#if RTE_VERSION < RTE_VERSION_NUM(16, 7, 0, 1) - return rte_mempool_count((struct rte_mempool *)pool); -#else return rte_mempool_avail_count((struct rte_mempool *)pool); -#endif } bool diff --git a/lib/env_dpdk/env_internal.h b/lib/env_dpdk/env_internal.h index 1c4401dbb..eb7e8bf9f 100644 --- a/lib/env_dpdk/env_internal.h +++ b/lib/env_dpdk/env_internal.h @@ -53,6 +53,10 @@ extern struct rte_pci_bus rte_pci_bus; #endif #include +#if RTE_VERSION < RTE_VERSION_NUM(16, 11, 0, 0) +#error RTE_VERSION is too old! Minimum 16.11 is required. +#endif + /* x86-64 and ARM userspace virtual addresses use only the low 48 bits [0..47], * which is enough to cover 256 TB. */ diff --git a/lib/env_dpdk/pci.c b/lib/env_dpdk/pci.c index 608df3b06..e762124eb 100644 --- a/lib/env_dpdk/pci.c +++ b/lib/env_dpdk/pci.c @@ -50,10 +50,9 @@ spdk_pci_device_init(struct rte_pci_driver *driver, int rc; if (!ctx->cb_fn) { -#if RTE_VERSION >= RTE_VERSION_NUM(16, 11, 0, 0) && RTE_VERSION < RTE_VERSION_NUM(17, 02, 0, 1) +#if RTE_VERSION < RTE_VERSION_NUM(17, 02, 0, 1) rte_eal_pci_unmap_device(device); #endif - /* Return a positive value to indicate that this device does not belong to this driver, but * this isn't an error. */ return 1; @@ -78,12 +77,6 @@ spdk_pci_device_fini(struct rte_pci_device *device) void spdk_pci_device_detach(struct spdk_pci_device *device) { -#if RTE_VERSION >= RTE_VERSION_NUM(16, 11, 0, 0) -#if RTE_VERSION < RTE_VERSION_NUM(17, 05, 0, 0) - rte_eal_device_remove(&device->device); -#endif -#endif - #if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0) rte_eal_hotplug_remove("pci", device->device.name); #elif RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 3) @@ -102,6 +95,7 @@ spdk_pci_device_detach(struct spdk_pci_device *device) #elif RTE_VERSION >= RTE_VERSION_NUM(17, 05, 0, 4) rte_pci_detach(&device->addr); #else + rte_eal_device_remove(&device->device); rte_eal_pci_detach(&device->addr); #endif } @@ -286,11 +280,7 @@ spdk_pci_device_get_id(struct spdk_pci_device *pci_dev) int spdk_pci_device_get_socket_id(struct spdk_pci_device *pci_dev) { -#if RTE_VERSION >= RTE_VERSION_NUM(16, 11, 0, 0) return pci_dev->device.numa_node; -#else - return pci_dev->numa_node; -#endif } int diff --git a/lib/env_dpdk/pci_ioat.c b/lib/env_dpdk/pci_ioat.c index d06801605..6ed7d8ccc 100644 --- a/lib/env_dpdk/pci_ioat.c +++ b/lib/env_dpdk/pci_ioat.c @@ -92,15 +92,9 @@ static struct spdk_pci_enum_ctx g_ioat_pci_drv = { .driver = { .drv_flags = RTE_PCI_DRV_NEED_MAPPING, .id_table = ioat_driver_id, -#if RTE_VERSION >= RTE_VERSION_NUM(16, 11, 0, 0) .probe = spdk_pci_device_init, .remove = spdk_pci_device_fini, .driver.name = "spdk_ioat", -#else - .devinit = spdk_pci_device_init, - .devuninit = spdk_pci_device_fini, - .name = "spdk_ioat", -#endif }, .cb_fn = NULL, diff --git a/lib/env_dpdk/pci_nvme.c b/lib/env_dpdk/pci_nvme.c index a6d6e5fb3..d7a82a8e1 100644 --- a/lib/env_dpdk/pci_nvme.c +++ b/lib/env_dpdk/pci_nvme.c @@ -36,7 +36,6 @@ #include "spdk/pci_ids.h" static struct rte_pci_id nvme_pci_driver_id[] = { -#if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 1) { .class_id = SPDK_PCI_CLASS_NVME, .vendor_id = PCI_ANY_ID, @@ -44,9 +43,6 @@ static struct rte_pci_id nvme_pci_driver_id[] = { .subsystem_vendor_id = PCI_ANY_ID, .subsystem_device_id = PCI_ANY_ID, }, -#else - {RTE_PCI_DEVICE(0x8086, 0x0953)}, -#endif { .vendor_id = 0, /* sentinel */ }, }; @@ -58,15 +54,9 @@ static struct spdk_pci_enum_ctx g_nvme_pci_drv = { #endif , .id_table = nvme_pci_driver_id, -#if RTE_VERSION >= RTE_VERSION_NUM(16, 11, 0, 0) .probe = spdk_pci_device_init, .remove = spdk_pci_device_fini, .driver.name = "spdk_nvme", -#else - .devinit = spdk_pci_device_init, - .devuninit = spdk_pci_device_fini, - .name = "spdk_nvme", -#endif }, .cb_fn = NULL, diff --git a/lib/env_dpdk/pci_virtio.c b/lib/env_dpdk/pci_virtio.c index 18067da95..5f58b0aa3 100644 --- a/lib/env_dpdk/pci_virtio.c +++ b/lib/env_dpdk/pci_virtio.c @@ -49,15 +49,9 @@ static struct spdk_pci_enum_ctx g_virtio_pci_drv = { #endif , .id_table = virtio_pci_driver_id, -#if RTE_VERSION >= RTE_VERSION_NUM(16, 11, 0, 0) .probe = spdk_pci_device_init, .remove = spdk_pci_device_fini, .driver.name = "spdk_virtio", -#else - .devinit = spdk_pci_device_init, - .devuninit = spdk_pci_device_fini, - .name = "spdk_virtio", -#endif }, .cb_fn = NULL, diff --git a/lib/env_dpdk/threads.c b/lib/env_dpdk/threads.c index 55b0bbb68..01c7b8d9f 100644 --- a/lib/env_dpdk/threads.c +++ b/lib/env_dpdk/threads.c @@ -31,7 +31,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "spdk/env.h" +#include "env_internal.h" #include #include diff --git a/lib/env_dpdk/vtophys.c b/lib/env_dpdk/vtophys.c index 67572ea5b..9e4d4fa50 100644 --- a/lib/env_dpdk/vtophys.c +++ b/lib/env_dpdk/vtophys.c @@ -304,11 +304,7 @@ vtophys_get_paddr_pci(uint64_t vaddr) struct spdk_vtophys_pci_device *vtophys_dev; uintptr_t paddr; struct rte_pci_device *dev; -#if RTE_VERSION >= RTE_VERSION_NUM(16, 11, 0, 1) struct rte_mem_resource *res; -#else - struct rte_pci_resource *res; -#endif unsigned r; pthread_mutex_lock(&g_vtophys_pci_devices_mutex);