To provide support of different definitions of odp_queue_t
it's good to have a proper mechanism to set the queue invalid
in case any error during the transmission happen.

This eases the case when odp_queue_t is defined as an union
and the type of this queue is set as a member of the given
union.

Signed-off-by: José Pekkarinen <[email protected]>
---
 include/odp/api/queue.h            | 10 ++++++++++
 platform/linux-generic/odp_queue.c | 10 ++++++++++
 2 files changed, 20 insertions(+)

diff --git a/include/odp/api/queue.h b/include/odp/api/queue.h
index bde8ca3..95eaf3b 100644
--- a/include/odp/api/queue.h
+++ b/include/odp/api/queue.h
@@ -371,6 +371,16 @@ typedef struct odp_queue_info_t {
 int odp_queue_info(odp_queue_t queue, odp_queue_info_t *info);
 
 /**
+ * Invalidate a queue
+ *
+ * @param      queue   Queue handle
+ *
+ * @retval 0 Success
+ * @retval <0 Failure. Queue could not be invalidated.
+ */
+int odp_queue_invalidate(odp_queue_t queue);
+
+/**
  * @}
  */
 
diff --git a/platform/linux-generic/odp_queue.c 
b/platform/linux-generic/odp_queue.c
index dbe2d9c..591cc79 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -1116,3 +1116,13 @@ int odp_queue_info(odp_queue_t handle, odp_queue_info_t 
*info)
 
        return 0;
 }
+
+int odp_queue_invalidate(odp_queue_t handle)
+{
+       if(handle = ODP_QUEUE_INVALID){
+               ODP_ERR("Queue could not be invalidated\n");
+               return -1;
+       }
+
+       return 0;
+}
-- 
2.4.10

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to