|
EM-ODP
3.7.0
Event Machine on ODP
|
Go to the documentation of this file.
47 .local_queues.empty = 1,
48 .do_input_poll =
false,
49 .do_output_drain =
false,
50 .sync_api.in_progress =
false
56 if (unlikely(!conf)) {
71 "Conf pointer NULL!");
80 "EM shared memory ptr set - already initialized?");
84 "Select EITHER process-per-core OR thread-per-core!");
90 odp_shm_capability_t shm_capa;
92 ret = odp_shm_capability(&shm_capa);
94 "shm capability error:%d", ret);
96 if (shm_capa.flags & ODP_SHM_SINGLE_VA)
97 flags |= ODP_SHM_SINGLE_VA;
99 odp_shm_t shm = odp_shm_reserve(
"em_shm",
sizeof(
em_shm_t),
100 ODP_CACHE_LINE_SIZE, flags);
105 em_shm = odp_shm_addr(shm);
108 "Shared memory ptr NULL!");
119 memset(&
em_shm->conf.api_hooks, 0,
120 sizeof(
em_shm->conf.api_hooks));
130 "libconfig initialization failed:%d", ret);
142 "core_map_init() failed:%" PRI_STAT
"", stat);
145 stat = dispatch_init();
147 "dispatch_init() failed:%" PRI_STAT
"", stat);
155 stat = input_poll_check(&
em_shm->core_map.logic_mask, conf);
157 "input_poll_init() failed:%" PRI_STAT
"", stat);
158 stat = output_drain_check(&
em_shm->core_map.logic_mask, conf);
160 "output_drain_init() failed:%" PRI_STAT
"", stat);
168 "esv_init() failed:%" PRI_STAT
"", stat);
176 "hooks_init() failed:%" PRI_STAT
"", stat);
183 stat = pool_init(&
em_shm->mpool_tbl, &
em_shm->mpool_pool,
186 "pool_init() failed:%" PRI_STAT
"", stat);
190 "event_init() failed:%" PRI_STAT
"", stat);
192 stat = event_group_init(&
em_shm->event_group_tbl,
193 &
em_shm->event_group_pool);
195 "event_group_init() failed:%" PRI_STAT
"", stat);
198 &
em_shm->queue_pool_static);
200 "queue_init() failed:%" PRI_STAT
"", stat);
203 &
em_shm->queue_group_pool);
205 "queue_group_init() failed:%" PRI_STAT
"", stat);
208 &
em_shm->atomic_group_pool);
210 "atomic_group_init() failed:%" PRI_STAT
"", stat);
214 "eo_init() failed:%" PRI_STAT
"", stat);
218 "create_ctrl_queues() failed:%" PRI_STAT
"", stat);
222 stat = timer_init(&
em_shm->timers);
225 "timer_init() failed:%" PRI_STAT
"",
232 "chaining_init() failed:%" PRI_STAT
"", stat);
237 "emcli_init() failed:%" PRI_STAT
"", stat);
242 print_version_info();
255 shm = odp_shm_lookup(
"em_shm");
258 "Shared memory lookup failed!");
260 shm_addr = odp_shm_addr(shm);
262 "Shared memory ptr NULL");
264 if (shm_addr->conf.process_per_core &&
em_shm == NULL)
268 "Shared memory init fails: em_shm:%p != shm_addr:%p",
272 stat = core_map_init_local(&
em_shm->core_map);
274 "core_map_init_local() failed:%" PRI_STAT
"", stat);
276 stat = queue_group_init_local();
278 "queue_group_init_local() failed:%" PRI_STAT
"", stat);
280 stat = dispatch_init_local();
282 "dispatch_init_local() failed:%" PRI_STAT
"", stat);
285 stat = input_poll_init_local();
287 "input_poll_init_local() failed:%" PRI_STAT
"", stat);
290 stat = output_drain_init_local();
292 "output_drain_init_local() failed:%" PRI_STAT
"", stat);
296 "queue_init_local() failed:%" PRI_STAT
"", stat);
302 stat = timer_init_local();
304 "timer_init_local() failed:%" PRI_STAT
"", stat);
306 stat = sync_api_init_local();
308 "sync_api_init_local() failed:%" PRI_STAT
"", stat);
313 "emcli_init_local() failed:%" PRI_STAT
"", stat);
320 for (
int i = 0; i < EM_DEBUG_TSP_LAST; i++)
330 static void flush_scheduler_events(
void)
345 event_init_odp_multi(odp_ev_tbl, em_ev_tbl, ev_hdr_tbl,
348 }
while (num_events > 0);
371 odp_schedule_resume();
373 for (
int i = 0; i < 2; i++) {
374 flush_scheduler_events();
376 odp_schedule_pause();
381 "delete_ctrl_queues() failed:%" PRI_STAT
"", stat);
383 if (
em_shm->conf.event_timer)
384 timer_term(&
em_shm->timers);
388 "emcli_term() failed:%" PRI_STAT
"", stat);
392 "chaining_term() failed:%" PRI_STAT
"", stat);
396 "EM config term failed:%d");
398 stat = pool_term(&
em_shm->mpool_tbl);
400 "pool_term() failed:%" PRI_STAT
"", stat);
402 env_shared_free(
em_shm->queue_tbl.queue_elem);
409 "odp_shm_free() failed:%d", ret);
433 odp_schedule_pause();
435 flush_scheduler_events();
438 stat = timer_term_local();
442 "timer_term_local() fails: %" PRI_STAT
"", stat);
450 "emcli_term_local() fails: %" PRI_STAT
"", stat);
458 "queue_term_local() fails: %" PRI_STAT
"", stat);
461 stat = core_map_term_local(&
em_shm->core_map);
463 "core_map_term_local() failed:%" PRI_STAT
"", stat);
470 return em_shm->conf.device_id;
uint16_t em_device_id(void)
em_status_t delete_ctrl_queues(void)
Delete EM's internal unscheduled control queues at teardown.
em_status_t emcli_init(void)
Initialize the EM CLI (if enabled)
void queue_group_join_all(void)
The calling core joins all available queue groups.
em_status_t atomic_group_init(atomic_group_tbl_t *const atomic_group_tbl, atomic_group_pool_t *const atomic_group_pool)
em_status_t emcli_init_local(void)
Initialize the EM CLI locally on an EM core (if enabled)
em_status_t chaining_term(const event_chaining_t *event_chaining)
#define EM_API_HOOKS_ENABLE
em_status_t create_ctrl_queues(void)
Create EM's internal unscheduled control queues at startup.
void esv_disabled_warn_config(void)
ENV_LOCAL em_locm_t em_locm
#define EM_SCHED_MULTI_MAX_BURST
em_status_t chaining_init(event_chaining_t *event_chaining)
em_status_t queue_group_init(queue_group_tbl_t *const queue_group_tbl, queue_group_pool_t *const queue_group_pool)
em_pool_cfg_t default_pool_cfg
void poll_unsched_ctrl_queue(void)
Poll EM's internal unscheduled control queues during dispatch.
em_status_t em_term_core(void)
#define RETURN_ERROR_IF(cond, error, escope, fmt,...)
uint64_t debug_ts[EM_DEBUG_TSP_LAST]
em_status_t emcli_term(void)
Terminate the EM CLI (if enabled)
#define INTERNAL_ERROR(error, escope, fmt,...)
void em_pool_cfg_init(em_pool_cfg_t *const pool_cfg)
em_status_t em_term(const em_conf_t *conf)
em_status_t em_init(const em_conf_t *conf)
em_status_t emcli_term_local(void)
Terminate the EM CLI locally on an EM core (if enabled)
em_idle_hooks_t idle_hooks
@ EM_ERR_OPERATION_FAILED
void em_conf_init(em_conf_t *conf)
em_status_t hooks_init(const em_api_hooks_t *api_hooks, const em_idle_hooks_t *idle_hooks)
@ EM_SCHED_CONTEXT_TYPE_NONE
#define EM_ESCOPE_CONF_INIT
em_status_t queue_init_local(void)
em_status_t queue_init(queue_tbl_t *const queue_tbl, queue_pool_t *const queue_pool, queue_pool_t *const queue_pool_static)
em_status_t esv_init(void)
#define EM_ESCOPE_TERM_CORE
em_status_t queue_term_local(void)
void em_free_multi(em_event_t events[], int num)
#define EM_ESCOPE_INIT_CORE
#define EM_EVENT_GROUP_UNDEF
#define EM_DEBUG_TIMESTAMP_ENABLE
em_status_t em_init_core(void)