aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2021-04-21 09:51:45 +0300
committerMatias Elo <matias.elo@nokia.com>2021-04-28 14:17:29 +0300
commit20eb6b4655671fbfb6fd41c7407762cd30f1cfc5 (patch)
treebb12bb9dcd04e8a1176a782b50a16a085c03963f
parentf3db3a43c05847aa81d91cdb5889b6d479e18090 (diff)
Port 72e450dd3 "linux-gen: queue: implement odp_queue_print_all"
Port original commit from linux-generic. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
-rw-r--r--platform/linux-dpdk/odp_queue_basic.c96
-rw-r--r--platform/linux-dpdk/odp_queue_if.c9
2 files changed, 102 insertions, 3 deletions
diff --git a/platform/linux-dpdk/odp_queue_basic.c b/platform/linux-dpdk/odp_queue_basic.c
index a006bcc54..4cf619965 100644
--- a/platform/linux-dpdk/odp_queue_basic.c
+++ b/platform/linux-dpdk/odp_queue_basic.c
@@ -1,4 +1,5 @@
/* Copyright (c) 2013-2018, Linaro Limited
+ * Copyright (c) 2021, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -726,6 +727,97 @@ static void queue_print(odp_queue_t handle)
UNLOCK(queue);
}
+static void queue_print_all(void)
+{
+ uint32_t i, index, len, max_len;
+ const char *name;
+ int status;
+ odp_queue_type_t type;
+ odp_nonblocking_t blocking;
+ odp_queue_op_mode_t enq_mode;
+ odp_queue_op_mode_t deq_mode;
+ odp_queue_order_t order;
+ const char *status_str;
+ const char *bl_str;
+ char type_c, enq_c, deq_c, order_c, sync_c;
+ const int col_width = 24;
+ int prio = 0;
+ odp_schedule_sync_t sync = ODP_SCHED_SYNC_PARALLEL;
+
+ ODP_PRINT("\nList of all queues\n");
+ ODP_PRINT("------------------\n");
+ ODP_PRINT(" idx %-*s type stat blk enq deq ord len max_len sync prio\n", col_width, "name");
+
+ for (i = 0; i < CONFIG_MAX_QUEUES; i++) {
+ queue_entry_t *queue = qentry_from_index(i);
+
+ if (queue->s.status < QUEUE_STATUS_READY)
+ continue;
+
+ LOCK(queue);
+
+ status = queue->s.status;
+ index = queue->s.index;
+ name = queue->s.name;
+ type = queue->s.type;
+ blocking = queue->s.param.nonblocking;
+ enq_mode = queue->s.param.enq_mode;
+ deq_mode = queue->s.param.deq_mode;
+ order = queue->s.param.order;
+
+ if (queue->s.queue_lf) {
+ len = _odp_queue_lf_length(queue->s.queue_lf);
+ max_len = _odp_queue_lf_max_length();
+ } else if (queue->s.spsc) {
+ len = ring_spsc_length(queue->s.ring_spsc);
+ max_len = ring_spsc_max_length(queue->s.ring_spsc);
+ } else if (type == ODP_QUEUE_TYPE_SCHED) {
+ len = ring_st_length(queue->s.ring_st);
+ max_len = ring_st_max_length(queue->s.ring_st);
+ prio = queue->s.param.sched.prio;
+ sync = queue->s.param.sched.sync;
+ } else {
+ len = ring_mpmc_length(queue->s.ring_mpmc);
+ max_len = ring_mpmc_max_length(queue->s.ring_mpmc);
+ }
+
+ UNLOCK(queue);
+
+ if (status < QUEUE_STATUS_READY)
+ continue;
+
+ status_str = (status == QUEUE_STATUS_READY) ? "R" :
+ ((status == QUEUE_STATUS_SCHED) ? "S" : "NS");
+
+ type_c = (type == ODP_QUEUE_TYPE_PLAIN) ? 'P' : 'S';
+
+ bl_str = (blocking == ODP_BLOCKING) ? "B" :
+ ((blocking == ODP_NONBLOCKING_LF) ? "LF" : "WF");
+
+ enq_c = (enq_mode == ODP_QUEUE_OP_MT) ? 'S' :
+ ((enq_mode == ODP_QUEUE_OP_MT_UNSAFE) ? 'U' : 'D');
+
+ deq_c = (deq_mode == ODP_QUEUE_OP_MT) ? 'S' :
+ ((deq_mode == ODP_QUEUE_OP_MT_UNSAFE) ? 'U' : 'D');
+
+ order_c = (order == ODP_QUEUE_ORDER_KEEP) ? 'K' : 'I';
+
+ ODP_PRINT("%4u %-*s %c %2s %2s", index, col_width, name, type_c,
+ status_str, bl_str);
+ ODP_PRINT(" %c %c %c %6u %6u", enq_c, deq_c, order_c, len, max_len);
+
+ if (type == ODP_QUEUE_TYPE_SCHED) {
+ sync_c = (sync == ODP_SCHED_SYNC_PARALLEL) ? 'P' :
+ ((sync == ODP_SCHED_SYNC_ATOMIC) ? 'A' : 'O');
+ ODP_PRINT(" %c %4i", sync_c, prio);
+ }
+
+ ODP_PRINT("\n");
+ }
+
+ ODP_PRINT("\n");
+}
+
static inline int _sched_queue_enq_multi(odp_queue_t handle,
odp_buffer_hdr_t *buf_hdr[], int num)
{
@@ -1094,7 +1186,9 @@ _odp_queue_api_fn_t queue_basic_api = {
.queue_to_u64 = queue_to_u64,
.queue_param_init = queue_param_init,
.queue_info = queue_info,
- .queue_print = queue_print
+ .queue_print = queue_print,
+ .queue_print_all = queue_print_all
+
};
/* Functions towards internal components */
diff --git a/platform/linux-dpdk/odp_queue_if.c b/platform/linux-dpdk/odp_queue_if.c
index f19716d73..310664fb8 100644
--- a/platform/linux-dpdk/odp_queue_if.c
+++ b/platform/linux-dpdk/odp_queue_if.c
@@ -88,7 +88,7 @@ uint64_t odp_queue_to_u64(odp_queue_t hdl)
void odp_queue_param_init(odp_queue_param_t *param)
{
- return _odp_queue_api->queue_param_init(param);
+ _odp_queue_api->queue_param_init(param);
}
int odp_queue_info(odp_queue_t queue, odp_queue_info_t *info)
@@ -98,7 +98,12 @@ int odp_queue_info(odp_queue_t queue, odp_queue_info_t *info)
void odp_queue_print(odp_queue_t queue)
{
- return _odp_queue_api->queue_print(queue);
+ _odp_queue_api->queue_print(queue);
+}
+
+void odp_queue_print_all(void)
+{
+ _odp_queue_api->queue_print_all();
}
int _odp_queue_init_global(void)