diff mbox

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

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

Commit Message

Mike Holmes Jan. 30, 2015, 2:46 a.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 608aafd..2bd4b83 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -39,6 +39,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 78597ef..47df7c2 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -124,6 +124,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 6db05b3..88a2578 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -72,7 +72,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;
 }