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

Function test_pktmbuf_pool

dpdk/app/test/test_mbuf.c:684–719  ·  view source on GitHub ↗

* test allocation and free of mbufs */

Source from the content-addressed store, hash-verified

682 * test allocation and free of mbufs
683 */
684static int
685test_pktmbuf_pool(struct rte_mempool *pktmbuf_pool)
686{
687 unsigned i;
688 struct rte_mbuf *m[NB_MBUF];
689 int ret = 0;
690
691 for (i=0; i<NB_MBUF; i++)
692 m[i] = NULL;
693
694 /* alloc NB_MBUF mbufs */
695 for (i=0; i<NB_MBUF; i++) {
696 m[i] = rte_pktmbuf_alloc(pktmbuf_pool);
697 if (m[i] == NULL) {
698 printf("rte_pktmbuf_alloc() failed (%u)\n", i);
699 ret = -1;
700 }
701 }
702 struct rte_mbuf *extra = NULL;
703 extra = rte_pktmbuf_alloc(pktmbuf_pool);
704 if(extra != NULL) {
705 printf("Error pool not empty");
706 ret = -1;
707 }
708 extra = rte_pktmbuf_clone(m[0], pktmbuf_pool);
709 if(extra != NULL) {
710 printf("Error pool not empty");
711 ret = -1;
712 }
713 /* free them */
714 for (i=0; i<NB_MBUF; i++) {
715 rte_pktmbuf_free(m[i]);
716 }
717
718 return ret;
719}
720
721/*
722 * test bulk allocation and bulk free of mbufs

Callers 2

test_mbufFunction · 0.85

Calls 4

rte_pktmbuf_allocFunction · 0.85
rte_pktmbuf_cloneFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected