diff mbox

[v2,01/10] linux-generic: classification: add term_global

Message ID 1424116520-20381-2-git-send-email-mike.holmes@linaro.org
State New
Headers show

Commit Message

Mike Holmes Feb. 16, 2015, 7:55 p.m. UTC
From: Yan Sonming <yan.songming@linaro.org>

Signed-off-by: Yan Sonming <yan.songming@linaro.org>
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 platform/linux-generic/include/odp_internal.h |  1 +
 platform/linux-generic/odp_classification.c   | 25 +++++++++++++++++++++++++
 platform/linux-generic/odp_init.c             |  6 +++++-
 3 files changed, 31 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 cd1adeb..40c040f 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -44,6 +44,7 @@  int odp_pktio_init_global(void);
 int odp_pktio_init_local(void);
 
 int odp_classification_init_global(void);
+int odp_classification_term_global(void);
 
 int odp_queue_init_global(void);
 
diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c
index a7344f8..7d9f73a 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -128,6 +128,31 @@  error:
 	return -1;
 }
 
+int odp_classification_term_global(void)
+{
+	odp_shm_t cos_shm;
+	odp_shm_t pmr_shm;
+	odp_shm_t pmr_set_shm;
+	int ret = 0;
+
+	cos_shm = odp_shm_lookup("shm_odp_cos_tbl");
+	if (cos_shm == ODP_SHM_INVALID)
+		return -1;
+	ret = odp_shm_free(cos_shm);
+
+	pmr_shm = odp_shm_lookup("shm_odp_pmr_tbl");
+	if (pmr_shm == ODP_SHM_INVALID)
+		return -1;
+	ret = odp_shm_free(pmr_shm);
+
+	pmr_set_shm = odp_shm_lookup("shm_odp_pmr_set_tbl");
+	if (pmr_set_shm == ODP_SHM_INVALID)
+		return -1;
+	ret = odp_shm_free(pmr_set_shm);
+
+	return ret;
+}
+
 odp_cos_t odp_cos_create(const char *name)
 {
 	int i;
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index cd8dc46..91f4ee7 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -76,7 +76,11 @@  int odp_init_global(odp_init_t *params  ODP_UNUSED,
 
 int odp_term_global(void)
 {
-	ODP_UNIMPLEMENTED();
+	if (odp_classification_term_global()) {
+		ODP_ERR("ODP classificatio term failed.\n");
+		return -1;
+	}
+
 	return 0;
 }