diff mbox series

[v1,2/2] test: queue_perf: handle max queue size capability zero

Message ID 1534856407-17971-3-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v1,1/2] linux-gen: queue: fix ordered queue issue | expand

Commit Message

Github ODP bot Aug. 21, 2018, 1 p.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Queue size capability value of zero means that there is
not limit.

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

---
/** Email created from pull request 676 (psavol:master-queue-fix-ordered)
 ** https://github.com/Linaro/odp/pull/676
 ** Patch: https://github.com/Linaro/odp/pull/676.patch
 ** Base sha: 912e026c108d7a496ac7467e953dea77dadaaa57
 ** Merge commit sha: a997e012a8edc13ce577c8aa49683fc9d722c2ec
 **/
 test/performance/odp_queue_perf.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/test/performance/odp_queue_perf.c b/test/performance/odp_queue_perf.c
index d5ff254db..1ca639ebc 100644
--- a/test/performance/odp_queue_perf.c
+++ b/test/performance/odp_queue_perf.c
@@ -110,6 +110,7 @@  static int test_queue(test_options_t *test_options)
 	odp_pool_t pool;
 	odp_event_t ev;
 	uint32_t i, j, rounds;
+	uint32_t max_size;
 	uint64_t c1, c2, diff, ops, nsec;
 	odp_time_t t1, t2;
 	uint64_t num_retry = 0;
@@ -152,9 +153,9 @@  static int test_queue(test_options_t *test_options)
 			return -1;
 		}
 
-		if (num_event > queue_capa.plain.max_size) {
-			printf("Max queue size supported %u\n",
-			       queue_capa.plain.max_size);
+		max_size = queue_capa.plain.max_size;
+		if (max_size && num_event > max_size) {
+			printf("Max queue size supported %u\n", max_size);
 			return -1;
 		}
 	} else if (nonblock == ODP_NONBLOCKING_LF) {
@@ -169,9 +170,10 @@  static int test_queue(test_options_t *test_options)
 			return -1;
 		}
 
-		if (num_event > queue_capa.plain.lockfree.max_size) {
+		max_size = queue_capa.plain.lockfree.max_size;
+		if (max_size && num_event > max_size) {
 			printf("Max lockfree queue size supported %u\n",
-			       queue_capa.plain.lockfree.max_size);
+			       max_size);
 			return -1;
 		}
 	} else if (nonblock == ODP_NONBLOCKING_WF) {
@@ -186,9 +188,10 @@  static int test_queue(test_options_t *test_options)
 			return -1;
 		}
 
-		if (num_event > queue_capa.plain.waitfree.max_size) {
+		max_size = queue_capa.plain.waitfree.max_size;
+		if (max_size && num_event > max_size) {
 			printf("Max waitfree queue size supported %u\n",
-			       queue_capa.plain.waitfree.max_size);
+			       max_size);
 			return -1;
 		}
 	} else {