From patchwork Sat Oct 24 16:11:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 318944 Delivered-To: patch@linaro.org Received: by 2002:a92:d1d1:0:0:0:0:0 with SMTP id u17csp1343226ilg; Sat, 24 Oct 2020 09:12:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo23JUalVhSG4yOZrWNpRxwHb3zSXI2fZmKk0ZnGDJwE5vSb+iquDGzTttWeCm62ihLY+X X-Received: by 2002:aa7:c792:: with SMTP id n18mr7796361eds.209.1603555932197; Sat, 24 Oct 2020 09:12:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603555932; cv=none; d=google.com; s=arc-20160816; b=1BAkZU+/9q4q39FnW9Wc+drPhIGCBxND6RsgvQPqPGsLvRtsn0dRCUDzm5RmPIrtQP bKYeVrJbkn0N6wcFg3W0XV4NSxknNLutw+3rAOcPDvrwvBs34RZVspXGmhDcVs/fKoCD hykInG4xYA2k8Ez7GfGxkK8PJIvd7iyvcajzie0KTzfwmZRNKDSTTiOdgHbjxEIFsr8E 18zXek/4y3LCaNKNsyjC/GuDK6K5HjetA1MkXm7pbMlV57ydLyWw3mzKn+AO9Gwy13Jy 1uS9QI0+pZBtiO2BDkGgqz8grq2bD4HxjRK50NltOaJPeolSR8ddfBUkm6C5rCKOP+QZ sMHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=469df2CbOJfoXDTuqr3CcF0i3jtt4a1CqgiPG2XfR7U=; b=1CQzsouaqy2Xmsw1nbjkAAT+JHxij7HeNTtXoclbYR57vvjFd1ITf/d/bRSRDhP82D GmZ7k0PX6AaKkgrWQsDBbq8FMseVldQpbFs8bYbyAUozx1pSnLhX8fpR62gtVLGZf506 g5JVNf8LRndqXHTTSCHaCPSHVkU3vIHsNt9ppauqb+QqUilZ9GZBv5jq7JJX9gsA853X EIHpyfPYI6uF7zC0AKccri1EpCNB63cvt8B6nME+gP2f+VrM/G1ZkXJgIEIfGUNDAoeD YBHZSwJbOih0LMHWEvRpCJHERWp+BIjf8cZ2Ay5BrdeAfYS1ruBSOIZ1hi5+idzTfCyF aokw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id f3si3337426ejz.386.2020.10.24.09.12.12; Sat, 24 Oct 2020 09:12:12 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 344EB2BEA; Sat, 24 Oct 2020 18:11:29 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id B63C825D9 for ; Sat, 24 Oct 2020 18:11:24 +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 24131101E; Sat, 24 Oct 2020 09:11:23 -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 130F83F66B; Sat, 24 Oct 2020 09:11:23 -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: Sat, 24 Oct 2020 11:11:06 -0500 Message-Id: <20201024161112.13730-3-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201024161112.13730-1-honnappa.nagarahalli@arm.com> References: <20200224203931.21256-1-honnappa.nagarahalli@arm.com> <20201024161112.13730-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH v4 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 --- app/test/test_ring.c | 11 ----------- app/test/test_ring.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 11 deletions(-) -- 2.17.1 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)