54#include "em_libconfig.h"
61int chaining_output(
const em_event_t events[],
const unsigned int num,
62 const em_queue_t output_queue,
void *output_fn_args);
76 bool val_bool =
false;
82 EM_PRINT(
"EM event-chaining config:\n");
86 conf_str =
"event_chaining.order_keep";
87 ret = em_libconfig_lookup_bool(&
em_shm->libconfig, conf_str, &val_bool);
89 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found\n", conf_str);
93 em_shm->
opt.event_chaining.order_keep = val_bool;
94 EM_PRINT(
" %s: %s(%d)\n", conf_str, val_bool ?
"true" :
"false",
98 if (!
em_shm->
opt.event_chaining.order_keep)
102 if (unlikely(
em_shm->
opt.event_chaining.order_keep)) {
104 "Config option %s: %s(%d) currently not supported\n",
105 conf_str, val_bool ?
"true" :
"false", val_bool);
113 conf_str =
"event_chaining.num_order_queues";
114 ret = em_libconfig_lookup_int(&
em_shm->libconfig, conf_str, &val);
115 if (unlikely(!ret)) {
116 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
119 if (val < 0 || val > MAX_CHAINING_OUTPUT_QUEUES) {
120 EM_LOG(EM_LOG_ERR,
"Bad config value '%s = %d' (max: %d)\n",
121 conf_str, val, MAX_CHAINING_OUTPUT_QUEUES);
125 em_shm->
opt.event_chaining.num_order_queues = val;
126 EM_PRINT(
" %s: %d (max: %d)\n", conf_str, val,
127 MAX_CHAINING_OUTPUT_QUEUES);
135 if (read_config_file())
139 event_chaining->num_output_queues = 0;
141 for (
unsigned int i = 0; i < MAX_CHAINING_OUTPUT_QUEUES; i++)
144 if (!
em_shm->
opt.event_chaining.order_keep)
154 memset(&queue_conf, 0,
sizeof(queue_conf));
155 memset(&output_conf, 0,
sizeof(output_conf));
159 queue_conf.
conf_len =
sizeof(output_conf);
160 queue_conf.
conf = &output_conf;
166 const unsigned int num =
em_shm->
opt.event_chaining.num_order_queues;
167 unsigned char idx = 0;
169 for (
unsigned int i = 0; i < num; i++) {
172 snprintf(name,
sizeof(name),
"Event-Chaining-Output-%02u", idx);
174 name[
sizeof(name) - 1] =
'\0';
184 event_chaining->num_output_queues++;
185 event_chaining->output_queues[i] = output_queue;
195 const unsigned int num = event_chaining->num_output_queues;
197 for (
unsigned int i = 0; i < num; i++) {
198 em_queue_t output_queue = event_chaining->output_queues[i];
202 if (unlikely(stat !=
EM_OK))
215chaining_output(
const em_event_t events[],
const unsigned int num,
216 const em_queue_t output_queue,
void *output_fn_args)
228 (void)output_fn_args;
230 if (unlikely(num <= 0))
236 if (unlikely(stat !=
EM_OK))
246 if (unlikely((
unsigned int)ret != num)) {
em_status_t event_send_device(em_event_t event, em_queue_t queue)
int event_send_device_multi(const em_event_t events[], int num, em_queue_t queue)
#define EM_QUEUE_NAME_LEN
#define EM_QUEUE_GROUP_UNDEF
em_status_t em_queue_delete(em_queue_t queue)
#define EM_QUEUE_PRIO_UNDEF
#define EM_QUEUE_FLAG_DEFAULT
em_queue_t em_queue_create(const char *name, em_queue_type_t type, em_queue_prio_t prio, em_queue_group_t group, const em_queue_conf_t *conf)
em_output_func_t output_fn