mempool: optimize copy in cache
Replace C memcpy code semantics with optimized rte_memcpy. Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Tested-by: David Hunt <david.hunt@intel.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
parent
729f17a932
commit
863bfb4744
@ -74,6 +74,7 @@
|
|||||||
#include <rte_memory.h>
|
#include <rte_memory.h>
|
||||||
#include <rte_branch_prediction.h>
|
#include <rte_branch_prediction.h>
|
||||||
#include <rte_ring.h>
|
#include <rte_ring.h>
|
||||||
|
#include <rte_memcpy.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -1028,7 +1029,6 @@ static inline void __attribute__((always_inline))
|
|||||||
__mempool_generic_put(struct rte_mempool *mp, void * const *obj_table,
|
__mempool_generic_put(struct rte_mempool *mp, void * const *obj_table,
|
||||||
unsigned n, struct rte_mempool_cache *cache, int flags)
|
unsigned n, struct rte_mempool_cache *cache, int flags)
|
||||||
{
|
{
|
||||||
uint32_t index;
|
|
||||||
void **cache_objs;
|
void **cache_objs;
|
||||||
|
|
||||||
/* increment stat now, adding in mempool always success */
|
/* 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 */
|
/* Add elements back into the cache */
|
||||||
for (index = 0; index < n; ++index, obj_table++)
|
rte_memcpy(&cache_objs[0], obj_table, sizeof(void *) * n);
|
||||||
cache_objs[index] = *obj_table;
|
|
||||||
|
|
||||||
cache->len += n;
|
cache->len += n;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user