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

Function setup_memory_env

dpdk/app/test-dma-perf/benchmark.c:305–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305static int
306setup_memory_env(struct test_configure *cfg, struct rte_mbuf ***srcs,
307 struct rte_mbuf ***dsts)
308{
309 unsigned int buf_size = cfg->buf_size.cur;
310 unsigned int nr_sockets;
311 uint32_t nr_buf = cfg->nr_buf;
312
313 nr_sockets = rte_socket_count();
314 if (cfg->src_numa_node >= nr_sockets ||
315 cfg->dst_numa_node >= nr_sockets) {
316 printf("Error: Source or destination numa exceeds the acture numa nodes.\n");
317 return -1;
318 }
319
320 src_pool = rte_pktmbuf_pool_create("Benchmark_DMA_SRC",
321 nr_buf,
322 0,
323 0,
324 buf_size + RTE_PKTMBUF_HEADROOM,
325 cfg->src_numa_node);
326 if (src_pool == NULL) {
327 PRINT_ERR("Error with source mempool creation.\n");
328 return -1;
329 }
330
331 dst_pool = rte_pktmbuf_pool_create("Benchmark_DMA_DST",
332 nr_buf,
333 0,
334 0,
335 buf_size + RTE_PKTMBUF_HEADROOM,
336 cfg->dst_numa_node);
337 if (dst_pool == NULL) {
338 PRINT_ERR("Error with destination mempool creation.\n");
339 return -1;
340 }
341
342 *srcs = rte_malloc(NULL, nr_buf * sizeof(struct rte_mbuf *), 0);
343 if (*srcs == NULL) {
344 printf("Error: srcs malloc failed.\n");
345 return -1;
346 }
347
348 *dsts = rte_malloc(NULL, nr_buf * sizeof(struct rte_mbuf *), 0);
349 if (*dsts == NULL) {
350 printf("Error: dsts malloc failed.\n");
351 return -1;
352 }
353
354 if (rte_pktmbuf_alloc_bulk(src_pool, *srcs, nr_buf) != 0) {
355 printf("alloc src mbufs failed.\n");
356 return -1;
357 }
358
359 if (rte_pktmbuf_alloc_bulk(dst_pool, *dsts, nr_buf) != 0) {
360 printf("alloc dst mbufs failed.\n");
361 return -1;
362 }

Callers 1

mem_copy_benchmarkFunction · 0.85

Calls 5

rte_socket_countFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85
rte_mallocFunction · 0.85
rte_pktmbuf_alloc_bulkFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected