diff mbox

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

Message ID 1424793647-28572-2-git-send-email-robking@cisco.com
State Accepted
Commit 8902edc8342a40d17d185d0a3f819f70a6fe5a6b
Headers show

Commit Message

Robbie King Feb. 24, 2015, 4 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>
Signed-off-by: Robbie King <robking@cisco.com>
---
 platform/linux-generic/include/odp_internal.h |  1 +
 platform/linux-generic/odp_classification.c   | 26 ++++++++++++++++++++++++++
 platform/linux-generic/odp_init.c             | 10 ++++++++--
 3 files changed, 35 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h
index b250ed6..fd684d1 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 cd9ad9e..9fb034f 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -128,6 +128,32 @@  error:
 	return -1;
 }
 
+int odp_classification_term_global(void)
+{
+	int ret = 0;
+	int rc = 0;
+
+	ret = odp_shm_free(odp_shm_lookup("shm_odp_cos_tbl"));
+	if (ret < 0) {
+		ODP_ERR("shm free failed for shm_odp_cos_tbl");
+		rc = -1;
+	}
+
+	ret = odp_shm_free(odp_shm_lookup("shm_odp_pmr_tbl"));
+	if (ret < 0) {
+		ODP_ERR("shm free failed for shm_odp_pmr_tbl");
+		rc = -1;
+	}
+
+	ret = odp_shm_free(odp_shm_lookup("shm_odp_pmr_set_tbl"));
+	if (ret < 0) {
+		ODP_ERR("shm free failed for shm_odp_pmr_tbl");
+		rc = -1;
+	}
+
+	return rc;
+}
+
 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 2d91744..58e1ab6 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -76,8 +76,14 @@  int odp_init_global(odp_init_t *params,
 
 int odp_term_global(void)
 {
-	ODP_UNIMPLEMENTED();
-	return 0;
+	int rc = 0;
+
+	if (odp_classification_term_global()) {
+		ODP_ERR("ODP classificatio term failed.\n");
+		rc = -1;
+	}
+
+	return rc;
 }
 
 int odp_init_local(void)