From: Bing Zhao <ilovethull@163.com>
To: keith.wiles@intel.com, dev@dpdk.org
Cc: bing.zhao@hxt-semitech.com, Bing Zhao <ilovethull@163.com>
Subject: [dpdk-dev] [PATCH] [pktgen] [PATCH] Fix the "rte_memcpy" compiling on aarch64 platform
Date: Tue, 3 Apr 2018 14:35:53 +0800 [thread overview]
Message-ID: <20180403063553.19852-1-ilovethull@163.com> (raw)
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 <ilovethull@163.com>
---
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;
--
2.11.0.windows.1
reply other threads:[~2018-04-03 6:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180403063553.19852-1-ilovethull@163.com \
--to=ilovethull@163.com \
--cc=bing.zhao@hxt-semitech.com \
--cc=dev@dpdk.org \
--cc=keith.wiles@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).