diff mbox series

[API-NEXT,v1,1/4] api: queue: block-free capabilities

Message ID 1516104008-9628-2-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [API-NEXT,v1,1/4] api: queue: block-free capabilities | expand

Commit Message

Github ODP bot Jan. 16, 2018, noon UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Lock-free and wait-free implementations may differ a lot from
the default (blocking) implementation. Thus the maximum number
of queues and queue sizes may be more limited. Non-blocking enum
is not needed anymore as capability, since number of queues may
be zero for LF/WF when not implemented.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 393 (psavol:next-lockfree-queue-impl-rebased)
 ** https://github.com/Linaro/odp/pull/393
 ** Patch: https://github.com/Linaro/odp/pull/393.patch
 ** Base sha: f6dab2bfa90ef5d3146cb76f86bc8782666f0f3e
 ** Merge commit sha: 3da13358015ca674abf51f61f539fcbf6607cb2d
 **/
 include/odp/api/spec/queue.h                | 74 +++++++++++++++++++++++------
 platform/linux-generic/odp_queue.c          |  2 -
 platform/linux-generic/odp_queue_scalable.c |  2 -
 test/validation/api/queue/queue.c           |  2 -
 4 files changed, 60 insertions(+), 20 deletions(-)
diff mbox series

Patch

diff --git a/include/odp/api/spec/queue.h b/include/odp/api/spec/queue.h
index 79a26df3a..107ef3f75 100644
--- a/include/odp/api/spec/queue.h
+++ b/include/odp/api/spec/queue.h
@@ -164,35 +164,81 @@  typedef struct odp_queue_capability_t {
 
 	/** Plain queue capabilities */
 	struct {
-		/** Maximum number of plain queues of the default size. */
+		/** Maximum number of plain (ODP_BLOCKING) queues of the
+		  * default size. */
 		uint32_t max_num;
 
-		/** Maximum number of events a plain queue can store
-		  * simultaneously. The value of zero means that plain
+		/** Maximum number of events a plain (ODP_BLOCKING) queue can
+		  * store simultaneously. The value of zero means that plain
 		  * queues do not have a size limit, but a single queue can
 		  * store all available events. */
 		uint32_t max_size;
 
-		/** The strongest guarantee of block freedom that is supported
-		  * for plain queues. */
-		odp_nonblocking_t nonblocking;
+		/** Lock-free (ODP_NONBLOCKING_LF) implementation capabilities.
+		  * The specification is the same as for the blocking
+		  * implementation. */
+		struct {
+			/** Maximum number of queues. Lock-free queues are not
+			  * supported when zero. */
+			uint32_t max_num;
+
+			/** Maximum queue size */
+			uint32_t max_size;
+
+		} lockfree;
+
+		/** Wait-free (ODP_NONBLOCKING_WF) implementation capabilities.
+		  * The specification is the same as for the blocking
+		  * implementation. */
+		struct {
+			/** Maximum number of queues. Wait-free queues are not
+			  * supported when zero. */
+			uint32_t max_num;
+
+			/** Maximum queue size */
+			uint32_t max_size;
+
+		} waitfree;
 
 	} plain;
 
 	/** Scheduled queue capabilities */
 	struct {
-		/** Maximum number of scheduled queues of the default size. */
+		/** Maximum number of scheduled (ODP_BLOCKING) queues of the
+		  * default size. */
 		uint32_t max_num;
 
-		/** Maximum number of events a scheduled queue can store
-		  * simultaneously. The value of zero means that scheduled
-		  * queues do not have a size limit, but a single queue can
-		  * store all available events. */
+		/** Maximum number of events a scheduled (ODP_BLOCKING) queue
+		  * can store simultaneously. The value of zero means that
+		  * scheduled queues do not have a size limit, but a single
+		  * queue can store all available events. */
 		uint32_t max_size;
 
-		/** The strongest guarantee of block freedom that is supported
-		  * for scheduled queues. */
-		odp_nonblocking_t nonblocking;
+		/** Lock-free (ODP_NONBLOCKING_LF) implementation capabilities.
+		  * The specification is the same as for the blocking
+		  * implementation. */
+		struct {
+			/** Maximum number of queues. Lock-free queues are not
+			  * supported when zero. */
+			uint32_t max_num;
+
+			/** Maximum queue size */
+			uint32_t max_size;
+
+		} lockfree;
+
+		/** Wait-free (ODP_NONBLOCKING_WF) implementation capabilities.
+		  * The specification is the same as for the blocking
+		  * implementation. */
+		struct {
+			/** Maximum number of queues. Wait-free queues are not
+			  * supported when zero. */
+			uint32_t max_num;
+
+			/** Maximum queue size */
+			uint32_t max_size;
+
+		} waitfree;
 
 	} sched;
 
diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c
index 58103930c..6a69eb849 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -150,9 +150,7 @@  static int queue_capability(odp_queue_capability_t *capa)
 	capa->max_sched_groups  = sched_fn->num_grps();
 	capa->sched_prios       = odp_schedule_num_prio();
 	capa->plain.max_num     = capa->max_queues;
-	capa->plain.nonblocking = ODP_BLOCKING;
 	capa->sched.max_num     = capa->max_queues;
-	capa->sched.nonblocking = ODP_BLOCKING;
 
 	return 0;
 }
diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c
index 88a5a8c27..72dec15b0 100644
--- a/platform/linux-generic/odp_queue_scalable.c
+++ b/platform/linux-generic/odp_queue_scalable.c
@@ -315,10 +315,8 @@  static int queue_capability(odp_queue_capability_t *capa)
 	capa->sched_prios       = odp_schedule_num_prio();
 	capa->plain.max_num     = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES;
 	capa->plain.max_size    = 0;
-	capa->plain.nonblocking = ODP_BLOCKING;
 	capa->sched.max_num     = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES;
 	capa->sched.max_size    = 0;
-	capa->sched.nonblocking = ODP_BLOCKING;
 
 	return 0;
 }
diff --git a/test/validation/api/queue/queue.c b/test/validation/api/queue/queue.c
index 3c6db33ab..f674b0813 100644
--- a/test/validation/api/queue/queue.c
+++ b/test/validation/api/queue/queue.c
@@ -69,8 +69,6 @@  void queue_test_capa(void)
 	CU_ASSERT(capa.sched_prios != 0);
 	CU_ASSERT(capa.plain.max_num != 0);
 	CU_ASSERT(capa.sched.max_num != 0);
-	CU_ASSERT(capa.plain.nonblocking >= ODP_BLOCKING);
-	CU_ASSERT(capa.sched.nonblocking >= ODP_BLOCKING);
 
 	min = capa.plain.max_num;
 	if (min > capa.sched.max_num)