From: Bruce Richardson Date: Tue, 18 Feb 2014 09:51:16 +0000 (+0100) Subject: eal: cleanup on mempool and memzone object names X-Git-Tag: spdx-start~11041 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5e8446dc6b41947ed70466ddec7503f12c102717;p=dpdk.git 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 Signed-off-by: David Marchand --- diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index df2e015a36..509ae527da 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -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; diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 4d24b82459..8b25981051 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -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); diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index d7b6317dbc..94c75cbab0 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -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_" */ +#define RTE_MEMPOOL_MZ_FORMAT RTE_MEMPOOL_MZ_PREFIX "%s" + +#define RTE_MEMPOOL_OBJ_NAME RTE_MEMPOOL_MZ_FORMAT /** * The RTE mempool structure. diff --git a/lib/librte_ring/rte_ring.c b/lib/librte_ring/rte_ring.c index 8acbbc6538..0d43a55982 100644 --- a/lib/librte_ring/rte_ring.c +++ b/lib/librte_ring/rte_ring.c @@ -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); diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h index 751b5a86a9..775ea790ea 100644 --- a/lib/librte_ring/rte_ring.h +++ b/lib/librte_ring/rte_ring.h @@ -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.