| 838 | #pragma pop_macro("RTE_TEST_TRACE_FAILURE") |
| 839 | |
| 840 | static int |
| 841 | test_mempool(void) |
| 842 | { |
| 843 | int ret = -1; |
| 844 | uint32_t nb_objs = 0; |
| 845 | uint32_t nb_mem_chunks = 0; |
| 846 | struct rte_mempool *mp_cache = NULL; |
| 847 | struct rte_mempool *mp_nocache = NULL; |
| 848 | struct rte_mempool *mp_stack_anon = NULL; |
| 849 | struct rte_mempool *mp_stack_mempool_iter = NULL; |
| 850 | struct rte_mempool *mp_stack = NULL; |
| 851 | struct rte_mempool *default_pool = NULL; |
| 852 | struct mp_data cb_arg = { |
| 853 | .ret = -1 |
| 854 | }; |
| 855 | const char *default_pool_ops = rte_mbuf_best_mempool_ops(); |
| 856 | |
| 857 | /* create a mempool (without cache) */ |
| 858 | mp_nocache = rte_mempool_create("test_nocache", MEMPOOL_SIZE, |
| 859 | MEMPOOL_ELT_SIZE, 0, 0, |
| 860 | NULL, NULL, |
| 861 | my_obj_init, NULL, |
| 862 | SOCKET_ID_ANY, 0); |
| 863 | |
| 864 | if (mp_nocache == NULL) { |
| 865 | printf("cannot allocate mp_nocache mempool\n"); |
| 866 | GOTO_ERR(ret, err); |
| 867 | } |
| 868 | |
| 869 | /* create a mempool (with cache) */ |
| 870 | mp_cache = rte_mempool_create("test_cache", MEMPOOL_SIZE, |
| 871 | MEMPOOL_ELT_SIZE, |
| 872 | RTE_MEMPOOL_CACHE_MAX_SIZE, 0, |
| 873 | NULL, NULL, |
| 874 | my_obj_init, NULL, |
| 875 | SOCKET_ID_ANY, 0); |
| 876 | |
| 877 | if (mp_cache == NULL) { |
| 878 | printf("cannot allocate mp_cache mempool\n"); |
| 879 | GOTO_ERR(ret, err); |
| 880 | } |
| 881 | |
| 882 | /* create an empty mempool */ |
| 883 | mp_stack_anon = rte_mempool_create_empty("test_stack_anon", |
| 884 | MEMPOOL_SIZE, |
| 885 | MEMPOOL_ELT_SIZE, |
| 886 | RTE_MEMPOOL_CACHE_MAX_SIZE, 0, |
| 887 | SOCKET_ID_ANY, 0); |
| 888 | |
| 889 | if (mp_stack_anon == NULL) |
| 890 | GOTO_ERR(ret, err); |
| 891 | |
| 892 | /* populate an empty mempool */ |
| 893 | ret = rte_mempool_populate_anon(mp_stack_anon); |
| 894 | printf("%s ret = %d\n", __func__, ret); |
| 895 | if (ret < 0) |
| 896 | GOTO_ERR(ret, err); |
| 897 |
nothing calls this directly
no test coverage detected