From patchwork Wed Sep 20 11:32:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Matz X-Patchwork-Id: 29015 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3FFDC7CDE; Wed, 20 Sep 2017 13:32:39 +0200 (CEST) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 8CC0123B for ; Wed, 20 Sep 2017 13:32:36 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id F178DE3DFC; Wed, 20 Sep 2017 13:28:16 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: venki497@gmail.com, bruce.richardson@intel.com, anatoly.burakov@intel.com Date: Wed, 20 Sep 2017 13:32:16 +0200 Message-Id: <20170920113216.1869-2-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170920113216.1869-1-olivier.matz@6wind.com> References: <20170907122033.17983-1-olivier.matz@6wind.com> <20170920113216.1869-1-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v2 2/2] test/ring: do not mask result of enqueue or dequeue 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 define RTE_RING_SZ_MASK is the maximum size supported by the rte_ring. The size is checked at ring creation. There is no reason today to mask the result of rte_ring_sp_enqueue_burst() or rte_ring_sc_dequeue_burst() with this value. The flag RTE_RING_QUOT_EXCEED was previously included in the returned value but it was removed in commit 77dd3064270c ("ring: remove watermark support"). Signed-off-by: Olivier Matz Reviewed-by: Anatoly Burakov --- v1->v2 - fix checkpatch issues test/test/test_ring.c | 59 +++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/test/test/test_ring.c b/test/test/test_ring.c index d664b04b7..d26e75269 100644 --- a/test/test/test_ring.c +++ b/test/test/test_ring.c @@ -375,37 +375,37 @@ test_ring_burst_basic(void) printf("enqueue 1 obj\n"); ret = rte_ring_sp_enqueue_burst(r, cur_src, 1, NULL); cur_src += 1; - if ((ret & RTE_RING_SZ_MASK) != 1) + if (ret != 1) goto fail; printf("enqueue 2 objs\n"); ret = rte_ring_sp_enqueue_burst(r, cur_src, 2, NULL); cur_src += 2; - if ((ret & RTE_RING_SZ_MASK) != 2) + if (ret != 2) goto fail; printf("enqueue MAX_BULK objs\n"); ret = rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL); cur_src += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) + if (ret != MAX_BULK) goto fail; printf("dequeue 1 obj\n"); ret = rte_ring_sc_dequeue_burst(r, cur_dst, 1, NULL); cur_dst += 1; - if ((ret & RTE_RING_SZ_MASK) != 1) + if (ret != 1) goto fail; printf("dequeue 2 objs\n"); ret = rte_ring_sc_dequeue_burst(r, cur_dst, 2, NULL); cur_dst += 2; - if ((ret & RTE_RING_SZ_MASK) != 2) + if (ret != 2) goto fail; printf("dequeue MAX_BULK objs\n"); ret = rte_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK, NULL); cur_dst += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) + if (ret != MAX_BULK) goto fail; /* check data */ @@ -423,22 +423,21 @@ test_ring_burst_basic(void) for (i = 0; i< (RING_SIZE/MAX_BULK - 1); i++) { ret = rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL); cur_src += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) { + if (ret != MAX_BULK) goto fail; - } } printf("Enqueue 2 objects, free entries = MAX_BULK - 2 \n"); ret = rte_ring_sp_enqueue_burst(r, cur_src, 2, NULL); cur_src += 2; - if ((ret & RTE_RING_SZ_MASK) != 2) + if (ret != 2) goto fail; printf("Enqueue the remaining entries = MAX_BULK - 2 \n"); /* Always one free entry left */ ret = rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL); cur_src += MAX_BULK - 3; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK - 3) + if (ret != MAX_BULK - 3) goto fail; printf("Test if ring is full \n"); @@ -447,26 +446,26 @@ test_ring_burst_basic(void) printf("Test enqueue for a full entry \n"); ret = rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL); - if ((ret & RTE_RING_SZ_MASK) != 0) + if (ret != 0) goto fail; printf("Test dequeue without enough objects \n"); for (i = 0; i