diff mbox series

[v1,8/12] api: queue: block-free capabilities

Message ID 1516608010-2535-9-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v1,1/12] validation: crypto: stop declaring test functions as public | expand

Commit Message

Github ODP bot Jan. 22, 2018, 8 a.m. 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>

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
/** Email created from pull request 413 (SonicwallYhe:api-next)
 ** https://github.com/Linaro/odp/pull/413
 ** Patch: https://github.com/Linaro/odp/pull/413.patch
 ** Base sha: 5a4502fc6bc53e6503169da3028f456b64811a0b
 ** Merge commit sha: 6669be7b55ab094f9e27d2101a6bb005ca87e405
 **/
 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)