diff mbox

[v2,02/10] linux-generic: odp_crypto: add term_global

Message ID 1424116520-20381-3-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_crypto.c           | 13 +++++++++++++
 platform/linux-generic/odp_init.c             |  5 +++++
 3 files changed, 19 insertions(+)
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h
index 40c040f..430d2fb 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -49,6 +49,7 @@  int odp_classification_term_global(void);
 int odp_queue_init_global(void);
 
 int odp_crypto_init_global(void);
+int odp_crypto_term_global(void);
 
 int odp_schedule_init_global(void);
 int odp_schedule_init_local(void);
diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index bc0f961..3572678 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -447,6 +447,19 @@  odp_crypto_init_global(void)
 	return 0;
 }
 
+int odp_crypto_term_global(void)
+{
+	odp_shm_t shm;
+	int ret = 0;
+
+	shm = odp_shm_lookup("crypto_pool");
+	if (shm == ODP_SHM_INVALID)
+		return -1;
+	ret = odp_shm_free(shm);
+
+	return ret;
+}
+
 ssize_t
 odp_random_data(uint8_t *buf, ssize_t len, odp_bool_t use_entropy ODP_UNUSED)
 {
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index 91f4ee7..9c2f9e7 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -81,6 +81,11 @@  int odp_term_global(void)
 		return -1;
 	}
 
+	if (odp_crypto_term_global()) {
+		ODP_ERR("ODP crypto term failed.\n");
+		return -1;
+	}
+
 	return 0;
 }