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 AB327A04B7; Sun, 20 Sep 2020 13:49:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3E7631D9E7; Sun, 20 Sep 2020 13:49:14 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 8F4A11D9E2; Sun, 20 Sep 2020 13:49:12 +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 EEFB5D6E; Sun, 20 Sep 2020 04:49:11 -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 BF58A3F68F; Sun, 20 Sep 2020 04:49:09 -0700 (PDT) From: Feifei Wang To: Honnappa Nagarahalli , Konstantin Ananyev Cc: dev@dpdk.org, nd@arm.com, Feifei Wang , stable@dpdk.org Date: Sun, 20 Sep 2020 06:48:51 -0500 Message-Id: <20200920114856.20697-3-feifei.wang2@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200920114856.20697-1-feifei.wang2@arm.com> References: <20200729063105.11299-1-feifei.wang2@arm.com> <20200920114856.20697-1-feifei.wang2@arm.com> Subject: [dpdk-dev] [PATCH v6 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