aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2018-07-10 09:37:51 +0300
committerMatias Elo <matias.elo@nokia.com>2018-07-11 12:59:12 +0300
commite209a47337d51cb14f9e3bca118482824a0e3303 (patch)
tree3b62df5ddc06df78d5743416660b9fc8d9082d2f
parent7ac6f8ab1c3b3df906e69a9e8a9b2bb532a6c2ac (diff)
Port 170e9305 "linux-gen: init: remove init.c internal types from header"
Signed-off-by: Matias Elo <matias.elo@nokia.com>
-rw-r--r--platform/linux-dpdk/odp_init.c358
1 files changed, 191 insertions, 167 deletions
diff --git a/platform/linux-dpdk/odp_init.c b/platform/linux-dpdk/odp_init.c
index 2729d6a6f..dac146208 100644
--- a/platform/linux-dpdk/odp_init.c
+++ b/platform/linux-dpdk/odp_init.c
@@ -30,6 +30,30 @@
#include <rte_eal.h>
#include <rte_string_fns.h>
+enum init_stage {
+ NO_INIT = 0, /* No init stages completed */
+ LIBCONFIG_INIT,
+ CPUMASK_INIT,
+ TIME_INIT,
+ SYSINFO_INIT,
+ ISHM_INIT,
+ FDSERVER_INIT,
+ THREAD_INIT,
+ POOL_INIT,
+ QUEUE_INIT,
+ SCHED_INIT,
+ PKTIO_INIT,
+ TIMER_INIT,
+ CRYPTO_INIT,
+ CLASSIFICATION_INIT,
+ TRAFFIC_MNGR_INIT,
+ NAME_TABLE_INIT,
+ IPSEC_EVENTS_INIT,
+ IPSEC_SAD_INIT,
+ IPSEC_INIT,
+ ALL_INIT /* All init stages completed */
+};
+
#define MEMPOOL_OPS(hdl) extern void mp_hdlr_init_##hdl(void)
MEMPOOL_OPS(ops_mp_mc);
MEMPOOL_OPS(ops_sp_sc);
@@ -139,6 +163,147 @@ void odp_init_param_init(odp_init_t *param)
memset(param, 0, sizeof(odp_init_t));
}
+static int term_global(enum init_stage stage)
+{
+ int rc = 0;
+
+ switch (stage) {
+ case ALL_INIT:
+ case IPSEC_INIT:
+ if (_odp_ipsec_term_global()) {
+ ODP_ERR("ODP IPsec term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case IPSEC_SAD_INIT:
+ if (_odp_ipsec_sad_term_global()) {
+ ODP_ERR("ODP IPsec SAD term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case IPSEC_EVENTS_INIT:
+ if (_odp_ipsec_events_term_global()) {
+ ODP_ERR("ODP IPsec events term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case NAME_TABLE_INIT:
+ if (_odp_int_name_tbl_term_global()) {
+ ODP_ERR("Name table term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case TRAFFIC_MNGR_INIT:
+ if (odp_tm_term_global()) {
+ ODP_ERR("TM term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case CLASSIFICATION_INIT:
+ if (odp_classification_term_global()) {
+ ODP_ERR("ODP classification term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case CRYPTO_INIT:
+ if (odp_crypto_term_global()) {
+ ODP_ERR("ODP crypto term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case TIMER_INIT:
+ if (odp_timer_term_global()) {
+ ODP_ERR("ODP timer term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case PKTIO_INIT:
+ if (odp_pktio_term_global()) {
+ ODP_ERR("ODP pktio term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case SCHED_INIT:
+ if (_odp_schedule_term_global()) {
+ ODP_ERR("ODP schedule term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case QUEUE_INIT:
+ if (_odp_queue_term_global()) {
+ ODP_ERR("ODP queue term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case POOL_INIT:
+ if (odp_pool_term_global()) {
+ ODP_ERR("ODP buffer pool term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case THREAD_INIT:
+ if (odp_thread_term_global()) {
+ ODP_ERR("ODP thread term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ /* Needed to prevent compiler warning */
+ case FDSERVER_INIT:
+ case ISHM_INIT:
+ if (_odp_shm_term_global()) {
+ ODP_ERR("ODP shm term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case SYSINFO_INIT:
+ if (odp_system_info_term()) {
+ ODP_ERR("ODP system info term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case TIME_INIT:
+ if (odp_time_term_global()) {
+ ODP_ERR("ODP time term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case CPUMASK_INIT:
+ if (odp_cpumask_term_global()) {
+ ODP_ERR("ODP cpumask term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case LIBCONFIG_INIT:
+ if (_odp_libconfig_term_global()) {
+ ODP_ERR("ODP runtime config term failed.\n");
+ rc = -1;
+ }
+ /* Fall through */
+
+ case NO_INIT:
+ ;
+ }
+
+ return rc;
+}
+
int odp_init_global(odp_instance_t *instance,
const odp_init_t *params,
const odp_platform_init_t *platform_params)
@@ -277,7 +442,7 @@ int odp_init_global(odp_instance_t *instance,
return 0;
init_failed:
- _odp_term_global(stage);
+ term_global(stage);
return -1;
}
@@ -287,145 +452,65 @@ int odp_term_global(odp_instance_t instance)
ODP_ERR("Bad instance.\n");
return -1;
}
- return _odp_term_global(ALL_INIT);
+ return term_global(ALL_INIT);
}
-int _odp_term_global(enum init_stage stage)
+static int term_local(enum init_stage stage)
{
int rc = 0;
+ int rc_thd = 0;
switch (stage) {
case ALL_INIT:
- case IPSEC_INIT:
- if (_odp_ipsec_term_global()) {
- ODP_ERR("ODP IPsec term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case IPSEC_SAD_INIT:
- if (_odp_ipsec_sad_term_global()) {
- ODP_ERR("ODP IPsec SAD term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case IPSEC_EVENTS_INIT:
- if (_odp_ipsec_events_term_global()) {
- ODP_ERR("ODP IPsec events term failed.\n");
- rc = -1;
- }
- /* Fall through */
- case NAME_TABLE_INIT:
- if (_odp_int_name_tbl_term_global()) {
- ODP_ERR("Name table term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case TRAFFIC_MNGR_INIT:
- if (odp_tm_term_global()) {
- ODP_ERR("TM term failed.\n");
+ case SCHED_INIT:
+ if (sched_fn->term_local()) {
+ ODP_ERR("ODP schedule local term failed.\n");
rc = -1;
}
/* Fall through */
- case CLASSIFICATION_INIT:
- if (odp_classification_term_global()) {
- ODP_ERR("ODP classification term failed.\n");
+ case QUEUE_INIT:
+ if (queue_fn->term_local()) {
+ ODP_ERR("ODP queue local term failed.\n");
rc = -1;
}
/* Fall through */
case CRYPTO_INIT:
- if (odp_crypto_term_global()) {
- ODP_ERR("ODP crypto term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case TIMER_INIT:
- if (odp_timer_term_global()) {
- ODP_ERR("ODP timer term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case PKTIO_INIT:
- if (odp_pktio_term_global()) {
- ODP_ERR("ODP pktio term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case SCHED_INIT:
- if (_odp_schedule_term_global()) {
- ODP_ERR("ODP schedule term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case QUEUE_INIT:
- if (_odp_queue_term_global()) {
- ODP_ERR("ODP queue term failed.\n");
+ if (_odp_crypto_term_local()) {
+ ODP_ERR("ODP crypto local term failed.\n");
rc = -1;
}
/* Fall through */
case POOL_INIT:
- if (odp_pool_term_global()) {
- ODP_ERR("ODP buffer pool term failed.\n");
+ if (odp_pool_term_local()) {
+ ODP_ERR("ODP buffer pool local term failed.\n");
rc = -1;
}
/* Fall through */
case THREAD_INIT:
- if (odp_thread_term_global()) {
- ODP_ERR("ODP thread term failed.\n");
+ rc_thd = odp_thread_term_local();
+ if (rc_thd < 0) {
+ ODP_ERR("ODP thread local term failed.\n");
rc = -1;
+ } else {
+ if (!rc)
+ rc = rc_thd;
}
/* Fall through */
- /* Needed to prevent compiler warning */
- case FDSERVER_INIT:
case ISHM_INIT:
- if (_odp_shm_term_global()) {
- ODP_ERR("ODP shm term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case SYSINFO_INIT:
- if (odp_system_info_term()) {
- ODP_ERR("ODP system info term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case TIME_INIT:
- if (odp_time_term_global()) {
- ODP_ERR("ODP time term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case CPUMASK_INIT:
- if (odp_cpumask_term_global()) {
- ODP_ERR("ODP cpumask term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case LIBCONFIG_INIT:
- if (_odp_libconfig_term_global()) {
- ODP_ERR("ODP runtime config term failed.\n");
+ if (_odp_shm_term_local()) {
+ ODP_ERR("ODP shm local term failed.\n");
rc = -1;
}
/* Fall through */
- case NO_INIT:
- ;
+ default:
+ break;
}
return rc;
@@ -485,72 +570,11 @@ int odp_init_local(odp_instance_t instance, odp_thread_type_t thr_type)
return 0;
init_fail:
- _odp_term_local(stage);
+ term_local(stage);
return -1;
}
int odp_term_local(void)
{
- return _odp_term_local(ALL_INIT);
-}
-
-int _odp_term_local(enum init_stage stage)
-{
- int rc = 0;
- int rc_thd = 0;
-
- switch (stage) {
- case ALL_INIT:
-
- case SCHED_INIT:
- if (sched_fn->term_local()) {
- ODP_ERR("ODP schedule local term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case QUEUE_INIT:
- if (queue_fn->term_local()) {
- ODP_ERR("ODP queue local term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case CRYPTO_INIT:
- if (_odp_crypto_term_local()) {
- ODP_ERR("ODP crypto local term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case POOL_INIT:
- if (odp_pool_term_local()) {
- ODP_ERR("ODP buffer pool local term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- case THREAD_INIT:
- rc_thd = odp_thread_term_local();
- if (rc_thd < 0) {
- ODP_ERR("ODP thread local term failed.\n");
- rc = -1;
- } else {
- if (!rc)
- rc = rc_thd;
- }
- /* Fall through */
-
- case ISHM_INIT:
- if (_odp_shm_term_local()) {
- ODP_ERR("ODP shm local term failed.\n");
- rc = -1;
- }
- /* Fall through */
-
- default:
- break;
- }
-
- return rc;
+ return term_local(ALL_INIT);
}