34 static ENV_LOCAL unsigned int _qgrp_tbl_iter_idx;
36 static ENV_LOCAL unsigned int _qgrp_q_iter_idx;
37 static ENV_LOCAL em_queue_group_t _qgrp_q_iter_qgrp;
43 em_queue_group_t queue_group;
46 if (unlikely(!mask)) {
53 if (unlikely(err !=
EM_OK)) {
55 char mstr[ODP_CPUMASK_STR_SIZE];
59 "Invalid mask given:%s", mstr);
64 if (unlikely(err !=
EM_OK)) {
66 "Invalid notif cfg given:%" PRI_STAT
"!", err);
78 em_queue_group_t queue_group;
81 if (unlikely(!mask)) {
88 if (unlikely(err !=
EM_OK)) {
90 char mstr[ODP_CPUMASK_STR_SIZE];
94 "Invalid mask given:%s", mstr);
111 queue_group_elem_get(queue_group);
115 "Invalid queue group: %" PRI_QGRP "", queue_group);
119 "Invalid notif cfg given, err=%" PRI_STAT
"", err);
128 "Queue group:%" PRI_QGRP " modify for delete failed!",
141 queue_group_elem_get(queue_group);
145 "Invalid queue group:%" PRI_QGRP "", queue_group);
154 "Queue group:%" PRI_QGRP " modify for delete failed!",
166 queue_group_elem_get(queue_group);
171 "Invalid queue group:%" PRI_QGRP "", queue_group);
174 "Queue group mask NULL! Queue group:%" PRI_QGRP "",
178 if (unlikely(err !=
EM_OK)) {
180 char mstr[ODP_CPUMASK_STR_SIZE];
184 "Queue group:%" PRI_QGRP ", invalid mask given:%s",
190 "Invalid notif cfg given, err=%" PRI_STAT
"", err);
195 "Queue group:%" PRI_QGRP " modify failed!",
205 queue_group_elem_get(queue_group);
210 "Invalid queue group: %" PRI_QGRP "", queue_group);
213 "Queue group mask NULL! Queue group:%" PRI_QGRP "",
217 if (unlikely(err !=
EM_OK)) {
219 char mstr[ODP_CPUMASK_STR_SIZE];
223 "Queue group:%" PRI_QGRP ", invalid core mask given:%s",
230 "Queue group:%" PRI_QGRP " modify sync failed!",
238 odp_schedule_group_t odp_group;
240 if (!name || name[0] ==
'\0')
243 odp_group = odp_schedule_group_lookup(name);
244 if (odp_group == ODP_SCHED_GROUP_INVALID)
249 &
em_shm->queue_group_tbl.queue_group_elem[i];
252 queue_group_allocated(qgrp_elem))
253 return qgrp_idx2hdl(i);
267 "Invalid queue group:%" PRI_QGRP "", queue_group);
269 env_spinlock_lock(&qgrp_elem->
lock);
271 allocated = queue_group_allocated(qgrp_elem);
275 env_spinlock_unlock(&qgrp_elem->
lock);
279 "Queue group:%" PRI_QGRP " in bad state:\t"
280 "allocated=%s, ongoing_delete=%s",
281 queue_group, allocated ?
"true" :
"false(!)",
282 ongoing_delete ?
"true(!)" :
"false");
289 char *name,
size_t maxlen)
292 odp_schedule_group_info_t info;
296 if (unlikely(!name || maxlen == 0)) {
298 "Invalid name=0x%" PRIx64
" or maxlen=%zu",
305 if (unlikely(!qgrp_elem || !queue_group_allocated(qgrp_elem))) {
307 "Invalid queue group:%" PRI_QGRP "",
313 if (unlikely(ret != 0)) {
315 "Failed to retrieve queue group info");
319 if (unlikely(!info.name))
322 len = strnlen(info.name, ODP_SCHED_GROUP_NAME_LEN - 1);
323 if (maxlen - 1 < len)
326 memcpy(name, info.name, len);
336 em_shm->queue_group_tbl.queue_group_elem;
339 const unsigned int qgrp_cnt = queue_group_count();
341 _qgrp_tbl_iter_idx = 0;
347 _qgrp_tbl_iter_idx = max_qgrps;
352 while (!queue_group_allocated(qgrp_elem)) {
353 _qgrp_tbl_iter_idx++;
354 if (_qgrp_tbl_iter_idx >= max_qgrps)
356 qgrp_elem = &qgrp_elem_tbl[_qgrp_tbl_iter_idx];
359 return qgrp_idx2hdl(_qgrp_tbl_iter_idx);
367 if (_qgrp_tbl_iter_idx >= max_qgrps - 1)
370 _qgrp_tbl_iter_idx++;
373 em_shm->queue_group_tbl.queue_group_elem;
375 &qgrp_elem_tbl[_qgrp_tbl_iter_idx];
378 while (!queue_group_allocated(qgrp_elem)) {
379 _qgrp_tbl_iter_idx++;
380 if (_qgrp_tbl_iter_idx >= max_qgrps)
382 qgrp_elem = &qgrp_elem_tbl[_qgrp_tbl_iter_idx];
385 return qgrp_idx2hdl(_qgrp_tbl_iter_idx);
392 const unsigned int max_queues =
em_shm->opt.queue.max_num;
394 if (unlikely(!qgrp_elem || !queue_group_allocated(qgrp_elem))) {
396 "Invalid queue group:%" PRI_QGRP "",
403 const unsigned int num_queues =
409 if (num_queues == 0) {
410 _qgrp_q_iter_idx = max_queues;
424 _qgrp_q_iter_idx = 0;
425 _qgrp_q_iter_qgrp = queue_group;
428 while (!queue_allocated(q_elem) ||
431 if (_qgrp_q_iter_idx >= max_queues)
433 q_elem = &q_elem_tbl[_qgrp_q_iter_idx];
436 return queue_idx2hdl(_qgrp_q_iter_idx);
442 const unsigned int max_queues =
em_shm->opt.queue.max_num;
444 if (_qgrp_q_iter_idx >= max_queues - 1)
450 const queue_elem_t *q_elem = &q_elem_tbl[_qgrp_q_iter_idx];
453 while (!queue_allocated(q_elem) ||
456 if (_qgrp_q_iter_idx >= max_queues)
458 q_elem = &q_elem_tbl[_qgrp_q_iter_idx];
461 return queue_idx2hdl(_qgrp_q_iter_idx);
466 return (uint64_t)queue_group;