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 04107A053A; Wed, 5 Aug 2020 08:15:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5B7231C0C3; Wed, 5 Aug 2020 08:15:16 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 3752E1C0BE; Wed, 5 Aug 2020 08:15:14 +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 BD5A1D6E; Tue, 4 Aug 2020 23:15:13 -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 1F1AF3F718; Tue, 4 Aug 2020 23:15:10 -0700 (PDT) From: Feifei Wang To: Honnappa Nagarahalli , Konstantin Ananyev , Olivier Matz , Gavin Hu Cc: dev@dpdk.org, nd@arm.com, Feifei Wang , stable@dpdk.org Date: Wed, 5 Aug 2020 01:14:20 -0500 Message-Id: <20200805061421.13037-4-feifei.wang2@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200805061421.13037-1-feifei.wang2@arm.com> References: <20200729063105.11299-1-feifei.wang2@arm.com> <20200805061421.13037-1-feifei.wang2@arm.com> Subject: [dpdk-dev] [PATCH v2 3/4] test/ring: fix the 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 actual capacity of ring should be the (RING_SIZE - 1), thus only (RING_SIZE - 1) elements can be enqueued into the ring. Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests") Cc: honnappa.nagarahalli@arm.com Cc: stable@dpdk.org Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang --- 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 c508a13a9..51bae0d48 100644 --- a/app/test/test_ring.c +++ b/app/test/test_ring.c @@ -822,7 +822,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); } @@ -833,7 +833,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