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

Function test_mempool

dpdk/app/test/test_mempool.c:840–1044  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

838#pragma pop_macro("RTE_TEST_TRACE_FAILURE")
839
840static int
841test_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

Callers

nothing calls this directly

Calls 15

rte_mempool_createFunction · 0.85
rte_mempool_create_emptyFunction · 0.85
rte_mempool_obj_iterFunction · 0.85
rte_mempool_mem_iterFunction · 0.85
rte_mempool_lookupFunction · 0.85
rte_mempool_walkFunction · 0.85
rte_mempool_list_dumpFunction · 0.85
test_mempool_basicFunction · 0.85

Tested by

no test coverage detected