From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 216EBA04C7; Tue, 15 Sep 2020 08:28:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 88B581C0CE; Tue, 15 Sep 2020 08:28:08 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id F3DEA1C0CE; Tue, 15 Sep 2020 08:28:06 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 62A5B30E; Mon, 14 Sep 2020 23:28:06 -0700 (PDT) Received: from net-arm-n1sdp.shanghai.arm.com (net-arm-n1sdp.shanghai.arm.com [10.169.208.213]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 455FE3F73B; Mon, 14 Sep 2020 23:28:04 -0700 (PDT) From: Feifei Wang To: Honnappa Nagarahalli , Konstantin Ananyev Cc: dev@dpdk.org, nd@arm.com, Feifei Wang , stable@dpdk.org Date: Tue, 15 Sep 2020 01:27:44 -0500 Message-Id: <20200915062749.21374-3-feifei.wang2@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200915062749.21374-1-feifei.wang2@arm.com> References: <20200729063105.11299-1-feifei.wang2@arm.com> <20200915062749.21374-1-feifei.wang2@arm.com> Subject: [dpdk-dev] [PATCH v5 2/7] test/ring: fix wrong number of enq/deq elements X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- app/test/test_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test/test_ring.c b/app/test/test_ring.c index 0ae97d341..04bdc9b69 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); } -- 2.17.1