Retrieve queue name and params.

Signed-off-by: Carl Wallen <[email protected]>
---
 platform/linux-generic/odp_queue.c | 40 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/platform/linux-generic/odp_queue.c 
b/platform/linux-generic/odp_queue.c
index 1c15e17..90e8972 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -1045,3 +1045,43 @@ void odp_schedule_order_unlock(unsigned lock_index)
        /* Release the ordered lock */
        odp_atomic_fetch_inc_u64(&origin_qe->s.sync_out[lock_index]);
 }
+
+int odp_queue_info(odp_queue_t handle, odp_queue_info_t *info)
+{
+       uint32_t queue_id;
+       queue_entry_t *queue;
+       int status;
+
+       if (odp_unlikely(info == NULL)) {
+               ODP_ERR("Unable to store info, NULL ptr given\n");
+               return -1;
+       }
+
+       queue_id = queue_to_id(handle);
+
+       if (odp_unlikely(queue_id >= ODP_CONFIG_QUEUES)) {
+               ODP_ERR("Invalid queue handle:%" PRIu64 "\n",
+                       odp_queue_to_u64(handle));
+               return -1;
+       }
+
+       queue = get_qentry(queue_id);
+
+       LOCK(&queue->s.lock);
+       status = queue->s.status;
+
+       if (odp_unlikely(status == QUEUE_STATUS_FREE ||
+                        status == QUEUE_STATUS_DESTROYED)) {
+               UNLOCK(&queue->s.lock);
+               ODP_ERR("Invalid queue status:%d\n", status);
+               return -1;
+       }
+
+       info->name = queue->s.name;
+       info->type = queue->s.type;
+       info->param = queue->s.param;
+
+       UNLOCK(&queue->s.lock);
+
+       return 0;
+}
--
2.1.4
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to