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: 318955 Delivered-To: patch@linaro.org Received: by 2002:a92:d1d1:0:0:0:0:0 with SMTP id u17csp1695275ilg; Sat, 24 Oct 2020 22:46:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUOYYIfaBhQgdVwXpmnJjo38uJcEUPRLNT2/T9Nn5cx+dvqirqlWGqyQWbKTzAkPpDpF7h X-Received: by 2002:a05:6402:a45:: with SMTP id bt5mr10247233edb.101.1603604811088; Sat, 24 Oct 2020 22:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603604811; cv=none; d=google.com; s=arc-20160816; b=S8N9MihMJ5FaJtgjRss6pgQZPgq41C4qPCG+GdByyvsQSzgRGG+WggWYpkdu4S3Dwq CJIXJIZMn5Na1tw7HiamhczPSVmOgoiikn+63ZPSnPMbZjwsqP+G3tH9bteEAQWHBDCT jKG8NFC3h8FRb47fpaXJRxKmpUJ01EDMp1yJrVgN6WZiktbUOSpB/WXh/1H5TDrwnhC5 BPIsG4Pq0dbowF8sJ8b9CWowLgHaRTitiuM7nd/Nll8PehyD1qy3WKiM4tPa8yxKwsL9 jtI0SyMw4ZHsSnPihMENon1PQcweojxin6lTGuGAqBi/1IThs87OEo+3Ig6Nt6gapGe3 hChA== 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=TyQSK9egzx8sDCwu7p2OFQ6+sPSbYYdBnZsKS3AC9y7ts3zLfE1lwLbSsh5Dq8Yqkb 7dTHHRMVGbNiTTfUxxCZHus7zoogIlIwxc6ttUSS7Mh3djpXDgF8hjBFoZhVeh2iYlRB q1h+to9zsAUPrNbe9ugK3FOhDTVrl+PSpfUXU56ZUrwQDeVUAx6LavkaXGeyIVGC4+Jl 3tQJCfLTsc+lQ7DpAtBc4pGAgOcLeRJSAjFDZTFfagPunS2N5Rjv0PDKC3fgxUPkYG7l rxPvHCu+jgxUeRNK42uVIGlGb+uFjH4Z6x5piQtJY1vxEcA/BOGoIu7zGDKOEgsS272F uNfg== 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 be17si4376106edb.35.2020.10.24.22.46.50; Sat, 24 Oct 2020 22:46:51 -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 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 --- app/test/test_ring.c | 11 ----------- app/test/test_ring.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 11 deletions(-) -- 2.17.1 Acked-by: Konstantin Ananyev 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)