diff mbox

[v3,3/3] linux-generic: implement of odp_term_local.

Message ID 1422183054-23030-1-git-send-email-yan.songming@linaro.org
State New
Headers show

Commit Message

yan.songming Jan. 25, 2015, 10:50 a.m. UTC
From: Yan Sonming <yan.songming@linaro.org>

Free local resource of odp.

Signed-off-by: Yan Songming <yan.songming@linaro.org>
---
 platform/linux-generic/include/odp_internal.h |  2 ++
 platform/linux-generic/odp_buffer_pool.c      |  7 +++++++
 platform/linux-generic/odp_init.c             | 10 ++++++++++
 platform/linux-generic/odp_schedule.c         |  6 +++++-
 4 files changed, 24 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h
index 60d89b1..ddf5dd5 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -37,6 +37,7 @@  int odp_shm_init_local(void);
 
 int odp_buffer_pool_init_global(void);
 int odp_buffer_pool_term_global(void);
+int odp_buffer_pool_term_local(void);
 
 int odp_pktio_init_global(void);
 int odp_pktio_term_global(void);
@@ -54,6 +55,7 @@  int odp_crypto_term_global(void);
 int odp_schedule_init_global(void);
 int odp_schedule_term_global(void);
 int odp_schedule_init_local(void);
+int odp_schedule_term_local(void);
 
 int odp_timer_init_global(void);
 int odp_timer_disarm_all(void);
diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c
index f9b0ba5..77f4a1e 100644
--- a/platform/linux-generic/odp_buffer_pool.c
+++ b/platform/linux-generic/odp_buffer_pool.c
@@ -124,6 +124,13 @@  int odp_buffer_pool_term_global(void)
        return ret;
 }
 
+int odp_buffer_pool_term_local(void)
+{
+	_odp_flush_caches();
+ 	return 0;
+}
+
+
 /**
  * Buffer pool creation
  */
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index a6f5c2c..73df6a7 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -141,5 +141,15 @@  int odp_init_local(void)
 
 int odp_term_local(void)
 {
+	if (odp_schedule_term_local()) {
+		ODP_ERR("ODP schedule local term failed.\n");
+		return -1;
+	}
+
+	if (odp_buffer_pool_term_local()) {
+		ODP_ERR("ODP buffer pool local term failed.\n");
+		return -1;
+	}
+
 	return (odp_thread_term_local() > 0) ? 1 : 0;
 }
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index 316bb01..a65a1d7 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -184,7 +184,11 @@  int odp_schedule_init_local(void)
 
 	return 0;
 }
-
+int odp_schedule_term_local(void)
+{
+ 	memset(&sched_local, 0, sizeof(sched_local_t));
+	return 0;
+}
 
 void odp_schedule_mask_set(odp_queue_t queue, int prio)
 {