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

Function ring_alloc

dpdk/drivers/mempool/ring/rte_mempool_ring.c:78–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78static int
79ring_alloc(struct rte_mempool *mp, uint32_t rg_flags)
80{
81 int ret;
82 char rg_name[RTE_RING_NAMESIZE];
83 struct rte_ring *r;
84
85 ret = snprintf(rg_name, sizeof(rg_name),
86 RTE_MEMPOOL_MZ_FORMAT, mp->name);
87 if (ret < 0 || ret >= (int)sizeof(rg_name)) {
88 rte_errno = ENAMETOOLONG;
89 return -rte_errno;
90 }
91
92 /*
93 * Allocate the ring that will be used to store objects.
94 * Ring functions will return appropriate errors if we are
95 * running as a secondary process etc., so no checks made
96 * in this function for that condition.
97 */
98 r = rte_ring_create(rg_name, rte_align32pow2(mp->size + 1),
99 mp->socket_id, rg_flags);
100 if (r == NULL)
101 return -rte_errno;
102
103 mp->pool_data = r;
104
105 return 0;
106}
107
108static int
109common_ring_alloc(struct rte_mempool *mp)

Callers 3

common_ring_allocFunction · 0.85
rts_ring_allocFunction · 0.85
hts_ring_allocFunction · 0.85

Calls 3

snprintfFunction · 0.85
rte_ring_createFunction · 0.85
rte_align32pow2Function · 0.50

Tested by

no test coverage detected