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 57B4AA04BB; Fri, 11 Sep 2020 18:11:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DB7D91C115; Fri, 11 Sep 2020 18:10:44 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id EE87A1C10C; Fri, 11 Sep 2020 18:10:42 +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 80E30106F; Fri, 11 Sep 2020 09:10:42 -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 47AC13F73C; Fri, 11 Sep 2020 09:10:40 -0700 (PDT) From: Feifei Wang To: Honnappa Nagarahalli , Konstantin Ananyev Cc: dev@dpdk.org, nd@arm.com, Feifei Wang , stable@dpdk.org Date: Fri, 11 Sep 2020 11:10:00 -0500 Message-Id: <20200911161002.19816-5-feifei.wang2@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200911161002.19816-1-feifei.wang2@arm.com> References: <20200729063105.11299-1-feifei.wang2@arm.com> <20200911161002.19816-1-feifei.wang2@arm.com> Subject: [dpdk-dev] [PATCH v3 4/6] 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 --- 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 63d44d85e..811adc523 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++) { ret = test_ring_enqueue(rp, cur_src, esize[i], 1, TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE); if (ret != 0) { @@ -839,7 +839,7 @@ test_ring_basic_ex(void) goto fail_test; } - for (j = 0; j < RING_SIZE; j++) { + for (j = 0; j < RING_SIZE - 1; j++) { ret = test_ring_dequeue(rp, cur_dst, esize[i], 1, TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE); if (ret != 0) { -- 2.17.1