4 * Copyright(c) 2010-2012 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.
42 #include <sys/queue.h>
44 #include <rte_common.h>
45 #include <rte_debug.h>
47 #include <rte_common.h>
48 #include <rte_memory.h>
49 #include <rte_memcpy.h>
50 #include <rte_memzone.h>
51 #include <rte_launch.h>
52 #include <rte_tailq.h>
54 #include <rte_per_lcore.h>
55 #include <rte_lcore.h>
56 #include <rte_atomic.h>
57 #include <rte_branch_prediction.h>
59 #include <rte_mempool.h>
61 #include <rte_random.h>
62 #include <rte_cycles.h>
64 #include <cmdline_parse.h>
68 #define MBUF_SIZE 2048
70 #define MBUF_TEST_DATA_LEN 1464
71 #define MBUF_TEST_DATA_LEN2 50
72 #define MBUF_TEST_HDR1_LEN 20
73 #define MBUF_TEST_HDR2_LEN 30
74 #define MBUF_TEST_ALL_HDRS_LEN (MBUF_TEST_HDR1_LEN+MBUF_TEST_HDR2_LEN)
76 #define REFCNT_MAX_ITER 64
77 #define REFCNT_MAX_TIMEOUT 10
78 #define REFCNT_MAX_REF (RTE_MAX_LCORE)
79 #define REFCNT_MBUF_NUM 64
80 #define REFCNT_MBUF_SIZE (sizeof (struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
81 #define REFCNT_RING_SIZE (REFCNT_MBUF_NUM * REFCNT_MAX_REF)
83 #define MAKE_STRING(x) # x
85 static struct rte_mempool *pktmbuf_pool = NULL;
86 static struct rte_mempool *ctrlmbuf_pool = NULL;
88 #if defined RTE_MBUF_SCATTER_GATHER && defined RTE_MBUF_REFCNT_ATOMIC
90 static struct rte_mempool *refcnt_pool = NULL;
91 static struct rte_ring *refcnt_mbuf_ring = NULL;
92 static volatile uint32_t refcnt_stop_slaves;
93 static uint32_t refcnt_lcore[RTE_MAX_LCORE];
101 * #. Allocate a mbuf pool.
103 * - The pool contains NB_MBUF elements, where each mbuf is MBUF_SIZE
106 * #. Test multiple allocations of mbufs from this pool.
108 * - Allocate NB_MBUF and store pointers in a table.
109 * - If an allocation fails, return an error.
110 * - Free all these mbufs.
111 * - Repeat the same test to check that mbufs were freed correctly.
113 * #. Test data manipulation in pktmbuf.
116 * - Append data using rte_pktmbuf_append().
117 * - Test for error in rte_pktmbuf_append() when len is too large.
118 * - Trim data at the end of mbuf using rte_pktmbuf_trim().
119 * - Test for error in rte_pktmbuf_trim() when len is too large.
120 * - Prepend a header using rte_pktmbuf_prepend().
121 * - Test for error in rte_pktmbuf_prepend() when len is too large.
122 * - Remove data at the beginning of mbuf using rte_pktmbuf_adj().
123 * - Test for error in rte_pktmbuf_adj() when len is too large.
124 * - Check that appended data is not corrupt.
126 * - Between all these tests, check data_len and pkt_len, and
127 * that the mbuf is contiguous.
128 * - Repeat the test to check that allocation operations
129 * reinitialize the mbuf correctly.
133 #define GOTO_FAIL(str, ...) do { \
134 printf("mbuf test FAILED (l.%d): <" str ">\n", \
135 __LINE__, ##__VA_ARGS__); \
140 * test data manipulation in mbuf with non-ascii data
143 test_pktmbuf_with_non_ascii_data(void)
145 struct rte_mbuf *m = NULL;
148 m = rte_pktmbuf_alloc(pktmbuf_pool);
150 GOTO_FAIL("Cannot allocate mbuf");
151 if (rte_pktmbuf_pkt_len(m) != 0)
152 GOTO_FAIL("Bad length");
154 data = rte_pktmbuf_append(m, MBUF_TEST_DATA_LEN);
156 GOTO_FAIL("Cannot append data");
157 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN)
158 GOTO_FAIL("Bad pkt length");
159 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN)
160 GOTO_FAIL("Bad data length");
161 memset(data, 0xff, rte_pktmbuf_pkt_len(m));
162 if (!rte_pktmbuf_is_contiguous(m))
163 GOTO_FAIL("Buffer should be continuous");
164 rte_pktmbuf_dump(m, MBUF_TEST_DATA_LEN);
178 * test data manipulation in mbuf
181 test_one_pktmbuf(void)
183 struct rte_mbuf *m = NULL;
184 char *data, *data2, *hdr;
187 printf("Test pktmbuf API\n");
191 m = rte_pktmbuf_alloc(pktmbuf_pool);
193 GOTO_FAIL("Cannot allocate mbuf");
194 if (rte_pktmbuf_pkt_len(m) != 0)
195 GOTO_FAIL("Bad length");
197 rte_pktmbuf_dump(m, 0);
201 data = rte_pktmbuf_append(m, MBUF_TEST_DATA_LEN);
203 GOTO_FAIL("Cannot append data");
204 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN)
205 GOTO_FAIL("Bad pkt length");
206 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN)
207 GOTO_FAIL("Bad data length");
208 memset(data, 0x66, rte_pktmbuf_pkt_len(m));
209 if (!rte_pktmbuf_is_contiguous(m))
210 GOTO_FAIL("Buffer should be continuous");
211 rte_pktmbuf_dump(m, MBUF_TEST_DATA_LEN);
212 rte_pktmbuf_dump(m, 2*MBUF_TEST_DATA_LEN);
214 /* this append should fail */
216 data2 = rte_pktmbuf_append(m, (uint16_t)(rte_pktmbuf_tailroom(m) + 1));
218 GOTO_FAIL("Append should not succeed");
220 /* append some more data */
222 data2 = rte_pktmbuf_append(m, MBUF_TEST_DATA_LEN2);
224 GOTO_FAIL("Cannot append data");
225 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN + MBUF_TEST_DATA_LEN2)
226 GOTO_FAIL("Bad pkt length");
227 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN + MBUF_TEST_DATA_LEN2)
228 GOTO_FAIL("Bad data length");
229 if (!rte_pktmbuf_is_contiguous(m))
230 GOTO_FAIL("Buffer should be continuous");
232 /* trim data at the end of mbuf */
234 if (rte_pktmbuf_trim(m, MBUF_TEST_DATA_LEN2) < 0)
235 GOTO_FAIL("Cannot trim data");
236 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN)
237 GOTO_FAIL("Bad pkt length");
238 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN)
239 GOTO_FAIL("Bad data length");
240 if (!rte_pktmbuf_is_contiguous(m))
241 GOTO_FAIL("Buffer should be continuous");
243 /* this trim should fail */
245 if (rte_pktmbuf_trim(m, (uint16_t)(rte_pktmbuf_data_len(m) + 1)) == 0)
246 GOTO_FAIL("trim should not succeed");
248 /* prepend one header */
250 hdr = rte_pktmbuf_prepend(m, MBUF_TEST_HDR1_LEN);
252 GOTO_FAIL("Cannot prepend");
253 if (data - hdr != MBUF_TEST_HDR1_LEN)
254 GOTO_FAIL("Prepend failed");
255 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN + MBUF_TEST_HDR1_LEN)
256 GOTO_FAIL("Bad pkt length");
257 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN + MBUF_TEST_HDR1_LEN)
258 GOTO_FAIL("Bad data length");
259 if (!rte_pktmbuf_is_contiguous(m))
260 GOTO_FAIL("Buffer should be continuous");
261 memset(hdr, 0x55, MBUF_TEST_HDR1_LEN);
263 /* prepend another header */
265 hdr = rte_pktmbuf_prepend(m, MBUF_TEST_HDR2_LEN);
267 GOTO_FAIL("Cannot prepend");
268 if (data - hdr != MBUF_TEST_ALL_HDRS_LEN)
269 GOTO_FAIL("Prepend failed");
270 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN + MBUF_TEST_ALL_HDRS_LEN)
271 GOTO_FAIL("Bad pkt length");
272 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN + MBUF_TEST_ALL_HDRS_LEN)
273 GOTO_FAIL("Bad data length");
274 if (!rte_pktmbuf_is_contiguous(m))
275 GOTO_FAIL("Buffer should be continuous");
276 memset(hdr, 0x55, MBUF_TEST_HDR2_LEN);
278 rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 1);
279 rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 0);
280 rte_pktmbuf_dump(m, 0);
282 /* this prepend should fail */
284 hdr = rte_pktmbuf_prepend(m, (uint16_t)(rte_pktmbuf_headroom(m) + 1));
286 GOTO_FAIL("prepend should not succeed");
288 /* remove data at beginning of mbuf (adj) */
290 if (data != rte_pktmbuf_adj(m, MBUF_TEST_ALL_HDRS_LEN))
291 GOTO_FAIL("rte_pktmbuf_adj failed");
292 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN)
293 GOTO_FAIL("Bad pkt length");
294 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN)
295 GOTO_FAIL("Bad data length");
296 if (!rte_pktmbuf_is_contiguous(m))
297 GOTO_FAIL("Buffer should be continuous");
299 /* this adj should fail */
301 if (rte_pktmbuf_adj(m, (uint16_t)(rte_pktmbuf_data_len(m) + 1)) != NULL)
302 GOTO_FAIL("rte_pktmbuf_adj should not succeed");
306 if (!rte_pktmbuf_is_contiguous(m))
307 GOTO_FAIL("Buffer should be continuous");
309 for (i=0; i<MBUF_TEST_DATA_LEN; i++) {
311 GOTO_FAIL("Data corrupted at offset %u", i);
330 test_one_ctrlmbuf(void)
332 struct rte_mbuf *m = NULL;
333 char message[] = "This is a message carried by a ctrlmbuf";
335 printf("Test ctrlmbuf API\n");
339 m = rte_ctrlmbuf_alloc(ctrlmbuf_pool);
341 GOTO_FAIL("Cannot allocate mbuf");
342 if (rte_ctrlmbuf_len(m) != 0)
343 GOTO_FAIL("Bad length");
346 rte_ctrlmbuf_data(m) = &message;
347 rte_ctrlmbuf_len(m) = sizeof(message);
350 if (rte_ctrlmbuf_data(m) != message)
351 GOTO_FAIL("Invalid data pointer");
352 if (rte_ctrlmbuf_len(m) != sizeof(message))
353 GOTO_FAIL("Invalid len");
355 rte_mbuf_sanity_check(m, RTE_MBUF_CTRL, 0);
358 rte_ctrlmbuf_free(m);
364 rte_ctrlmbuf_free(m);
369 testclone_testupdate_testdetach(void)
371 #ifndef RTE_MBUF_SCATTER_GATHER
374 struct rte_mbuf *mc = NULL;
375 struct rte_mbuf *clone = NULL;
379 mc = rte_pktmbuf_alloc(pktmbuf_pool);
381 GOTO_FAIL("ooops not allocating mbuf");
383 if (rte_pktmbuf_pkt_len(mc) != 0)
384 GOTO_FAIL("Bad length");
387 /* clone the allocated mbuf */
388 clone = rte_pktmbuf_clone(mc, pktmbuf_pool);
390 GOTO_FAIL("cannot clone data\n");
391 rte_pktmbuf_free(clone);
393 mc->pkt.next = rte_pktmbuf_alloc(pktmbuf_pool);
394 if(mc->pkt.next == NULL)
395 GOTO_FAIL("Next Pkt Null\n");
397 clone = rte_pktmbuf_clone(mc, pktmbuf_pool);
399 GOTO_FAIL("cannot clone data\n");
402 rte_pktmbuf_free(mc);
403 rte_pktmbuf_free(clone);
410 rte_pktmbuf_free(mc);
412 #endif /* RTE_MBUF_SCATTER_GATHER */
419 * test allocation and free of mbufs
422 test_pktmbuf_pool(void)
425 struct rte_mbuf *m[NB_MBUF];
428 for (i=0; i<NB_MBUF; i++)
431 /* alloc NB_MBUF mbufs */
432 for (i=0; i<NB_MBUF; i++) {
433 m[i] = rte_pktmbuf_alloc(pktmbuf_pool);
435 printf("rte_pktmbuf_alloc() failed (%u)\n", i);
439 struct rte_mbuf *extra = NULL;
440 extra = rte_pktmbuf_alloc(pktmbuf_pool);
442 printf("Error pool not empty");
445 #ifdef RTE_MBUF_SCATTER_GATHER
446 extra = rte_pktmbuf_clone(m[0], pktmbuf_pool);
448 printf("Error pool not empty");
453 for (i=0; i<NB_MBUF; i++) {
455 rte_pktmbuf_free(m[i]);
464 test_pktmbuf_free_segment(void)
467 struct rte_mbuf *m[NB_MBUF];
470 for (i=0; i<NB_MBUF; i++)
473 /* alloc NB_MBUF mbufs */
474 for (i=0; i<NB_MBUF; i++) {
475 m[i] = rte_pktmbuf_alloc(pktmbuf_pool);
477 printf("rte_pktmbuf_alloc() failed (%u)\n", i);
483 for (i=0; i<NB_MBUF; i++) {
485 struct rte_mbuf *mb, *mt;
491 rte_pktmbuf_free_seg(mt);
500 * Stress test for rte_mbuf atomic refcnt.
502 * RTE_MBUF_SCATTER_GATHER and RTE_MBUF_REFCNT_ATOMIC are both defined.
503 * For more efficency, recomended to run with RTE_LIBRTE_MBUF_DEBUG defined.
506 #if defined RTE_MBUF_SCATTER_GATHER && defined RTE_MBUF_REFCNT_ATOMIC
509 test_refcnt_slave(__attribute__((unused)) void *arg)
511 uint32_t lcore, free;
514 lcore = rte_lcore_id();
515 printf("%s started at lcore %u\n", __func__, lcore);
518 while (refcnt_stop_slaves == 0) {
519 if (rte_ring_dequeue(refcnt_mbuf_ring, &mp) == 0) {
521 rte_pktmbuf_free((struct rte_mbuf *)mp);
525 refcnt_lcore[lcore] += free;
526 printf("%s finished at lcore %u, "
527 "number of freed mbufs: %u\n",
528 __func__, lcore, free);
533 test_refcnt_iter(uint32_t lcore, uint32_t iter)
536 uint32_t i, n, tref, wn;
541 /* For each mbuf in the pool:
543 * - increment it's reference up to N+1,
544 * - enqueue it N times into the ring for slave cores to free.
546 for (i = 0, n = rte_mempool_count(refcnt_pool);
547 i != n && (m = rte_pktmbuf_alloc(refcnt_pool)) != NULL;
549 ref = RTE_MAX(rte_rand() % REFCNT_MAX_REF, 1UL);
551 if ((ref & 1) != 0) {
552 rte_pktmbuf_refcnt_update(m, ref);
554 rte_ring_enqueue(refcnt_mbuf_ring, m);
557 rte_pktmbuf_refcnt_update(m, 1);
558 rte_ring_enqueue(refcnt_mbuf_ring, m);
565 rte_panic("(lcore=%u, iter=%u): was able to allocate only "
566 "%u from %u mbufs\n", lcore, iter, i, n);
568 /* wait till slave lcores will consume all mbufs */
569 while (!rte_ring_empty(refcnt_mbuf_ring))
572 /* check that all mbufs are back into mempool by now */
573 for (wn = 0; wn != REFCNT_MAX_TIMEOUT; wn++) {
574 if ((i = rte_mempool_count(refcnt_pool)) == n) {
575 refcnt_lcore[lcore] += tref;
576 printf("%s(lcore=%u, iter=%u) completed, "
577 "%u references processed\n",
578 __func__, lcore, iter, tref);
584 rte_panic("(lcore=%u, iter=%u): after %us only "
585 "%u of %u mbufs left free\n", lcore, iter, wn, i, n);
589 test_refcnt_master(void)
593 lcore = rte_lcore_id();
594 printf("%s started at lcore %u\n", __func__, lcore);
596 for (i = 0; i != REFCNT_MAX_ITER; i++)
597 test_refcnt_iter(lcore, i);
599 refcnt_stop_slaves = 1;
602 printf("%s finished at lcore %u\n", __func__, lcore);
609 test_refcnt_mbuf(void)
611 #if defined RTE_MBUF_SCATTER_GATHER && defined RTE_MBUF_REFCNT_ATOMIC
613 uint32_t lnum, master, slave, tref;
616 if ((lnum = rte_lcore_count()) == 1) {
617 printf("skipping %s, number of lcores: %u is not enough\n",
622 printf("starting %s, at %u lcores\n", __func__, lnum);
624 /* create refcnt pool & ring if they don't exist */
626 if (refcnt_pool == NULL &&
627 (refcnt_pool = rte_mempool_create(
628 MAKE_STRING(refcnt_pool),
629 REFCNT_MBUF_NUM, REFCNT_MBUF_SIZE, 0,
630 sizeof(struct rte_pktmbuf_pool_private),
631 rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL,
632 SOCKET_ID_ANY, 0)) == NULL) {
633 printf("%s: cannot allocate " MAKE_STRING(refcnt_pool) "\n",
638 if (refcnt_mbuf_ring == NULL &&
639 (refcnt_mbuf_ring = rte_ring_create("refcnt_mbuf_ring",
640 REFCNT_RING_SIZE, SOCKET_ID_ANY,
641 RING_F_SP_ENQ)) == NULL) {
642 printf("%s: cannot allocate " MAKE_STRING(refcnt_mbuf_ring)
647 refcnt_stop_slaves = 0;
648 memset(refcnt_lcore, 0, sizeof (refcnt_lcore));
650 rte_eal_mp_remote_launch(test_refcnt_slave, NULL, SKIP_MASTER);
652 test_refcnt_master();
654 rte_eal_mp_wait_lcore();
656 /* check that we porcessed all references */
658 master = rte_get_master_lcore();
660 RTE_LCORE_FOREACH_SLAVE(slave)
661 tref += refcnt_lcore[slave];
663 if (tref != refcnt_lcore[master])
664 rte_panic("refernced mbufs: %u, freed mbufs: %u\n",
665 tref, refcnt_lcore[master]);
667 rte_mempool_dump(refcnt_pool);
668 rte_ring_dump(refcnt_mbuf_ring);
674 #ifdef RTE_EXEC_ENV_BAREMETAL
676 /* baremetal - don't test failing sanity checks */
678 test_failing_mbuf_sanity_check(void)
686 #include <sys/wait.h>
688 /* linuxapp - use fork() to test mbuf errors panic */
690 verify_mbuf_check_panics(struct rte_mbuf *buf)
698 rte_mbuf_sanity_check(buf, RTE_MBUF_PKT, 1); /* should panic */
699 exit(0); /* return normally if it doesn't panic */
701 printf("Fork Failed\n");
712 test_failing_mbuf_sanity_check(void)
714 struct rte_mbuf *buf;
715 struct rte_mbuf badbuf;
717 printf("Checking rte_mbuf_sanity_check for failure conditions\n");
719 /* get a good mbuf to use to make copies */
720 buf = rte_pktmbuf_alloc(pktmbuf_pool);
723 printf("Checking good mbuf initially\n");
724 if (verify_mbuf_check_panics(buf) != -1)
727 printf("Now checking for error conditions\n");
729 if (verify_mbuf_check_panics(NULL)) {
730 printf("Error with NULL mbuf test\n");
735 badbuf.type = (uint8_t)-1;
736 if (verify_mbuf_check_panics(&badbuf)) {
737 printf("Error with bad-type mbuf test\n");
743 if (verify_mbuf_check_panics(&badbuf)) {
744 printf("Error with bad-pool mbuf test\n");
749 badbuf.buf_physaddr = 0;
750 if (verify_mbuf_check_panics(&badbuf)) {
751 printf("Error with bad-physaddr mbuf test\n");
756 badbuf.buf_addr = NULL;
757 if (verify_mbuf_check_panics(&badbuf)) {
758 printf("Error with bad-addr mbuf test\n");
762 #ifdef RTE_MBUF_SCATTER_GATHER
765 if (verify_mbuf_check_panics(&badbuf)) {
766 printf("Error with bad-refcnt(0) mbuf test\n");
771 badbuf.refcnt = UINT16_MAX;
772 if (verify_mbuf_check_panics(&badbuf)) {
773 printf("Error with bad-refcnt(MAX) mbuf test\n");
786 RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) != 64);
788 /* create pktmbuf pool if it does not exist */
789 if (pktmbuf_pool == NULL) {
791 rte_mempool_create("test_pktmbuf_pool", NB_MBUF,
793 sizeof(struct rte_pktmbuf_pool_private),
794 rte_pktmbuf_pool_init, NULL,
795 rte_pktmbuf_init, NULL,
799 if (pktmbuf_pool == NULL) {
800 printf("cannot allocate mbuf pool\n");
804 /* test multiple mbuf alloc */
805 if (test_pktmbuf_pool() < 0) {
806 printf("test_mbuf_pool() failed\n");
810 /* do it another time to check that all mbufs were freed */
811 if (test_pktmbuf_pool() < 0) {
812 printf("test_mbuf_pool() failed (2)\n");
816 /* test data manipulation in mbuf */
817 if (test_one_pktmbuf() < 0) {
818 printf("test_one_mbuf() failed\n");
824 * do it another time, to check that allocation reinitialize
827 if (test_one_pktmbuf() < 0) {
828 printf("test_one_mbuf() failed (2)\n");
832 if (test_pktmbuf_with_non_ascii_data() < 0) {
833 printf("test_pktmbuf_with_non_ascii_data() failed\n");
837 /* create ctrlmbuf pool if it does not exist */
838 if (ctrlmbuf_pool == NULL) {
840 rte_mempool_create("test_ctrlmbuf_pool", NB_MBUF,
841 sizeof(struct rte_mbuf), 32, 0,
843 rte_ctrlmbuf_init, NULL,
847 /* test control mbuf */
848 if (test_one_ctrlmbuf() < 0) {
849 printf("test_one_ctrlmbuf() failed\n");
853 /* test free pktmbuf segment one by one */
854 if (test_pktmbuf_free_segment() < 0) {
855 printf("test_pktmbuf_free_segment() failed.\n");
859 if (testclone_testupdate_testdetach()<0){
860 printf("testclone_and_testupdate() failed \n");
864 if (test_refcnt_mbuf()<0){
865 printf("test_refcnt_mbuf() failed \n");
869 if (test_failing_mbuf_sanity_check() < 0) {
870 printf("test_failing_mbuf_sanity_check() failed\n");