* test that the pointer to the data on a packet mbuf is set properly */
| 891 | * test that the pointer to the data on a packet mbuf is set properly |
| 892 | */ |
| 893 | static int |
| 894 | test_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 | |
| 944 | static int |
| 945 | test_pktmbuf_free_segment(struct rte_mempool *pktmbuf_pool) |
no test coverage detected