From patchwork Tue Apr 3 06:35:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 36909 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 C5D791B668; Tue, 3 Apr 2018 08:36:44 +0200 (CEST) Received: from hw-sz-163mx2.163.com (proxy41132.mail.163.com [103.65.41.132]) by dpdk.org (Postfix) with ESMTP id C6FD01B667 for ; Tue, 3 Apr 2018 08:36:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=/Z65zcovggxStQVlZz FL8mih2LjXtS1AFYdRnDexIew=; b=kR45cHdBxCv2PuuEIeb9FBJyD8G0LdKZLc 91uH+GlMu2Y2k6Jf3t98+c6L5wlRYMEHFLgdRw5YDEdkIYmTgLt4qEfB+ygxTIYb LUHLDwQEjt4lbZP4cvSldF+pkgiNDNKoN6w/Xk5qPFnTPBVm84uolqhGiFjc83tl 8uVQRNXyM= Received: from SHL0405.hxtcorp.net (unknown [101.81.130.12]) by smtp3 (Coremail) with SMTP id DdGowACH8SbqIMNavuV2AA--.8352S2; Tue, 03 Apr 2018 14:36:27 +0800 (CST) From: Bing Zhao To: keith.wiles@intel.com, dev@dpdk.org Cc: bing.zhao@hxt-semitech.com, Bing Zhao Date: Tue, 3 Apr 2018 14:35:53 +0800 Message-Id: <20180403063553.19852-1-ilovethull@163.com> X-Mailer: git-send-email 2.11.0.windows.1 X-CM-TRANSID: DdGowACH8SbqIMNavuV2AA--.8352S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tF13Jry8uFW8GF1DZw17trb_yoW8CrWUpr 4kC3Z3KF1kGayxJw4xKr48XF4fZrs7JF4I9FnIy3yDua18Jr4vyrZYgr1Yyry5G3s29FWF 9FW8WFnrAr47uaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jda93UUUUU= X-Originating-IP: [101.81.130.12] X-CM-SenderInfo: xlor4vhwkxzzi6rwjhhfrp/xtbBDwsdt1O-+XhRpAAAs2 Subject: [dpdk-dev] [PATCH] [pktgen] [PATCH] Fix the "rte_memcpy" compiling on aarch64 platform 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 "rte_memcpy" will be a macro but not a function on aarch64 platform if the flags are not enabled (latest version). In old versions, it will always be a macro to memcpy. Now the preprocessor couldn't handle the "rte_memcpy" properly. Because the definition has the format like "rte_memcpy(d, s, n)", the single word "rte_memcpy" then cannnot be recognized. This fix is a WA on some level and not graceful. An additional if-else check will affect the performance a little (I hope not so much). Or shall we change the "rte_memcpy" from a pre-defined macro to an in-line function in the old versions and the latest version without the flags enabled? Thanks Signed-off-by: Bing Zhao --- app/cli-functions.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/cli-functions.c b/app/cli-functions.c index 1bddbbe..9c2fa2e 100644 --- a/app/cli-functions.c +++ b/app/cli-functions.c @@ -901,7 +901,7 @@ rte_memcpy_perf(unsigned int cnt, unsigned int kb, int flag) uint64_t start_time, total_time; uint64_t total_bits, bits_per_tick; unsigned int i; - void *(*cpy)(void *, const void *, size_t); + /* void *(*cpy)(void *, const void *, size_t); */ kb *= 1024; @@ -911,11 +911,17 @@ rte_memcpy_perf(unsigned int cnt, unsigned int kb, int flag) src = RTE_PTR_ALIGN(buf[0], RTE_CACHE_LINE_SIZE); dst = RTE_PTR_ALIGN(buf[1], RTE_CACHE_LINE_SIZE); - cpy = (flag)? rte_memcpy : memcpy; + /* cpy = (flag)? rte_memcpy : memcpy; */ start_time = rte_get_tsc_cycles(); - for(i = 0; i < cnt; i++) - cpy(dst, src, kb); + if (flag) { + for(i = 0; i < cnt; i++) + rte_memcpy(dst, src, kb); + } + else { + for(i = 0; i < cnt; i++) + memcpy(dst, src, kb); + } total_time = rte_get_tsc_cycles() - start_time; total_bits = ((uint64_t)cnt * (uint64_t)kb) * 8L;