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.
41 #include <sys/queue.h>
43 #include <rte_common.h>
44 #include <rte_debug.h>
46 #include <rte_common.h>
47 #include <rte_memory.h>
48 #include <rte_memcpy.h>
49 #include <rte_memzone.h>
50 #include <rte_launch.h>
51 #include <rte_tailq.h>
53 #include <rte_per_lcore.h>
54 #include <rte_lcore.h>
55 #include <rte_atomic.h>
56 #include <rte_branch_prediction.h>
58 #include <rte_mempool.h>
60 #include <rte_random.h>
61 #include <rte_cycles.h>
65 #define MBUF_SIZE 2048
67 #define MBUF_TEST_DATA_LEN 1464
68 #define MBUF_TEST_DATA_LEN2 50
69 #define MBUF_TEST_HDR1_LEN 20
70 #define MBUF_TEST_HDR2_LEN 30
71 #define MBUF_TEST_ALL_HDRS_LEN (MBUF_TEST_HDR1_LEN+MBUF_TEST_HDR2_LEN)
73 #define REFCNT_MAX_ITER 64
74 #define REFCNT_MAX_TIMEOUT 10
75 #define REFCNT_MAX_REF (RTE_MAX_LCORE)
76 #define REFCNT_MBUF_NUM 64
77 #define REFCNT_MBUF_SIZE (sizeof (struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
78 #define REFCNT_RING_SIZE (REFCNT_MBUF_NUM * REFCNT_MAX_REF)
80 #define MAKE_STRING(x) # x
82 static struct rte_mempool *pktmbuf_pool = NULL;
84 #if defined RTE_MBUF_REFCNT && defined RTE_MBUF_REFCNT_ATOMIC
86 static struct rte_mempool *refcnt_pool = NULL;
87 static struct rte_ring *refcnt_mbuf_ring = NULL;
88 static volatile uint32_t refcnt_stop_slaves;
89 static unsigned refcnt_lcore[RTE_MAX_LCORE];
97 * #. Allocate a mbuf pool.
99 * - The pool contains NB_MBUF elements, where each mbuf is MBUF_SIZE
102 * #. Test multiple allocations of mbufs from this pool.
104 * - Allocate NB_MBUF and store pointers in a table.
105 * - If an allocation fails, return an error.
106 * - Free all these mbufs.
107 * - Repeat the same test to check that mbufs were freed correctly.
109 * #. Test data manipulation in pktmbuf.
112 * - Append data using rte_pktmbuf_append().
113 * - Test for error in rte_pktmbuf_append() when len is too large.
114 * - Trim data at the end of mbuf using rte_pktmbuf_trim().
115 * - Test for error in rte_pktmbuf_trim() when len is too large.
116 * - Prepend a header using rte_pktmbuf_prepend().
117 * - Test for error in rte_pktmbuf_prepend() when len is too large.
118 * - Remove data at the beginning of mbuf using rte_pktmbuf_adj().
119 * - Test for error in rte_pktmbuf_adj() when len is too large.
120 * - Check that appended data is not corrupt.
122 * - Between all these tests, check data_len and pkt_len, and
123 * that the mbuf is contiguous.
124 * - Repeat the test to check that allocation operations
125 * reinitialize the mbuf correctly.
129 #define GOTO_FAIL(str, ...) do { \
130 printf("mbuf test FAILED (l.%d): <" str ">\n", \
131 __LINE__, ##__VA_ARGS__); \
136 * test data manipulation in mbuf with non-ascii data
139 test_pktmbuf_with_non_ascii_data(void)
141 struct rte_mbuf *m = NULL;
144 m = rte_pktmbuf_alloc(pktmbuf_pool);
146 GOTO_FAIL("Cannot allocate mbuf");
147 if (rte_pktmbuf_pkt_len(m) != 0)
148 GOTO_FAIL("Bad length");
150 data = rte_pktmbuf_append(m, MBUF_TEST_DATA_LEN);
152 GOTO_FAIL("Cannot append data");
153 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN)
154 GOTO_FAIL("Bad pkt length");
155 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN)
156 GOTO_FAIL("Bad data length");
157 memset(data, 0xff, rte_pktmbuf_pkt_len(m));
158 if (!rte_pktmbuf_is_contiguous(m))
159 GOTO_FAIL("Buffer should be continuous");
160 rte_pktmbuf_dump(stdout, m, MBUF_TEST_DATA_LEN);
174 * test data manipulation in mbuf
177 test_one_pktmbuf(void)
179 struct rte_mbuf *m = NULL;
180 char *data, *data2, *hdr;
183 printf("Test pktmbuf API\n");
187 m = rte_pktmbuf_alloc(pktmbuf_pool);
189 GOTO_FAIL("Cannot allocate mbuf");
190 if (rte_pktmbuf_pkt_len(m) != 0)
191 GOTO_FAIL("Bad length");
193 rte_pktmbuf_dump(stdout, m, 0);
197 data = rte_pktmbuf_append(m, MBUF_TEST_DATA_LEN);
199 GOTO_FAIL("Cannot append data");
200 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN)
201 GOTO_FAIL("Bad pkt length");
202 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN)
203 GOTO_FAIL("Bad data length");
204 memset(data, 0x66, rte_pktmbuf_pkt_len(m));
205 if (!rte_pktmbuf_is_contiguous(m))
206 GOTO_FAIL("Buffer should be continuous");
207 rte_pktmbuf_dump(stdout, m, MBUF_TEST_DATA_LEN);
208 rte_pktmbuf_dump(stdout, m, 2*MBUF_TEST_DATA_LEN);
210 /* this append should fail */
212 data2 = rte_pktmbuf_append(m, (uint16_t)(rte_pktmbuf_tailroom(m) + 1));
214 GOTO_FAIL("Append should not succeed");
216 /* append some more data */
218 data2 = rte_pktmbuf_append(m, MBUF_TEST_DATA_LEN2);
220 GOTO_FAIL("Cannot append data");
221 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN + MBUF_TEST_DATA_LEN2)
222 GOTO_FAIL("Bad pkt length");
223 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN + MBUF_TEST_DATA_LEN2)
224 GOTO_FAIL("Bad data length");
225 if (!rte_pktmbuf_is_contiguous(m))
226 GOTO_FAIL("Buffer should be continuous");
228 /* trim data at the end of mbuf */
230 if (rte_pktmbuf_trim(m, MBUF_TEST_DATA_LEN2) < 0)
231 GOTO_FAIL("Cannot trim data");
232 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN)
233 GOTO_FAIL("Bad pkt length");
234 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN)
235 GOTO_FAIL("Bad data length");
236 if (!rte_pktmbuf_is_contiguous(m))
237 GOTO_FAIL("Buffer should be continuous");
239 /* this trim should fail */
241 if (rte_pktmbuf_trim(m, (uint16_t)(rte_pktmbuf_data_len(m) + 1)) == 0)
242 GOTO_FAIL("trim should not succeed");
244 /* prepend one header */
246 hdr = rte_pktmbuf_prepend(m, MBUF_TEST_HDR1_LEN);
248 GOTO_FAIL("Cannot prepend");
249 if (data - hdr != MBUF_TEST_HDR1_LEN)
250 GOTO_FAIL("Prepend failed");
251 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN + MBUF_TEST_HDR1_LEN)
252 GOTO_FAIL("Bad pkt length");
253 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN + MBUF_TEST_HDR1_LEN)
254 GOTO_FAIL("Bad data length");
255 if (!rte_pktmbuf_is_contiguous(m))
256 GOTO_FAIL("Buffer should be continuous");
257 memset(hdr, 0x55, MBUF_TEST_HDR1_LEN);
259 /* prepend another header */
261 hdr = rte_pktmbuf_prepend(m, MBUF_TEST_HDR2_LEN);
263 GOTO_FAIL("Cannot prepend");
264 if (data - hdr != MBUF_TEST_ALL_HDRS_LEN)
265 GOTO_FAIL("Prepend failed");
266 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN + MBUF_TEST_ALL_HDRS_LEN)
267 GOTO_FAIL("Bad pkt length");
268 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN + MBUF_TEST_ALL_HDRS_LEN)
269 GOTO_FAIL("Bad data length");
270 if (!rte_pktmbuf_is_contiguous(m))
271 GOTO_FAIL("Buffer should be continuous");
272 memset(hdr, 0x55, MBUF_TEST_HDR2_LEN);
274 rte_mbuf_sanity_check(m, 1);
275 rte_mbuf_sanity_check(m, 0);
276 rte_pktmbuf_dump(stdout, m, 0);
278 /* this prepend should fail */
280 hdr = rte_pktmbuf_prepend(m, (uint16_t)(rte_pktmbuf_headroom(m) + 1));
282 GOTO_FAIL("prepend should not succeed");
284 /* remove data at beginning of mbuf (adj) */
286 if (data != rte_pktmbuf_adj(m, MBUF_TEST_ALL_HDRS_LEN))
287 GOTO_FAIL("rte_pktmbuf_adj failed");
288 if (rte_pktmbuf_pkt_len(m) != MBUF_TEST_DATA_LEN)
289 GOTO_FAIL("Bad pkt length");
290 if (rte_pktmbuf_data_len(m) != MBUF_TEST_DATA_LEN)
291 GOTO_FAIL("Bad data length");
292 if (!rte_pktmbuf_is_contiguous(m))
293 GOTO_FAIL("Buffer should be continuous");
295 /* this adj should fail */
297 if (rte_pktmbuf_adj(m, (uint16_t)(rte_pktmbuf_data_len(m) + 1)) != NULL)
298 GOTO_FAIL("rte_pktmbuf_adj should not succeed");
302 if (!rte_pktmbuf_is_contiguous(m))
303 GOTO_FAIL("Buffer should be continuous");
305 for (i=0; i<MBUF_TEST_DATA_LEN; i++) {
307 GOTO_FAIL("Data corrupted at offset %u", i);
323 testclone_testupdate_testdetach(void)
325 #ifndef RTE_MBUF_REFCNT
328 struct rte_mbuf *mc = NULL;
329 struct rte_mbuf *clone = NULL;
333 mc = rte_pktmbuf_alloc(pktmbuf_pool);
335 GOTO_FAIL("ooops not allocating mbuf");
337 if (rte_pktmbuf_pkt_len(mc) != 0)
338 GOTO_FAIL("Bad length");
341 /* clone the allocated mbuf */
342 clone = rte_pktmbuf_clone(mc, pktmbuf_pool);
344 GOTO_FAIL("cannot clone data\n");
345 rte_pktmbuf_free(clone);
347 mc->next = rte_pktmbuf_alloc(pktmbuf_pool);
349 GOTO_FAIL("Next Pkt Null\n");
351 clone = rte_pktmbuf_clone(mc, pktmbuf_pool);
353 GOTO_FAIL("cannot clone data\n");
356 rte_pktmbuf_free(mc);
357 rte_pktmbuf_free(clone);
364 rte_pktmbuf_free(mc);
366 #endif /* RTE_MBUF_REFCNT */
373 * test allocation and free of mbufs
376 test_pktmbuf_pool(void)
379 struct rte_mbuf *m[NB_MBUF];
382 for (i=0; i<NB_MBUF; i++)
385 /* alloc NB_MBUF mbufs */
386 for (i=0; i<NB_MBUF; i++) {
387 m[i] = rte_pktmbuf_alloc(pktmbuf_pool);
389 printf("rte_pktmbuf_alloc() failed (%u)\n", i);
393 struct rte_mbuf *extra = NULL;
394 extra = rte_pktmbuf_alloc(pktmbuf_pool);
396 printf("Error pool not empty");
399 #ifdef RTE_MBUF_REFCNT
400 extra = rte_pktmbuf_clone(m[0], pktmbuf_pool);
402 printf("Error pool not empty");
407 for (i=0; i<NB_MBUF; i++) {
409 rte_pktmbuf_free(m[i]);
416 * test that the pointer to the data on a packet mbuf is set properly
419 test_pktmbuf_pool_ptr(void)
422 struct rte_mbuf *m[NB_MBUF];
425 for (i=0; i<NB_MBUF; i++)
428 /* alloc NB_MBUF mbufs */
429 for (i=0; i<NB_MBUF; i++) {
430 m[i] = rte_pktmbuf_alloc(pktmbuf_pool);
432 printf("rte_pktmbuf_alloc() failed (%u)\n", i);
435 m[i]->data_off += 64;
439 for (i=0; i<NB_MBUF; i++) {
441 rte_pktmbuf_free(m[i]);
444 for (i=0; i<NB_MBUF; i++)
447 /* alloc NB_MBUF mbufs */
448 for (i=0; i<NB_MBUF; i++) {
449 m[i] = rte_pktmbuf_alloc(pktmbuf_pool);
451 printf("rte_pktmbuf_alloc() failed (%u)\n", i);
454 if (m[i]->data_off != RTE_PKTMBUF_HEADROOM) {
455 printf("invalid data_off\n");
461 for (i=0; i<NB_MBUF; i++) {
463 rte_pktmbuf_free(m[i]);
470 test_pktmbuf_free_segment(void)
473 struct rte_mbuf *m[NB_MBUF];
476 for (i=0; i<NB_MBUF; i++)
479 /* alloc NB_MBUF mbufs */
480 for (i=0; i<NB_MBUF; i++) {
481 m[i] = rte_pktmbuf_alloc(pktmbuf_pool);
483 printf("rte_pktmbuf_alloc() failed (%u)\n", i);
489 for (i=0; i<NB_MBUF; i++) {
491 struct rte_mbuf *mb, *mt;
497 rte_pktmbuf_free_seg(mt);
506 * Stress test for rte_mbuf atomic refcnt.
508 * RTE_MBUF_REFCNT and RTE_MBUF_REFCNT_ATOMIC are both defined.
509 * For more efficency, recomended to run with RTE_LIBRTE_MBUF_DEBUG defined.
512 #if defined RTE_MBUF_REFCNT && defined RTE_MBUF_REFCNT_ATOMIC
515 test_refcnt_slave(__attribute__((unused)) void *arg)
517 unsigned lcore, free;
520 lcore = rte_lcore_id();
521 printf("%s started at lcore %u\n", __func__, lcore);
524 while (refcnt_stop_slaves == 0) {
525 if (rte_ring_dequeue(refcnt_mbuf_ring, &mp) == 0) {
527 rte_pktmbuf_free((struct rte_mbuf *)mp);
531 refcnt_lcore[lcore] += free;
532 printf("%s finished at lcore %u, "
533 "number of freed mbufs: %u\n",
534 __func__, lcore, free);
539 test_refcnt_iter(unsigned lcore, unsigned iter)
542 unsigned i, n, tref, wn;
547 /* For each mbuf in the pool:
549 * - increment it's reference up to N+1,
550 * - enqueue it N times into the ring for slave cores to free.
552 for (i = 0, n = rte_mempool_count(refcnt_pool);
553 i != n && (m = rte_pktmbuf_alloc(refcnt_pool)) != NULL;
555 ref = RTE_MAX(rte_rand() % REFCNT_MAX_REF, 1UL);
557 if ((ref & 1) != 0) {
558 rte_pktmbuf_refcnt_update(m, ref);
560 rte_ring_enqueue(refcnt_mbuf_ring, m);
563 rte_pktmbuf_refcnt_update(m, 1);
564 rte_ring_enqueue(refcnt_mbuf_ring, m);
571 rte_panic("(lcore=%u, iter=%u): was able to allocate only "
572 "%u from %u mbufs\n", lcore, iter, i, n);
574 /* wait till slave lcores will consume all mbufs */
575 while (!rte_ring_empty(refcnt_mbuf_ring))
578 /* check that all mbufs are back into mempool by now */
579 for (wn = 0; wn != REFCNT_MAX_TIMEOUT; wn++) {
580 if ((i = rte_mempool_count(refcnt_pool)) == n) {
581 refcnt_lcore[lcore] += tref;
582 printf("%s(lcore=%u, iter=%u) completed, "
583 "%u references processed\n",
584 __func__, lcore, iter, tref);
590 rte_panic("(lcore=%u, iter=%u): after %us only "
591 "%u of %u mbufs left free\n", lcore, iter, wn, i, n);
595 test_refcnt_master(void)
599 lcore = rte_lcore_id();
600 printf("%s started at lcore %u\n", __func__, lcore);
602 for (i = 0; i != REFCNT_MAX_ITER; i++)
603 test_refcnt_iter(lcore, i);
605 refcnt_stop_slaves = 1;
608 printf("%s finished at lcore %u\n", __func__, lcore);
615 test_refcnt_mbuf(void)
617 #if defined RTE_MBUF_REFCNT && defined RTE_MBUF_REFCNT_ATOMIC
619 unsigned lnum, master, slave, tref;
622 if ((lnum = rte_lcore_count()) == 1) {
623 printf("skipping %s, number of lcores: %u is not enough\n",
628 printf("starting %s, at %u lcores\n", __func__, lnum);
630 /* create refcnt pool & ring if they don't exist */
632 if (refcnt_pool == NULL &&
633 (refcnt_pool = rte_mempool_create(
634 MAKE_STRING(refcnt_pool),
635 REFCNT_MBUF_NUM, REFCNT_MBUF_SIZE, 0,
636 sizeof(struct rte_pktmbuf_pool_private),
637 rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL,
638 SOCKET_ID_ANY, 0)) == NULL) {
639 printf("%s: cannot allocate " MAKE_STRING(refcnt_pool) "\n",
644 if (refcnt_mbuf_ring == NULL &&
645 (refcnt_mbuf_ring = rte_ring_create("refcnt_mbuf_ring",
646 REFCNT_RING_SIZE, SOCKET_ID_ANY,
647 RING_F_SP_ENQ)) == NULL) {
648 printf("%s: cannot allocate " MAKE_STRING(refcnt_mbuf_ring)
653 refcnt_stop_slaves = 0;
654 memset(refcnt_lcore, 0, sizeof (refcnt_lcore));
656 rte_eal_mp_remote_launch(test_refcnt_slave, NULL, SKIP_MASTER);
658 test_refcnt_master();
660 rte_eal_mp_wait_lcore();
662 /* check that we porcessed all references */
664 master = rte_get_master_lcore();
666 RTE_LCORE_FOREACH_SLAVE(slave)
667 tref += refcnt_lcore[slave];
669 if (tref != refcnt_lcore[master])
670 rte_panic("refernced mbufs: %u, freed mbufs: %u\n",
671 tref, refcnt_lcore[master]);
673 rte_mempool_dump(stdout, refcnt_pool);
674 rte_ring_dump(stdout, refcnt_mbuf_ring);
680 #ifdef RTE_EXEC_ENV_BAREMETAL
682 /* baremetal - don't test failing sanity checks */
684 test_failing_mbuf_sanity_check(void)
692 #include <sys/wait.h>
694 /* linuxapp - use fork() to test mbuf errors panic */
696 verify_mbuf_check_panics(struct rte_mbuf *buf)
704 rte_mbuf_sanity_check(buf, 1); /* should panic */
705 exit(0); /* return normally if it doesn't panic */
707 printf("Fork Failed\n");
718 test_failing_mbuf_sanity_check(void)
720 struct rte_mbuf *buf;
721 struct rte_mbuf badbuf;
723 printf("Checking rte_mbuf_sanity_check for failure conditions\n");
725 /* get a good mbuf to use to make copies */
726 buf = rte_pktmbuf_alloc(pktmbuf_pool);
729 printf("Checking good mbuf initially\n");
730 if (verify_mbuf_check_panics(buf) != -1)
733 printf("Now checking for error conditions\n");
735 if (verify_mbuf_check_panics(NULL)) {
736 printf("Error with NULL mbuf test\n");
742 if (verify_mbuf_check_panics(&badbuf)) {
743 printf("Error with bad-pool mbuf test\n");
748 badbuf.buf_physaddr = 0;
749 if (verify_mbuf_check_panics(&badbuf)) {
750 printf("Error with bad-physaddr mbuf test\n");
755 badbuf.buf_addr = NULL;
756 if (verify_mbuf_check_panics(&badbuf)) {
757 printf("Error with bad-addr mbuf test\n");
761 #ifdef RTE_MBUF_REFCNT
764 if (verify_mbuf_check_panics(&badbuf)) {
765 printf("Error with bad-refcnt(0) mbuf test\n");
770 badbuf.refcnt = UINT16_MAX;
771 if (verify_mbuf_check_panics(&badbuf)) {
772 printf("Error with bad-refcnt(MAX) mbuf test\n");
785 RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) != 64);
787 /* create pktmbuf pool if it does not exist */
788 if (pktmbuf_pool == NULL) {
790 rte_mempool_create("test_pktmbuf_pool", NB_MBUF,
792 sizeof(struct rte_pktmbuf_pool_private),
793 rte_pktmbuf_pool_init, NULL,
794 rte_pktmbuf_init, NULL,
798 if (pktmbuf_pool == NULL) {
799 printf("cannot allocate mbuf pool\n");
803 /* test multiple mbuf alloc */
804 if (test_pktmbuf_pool() < 0) {
805 printf("test_mbuf_pool() failed\n");
809 /* do it another time to check that all mbufs were freed */
810 if (test_pktmbuf_pool() < 0) {
811 printf("test_mbuf_pool() failed (2)\n");
815 /* test that the pointer to the data on a packet mbuf is set properly */
816 if (test_pktmbuf_pool_ptr() < 0) {
817 printf("test_pktmbuf_pool_ptr() failed\n");
821 /* test data manipulation in mbuf */
822 if (test_one_pktmbuf() < 0) {
823 printf("test_one_mbuf() failed\n");
829 * do it another time, to check that allocation reinitialize
832 if (test_one_pktmbuf() < 0) {
833 printf("test_one_mbuf() failed (2)\n");
837 if (test_pktmbuf_with_non_ascii_data() < 0) {
838 printf("test_pktmbuf_with_non_ascii_data() failed\n");
842 /* test free pktmbuf segment one by one */
843 if (test_pktmbuf_free_segment() < 0) {
844 printf("test_pktmbuf_free_segment() failed.\n");
848 if (testclone_testupdate_testdetach()<0){
849 printf("testclone_and_testupdate() failed \n");
853 if (test_refcnt_mbuf()<0){
854 printf("test_refcnt_mbuf() failed \n");
858 if (test_failing_mbuf_sanity_check() < 0) {
859 printf("test_failing_mbuf_sanity_check() failed\n");
865 static struct test_command mbuf_cmd = {
866 .command = "mbuf_autotest",
867 .callback = test_mbuf,
869 REGISTER_TEST_COMMAND(mbuf_cmd);