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: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/416977
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Dariusz Stojaczyk 2018-06-27 10:29:22 +02:00 committed by Jim Harris
parent 5dcd6f6318
commit 2044690e6a
3 changed files with 16 additions and 1 deletions

View File

@ -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;
/**

View File

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

View File

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