app/eventdev: add mempool setup and destroy
authorPavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Tue, 16 Jan 2018 17:45:55 +0000 (23:15 +0530)
committerJerin Jacob <jerin.jacob@caviumnetworks.com>
Fri, 19 Jan 2018 15:09:56 +0000 (16:09 +0100)
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
app/test-eventdev/test_pipeline_common.c
app/test-eventdev/test_pipeline_common.h

index aa34812..ff60fc3 100644 (file)
@@ -5,6 +5,35 @@
 
 #include "test_pipeline_common.h"
 
+int
+pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt)
+{
+       struct test_pipeline *t = evt_test_priv(test);
+
+       t->pool = rte_pktmbuf_pool_create(test->name, /* mempool name */
+                       opt->pool_sz, /* number of elements*/
+                       512, /* cache size*/
+                       0,
+                       RTE_MBUF_DEFAULT_BUF_SIZE,
+                       opt->socket_id); /* flags */
+
+       if (t->pool == NULL) {
+               evt_err("failed to create mempool");
+               return -ENOMEM;
+       }
+
+       return 0;
+}
+
+void
+pipeline_mempool_destroy(struct evt_test *test, struct evt_options *opt)
+{
+       RTE_SET_USED(opt);
+       struct test_pipeline *t = evt_test_priv(test);
+
+       rte_mempool_free(t->pool);
+}
+
 int
 pipeline_test_setup(struct evt_test *test, struct evt_options *opt)
 {
index 645571c..569db1d 100644 (file)
@@ -52,6 +52,8 @@ struct test_pipeline {
 } __rte_cache_aligned;
 
 int pipeline_test_setup(struct evt_test *test, struct evt_options *opt);
+int pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt);
 void pipeline_test_destroy(struct evt_test *test, struct evt_options *opt);
+void pipeline_mempool_destroy(struct evt_test *test, struct evt_options *opt);
 
 #endif /* _TEST_PIPELINE_COMMON_ */