From: Feifei Wang Date: Sun, 20 Sep 2020 11:48:51 +0000 (-0500) Subject: test/ring: fix number of single element enqueue/dequeue X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f642148eea7c63ab0cfe7ef783657bd9db83518e;p=dpdk.git test/ring: fix number of single element enqueue/dequeue The ring capacity is (RING_SIZE - 1), thus only (RING_SIZE - 1) number of elements can be enqueued into the ring. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang Reviewed-by: Phil Yang Reviewed-by: Honnappa Nagarahalli Acked-by: Konstantin Ananyev --- diff --git a/app/test/test_ring.c b/app/test/test_ring.c index 0ae97d341e..04bdc9b696 100644 --- a/app/test/test_ring.c +++ b/app/test/test_ring.c @@ -811,7 +811,7 @@ test_ring_basic_ex(void) printf("%u ring entries are now free\n", rte_ring_free_count(rp)); - for (j = 0; j < RING_SIZE; j++) { + for (j = 0; j < RING_SIZE - 1; j++) { test_ring_enqueue(rp, obj, esize[i], 1, TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE); } @@ -822,7 +822,7 @@ test_ring_basic_ex(void) goto fail_test; } - for (j = 0; j < RING_SIZE; j++) { + for (j = 0; j < RING_SIZE - 1; j++) { test_ring_dequeue(rp, obj, esize[i], 1, TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE); }