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

Function test_pktmbuf_pool_ptr

dpdk/app/test/test_mbuf.c:893–942  ·  view source on GitHub ↗

* test that the pointer to the data on a packet mbuf is set properly */

Source from the content-addressed store, hash-verified

891 * test that the pointer to the data on a packet mbuf is set properly
892 */
893static int
894test_pktmbuf_pool_ptr(struct rte_mempool *pktmbuf_pool)
895{
896 unsigned i;
897 struct rte_mbuf *m[NB_MBUF];
898 int ret = 0;
899
900 for (i=0; i<NB_MBUF; i++)
901 m[i] = NULL;
902
903 /* alloc NB_MBUF mbufs */
904 for (i=0; i<NB_MBUF; i++) {
905 m[i] = rte_pktmbuf_alloc(pktmbuf_pool);
906 if (m[i] == NULL) {
907 printf("rte_pktmbuf_alloc() failed (%u)\n", i);
908 ret = -1;
909 break;
910 }
911 m[i]->data_off += 64;
912 }
913
914 /* free them */
915 for (i=0; i<NB_MBUF; i++) {
916 rte_pktmbuf_free(m[i]);
917 }
918
919 for (i=0; i<NB_MBUF; i++)
920 m[i] = NULL;
921
922 /* alloc NB_MBUF mbufs */
923 for (i=0; i<NB_MBUF; i++) {
924 m[i] = rte_pktmbuf_alloc(pktmbuf_pool);
925 if (m[i] == NULL) {
926 printf("rte_pktmbuf_alloc() failed (%u)\n", i);
927 ret = -1;
928 break;
929 }
930 if (m[i]->data_off != RTE_PKTMBUF_HEADROOM) {
931 printf("invalid data_off\n");
932 ret = -1;
933 }
934 }
935
936 /* free them */
937 for (i=0; i<NB_MBUF; i++) {
938 rte_pktmbuf_free(m[i]);
939 }
940
941 return ret;
942}
943
944static int
945test_pktmbuf_free_segment(struct rte_mempool *pktmbuf_pool)

Callers 2

test_mbufFunction · 0.85

Calls 3

rte_pktmbuf_allocFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected