-/*
- * test control mbuf
- */
-static int
-test_one_ctrlmbuf(void)
-{
- struct rte_mbuf *m = NULL;
- char message[] = "This is a message carried by a ctrlmbuf";
-
- printf("Test ctrlmbuf API\n");
-
- /* alloc a mbuf */
-
- m = rte_ctrlmbuf_alloc(ctrlmbuf_pool);
- if (m == NULL)
- GOTO_FAIL("Cannot allocate mbuf");
- if (rte_ctrlmbuf_len(m) != 0)
- GOTO_FAIL("Bad length");
-
- /* set data */
- rte_ctrlmbuf_data(m) = &message;
- rte_ctrlmbuf_len(m) = sizeof(message);
-
- /* read data */
- if (rte_ctrlmbuf_data(m) != message)
- GOTO_FAIL("Invalid data pointer");
- if (rte_ctrlmbuf_len(m) != sizeof(message))
- GOTO_FAIL("Invalid len");
-
- rte_mbuf_sanity_check(m, RTE_MBUF_CTRL, 0);
-
- /* free mbuf */
- rte_ctrlmbuf_free(m);
- m = NULL;
- return 0;
-
-fail:
- if (m)
- rte_ctrlmbuf_free(m);
- return -1;
-}
-