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

Function mbuf_pool_create

dpdk/app/test-pmd/testpmd.c:1165–1279  ·  view source on GitHub ↗

* Configuration initialisation done once at init time. */

Source from the content-addressed store, hash-verified

1163 * Configuration initialisation done once at init time.
1164 */
1165static struct rte_mempool *
1166mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
1167 unsigned int socket_id, uint16_t size_idx)
1168{
1169 char pool_name[RTE_MEMPOOL_NAMESIZE];
1170 struct rte_mempool *rte_mp = NULL;
1171#ifndef RTE_EXEC_ENV_WINDOWS
1172 uint32_t mb_size;
1173
1174 mb_size = sizeof(struct rte_mbuf) + mbuf_seg_size;
1175#endif
1176 mbuf_poolname_build(socket_id, pool_name, sizeof(pool_name), size_idx);
1177 if (!is_proc_primary()) {
1178 rte_mp = rte_mempool_lookup(pool_name);
1179 if (rte_mp == NULL)
1180 rte_exit(EXIT_FAILURE,
1181 "Get mbuf pool for socket %u failed: %s\n",
1182 socket_id, rte_strerror(rte_errno));
1183 return rte_mp;
1184 }
1185
1186 TESTPMD_LOG(INFO,
1187 "create a new mbuf pool <%s>: n=%u, size=%u, socket=%u\n",
1188 pool_name, nb_mbuf, mbuf_seg_size, socket_id);
1189
1190 switch (mp_alloc_type) {
1191 case MP_ALLOC_NATIVE:
1192 {
1193 /* wrapper to rte_mempool_create() */
1194 TESTPMD_LOG(INFO, "preferred mempool ops selected: %s\n",
1195 rte_mbuf_best_mempool_ops());
1196 rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf,
1197 mb_mempool_cache, 0, mbuf_seg_size, socket_id);
1198 break;
1199 }
1200#ifndef RTE_EXEC_ENV_WINDOWS
1201 case MP_ALLOC_ANON:
1202 {
1203 rte_mp = rte_mempool_create_empty(pool_name, nb_mbuf,
1204 mb_size, (unsigned int) mb_mempool_cache,
1205 sizeof(struct rte_pktmbuf_pool_private),
1206 socket_id, mempool_flags);
1207 if (rte_mp == NULL)
1208 goto err;
1209
1210 if (rte_mempool_populate_anon(rte_mp) == 0) {
1211 rte_mempool_free(rte_mp);
1212 rte_mp = NULL;
1213 goto err;
1214 }
1215 rte_pktmbuf_pool_init(rte_mp, NULL);
1216 rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
1217 rte_mempool_mem_iter(rte_mp, dma_map_cb, NULL);
1218 break;
1219 }
1220 case MP_ALLOC_XMEM:
1221 case MP_ALLOC_XMEM_HUGE:
1222 {

Callers 1

init_configFunction · 0.85

Calls 15

mbuf_poolname_buildFunction · 0.85
is_proc_primaryFunction · 0.85
rte_mempool_lookupFunction · 0.85
rte_exitFunction · 0.85
rte_strerrorFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85
rte_mempool_create_emptyFunction · 0.85
rte_mempool_freeFunction · 0.85
rte_pktmbuf_pool_initFunction · 0.85
rte_mempool_obj_iterFunction · 0.85

Tested by

no test coverage detected