diff mbox

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

Message ID 1424793647-28572-3-git-send-email-robking@cisco.com
State Accepted
Commit 7e41864db502892c00cfb3a5e5f1d4f1a0799f33
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_crypto.c           | 11 +++++++++++
 platform/linux-generic/odp_init.c             |  5 +++++
 3 files changed, 17 insertions(+)
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h
index fd684d1..9ae8530 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..2df37e7 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -447,6 +447,17 @@  odp_crypto_init_global(void)
 	return 0;
 }
 
+int odp_crypto_term_global(void)
+{
+	int ret;
+
+	ret = odp_shm_free(odp_shm_lookup("crypto_pool"));
+	if (ret < 0)
+		ODP_ERR("shm free failed for crypto_pool");
+
+	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 58e1ab6..602a3fd 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -83,6 +83,11 @@  int odp_term_global(void)
 		rc = -1;
 	}
 
+	if (odp_crypto_term_global()) {
+		ODP_ERR("ODP crypto term failed.\n");
+		rc = -1;
+	}
+
 	return rc;
 }