diff options
author | Matias Elo <matias.elo@nokia.com> | 2023-06-28 13:51:58 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2023-08-08 09:54:40 +0300 |
commit | b05586bba7a3cea11755da804a9fd6f8338f9e0f (patch) | |
tree | 9cdf8937f3c1f143fc765c329e0c16c615983bfd | |
parent | d7bc1c426dd6e545dffd134dd343460fa515d5d4 (diff) |
Port 5cfbf7b26 "linux-gen: init: implement odp_term_abnormal()"
Port original commit from linux-generic.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
-rw-r--r-- | platform/linux-dpdk/odp_init.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/platform/linux-dpdk/odp_init.c b/platform/linux-dpdk/odp_init.c index d35c63692..c7ae1ea47 100644 --- a/platform/linux-dpdk/odp_init.c +++ b/platform/linux-dpdk/odp_init.c @@ -26,6 +26,7 @@ #include <inttypes.h> #include <rte_config.h> +#include <rte_debug.h> #include <rte_eal.h> #include <rte_string_fns.h> @@ -872,6 +873,28 @@ int odp_term_local(void) return term_local(ALL_INIT); } +int odp_term_abnormal(odp_instance_t instance, uint64_t flags, void *data ODP_UNUSED) +{ + rte_dump_stack(); + + if (flags & ODP_TERM_FROM_SIGH) + /* Called from signal handler, not safe to terminate with local/global, + * return with failure as not able to perform all actions */ + return -1; + + if (odp_term_local() < 0) { + _ODP_ERR("ODP local terminate failed.\n"); + return -2; + } + + if (odp_term_global(instance) < 0) { + _ODP_ERR("ODP global terminate failed.\n"); + return -3; + } + + return 0; +} + void odp_log_thread_fn_set(odp_log_func_t func) { _odp_this_thread->log_fn = func; |