From 863bfb47449363b5ac8c9574c7247a06a2aaf1c1 Mon Sep 17 00:00:00 2001 From: Jerin Jacob Date: Thu, 30 Jun 2016 17:46:36 +0530 Subject: [PATCH] mempool: optimize copy in cache Replace C memcpy code semantics with optimized rte_memcpy. Signed-off-by: Jerin Jacob Tested-by: David Hunt Acked-by: Olivier Matz --- lib/librte_mempool/rte_mempool.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index b2a51976d0..c8a81e2da7 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -74,6 +74,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -1028,7 +1029,6 @@ static inline void __attribute__((always_inline)) __mempool_generic_put(struct rte_mempool *mp, void * const *obj_table, unsigned n, struct rte_mempool_cache *cache, int flags) { - uint32_t index; void **cache_objs; /* increment stat now, adding in mempool always success */ @@ -1052,8 +1052,7 @@ __mempool_generic_put(struct rte_mempool *mp, void * const *obj_table, */ /* Add elements back into the cache */ - for (index = 0; index < n; ++index, obj_table++) - cache_objs[index] = *obj_table; + rte_memcpy(&cache_objs[0], obj_table, sizeof(void *) * n); cache->len += n; -- 2.20.1