From patchwork Sun Oct 25 05:45:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 82091 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 84843A04B5; Sun, 25 Oct 2020 06:46:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 165B62B86; Sun, 25 Oct 2020 06:46:13 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id A180B2A62 for ; Sun, 25 Oct 2020 06:46:09 +0100 (CET) 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 0AE7D113E; Sat, 24 Oct 2020 22:46:08 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EE0EB3F66B; Sat, 24 Oct 2020 22:46:07 -0700 (PDT) From: Honnappa Nagarahalli To: dev@dpdk.org, honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com, stephen@networkplumber.org Cc: dharmik.thakkar@arm.com, ruifeng.wang@arm.com, olivier.matz@6wind.com, david.marchand@redhat.com, nd@arm.com Date: Sun, 25 Oct 2020 00:45:50 -0500 Message-Id: <20201025054556.14277-3-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201025054556.14277-1-honnappa.nagarahalli@arm.com> References: <20200224203931.21256-1-honnappa.nagarahalli@arm.com> <20201025054556.14277-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH v5 2/8] test/ring: move common function to header file 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" Move test_ring_inc_ptr to header file so that it can be used by functions in other files. Signed-off-by: Honnappa Nagarahalli Reviewed-by: Dharmik Thakkar Acked-by: Konstantin Ananyev --- app/test/test_ring.c | 11 ----------- app/test/test_ring.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/test/test_ring.c b/app/test/test_ring.c index a62cb263b..329d538a9 100644 --- a/app/test/test_ring.c +++ b/app/test/test_ring.c @@ -243,17 +243,6 @@ test_ring_deq_impl(struct rte_ring *r, void **obj, int esize, unsigned int n, NULL); } -static void** -test_ring_inc_ptr(void **obj, int esize, unsigned int n) -{ - /* Legacy queue APIs? */ - if ((esize) == -1) - return ((void **)obj) + n; - else - return (void **)(((uint32_t *)obj) + - (n * esize / sizeof(uint32_t))); -} - static void test_ring_mem_init(void *obj, unsigned int count, int esize) { diff --git a/app/test/test_ring.h b/app/test/test_ring.h index d4b15af7c..b44711398 100644 --- a/app/test/test_ring.h +++ b/app/test/test_ring.h @@ -42,6 +42,19 @@ test_ring_create(const char *name, int esize, unsigned int count, (socket_id), (flags)); } +static inline void* +test_ring_inc_ptr(void *obj, int esize, unsigned int n) +{ + size_t sz; + + sz = sizeof(void *); + /* Legacy queue APIs? */ + if (esize != -1) + sz = esize; + + return (void *)((uint32_t *)obj + (n * sz / sizeof(uint32_t))); +} + static __rte_always_inline unsigned int test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n, unsigned int api_type)