47 const bool do_schedule_pause =
em_shm->opt.dispatch.sched_pause;
50 odp_schedule_resume();
54 if (do_input_poll || do_output_drain)
55 events = dispatch_with_userfn(rounds, do_input_poll, do_output_drain);
57 events = dispatch_no_userfn(rounds);
59 if (do_schedule_pause) {
68 round_events = dispatch_round(ODP_SCHED_NO_WAIT,
70 events += round_events;
71 }
while (round_events > 0);
81 "Bad argument, opt=NULL");
85 *opt = dispatch_opt_default;
100 odp_schedule_resume();
104 if (do_input_poll || do_output_drain)
105 events = dispatch_duration_with_userfn(duration, opt, results,
106 do_input_poll, do_output_drain);
108 events = dispatch_duration_no_userfn(duration, opt, results);
111 if (do_sched_pause) {
112 odp_schedule_pause();
121 round_events = dispatch_round(ODP_SCHED_NO_WAIT,
123 events += round_events;
125 }
while (round_events > 0);
128 results->
rounds += rounds;
141 "Bad argument: duration=NULL");
144 opt = &dispatch_opt_default;
148 "Not initialized: em_dispatch_opt_init(opt) not called");
154 "Bad option: 0 < opt.burst_size (%" PRIu64
") <= %u (max)",
161 (EM_DISPATCH_DURATION_LAST >> 1) << 2;
165 "Bad option: duration->select=0x%x invalid", duration->
select);
169 duration->
ns == 0) ||
173 duration->no_events.
rounds == 0) ||
175 duration->no_events.
ns == 0)),
177 "Bad option: opt.duration is zero(0).");
180 return dispatch_duration(duration, opt, results);
188 "Bad argument: ns=0");
191 opt = &dispatch_opt_default;
195 "Not initialized: em_dispatch_opt_init(opt) not called");
201 "Bad option: 0 < opt.burst_size (%" PRIu64
") <= %u (max)",
210 return dispatch_duration(&duration, opt, results);
218 "Bad argument: events=0");
221 opt = &dispatch_opt_default;
225 "Not initialized: em_dispatch_opt_init(opt) not called");
231 "Bad option: 0 < opt.burst_size (%" PRIu64
") <= %u (max)",
240 return dispatch_duration(&duration, opt, results);
248 "Bad argument: rounds=0");
251 opt = &dispatch_opt_default;
255 "Not initialized: em_dispatch_opt_init(opt) not called");
261 "Bad option: 0 < opt.burst_size (%" PRIu64
") <= %u (max)",
270 return dispatch_duration(&duration, opt, results);
280 EM_ESCOPE_DISPATCH_REGISTER_ENTER_CB,
281 "EM dispatch callbacks disabled");
283 hook_fn.disp_enter = func;
286 EM_ESCOPE_DISPATCH_REGISTER_ENTER_CB,
287 "Dispatch callback register failed");
299 EM_ESCOPE_DISPATCH_UNREGISTER_ENTER_CB,
300 "EM dispatch callbacks disabled");
302 hook_fn.disp_enter = func;
305 EM_ESCOPE_DISPATCH_UNREGISTER_ENTER_CB,
306 "Dispatch callback unregister failed");
318 EM_ESCOPE_DISPATCH_REGISTER_EXIT_CB,
319 "EM dispatch callbacks disabled");
321 hook_fn.disp_exit = func;
324 EM_ESCOPE_DISPATCH_REGISTER_EXIT_CB,
325 "Dispatch callback register failed");
336 EM_ESCOPE_DISPATCH_UNREGISTER_EXIT_CB,
337 "EM dispatch callbacks disabled");
339 hook_fn.disp_exit = func;
342 EM_ESCOPE_DISPATCH_UNREGISTER_EXIT_CB,
343 "Dispatch callback unregister failed");
#define INTERNAL_ERROR(error, escope, fmt,...)
#define RETURN_ERROR_IF(cond, error, escope, fmt,...)
em_status_t hook_unregister(uint8_t type, hook_fn_t hook_fn)
em_status_t hook_register(uint8_t type, hook_fn_t hook_fn)
#define EM_CHECK_INIT_CALLED
ENV_LOCAL em_locm_t em_locm
#define EM_SCHED_MULTI_MAX_BURST
em_status_t em_dispatch_events(uint64_t events, const em_dispatch_opt_t *opt, em_dispatch_results_t *results)
Run the EM dispatcher until a given number of events have been dispatched.
em_status_t em_dispatch_unregister_exit_cb(em_dispatch_exit_func_t func)
em_status_t em_dispatch_register_enter_cb(em_dispatch_enter_func_t func)
uint64_t em_dispatch(uint64_t rounds)
void em_dispatch_opt_init(em_dispatch_opt_t *opt)
Initialize the EM dispatch options.
em_status_t em_dispatch_register_exit_cb(em_dispatch_exit_func_t func)
em_status_t em_dispatch_ns(uint64_t ns, const em_dispatch_opt_t *opt, em_dispatch_results_t *results)
Run the EM dispatcher for a given amount of time (in nanoseconds).
em_status_t em_dispatch_rounds(uint64_t rounds, const em_dispatch_opt_t *opt, em_dispatch_results_t *results)
Run the EM dispatcher for a given number of dispatch-rounds.
em_status_t em_dispatch_unregister_enter_cb(em_dispatch_enter_func_t func)
em_status_t em_dispatch_duration(const em_dispatch_duration_t *duration, const em_dispatch_opt_t *opt, em_dispatch_results_t *results)
Run the EM dispatcher for a certain duration with options.
void(* em_dispatch_enter_func_t)(em_eo_t eo, void **eo_ctx, em_event_t events[], int num, em_queue_t *queue, void **q_ctx)
void(* em_dispatch_exit_func_t)(em_eo_t eo)
em_dispatch_duration_select_t
EM dispatch duration selection flags.
@ EM_DISPATCH_DURATION_ROUNDS
@ EM_DISPATCH_DURATION_NO_EVENTS_NS
@ EM_DISPATCH_DURATION_EVENTS
@ EM_DISPATCH_DURATION_NS
@ EM_DISPATCH_DURATION_NO_EVENTS_ROUNDS
em_dispatch_duration_select_t select
uint32_t __internal_check