MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_mempool_cache_create

Function rte_mempool_cache_create

dpdk/lib/mempool/rte_mempool.c:763–785  ·  view source on GitHub ↗

* Create and initialize a cache for objects that are retrieved from and * returned to an underlying mempool. This structure is identical to the * local_cache[lcore_id] pointed to by the mempool structure. */

Source from the content-addressed store, hash-verified

761 * local_cache[lcore_id] pointed to by the mempool structure.
762 */
763struct rte_mempool_cache *
764rte_mempool_cache_create(uint32_t size, int socket_id)
765{
766 struct rte_mempool_cache *cache;
767
768 if (size == 0 || size > RTE_MEMPOOL_CACHE_MAX_SIZE) {
769 rte_errno = EINVAL;
770 return NULL;
771 }
772
773 cache = rte_zmalloc_socket("MEMPOOL_CACHE", sizeof(*cache),
774 RTE_CACHE_LINE_SIZE, socket_id);
775 if (cache == NULL) {
776 RTE_LOG(ERR, MEMPOOL, "Cannot allocate mempool cache.\n");
777 rte_errno = ENOMEM;
778 return NULL;
779 }
780
781 mempool_cache_init(cache, size);
782
783 rte_mempool_trace_cache_create(size, socket_id, cache);
784 return cache;
785}
786
787/*
788 * Free a cache. It's the responsibility of the user to make sure that any

Callers 2

per_lcore_mempool_testFunction · 0.85
test_mempool_basicFunction · 0.85

Calls 2

rte_zmalloc_socketFunction · 0.85
mempool_cache_initFunction · 0.85

Tested by 2

per_lcore_mempool_testFunction · 0.68
test_mempool_basicFunction · 0.68