[PATCH 4/4] mempool: use lcore API to check if lcore ID is valid
Honnappa Nagarahalli
honnappa.nagarahalli at arm.com
Thu Mar 9 05:57:38 CET 2023
Use lcore API to check if the lcore ID is valid. The runtime
check does not add much value. Hence use assert to validate
the lcore ID.
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
Reviewed-by: Wathsala Vithanage <wathsala.vithanage at arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang at arm.com>
---
lib/mempool/rte_mempool.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
index 009bd10215..00c5aa961b 100644
--- a/lib/mempool/rte_mempool.h
+++ b/lib/mempool/rte_mempool.h
@@ -1314,10 +1314,9 @@ rte_mempool_cache_free(struct rte_mempool_cache *cache);
static __rte_always_inline struct rte_mempool_cache *
rte_mempool_default_cache(struct rte_mempool *mp, unsigned lcore_id)
{
- if (mp->cache_size == 0)
- return NULL;
+ RTE_ASSERT(rte_lcore_id_is_valid(lcore_id));
- if (lcore_id >= RTE_MAX_LCORE)
+ if (mp->cache_size == 0)
return NULL;
rte_mempool_trace_default_cache(mp, lcore_id,
--
2.25.1
More information about the dev
mailing list