34 int chaining_output(
const em_event_t events[],
const unsigned int num,
35 const em_queue_t output_queue,
void *output_fn_args);
50 "No %s() function given!\t"
51 "device:0x%" PRIx16
" Q-id:0x%" PRIx16
"\n",
52 __func__, iq.device_id, iq.queue_id);
69 "No %s() function given!\t"
70 "device:0x%" PRIx16
" Q-id:0x%" PRIx16
"\n",
71 __func__, iq.device_id, iq.queue_id);
76 read_config_file(
void)
80 bool val_bool =
false;
84 memset(&
em_shm->opt.event_chaining, 0,
sizeof(
em_shm->opt.event_chaining));
86 EM_PRINT(
"EM Event-Chaining config:\n");
90 conf_str =
"event_chaining.order_keep";
91 ret = em_libconfig_lookup_bool(&
em_shm->
libconfig, conf_str, &val_bool);
93 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found\n", conf_str);
97 em_shm->opt.event_chaining.order_keep = val_bool;
98 EM_PRINT(
" %s: %s(%d)\n", conf_str, val_bool ?
"true" :
"false",
102 if (!
em_shm->opt.event_chaining.order_keep)
106 if (unlikely(
em_shm->opt.event_chaining.order_keep)) {
108 "Config option %s: %s(%d) currently not supported\n",
109 conf_str, val_bool ?
"true" :
"false", val_bool);
117 conf_str =
"event_chaining.num_order_queues";
119 if (unlikely(!ret)) {
120 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
123 if (val < 0 || val > MAX_CHAINING_OUTPUT_QUEUES) {
124 EM_LOG(EM_LOG_ERR,
"Bad config value '%s = %d' (max: %d)\n",
125 conf_str, val, MAX_CHAINING_OUTPUT_QUEUES);
129 em_shm->opt.event_chaining.num_order_queues = val;
130 EM_PRINT(
" %s: %d (max: %d)\n", conf_str, val,
131 MAX_CHAINING_OUTPUT_QUEUES);
139 if (read_config_file())
143 event_chaining->num_output_queues = 0;
145 for (
unsigned int i = 0; i < MAX_CHAINING_OUTPUT_QUEUES; i++)
148 if (!
em_shm->opt.event_chaining.order_keep)
158 memset(&queue_conf, 0,
sizeof(queue_conf));
159 memset(&output_conf, 0,
sizeof(output_conf));
163 queue_conf.
conf_len =
sizeof(output_conf);
164 queue_conf.
conf = &output_conf;
170 const unsigned int num =
em_shm->opt.event_chaining.num_order_queues;
171 unsigned char idx = 0;
173 for (
unsigned int i = 0; i < num; i++) {
176 snprintf(name,
sizeof(name),
"Event-Chaining-Output-%02u", idx);
178 name[
sizeof(name) - 1] =
'\0';
188 event_chaining->num_output_queues++;
189 event_chaining->output_queues[i] = output_queue;
199 const unsigned int num = event_chaining->num_output_queues;
201 for (
unsigned int i = 0; i < num; i++) {
202 em_queue_t output_queue = event_chaining->output_queues[i];
206 if (unlikely(stat !=
EM_OK))
219 chaining_output(
const em_event_t events[],
const unsigned int num,
220 const em_queue_t output_queue,
void *output_fn_args)
232 (void)output_fn_args;
234 if (unlikely(num <= 0))
240 if (unlikely(stat !=
EM_OK))
250 if (unlikely((
unsigned int)ret != num)) {
em_status_t chaining_init(event_chaining_t *event_chaining)
em_status_t event_send_device(em_event_t event, em_queue_t queue)
em_status_t chaining_term(const event_chaining_t *event_chaining)
int event_send_device_multi(const em_event_t events[], int num, em_queue_t queue)
#define INTERNAL_ERROR(error, escope, fmt,...)
#define EM_QUEUE_NAME_LEN
#define EM_ESCOPE_EVENT_SEND_DEVICE
#define EM_QUEUE_PRIO_UNDEF
#define EM_QUEUE_FLAG_DEFAULT
#define EM_ESCOPE_EVENT_SEND_DEVICE_MULTI
#define EM_QUEUE_GROUP_UNDEF
em_status_t em_queue_delete(em_queue_t queue)
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