Commit 35549703 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

env_dpdk: drop DPDK 18.08 support



DPDK versions 17.11 to 18.08 reached EOL.

Change-Id: Icfec27b0099f53d6ab00ec3aed63e5d30d94ee4d
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2940


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarMichael Haeuptle <michaelhaeuptle@gmail.com>
parent 64c4fafd
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -150,14 +150,9 @@ spdk_memzone_reserve_aligned(const char *name, size_t len, int socket_id,
	const struct rte_memzone *mz;
	unsigned dpdk_flags = 0;

#if RTE_VERSION >= RTE_VERSION_NUM(18, 05, 0, 0)
	/* Older DPDKs do not offer such flag since their
	 * memzones are iova-contiguous by default.
	 */
	if ((flags & SPDK_MEMZONE_NO_IOVA_CONTIG) == 0) {
		dpdk_flags |= RTE_MEMZONE_IOVA_CONTIG;
	}
#endif

	if (socket_id == SPDK_ENV_SOCKET_ID_ANY) {
		socket_id = SOCKET_ID_ANY;
+2 −2
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@
#include <rte_bus_pci.h>
#include <rte_dev.h>

#if RTE_VERSION < RTE_VERSION_NUM(17, 11, 0, 0)
#error RTE_VERSION is too old! Minimum 17.11 is required.
#if RTE_VERSION < RTE_VERSION_NUM(18, 11, 0, 0)
#error RTE_VERSION is too old! Minimum 18.11 is required.
#endif

/* x86-64 and ARM userspace virtual addresses use only the low 48 bits [0..47],
+0 −41
Original line number Diff line number Diff line
@@ -105,23 +105,6 @@ _sprintf_alloc(const char *format, ...)
	return NULL;
}

static void
env_unlink_shared_files(void)
{
	/* Starting with DPDK 18.05, there are more files with unpredictable paths
	 * and filenames. The --no-shconf option prevents from creating them, but
	 * only for DPDK 18.08+. For DPDK 18.05 we just leave them be.
	 */
#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0)
	char buffer[PATH_MAX];

	snprintf(buffer, PATH_MAX, "/var/run/.spdk_pid%d_hugepage_info", getpid());
	if (unlink(buffer)) {
		fprintf(stderr, "Unable to unlink shared memory file: %s. Error code: %d\n", buffer, errno);
	}
#endif
}

void
spdk_env_opts_init(struct spdk_env_opts *opts)
{
@@ -348,16 +331,6 @@ build_eal_cmdline(const struct spdk_env_opts *opts)
		}
	}

#if RTE_VERSION >= RTE_VERSION_NUM(18, 05, 0, 0) && RTE_VERSION < RTE_VERSION_NUM(18, 5, 1, 0)
	/* Dynamic memory management is buggy in DPDK 18.05.0. Don't use it. */
	if (!opts->env_context || strstr(opts->env_context, "--legacy-mem") == NULL) {
		args = push_arg(args, &argcount, _sprintf_alloc("--legacy-mem"));
		if (args == NULL) {
			return -1;
		}
	}
#endif

	if (opts->num_pci_addr) {
		size_t i;
		char bdf[32];
@@ -375,8 +348,6 @@ build_eal_cmdline(const struct spdk_env_opts *opts)
		}
	}

	/* The following log-level options are not understood by older DPDKs */
#if RTE_VERSION >= RTE_VERSION_NUM(18, 05, 0, 0)
	/* Lower default EAL loglevel to RTE_LOG_NOTICE - normal, but significant messages.
	 * This can be overridden by specifying the same option in opts->env_context
	 */
@@ -402,7 +373,6 @@ build_eal_cmdline(const struct spdk_env_opts *opts)
	if (args == NULL) {
		return -1;
	}
#endif

	if (opts->env_context) {
		args = push_arg(args, &argcount, strdup(opts->env_context));
@@ -584,17 +554,6 @@ spdk_env_init(const struct spdk_env_opts *opts)
		return -rte_errno;
	}

	if (opts->shm_id < 0 && !opts->hugepage_single_segments) {
		/*
		 * Unlink hugepage and config info files after init.  This will ensure they get
		 *  deleted on app exit, even if the app crashes and does not exit normally.
		 *  Only do this when not in multi-process mode, since for multi-process other
		 *  apps will need to open these files. These files are not created for
		 *  "single file segments".
		 */
		env_unlink_shared_files();
	}

	legacy_mem = false;
	if (opts->env_context && strstr(opts->env_context, "--legacy-mem") != NULL) {
		legacy_mem = true;
+0 −41
Original line number Diff line number Diff line
@@ -703,7 +703,6 @@ spdk_mem_map_translate(const struct spdk_mem_map *map, uint64_t vaddr, uint64_t
	return orig_translation;
}

#if RTE_VERSION >= RTE_VERSION_NUM(18, 05, 0, 0)
static void
memory_hotplug_cb(enum rte_mem_event event_type,
		  const void *addr, size_t len, void *arg)
@@ -751,7 +750,6 @@ memory_iter_cb(const struct rte_memseg_list *msl,
{
	return spdk_mem_register(ms->addr, len);
}
#endif

int
mem_map_init(bool legacy_mem)
@@ -768,24 +766,8 @@ mem_map_init(bool legacy_mem)
	 * Walk all DPDK memory segments and register them
	 * with the master memory map
	 */
#if RTE_VERSION >= RTE_VERSION_NUM(18, 05, 0, 0)
	rte_mem_event_callback_register("spdk", memory_hotplug_cb, NULL);
	rte_memseg_contig_walk(memory_iter_cb, NULL);
#else
	struct rte_mem_config *mcfg;
	size_t seg_idx;

	mcfg = rte_eal_get_configuration()->mem_config;
	for (seg_idx = 0; seg_idx < RTE_MAX_MEMSEG; seg_idx++) {
		struct rte_memseg *seg = &mcfg->memseg[seg_idx];

		if (seg->addr == NULL) {
			break;
		}

		spdk_mem_register(seg->addr, seg->len);
	}
#endif
	return 0;
}

@@ -938,7 +920,6 @@ vtophys_get_paddr_memseg(uint64_t vaddr)
	uintptr_t paddr;
	struct rte_memseg *seg;

#if RTE_VERSION >= RTE_VERSION_NUM(18, 05, 0, 0)
	seg = rte_mem_virt2memseg((void *)(uintptr_t)vaddr, NULL);
	if (seg != NULL) {
		paddr = seg->phys_addr;
@@ -948,28 +929,6 @@ vtophys_get_paddr_memseg(uint64_t vaddr)
		paddr += (vaddr - (uintptr_t)seg->addr);
		return paddr;
	}
#else
	struct rte_mem_config *mcfg;
	uint32_t seg_idx;

	mcfg = rte_eal_get_configuration()->mem_config;
	for (seg_idx = 0; seg_idx < RTE_MAX_MEMSEG; seg_idx++) {
		seg = &mcfg->memseg[seg_idx];
		if (seg->addr == NULL) {
			break;
		}

		if (vaddr >= (uintptr_t)seg->addr &&
		    vaddr < ((uintptr_t)seg->addr + seg->len)) {
			paddr = seg->phys_addr;
			if (paddr == RTE_BAD_IOVA) {
				return SPDK_VTOPHYS_ERROR;
			}
			paddr += (vaddr - (uintptr_t)seg->addr);
			return paddr;
		}
	}
#endif

	return SPDK_VTOPHYS_ERROR;
}
+0 −29
Original line number Diff line number Diff line
@@ -80,10 +80,6 @@ cfg_read_rte(struct spdk_pci_device *dev, void *value, uint32_t len, uint32_t of

	rc = rte_pci_read_config(dev->dev_handle, value, len, offset);

#if defined(__FreeBSD__) && RTE_VERSION < RTE_VERSION_NUM(18, 11, 0, 0)
	/* Older DPDKs return 0 on success and -1 on failure */
	return rc;
#endif
	return (rc > 0 && (uint32_t) rc == len) ? 0 : -1;
}

@@ -104,7 +100,6 @@ cfg_write_rte(struct spdk_pci_device *dev, void *value, uint32_t len, uint32_t o
static void
remove_rte_dev(struct rte_pci_device *rte_dev)
{
#if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0)
	char bdf[32];
	int i = 0, rc;

@@ -112,9 +107,6 @@ remove_rte_dev(struct rte_pci_device *rte_dev)
	do {
		rc = rte_eal_hotplug_remove("pci", bdf);
	} while (rc == -ENOMSG && ++i <= DPDK_HOTPLUG_RETRY_COUNT);
#else
	rte_eal_dev_detach(&rte_dev->device);
#endif
}

static void
@@ -183,7 +175,6 @@ pci_driver_register(struct spdk_pci_driver *driver)
	TAILQ_INSERT_TAIL(&g_pci_drivers, driver, tailq);
}

#if RTE_VERSION >= RTE_VERSION_NUM(18, 5, 0, 0)
static void
pci_device_rte_hotremove(const char *device_name,
			 enum rte_dev_event_type event,
@@ -217,7 +208,6 @@ pci_device_rte_hotremove(const char *device_name,
		remove_rte_dev(dev->dev_handle);
	}
}
#endif

static void
cleanup_pci_devices(void)
@@ -248,7 +238,6 @@ cleanup_pci_devices(void)
void
pci_env_init(void)
{
#if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0)
	struct spdk_pci_driver *driver;

	/* We need to pre-register pci drivers for the pci devices to be
@@ -269,14 +258,11 @@ pci_env_init(void)
		driver->is_registered = true;
		rte_pci_register(&driver->driver);
	}
#endif

#if RTE_VERSION >= RTE_VERSION_NUM(18, 5, 0, 0)
	/* Register a single hotremove callback for all devices. */
	if (spdk_process_is_primary()) {
		rte_dev_event_callback_register(NULL, pci_device_rte_hotremove, NULL);
	}
#endif
}

void
@@ -293,11 +279,9 @@ pci_env_fini(void)
		}
	}

#if RTE_VERSION >= RTE_VERSION_NUM(18, 5, 0, 0)
	if (spdk_process_is_primary()) {
		rte_dev_event_callback_unregister(NULL, pci_device_rte_hotremove, NULL);
	}
#endif
}

int
@@ -308,15 +292,6 @@ pci_device_init(struct rte_pci_driver *_drv,
	struct spdk_pci_device *dev;
	int rc;

#if RTE_VERSION < RTE_VERSION_NUM(18, 11, 0, 0)
	if (!driver->cb_fn) {
		/* Return a positive value to indicate that this device does
		 * not belong to this driver, but this isn't an error.
		 */
		return 1;
	}
#endif

	dev = calloc(1, sizeof(*dev));
	if (dev == NULL) {
		return -1;
@@ -441,7 +416,6 @@ spdk_pci_device_attach(struct spdk_pci_driver *driver,
	driver->cb_fn = enum_cb;
	driver->cb_arg = enum_ctx;

#if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0)
	int i = 0;

	do {
@@ -454,9 +428,6 @@ spdk_pci_device_attach(struct spdk_pci_driver *driver,
		 */
		rc = 0;
	}
#else
	rc = rte_eal_dev_attach(bdf, "");
#endif

	driver->cb_arg = NULL;
	driver->cb_fn = NULL;
Loading