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

Function test_memzone_aligned

dpdk/app/test/test_memzone.c:625–770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

623}
624
625static int
626test_memzone_aligned(void)
627{
628 const struct rte_memzone *memzone_aligned_32;
629 const struct rte_memzone *memzone_aligned_128;
630 const struct rte_memzone *memzone_aligned_256;
631 const struct rte_memzone *memzone_aligned_512;
632 const struct rte_memzone *memzone_aligned_1024;
633
634 /* memzone that should automatically be adjusted to align on 64 bytes */
635 memzone_aligned_32 = rte_memzone_reserve_aligned(
636 TEST_MEMZONE_NAME("aligned_32"), 100, SOCKET_ID_ANY, 0,
637 32);
638
639 /* memzone that is supposed to be aligned on a 128 byte boundary */
640 memzone_aligned_128 = rte_memzone_reserve_aligned(
641 TEST_MEMZONE_NAME("aligned_128"), 100, SOCKET_ID_ANY, 0,
642 128);
643
644 /* memzone that is supposed to be aligned on a 256 byte boundary */
645 memzone_aligned_256 = rte_memzone_reserve_aligned(
646 TEST_MEMZONE_NAME("aligned_256"), 100, SOCKET_ID_ANY, 0,
647 256);
648
649 /* memzone that is supposed to be aligned on a 512 byte boundary */
650 memzone_aligned_512 = rte_memzone_reserve_aligned(
651 TEST_MEMZONE_NAME("aligned_512"), 100, SOCKET_ID_ANY, 0,
652 512);
653
654 /* memzone that is supposed to be aligned on a 1024 byte boundary */
655 memzone_aligned_1024 = rte_memzone_reserve_aligned(
656 TEST_MEMZONE_NAME("aligned_1024"), 100, SOCKET_ID_ANY,
657 0, 1024);
658
659 printf("check alignments and lengths\n");
660 if (memzone_aligned_32 == NULL) {
661 printf("Unable to reserve 64-byte aligned memzone!\n");
662 return -1;
663 }
664 if ((memzone_aligned_32->iova & RTE_CACHE_LINE_MASK) != 0)
665 return -1;
666 if (((uintptr_t) memzone_aligned_32->addr & RTE_CACHE_LINE_MASK) != 0)
667 return -1;
668 if ((memzone_aligned_32->len & RTE_CACHE_LINE_MASK) != 0)
669 return -1;
670
671 if (memzone_aligned_128 == NULL) {
672 printf("Unable to reserve 128-byte aligned memzone!\n");
673 return -1;
674 }
675 if ((memzone_aligned_128->iova & 127) != 0)
676 return -1;
677 if (((uintptr_t) memzone_aligned_128->addr & 127) != 0)
678 return -1;
679 if ((memzone_aligned_128->len & RTE_CACHE_LINE_MASK) != 0)
680 return -1;
681
682 if (memzone_aligned_256 == NULL) {

Callers 1

test_memzoneFunction · 0.85

Calls 4

rte_memzone_freeFunction · 0.85
is_memory_overlapFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected