54#include "em_libconfig.h"
60#include "em_timer_types.h"
62static int read_config_file(
void);
66 for (
int i = 0; i < EM_ODP_MAX_TIMERS; i++) {
68 tmrs->timer[i].idx = i;
69 tmrs->timer[i].tmo_pool = ODP_POOL_INVALID;
70 tmrs->timer[i].odp_tmr_pool = ODP_TIMER_POOL_INVALID;
72 tmrs->ring_tmo_pool = ODP_POOL_INVALID;
73 tmrs->shared_tmo_pool = ODP_POOL_INVALID;
74 tmrs->ring_reserved = 0;
78 tmrs->num_ring_create_calls = 0;
80 odp_ticketlock_init(&tmrs->timer_lock);
82 if (read_config_file() < 0)
100#if PRE_1_50_ODP_TIMER_API
104 if (tmrs && tmrs->ring_tmo_pool != ODP_POOL_INVALID) {
105 if (odp_pool_destroy(tmrs->ring_tmo_pool) != 0)
107 tmrs->ring_tmo_pool = ODP_POOL_INVALID;
115static int read_config_file(
void)
117 const char *conf_str;
122 EM_PRINT(
"EM timer config:\n");
127 conf_str =
"timer.shared_tmo_pool_enable";
128 ret = em_libconfig_lookup_bool(&
em_shm->libconfig, conf_str, &bval);
129 if (unlikely(!ret)) {
130 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
134 em_shm->
opt.timer.shared_tmo_pool_enable = bval;
135 EM_PRINT(
" %s: %s\n", conf_str, bval ?
"true" :
"false");
140 if (
em_shm->
opt.timer.shared_tmo_pool_enable) {
141 conf_str =
"timer.shared_tmo_pool_size";
142 ret = em_libconfig_lookup_int(&
em_shm->libconfig, conf_str, &val);
143 if (unlikely(!ret)) {
144 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
149 EM_LOG(EM_LOG_ERR,
"Bad config value '%s = %d'\n", conf_str, val);
153 em_shm->
opt.timer.shared_tmo_pool_size = val;
154 EM_PRINT(
" %s: %d\n", conf_str, val);
160 conf_str =
"timer.tmo_pool_cache";
161 ret = em_libconfig_lookup_int(&
em_shm->libconfig, conf_str, &val);
162 if (unlikely(!ret)) {
163 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
168 EM_LOG(EM_LOG_ERR,
"Bad config value '%s = %d'\n", conf_str, val);
173 EM_PRINT(
" %s: %d\n", conf_str, val);
178 conf_str =
"timer.ring.timer_event_pool_size";
179 ret = em_libconfig_lookup_int(&
em_shm->libconfig, conf_str, &val);
180 if (unlikely(!ret)) {
181 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
186 EM_LOG(EM_LOG_ERR,
"Bad config value '%s = %d'\n", conf_str, val);
190 em_shm->
opt.timer.ring.timer_event_pool_size = val;
191 EM_PRINT(
" %s: %d\n", conf_str, val);
196 conf_str =
"timer.ring.timer_event_pool_cache";
197 ret = em_libconfig_lookup_int(&
em_shm->libconfig, conf_str, &val);
198 if (unlikely(!ret)) {
199 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
204 EM_LOG(EM_LOG_ERR,
"Bad config value '%s = %d'\n", conf_str, val);
208 em_shm->
opt.timer.ring.timer_event_pool_cache = val;
209 EM_PRINT(
" %s: %d\n", conf_str, val);
#define EM_CHECK_INIT_CALLED