Message ID | 1424723769-8762-3-git-send-email-robking@cisco.com |
---|---|
State | New |
Headers | show |
On 02/23/2015 11:36 PM, Robbie King wrote: > 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 --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..631b0d0 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 = 0; > + no need to set to 0. > + 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 064deea..645ac10 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; > } >
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..631b0d0 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 = 0; + + 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 064deea..645ac10 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; }