Commit 2044690e authored by Dariusz Stojaczyk's avatar Dariusz Stojaczyk Committed by Jim Harris
Browse files

env: introduce SPDK_MEMZONE_NO_IOVA_CONTIG



Future DPDK versions may drop physical memory contiguity
guarantee for common memzones. DPDK 18.05 introduces
an RTE_MEMZONE_IOVA_CONTIG (0x00100000) flag, which is
documented as follows:

> RTE_MEMZONE_IOVA_CONTIG - Ensure reserved memzone is IOVA-contiguous.
>                           This option should be used when allocating
>                           memory intended for hardware rings etc.

To preserve backward compatibility, SPDK introduces an opposite
flag, SPDK_MEMZONE_NO_IOVA_CONTIG.

Change-Id: I9ea79b096fdb094051f13c9a802740b0e4ccc98e
Signed-off-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/416977


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 5dcd6f63
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -58,6 +58,11 @@ extern "C" {
 */
#define SPDK_MALLOC_SHARE  0x02

/**
 * Memzone flags
 */
#define SPDK_MEMZONE_NO_IOVA_CONTIG 0x00100000 /**< no iova contiguity */

struct spdk_pci_device;

/**
+9 −0
Original line number Diff line number Diff line
@@ -138,6 +138,15 @@ spdk_memzone_reserve(const char *name, size_t len, int socket_id, unsigned flags
	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 −1
Original line number Diff line number Diff line
@@ -305,7 +305,8 @@ nvme_driver_init(void)
			return 0;
		} else {
			g_spdk_nvme_driver = spdk_memzone_reserve(SPDK_NVME_DRIVER_NAME,
					     sizeof(struct nvme_driver), socket_id, 0);
					     sizeof(struct nvme_driver), socket_id,
					     SPDK_MEMZONE_NO_IOVA_CONTIG);
		}

		if (g_spdk_nvme_driver == NULL) {