[dpdk-dev,v2,03/12] app/eventdev: add mempool setup and destroy

Message ID 20171218214405.26763-3-pbhagavatula@caviumnetworks.com (mailing list archive)
State Changes Requested, archived
Delegated to: Jerin Jacob
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Pavan Nikhilesh Dec. 18, 2017, 9:43 p.m. UTC
  Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 app/test-eventdev/test_pipeline_common.c | 29 +++++++++++++++++++++++++++++
 app/test-eventdev/test_pipeline_common.h |  2 ++
 2 files changed, 31 insertions(+)
  

Comments

Jerin Jacob Jan. 8, 2018, 2:06 p.m. UTC | #1
-----Original Message-----
> Date: Tue, 19 Dec 2017 03:13:56 +0530
> From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com,
>  bruce.richardson@intel.com, harry.van.haaren@intel.com,
>  gage.eads@intel.com, hemant.agrawal@nxp.com, nipun.gupta@nxp.com,
>  liang.j.ma@intel.com
> Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH v2 03/12] app/eventdev: add mempool setup and
>  destroy
> X-Mailer: git-send-email 2.14.1
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>

Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

> ---
>  app/test-eventdev/test_pipeline_common.c | 29 +++++++++++++++++++++++++++++
>  app/test-eventdev/test_pipeline_common.h |  2 ++
>  2 files changed, 31 insertions(+)
> 
> diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
> index 6e9088719..d34003362 100644
> --- a/app/test-eventdev/test_pipeline_common.c
> +++ b/app/test-eventdev/test_pipeline_common.c
> @@ -32,6 +32,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)
>  {
> diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h
> index f87d02d6b..35367d546 100644
> --- a/app/test-eventdev/test_pipeline_common.h
> +++ b/app/test-eventdev/test_pipeline_common.h
> @@ -79,6 +79,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_ */
> -- 
> 2.14.1
>
  

Patch

diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index 6e9088719..d34003362 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -32,6 +32,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)
 {
diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h
index f87d02d6b..35367d546 100644
--- a/app/test-eventdev/test_pipeline_common.h
+++ b/app/test-eventdev/test_pipeline_common.h
@@ -79,6 +79,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_ */