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

Function test_memzone_reserve_max

dpdk/app/test/test_memzone.c:517–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515}
516
517static int
518test_memzone_reserve_max(void)
519{
520 unsigned int i;
521
522 for (i = 0; i < rte_socket_count(); i++) {
523 const struct rte_memzone *mz;
524 size_t maxlen;
525 int socket;
526
527 socket = rte_socket_id_by_idx(i);
528 maxlen = find_max_block_free_size(0, socket);
529
530 if (maxlen == 0) {
531 printf("There is no space left!\n");
532 return 0;
533 }
534
535 mz = rte_memzone_reserve(TEST_MEMZONE_NAME("max_zone"), 0,
536 socket, 0);
537 if (mz == NULL) {
538 printf("Failed to reserve a big chunk of memory - %s\n",
539 rte_strerror(rte_errno));
540 rte_dump_physmem_layout(stdout);
541 rte_memzone_dump(stdout);
542 return -1;
543 }
544
545 if (mz->len != maxlen) {
546 printf("Memzone reserve with 0 size did not return biggest block\n");
547 printf("Expected size = %zu, actual size = %zu\n",
548 maxlen, mz->len);
549 rte_dump_physmem_layout(stdout);
550 rte_memzone_dump(stdout);
551 return -1;
552 }
553
554 if (rte_memzone_free(mz)) {
555 printf("Fail memzone free\n");
556 return -1;
557 }
558 }
559
560 return 0;
561}
562
563static int
564test_memzone_reserve_max_aligned(void)

Callers 1

test_memzoneFunction · 0.85

Calls 9

rte_socket_countFunction · 0.85
rte_socket_id_by_idxFunction · 0.85
find_max_block_free_sizeFunction · 0.85
rte_memzone_reserveFunction · 0.85
rte_strerrorFunction · 0.85
rte_dump_physmem_layoutFunction · 0.85
rte_memzone_dumpFunction · 0.85
rte_memzone_freeFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected