env: drop DPDK 16.07 support

Now that even DPDK 16.11 (LTS) reaches its end of life in
November 2018, we can surely drop support for DPDK
versions older than that.

The PCI code will go through a major refactor soon, so this
patch cleans it up first.

Since this is the very first SPDK patch that drops support
for older DPDK versions, it also introduces an #error
directive that'll directly fail the build if the used DPDK
lib is too old.

Change-Id: I9bae30c98826c75cc91cda498e47e46979a08ed1
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/433865
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Darek Stojaczyk 2018-11-18 01:05:41 +01:00 committed by Jim Harris
parent 942e02aa68
commit ab12e36be6
8 changed files with 8 additions and 46 deletions

View File

@ -33,7 +33,7 @@
#include "spdk/stdinc.h"
#include "spdk/env.h"
#include "env_internal.h"
#include <rte_config.h>
#include <rte_cycles.h>
@ -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

View File

@ -53,6 +53,10 @@ extern struct rte_pci_bus rte_pci_bus;
#endif
#include <rte_dev.h>
#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.
*/

View File

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

View File

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

View File

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

View File

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

View File

@ -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 <rte_config.h>
#include <rte_lcore.h>

View File

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