return 0;
}
+static int test_mempool_creation_with_unknown_flag(void)
+{
+ struct rte_mempool *mp_cov;
+
+ mp_cov = rte_mempool_create("test_mempool_unknown_flag", MEMPOOL_SIZE,
+ MEMPOOL_ELT_SIZE, 0, 0,
+ NULL, NULL,
+ NULL, NULL,
+ SOCKET_ID_ANY, MEMPOOL_F_NO_IOVA_CONTIG << 1);
+
+ if (mp_cov != NULL) {
+ rte_mempool_free(mp_cov);
+ RET_ERR();
+ }
+
+ return 0;
+}
+
static struct rte_mempool *mp_spsc;
static rte_spinlock_t scsp_spinlock;
static void *scsp_obj_table[MAX_KEEP];
if (test_mempool_creation_with_exceeded_cache_size() < 0)
GOTO_ERR(ret, err);
+ if (test_mempool_creation_with_unknown_flag() < 0)
+ GOTO_ERR(ret, err);
+
if (test_mempool_same_name_twice_creation() < 0)
GOTO_ERR(ret, err);
rte_free(cache);
}
+#define MEMPOOL_KNOWN_FLAGS (MEMPOOL_F_NO_SPREAD \
+ | MEMPOOL_F_NO_CACHE_ALIGN \
+ | MEMPOOL_F_SP_PUT \
+ | MEMPOOL_F_SC_GET \
+ | MEMPOOL_F_POOL_CREATED \
+ | MEMPOOL_F_NO_IOVA_CONTIG \
+ )
/* create an empty mempool */
struct rte_mempool *
rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size,
return NULL;
}
+ /* enforce no unknown flag is passed by the application */
+ if ((flags & ~MEMPOOL_KNOWN_FLAGS) != 0) {
+ rte_errno = EINVAL;
+ return NULL;
+ }
+
/* "no cache align" imply "no spread" */
if (flags & MEMPOOL_F_NO_CACHE_ALIGN)
flags |= MEMPOOL_F_NO_SPREAD;
* with rte_errno set appropriately. Possible rte_errno values include:
* - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
* - E_RTE_SECONDARY - function was called from a secondary process instance
- * - EINVAL - cache size provided is too large
+ * - EINVAL - cache size provided is too large or an unknown flag was passed
* - ENOSPC - the maximum number of memzones has already been allocated
* - EEXIST - a memzone with the same name already exists
* - ENOMEM - no appropriate memory area found in which to create memzone