eal: cleanup on mempool and memzone object names

Cleanup mempool and memzone object names so that we can more easily rename them
from headers.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
This commit is contained in:
Bruce Richardson 2014-02-18 10:51:16 +01:00 committed by David Marchand
parent 896c37c5af
commit 5e8446dc6b
5 changed files with 12 additions and 4 deletions

View File

@ -248,7 +248,8 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
dev_info.sync_phys = mz->phys_addr;
/* MBUF mempool */
rte_snprintf(mz_name, sizeof(mz_name), "MP_%s", pktmbuf_pool->name);
rte_snprintf(mz_name, sizeof(mz_name), RTE_MEMPOOL_OBJ_NAME,
pktmbuf_pool->name);
mz = rte_memzone_lookup(mz_name);
KNI_MZ_CHECK(mz == NULL);
dev_info.mbuf_va = mz->addr;

View File

@ -183,7 +183,7 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,
/* Ring functions will return appropriate errors if we are
* running as a secondary process etc., so no checks made
* in this function for that condition */
rte_snprintf(rg_name, sizeof(rg_name), "MP_%s", name);
rte_snprintf(rg_name, sizeof(rg_name), RTE_MEMPOOL_MZ_FORMAT, name);
r = rte_ring_create(rg_name, rte_align32pow2(n+1), socket_id, rg_flags);
if (r == NULL)
goto exit;
@ -236,7 +236,7 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,
CACHE_LINE_MASK) & (~CACHE_LINE_MASK);
mempool_size = total_elt_size * n +
sizeof(struct rte_mempool) + private_data_size;
rte_snprintf(mz_name, sizeof(mz_name), "MP_%s", name);
rte_snprintf(mz_name, sizeof(mz_name), RTE_MEMPOOL_MZ_FORMAT, name);
mz = rte_memzone_reserve(mz_name, mempool_size, socket_id, mz_flags);

View File

@ -109,6 +109,12 @@ struct rte_mempool_cache {
#endif /* RTE_MEMPOOL_CACHE_MAX_SIZE > 0 */
#define RTE_MEMPOOL_NAMESIZE 32 /**< Maximum length of a memory pool. */
#define RTE_MEMPOOL_MZ_PREFIX "MP_"
/* "MP_<name>" */
#define RTE_MEMPOOL_MZ_FORMAT RTE_MEMPOOL_MZ_PREFIX "%s"
#define RTE_MEMPOOL_OBJ_NAME RTE_MEMPOOL_MZ_FORMAT
/**
* The RTE mempool structure.

View File

@ -137,7 +137,7 @@ rte_ring_create(const char *name, unsigned count, int socket_id,
return NULL;
}
rte_snprintf(mz_name, sizeof(mz_name), "RG_%s", name);
rte_snprintf(mz_name, sizeof(mz_name), "%s%s", RTE_RING_MZ_PREFIX, name);
ring_size = count * sizeof(void *) + sizeof(struct rte_ring);
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);

View File

@ -124,6 +124,7 @@ struct rte_ring_debug_stats {
#endif
#define RTE_RING_NAMESIZE 32 /**< The maximum length of a ring name. */
#define RTE_RING_MZ_PREFIX "RG_"
/**
* An RTE ring structure.