* Copyright(c) 2010-2014 Intel Corporation
*/
-#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
-#include <stdarg.h>
#include <inttypes.h>
#include <string.h>
#include <errno.h>
-#include <sys/queue.h>
#include <rte_log.h>
#include <rte_memory.h>
#include <rte_memzone.h>
#include <rte_eal.h>
-#include <rte_per_lcore.h>
#include <rte_errno.h>
#include <rte_string_fns.h>
#include <rte_common.h>
return NULL;
}
+#define MEMZONE_KNOWN_FLAGS (RTE_MEMZONE_2MB \
+ | RTE_MEMZONE_1GB \
+ | RTE_MEMZONE_16MB \
+ | RTE_MEMZONE_16GB \
+ | RTE_MEMZONE_256KB \
+ | RTE_MEMZONE_256MB \
+ | RTE_MEMZONE_512MB \
+ | RTE_MEMZONE_4GB \
+ | RTE_MEMZONE_SIZE_HINT_ONLY \
+ | RTE_MEMZONE_IOVA_CONTIG \
+ )
+
static const struct rte_memzone *
memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
int socket_id, unsigned int flags, unsigned int align,
return NULL;
}
+ if ((flags & ~MEMZONE_KNOWN_FLAGS) != 0) {
+ rte_errno = EINVAL;
+ return NULL;
+ }
+
/* only set socket to SOCKET_ID_ANY if we aren't allocating for an
* external heap.
*/
rte_rwlock_write_unlock(&mcfg->mlock);
- if (addr != NULL)
- rte_free(addr);
+ rte_free(addr);
rte_eal_trace_memzone_free(name, addr, ret);
return ret;