4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #include <sys/queue.h>
39 #include <rte_random.h>
40 #include <rte_cycles.h>
41 #include <rte_memory.h>
42 #include <rte_memzone.h>
44 #include <rte_eal_memconfig.h>
45 #include <rte_common.h>
46 #include <rte_string_fns.h>
47 #include <rte_errno.h>
48 #include <rte_malloc.h>
49 #include "../../lib/librte_eal/common/malloc_elem.h"
57 * - Search for three reserved zones or reserve them if they do not exist:
59 * - One is on any socket id.
60 * - The second is on socket 0.
61 * - The last one is on socket 1 (if socket 1 exists).
63 * - Check that the zones exist.
65 * - Check that the zones are cache-aligned.
67 * - Check that zones do not overlap.
69 * - Check that the zones are on the correct socket id.
71 * - Check that a lookup of the first zone returns the same pointer.
73 * - Check that it is not possible to create another zone with the
74 * same name as an existing zone.
76 * - Check flags for specific huge page size reservation
79 /* Test if memory overlaps: return 1 if true, or 0 if false. */
81 is_memory_overlap(phys_addr_t ptr1, size_t len1, phys_addr_t ptr2, size_t len2)
83 if (ptr2 >= ptr1 && (ptr2 - ptr1) < len1)
85 else if (ptr2 < ptr1 && (ptr1 - ptr2) < len2)
91 test_memzone_invalid_alignment(void)
93 const struct rte_memzone * mz;
95 mz = rte_memzone_lookup("invalid_alignment");
97 printf("Zone with invalid alignment has been reserved\n");
101 mz = rte_memzone_reserve_aligned("invalid_alignment", 100,
102 SOCKET_ID_ANY, 0, 100);
104 printf("Zone with invalid alignment has been reserved\n");
111 test_memzone_reserving_zone_size_bigger_than_the_maximum(void)
113 const struct rte_memzone * mz;
115 mz = rte_memzone_lookup("zone_size_bigger_than_the_maximum");
117 printf("zone_size_bigger_than_the_maximum has been reserved\n");
121 mz = rte_memzone_reserve("zone_size_bigger_than_the_maximum", (size_t)-1,
124 printf("It is impossible to reserve such big a memzone\n");
132 test_memzone_reserve_flags(void)
134 const struct rte_memzone *mz;
135 const struct rte_memseg *ms;
136 int hugepage_2MB_avail = 0;
137 int hugepage_1GB_avail = 0;
138 int hugepage_16MB_avail = 0;
139 int hugepage_16GB_avail = 0;
140 const size_t size = 100;
142 ms = rte_eal_get_physmem_layout();
143 for (i = 0; i < RTE_MAX_MEMSEG; i++) {
144 if (ms[i].hugepage_sz == RTE_PGSIZE_2M)
145 hugepage_2MB_avail = 1;
146 if (ms[i].hugepage_sz == RTE_PGSIZE_1G)
147 hugepage_1GB_avail = 1;
148 if (ms[i].hugepage_sz == RTE_PGSIZE_16M)
149 hugepage_16MB_avail = 1;
150 if (ms[i].hugepage_sz == RTE_PGSIZE_16G)
151 hugepage_16GB_avail = 1;
153 /* Display the availability of 2MB ,1GB, 16MB, 16GB pages */
154 if (hugepage_2MB_avail)
155 printf("2MB Huge pages available\n");
156 if (hugepage_1GB_avail)
157 printf("1GB Huge pages available\n");
158 if (hugepage_16MB_avail)
159 printf("16MB Huge pages available\n");
160 if (hugepage_16GB_avail)
161 printf("16GB Huge pages available\n");
163 * If 2MB pages available, check that a small memzone is correctly
164 * reserved from 2MB huge pages when requested by the RTE_MEMZONE_2MB flag.
165 * Also check that RTE_MEMZONE_SIZE_HINT_ONLY flag only defaults to an
166 * available page size (i.e 1GB ) when 2MB pages are unavailable.
168 if (hugepage_2MB_avail) {
169 mz = rte_memzone_reserve("flag_zone_2M", size, SOCKET_ID_ANY,
172 printf("MEMZONE FLAG 2MB\n");
175 if (mz->hugepage_sz != RTE_PGSIZE_2M) {
176 printf("hugepage_sz not equal 2M\n");
180 mz = rte_memzone_reserve("flag_zone_2M_HINT", size, SOCKET_ID_ANY,
181 RTE_MEMZONE_2MB|RTE_MEMZONE_SIZE_HINT_ONLY);
183 printf("MEMZONE FLAG 2MB\n");
186 if (mz->hugepage_sz != RTE_PGSIZE_2M) {
187 printf("hugepage_sz not equal 2M\n");
191 /* Check if 1GB huge pages are unavailable, that function fails unless
192 * HINT flag is indicated
194 if (!hugepage_1GB_avail) {
195 mz = rte_memzone_reserve("flag_zone_1G_HINT", size, SOCKET_ID_ANY,
196 RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY);
198 printf("MEMZONE FLAG 1GB & HINT\n");
201 if (mz->hugepage_sz != RTE_PGSIZE_2M) {
202 printf("hugepage_sz not equal 2M\n");
206 mz = rte_memzone_reserve("flag_zone_1G", size, SOCKET_ID_ANY,
209 printf("MEMZONE FLAG 1GB\n");
215 /*As with 2MB tests above for 1GB huge page requests*/
216 if (hugepage_1GB_avail) {
217 mz = rte_memzone_reserve("flag_zone_1G", size, SOCKET_ID_ANY,
220 printf("MEMZONE FLAG 1GB\n");
223 if (mz->hugepage_sz != RTE_PGSIZE_1G) {
224 printf("hugepage_sz not equal 1G\n");
228 mz = rte_memzone_reserve("flag_zone_1G_HINT", size, SOCKET_ID_ANY,
229 RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY);
231 printf("MEMZONE FLAG 1GB\n");
234 if (mz->hugepage_sz != RTE_PGSIZE_1G) {
235 printf("hugepage_sz not equal 1G\n");
239 /* Check if 1GB huge pages are unavailable, that function fails unless
240 * HINT flag is indicated
242 if (!hugepage_2MB_avail) {
243 mz = rte_memzone_reserve("flag_zone_2M_HINT", size, SOCKET_ID_ANY,
244 RTE_MEMZONE_2MB|RTE_MEMZONE_SIZE_HINT_ONLY);
246 printf("MEMZONE FLAG 2MB & HINT\n");
249 if (mz->hugepage_sz != RTE_PGSIZE_1G) {
250 printf("hugepage_sz not equal 1G\n");
253 mz = rte_memzone_reserve("flag_zone_2M", size, SOCKET_ID_ANY,
256 printf("MEMZONE FLAG 2MB\n");
261 if (hugepage_2MB_avail && hugepage_1GB_avail) {
262 mz = rte_memzone_reserve("flag_zone_2M_HINT", size, SOCKET_ID_ANY,
263 RTE_MEMZONE_2MB|RTE_MEMZONE_1GB);
265 printf("BOTH SIZES SET\n");
271 * This option is for IBM Power. If 16MB pages available, check
272 * that a small memzone is correctly reserved from 16MB huge pages
273 * when requested by the RTE_MEMZONE_16MB flag. Also check that
274 * RTE_MEMZONE_SIZE_HINT_ONLY flag only defaults to an available
275 * page size (i.e 16GB ) when 16MB pages are unavailable.
277 if (hugepage_16MB_avail) {
278 mz = rte_memzone_reserve("flag_zone_16M", size, SOCKET_ID_ANY,
281 printf("MEMZONE FLAG 16MB\n");
284 if (mz->hugepage_sz != RTE_PGSIZE_16M) {
285 printf("hugepage_sz not equal 16M\n");
289 mz = rte_memzone_reserve("flag_zone_16M_HINT", size,
290 SOCKET_ID_ANY, RTE_MEMZONE_16MB|RTE_MEMZONE_SIZE_HINT_ONLY);
292 printf("MEMZONE FLAG 2MB\n");
295 if (mz->hugepage_sz != RTE_PGSIZE_16M) {
296 printf("hugepage_sz not equal 16M\n");
300 /* Check if 1GB huge pages are unavailable, that function fails
301 * unless HINT flag is indicated
303 if (!hugepage_16GB_avail) {
304 mz = rte_memzone_reserve("flag_zone_16G_HINT", size,
306 RTE_MEMZONE_16GB|RTE_MEMZONE_SIZE_HINT_ONLY);
308 printf("MEMZONE FLAG 16GB & HINT\n");
311 if (mz->hugepage_sz != RTE_PGSIZE_16M) {
312 printf("hugepage_sz not equal 16M\n");
316 mz = rte_memzone_reserve("flag_zone_16G", size,
317 SOCKET_ID_ANY, RTE_MEMZONE_16GB);
319 printf("MEMZONE FLAG 16GB\n");
324 /*As with 16MB tests above for 16GB huge page requests*/
325 if (hugepage_16GB_avail) {
326 mz = rte_memzone_reserve("flag_zone_16G", size, SOCKET_ID_ANY,
329 printf("MEMZONE FLAG 16GB\n");
332 if (mz->hugepage_sz != RTE_PGSIZE_16G) {
333 printf("hugepage_sz not equal 16G\n");
337 mz = rte_memzone_reserve("flag_zone_16G_HINT", size,
338 SOCKET_ID_ANY, RTE_MEMZONE_16GB|RTE_MEMZONE_SIZE_HINT_ONLY);
340 printf("MEMZONE FLAG 16GB\n");
343 if (mz->hugepage_sz != RTE_PGSIZE_16G) {
344 printf("hugepage_sz not equal 16G\n");
348 /* Check if 1GB huge pages are unavailable, that function fails
349 * unless HINT flag is indicated
351 if (!hugepage_16MB_avail) {
352 mz = rte_memzone_reserve("flag_zone_16M_HINT", size,
354 RTE_MEMZONE_16MB|RTE_MEMZONE_SIZE_HINT_ONLY);
356 printf("MEMZONE FLAG 16MB & HINT\n");
359 if (mz->hugepage_sz != RTE_PGSIZE_16G) {
360 printf("hugepage_sz not equal 16G\n");
363 mz = rte_memzone_reserve("flag_zone_16M", size,
364 SOCKET_ID_ANY, RTE_MEMZONE_16MB);
366 printf("MEMZONE FLAG 16MB\n");
371 if (hugepage_16MB_avail && hugepage_16GB_avail) {
372 mz = rte_memzone_reserve("flag_zone_16M_HINT", size,
374 RTE_MEMZONE_16MB|RTE_MEMZONE_16GB);
376 printf("BOTH SIZES SET\n");
385 /* Find the heap with the greatest free block size */
387 find_max_block_free_size(const unsigned _align)
389 struct rte_malloc_socket_stats stats;
390 unsigned i, align = _align;
393 for (i = 0; i < RTE_MAX_NUMA_NODES; i++) {
394 rte_malloc_get_socket_stats(i, &stats);
395 if (stats.greatest_free_size > len)
396 len = stats.greatest_free_size;
399 if (align < RTE_CACHE_LINE_SIZE)
400 align = RTE_CACHE_LINE_ROUNDUP(align+1);
402 if (len <= MALLOC_ELEM_OVERHEAD + align)
405 return len - MALLOC_ELEM_OVERHEAD - align;
409 test_memzone_reserve_max(void)
411 const struct rte_memzone *mz;
414 maxlen = find_max_block_free_size(0);
417 printf("There is no space left!\n");
421 mz = rte_memzone_reserve("max_zone", 0, SOCKET_ID_ANY, 0);
423 printf("Failed to reserve a big chunk of memory - %s\n",
424 rte_strerror(rte_errno));
425 rte_dump_physmem_layout(stdout);
426 rte_memzone_dump(stdout);
430 if (mz->len != maxlen) {
431 printf("Memzone reserve with 0 size did not return bigest block\n");
432 printf("Expected size = %zu, actual size = %zu\n", maxlen, mz->len);
433 rte_dump_physmem_layout(stdout);
434 rte_memzone_dump(stdout);
442 test_memzone_reserve_max_aligned(void)
444 const struct rte_memzone *mz;
447 /* random alignment */
448 rte_srand((unsigned)rte_rdtsc());
449 const unsigned align = 1 << ((rte_rand() % 8) + 5); /* from 128 up to 4k alignment */
451 maxlen = find_max_block_free_size(align);
454 printf("There is no space left for biggest %u-aligned memzone!\n", align);
458 mz = rte_memzone_reserve_aligned("max_zone_aligned", 0,
459 SOCKET_ID_ANY, 0, align);
461 printf("Failed to reserve a big chunk of memory - %s\n",
462 rte_strerror(rte_errno));
463 rte_dump_physmem_layout(stdout);
464 rte_memzone_dump(stdout);
468 if (mz->len != maxlen) {
469 printf("Memzone reserve with 0 size and alignment %u did not return"
470 " bigest block\n", align);
471 printf("Expected size = %zu, actual size = %zu\n",
473 rte_dump_physmem_layout(stdout);
474 rte_memzone_dump(stdout);
482 test_memzone_aligned(void)
484 const struct rte_memzone *memzone_aligned_32;
485 const struct rte_memzone *memzone_aligned_128;
486 const struct rte_memzone *memzone_aligned_256;
487 const struct rte_memzone *memzone_aligned_512;
488 const struct rte_memzone *memzone_aligned_1024;
490 /* memzone that should automatically be adjusted to align on 64 bytes */
491 memzone_aligned_32 = rte_memzone_reserve_aligned("aligned_32", 100,
492 SOCKET_ID_ANY, 0, 32);
494 /* memzone that is supposed to be aligned on a 128 byte boundary */
495 memzone_aligned_128 = rte_memzone_reserve_aligned("aligned_128", 100,
496 SOCKET_ID_ANY, 0, 128);
498 /* memzone that is supposed to be aligned on a 256 byte boundary */
499 memzone_aligned_256 = rte_memzone_reserve_aligned("aligned_256", 100,
500 SOCKET_ID_ANY, 0, 256);
502 /* memzone that is supposed to be aligned on a 512 byte boundary */
503 memzone_aligned_512 = rte_memzone_reserve_aligned("aligned_512", 100,
504 SOCKET_ID_ANY, 0, 512);
506 /* memzone that is supposed to be aligned on a 1024 byte boundary */
507 memzone_aligned_1024 = rte_memzone_reserve_aligned("aligned_1024", 100,
508 SOCKET_ID_ANY, 0, 1024);
510 printf("check alignments and lengths\n");
511 if (memzone_aligned_32 == NULL) {
512 printf("Unable to reserve 64-byte aligned memzone!\n");
515 if ((memzone_aligned_32->phys_addr & RTE_CACHE_LINE_MASK) != 0)
517 if (((uintptr_t) memzone_aligned_32->addr & RTE_CACHE_LINE_MASK) != 0)
519 if ((memzone_aligned_32->len & RTE_CACHE_LINE_MASK) != 0)
522 if (memzone_aligned_128 == NULL) {
523 printf("Unable to reserve 128-byte aligned memzone!\n");
526 if ((memzone_aligned_128->phys_addr & 127) != 0)
528 if (((uintptr_t) memzone_aligned_128->addr & 127) != 0)
530 if ((memzone_aligned_128->len & RTE_CACHE_LINE_MASK) != 0)
533 if (memzone_aligned_256 == NULL) {
534 printf("Unable to reserve 256-byte aligned memzone!\n");
537 if ((memzone_aligned_256->phys_addr & 255) != 0)
539 if (((uintptr_t) memzone_aligned_256->addr & 255) != 0)
541 if ((memzone_aligned_256->len & RTE_CACHE_LINE_MASK) != 0)
544 if (memzone_aligned_512 == NULL) {
545 printf("Unable to reserve 512-byte aligned memzone!\n");
548 if ((memzone_aligned_512->phys_addr & 511) != 0)
550 if (((uintptr_t) memzone_aligned_512->addr & 511) != 0)
552 if ((memzone_aligned_512->len & RTE_CACHE_LINE_MASK) != 0)
555 if (memzone_aligned_1024 == NULL) {
556 printf("Unable to reserve 1024-byte aligned memzone!\n");
559 if ((memzone_aligned_1024->phys_addr & 1023) != 0)
561 if (((uintptr_t) memzone_aligned_1024->addr & 1023) != 0)
563 if ((memzone_aligned_1024->len & RTE_CACHE_LINE_MASK) != 0)
566 /* check that zones don't overlap */
567 printf("check overlapping\n");
568 if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len,
569 memzone_aligned_128->phys_addr, memzone_aligned_128->len))
571 if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len,
572 memzone_aligned_256->phys_addr, memzone_aligned_256->len))
574 if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len,
575 memzone_aligned_512->phys_addr, memzone_aligned_512->len))
577 if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len,
578 memzone_aligned_1024->phys_addr, memzone_aligned_1024->len))
580 if (is_memory_overlap(memzone_aligned_128->phys_addr, memzone_aligned_128->len,
581 memzone_aligned_256->phys_addr, memzone_aligned_256->len))
583 if (is_memory_overlap(memzone_aligned_128->phys_addr, memzone_aligned_128->len,
584 memzone_aligned_512->phys_addr, memzone_aligned_512->len))
586 if (is_memory_overlap(memzone_aligned_128->phys_addr, memzone_aligned_128->len,
587 memzone_aligned_1024->phys_addr, memzone_aligned_1024->len))
589 if (is_memory_overlap(memzone_aligned_256->phys_addr, memzone_aligned_256->len,
590 memzone_aligned_512->phys_addr, memzone_aligned_512->len))
592 if (is_memory_overlap(memzone_aligned_256->phys_addr, memzone_aligned_256->len,
593 memzone_aligned_1024->phys_addr, memzone_aligned_1024->len))
595 if (is_memory_overlap(memzone_aligned_512->phys_addr, memzone_aligned_512->len,
596 memzone_aligned_1024->phys_addr, memzone_aligned_1024->len))
602 check_memzone_bounded(const char *name, uint32_t len, uint32_t align,
605 const struct rte_memzone *mz;
608 bmask = ~((phys_addr_t)bound - 1);
610 if ((mz = rte_memzone_reserve_bounded(name, len, SOCKET_ID_ANY, 0,
611 align, bound)) == NULL) {
612 printf("%s(%s): memzone creation failed\n",
617 if ((mz->phys_addr & ((phys_addr_t)align - 1)) != 0) {
618 printf("%s(%s): invalid phys addr alignment\n",
623 if (((uintptr_t) mz->addr & ((uintptr_t)align - 1)) != 0) {
624 printf("%s(%s): invalid virtual addr alignment\n",
629 if ((mz->len & RTE_CACHE_LINE_MASK) != 0 || mz->len < len ||
630 mz->len < RTE_CACHE_LINE_SIZE) {
631 printf("%s(%s): invalid length\n",
636 if ((mz->phys_addr & bmask) !=
637 ((mz->phys_addr + mz->len - 1) & bmask)) {
638 printf("%s(%s): invalid memzone boundary %u crossed\n",
639 __func__, mz->name, bound);
647 test_memzone_bounded(void)
649 const struct rte_memzone *memzone_err;
653 /* should fail as boundary is not power of two */
654 name = "bounded_error_31";
655 if ((memzone_err = rte_memzone_reserve_bounded(name,
656 100, SOCKET_ID_ANY, 0, 32, UINT32_MAX)) != NULL) {
657 printf("%s(%s)created a memzone with invalid boundary "
658 "conditions\n", __func__, memzone_err->name);
662 /* should fail as len is greater then boundary */
663 name = "bounded_error_32";
664 if ((memzone_err = rte_memzone_reserve_bounded(name,
665 100, SOCKET_ID_ANY, 0, 32, 32)) != NULL) {
666 printf("%s(%s)created a memzone with invalid boundary "
667 "conditions\n", __func__, memzone_err->name);
671 if ((rc = check_memzone_bounded("bounded_128", 100, 128, 128)) != 0)
674 if ((rc = check_memzone_bounded("bounded_256", 100, 256, 128)) != 0)
677 if ((rc = check_memzone_bounded("bounded_1K", 100, 64, 1024)) != 0)
680 if ((rc = check_memzone_bounded("bounded_1K_MAX", 0, 64, 1024)) != 0)
689 const struct rte_memzone *memzone1;
690 const struct rte_memzone *memzone2;
691 const struct rte_memzone *memzone3;
692 const struct rte_memzone *memzone4;
693 const struct rte_memzone *mz;
695 memzone1 = rte_memzone_reserve("testzone1", 100,
698 memzone2 = rte_memzone_reserve("testzone2", 1000,
701 memzone3 = rte_memzone_reserve("testzone3", 1000,
704 memzone4 = rte_memzone_reserve("testzone4", 1024,
707 /* memzone3 may be NULL if we don't have NUMA */
708 if (memzone1 == NULL || memzone2 == NULL || memzone4 == NULL)
711 rte_memzone_dump(stdout);
713 /* check cache-line alignments */
714 printf("check alignments and lengths\n");
716 if ((memzone1->phys_addr & RTE_CACHE_LINE_MASK) != 0)
718 if ((memzone2->phys_addr & RTE_CACHE_LINE_MASK) != 0)
720 if (memzone3 != NULL && (memzone3->phys_addr & RTE_CACHE_LINE_MASK) != 0)
722 if ((memzone1->len & RTE_CACHE_LINE_MASK) != 0 || memzone1->len == 0)
724 if ((memzone2->len & RTE_CACHE_LINE_MASK) != 0 || memzone2->len == 0)
726 if (memzone3 != NULL && ((memzone3->len & RTE_CACHE_LINE_MASK) != 0 ||
729 if (memzone4->len != 1024)
732 /* check that zones don't overlap */
733 printf("check overlapping\n");
735 if (is_memory_overlap(memzone1->phys_addr, memzone1->len,
736 memzone2->phys_addr, memzone2->len))
738 if (memzone3 != NULL &&
739 is_memory_overlap(memzone1->phys_addr, memzone1->len,
740 memzone3->phys_addr, memzone3->len))
742 if (memzone3 != NULL &&
743 is_memory_overlap(memzone2->phys_addr, memzone2->len,
744 memzone3->phys_addr, memzone3->len))
747 printf("check socket ID\n");
749 /* memzone2 must be on socket id 0 and memzone3 on socket 1 */
750 if (memzone2->socket_id != 0)
752 if (memzone3 != NULL && memzone3->socket_id != 1)
755 printf("test zone lookup\n");
756 mz = rte_memzone_lookup("testzone1");
760 printf("test duplcate zone name\n");
761 mz = rte_memzone_reserve("testzone1", 100,
766 printf("test reserving memzone with bigger size than the maximum\n");
767 if (test_memzone_reserving_zone_size_bigger_than_the_maximum() < 0)
770 printf("test memzone_reserve flags\n");
771 if (test_memzone_reserve_flags() < 0)
774 printf("test alignment for memzone_reserve\n");
775 if (test_memzone_aligned() < 0)
778 printf("test boundary alignment for memzone_reserve\n");
779 if (test_memzone_bounded() < 0)
782 printf("test invalid alignment for memzone_reserve\n");
783 if (test_memzone_invalid_alignment() < 0)
786 printf("test reserving the largest size memzone possible\n");
787 if (test_memzone_reserve_max() < 0)
790 printf("test reserving the largest size aligned memzone possible\n");
791 if (test_memzone_reserve_max_aligned() < 0)
797 static struct test_command memzone_cmd = {
798 .command = "memzone_autotest",
799 .callback = test_memzone,
801 REGISTER_TEST_COMMAND(memzone_cmd);