35 static ENV_LOCAL unsigned int _queue_tbl_iter_idx;
38 EM_QUEUE_NAME_LEN_OVER_ODP_LIMIT);
44 const char *err_str =
"";
62 const char *err_str =
"";
63 em_queue_t queue_static;
67 "Invalid static queue requested:%" PRI_QUEUE "",
70 queue_static =
queue_create(name, type, prio, queue_group,
75 "Static queue:%" PRI_QUEUE " creation failed: %s", queue, err_str);
77 if (unlikely(queue_static != queue)) {
82 EM_ESCOPE_QUEUE_CREATE_STATIC,
107 "queue delete failed!");
121 queue_elem->
context = (
void *)(uintptr_t)context;
136 if (unlikely(
EM_CHECK_LEVEL >= 2 && !queue_allocated(queue_elem))) {
138 "Queue:%" PRI_QUEUE " not created!", queue);
150 unlikely(name == NULL || maxlen == 0)) {
152 "Invalid ptr or maxlen (name=0x%" PRIx64
", maxlen=%zu)",
160 unlikely(queue_elem == NULL || !queue_allocated(queue_elem))) {
166 return queue_get_name(queue_elem, name, maxlen);
173 for (
unsigned int i = 0; i <
em_shm->opt.queue.max_num; i++) {
175 &
em_shm->queue_tbl.queue_elem[i];
177 if (queue_allocated(q_elem) &&
179 return (em_queue_t)(uintptr_t)
180 em_shm->queue_tbl.queue_elem[i].queue;
192 unlikely(queue_elem == NULL || !queue_allocated(queue_elem))) {
206 unlikely(queue_elem == NULL || !queue_allocated(queue_elem))) {
208 "Invalid queue-id:%" PRI_QUEUE "", queue);
212 return queue_elem->
type;
220 unlikely(q_elem == NULL || !queue_allocated(q_elem))) {
222 "Invalid queue-id:%" PRI_QUEUE "", queue);
239 "Invalid EM queue:%" PRI_QUEUE "", queue);
245 "Queue:%" PRI_QUEUE " not created", queue);
252 "Queue is not unscheduled, cannot dequeue!");
256 event = queue_dequeue(q_elem);
261 em_event_t events[],
int num)
267 unlikely(!q_elem || !events || num < 0)) {
269 "Inv.args: Q:%" PRI_QUEUE " events[]:%p num:%d",
276 "Queue:%" PRI_QUEUE " not created", queue);
280 if (unlikely(num == 0))
286 EM_ESCOPE_QUEUE_DEQUEUE_MULTI,
287 "Queue is not unscheduled, cannot dequeue!");
291 ret = queue_dequeue_multi(q_elem, events , num);
292 if (unlikely(ret < 0)) {
294 EM_ESCOPE_QUEUE_DEQUEUE_MULTI,
295 "odp_queue_deq_multi(%d):%d", num, ret);
304 return queue_current();
310 const unsigned int queue_cnt = queue_count();
311 const unsigned int max_queues =
em_shm->opt.queue.max_num;
313 _queue_tbl_iter_idx = 0;
318 if (queue_cnt == 0) {
319 _queue_tbl_iter_idx = max_queues;
324 while (!queue_allocated(&queue_tbl->queue_elem[_queue_tbl_iter_idx])) {
325 _queue_tbl_iter_idx++;
326 if (_queue_tbl_iter_idx >= max_queues)
330 return queue_idx2hdl(_queue_tbl_iter_idx);
335 const unsigned int max_queues =
em_shm->opt.queue.max_num;
337 if (_queue_tbl_iter_idx >= max_queues - 1)
340 _queue_tbl_iter_idx++;
345 while (!queue_allocated(&queue_tbl->queue_elem[_queue_tbl_iter_idx])) {
346 _queue_tbl_iter_idx++;
347 if (_queue_tbl_iter_idx >= max_queues)
351 return queue_idx2hdl(_queue_tbl_iter_idx);
357 const int queue_idx = queue_id2idx(iq.queue_id);
359 if (unlikely((
unsigned int)queue_idx >
em_shm->opt.queue.max_num - 1))
363 unlikely(iq.device_id !=
em_shm->conf.device_id))
368 &
em_shm->queue_tbl.queue_elem[queue_idx];
369 if (unlikely(q_elem == NULL || !queue_allocated(q_elem)))
377 "Bad arg, invalid queue:%" PRI_QUEUE ":\n"
378 " Q.device-id:0x%" PRIx16
" Q.id:0x%" PRIx16
"",
379 queue, iq.device_id, iq.queue_id);
380 return queue_idx %
em_shm->opt.queue.max_num;
387 EM_ESCOPE_QUEUE_GET_NUM_PRIO,
388 "EM not initialized!");
391 if (num_runtime != NULL)
399 return em_shm->opt.queue.max_num;
420 if (likely(device_id))
421 *device_id = iq.device_id;
435 uint64_t queue_uptr = (uintptr_t)queue;
436 uint32_t queue_u32 = (uint32_t)(queue_uptr & UINT32_MAX);