34 int chaining_output(
const em_event_t events[],
const unsigned int num,
35 const em_queue_t output_queue,
void *output_fn_args);
42 event_send_device(em_event_t event, em_queue_t queue)
49 "No %s() function given!\t"
50 "device:0x%" PRIx16
" Q-id:0x%" PRIx16
"\n",
51 __func__, iq.device_id, iq.queue_id);
59 event_send_device_multi(
const em_event_t events[],
int num, em_queue_t queue)
67 "No %s() function given!\t"
68 "device:0x%" PRIx16
" Q-id:0x%" PRIx16
"\n",
69 __func__, iq.device_id, iq.queue_id);
74 read_config_file(
void)
78 bool val_bool =
false;
82 memset(&
em_shm->opt.event_chaining, 0,
sizeof(
em_shm->opt.event_chaining));
84 EM_PRINT(
"EM Event-Chaining config:\n");
88 conf_str =
"event_chaining.order_keep";
89 ret = em_libconfig_lookup_bool(&
em_shm->
libconfig, conf_str, &val_bool);
91 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found\n", conf_str);
95 em_shm->opt.event_chaining.order_keep = val_bool;
96 EM_PRINT(
" %s: %s(%d)\n", conf_str, val_bool ?
"true" :
"false",
100 if (!
em_shm->opt.event_chaining.order_keep)
104 if (unlikely(
em_shm->opt.event_chaining.order_keep)) {
106 "Config option %s: %s(%d) currently not supported\n",
107 conf_str, val_bool ?
"true" :
"false", val_bool);
115 conf_str =
"event_chaining.num_order_queues";
117 if (unlikely(!ret)) {
118 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
121 if (val < 0 || val > MAX_CHAINING_OUTPUT_QUEUES) {
122 EM_LOG(EM_LOG_ERR,
"Bad config value '%s = %d' (max: %d)\n",
123 conf_str, val, MAX_CHAINING_OUTPUT_QUEUES);
127 em_shm->opt.event_chaining.num_order_queues = val;
128 EM_PRINT(
" %s: %d (max: %d)\n", conf_str, val,
129 MAX_CHAINING_OUTPUT_QUEUES);
137 if (read_config_file())
141 event_chaining->num_output_queues = 0;
143 for (
unsigned int i = 0; i < MAX_CHAINING_OUTPUT_QUEUES; i++)
146 if (!
em_shm->opt.event_chaining.order_keep)
156 memset(&queue_conf, 0,
sizeof(queue_conf));
157 memset(&output_conf, 0,
sizeof(output_conf));
161 queue_conf.
conf_len =
sizeof(output_conf);
162 queue_conf.
conf = &output_conf;
168 const unsigned int num =
em_shm->opt.event_chaining.num_order_queues;
169 unsigned char idx = 0;
171 for (
unsigned int i = 0; i < num; i++) {
174 snprintf(name,
sizeof(name),
"Event-Chaining-Output-%02u", idx);
176 name[
sizeof(name) - 1] =
'\0';
186 event_chaining->num_output_queues++;
187 event_chaining->output_queues[i] = output_queue;
197 const unsigned int num = event_chaining->num_output_queues;
199 for (
unsigned int i = 0; i < num; i++) {
200 em_queue_t output_queue = event_chaining->output_queues[i];
204 if (unlikely(stat !=
EM_OK))
217 chaining_output(
const em_event_t events[],
const unsigned int num,
218 const em_queue_t output_queue,
void *output_fn_args)
230 (void)output_fn_args;
232 if (unlikely(num <= 0))
236 em_status_t stat = event_send_device(events[0], chaining_queue);
238 if (unlikely(stat !=
EM_OK))
246 int ret = event_send_device_multi(events, num, chaining_queue);
248 if (unlikely((
unsigned int)ret != num)) {