DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org, viktorin@rehivetech.com
Subject: Re: [dpdk-dev] [PATCH v1 0/5] clean-up cpuflags
Date: Wed, 3 Feb 2016 21:06:23 +0530	[thread overview]
Message-ID: <20160203153622.GA11424@localhost.localdomain> (raw)
In-Reply-To: <2567498.ifnkeR5xCN@xps13>

On Wed, Feb 03, 2016 at 03:01:26PM +0100, Thomas Monjalon wrote:
> 2016-02-03 19:08, Jerin Jacob:
> > On Tue, Feb 02, 2016 at 11:59:48PM +0100, Thomas Monjalon wrote:
> > compilation errors on arm64 too.
> 
> Yes I forgot REG_PLATFORM.
> 
> > arm64 toolchains are publicly available @
> > http://releases.linaro.org/14.11/components/toolchain/binaries/aarch64-linux-gnu/
> 
> Yes I know, thank you.
> I will test and make a v2.
> 
> Do you have any comment on the changes?

looks good, nice cleanup.

IMO, Something like below can be done to remove the #ifdef clutter in
rte_cpu_get_features for ARM introduced in this rework

[master] pass2  [dpdk-master] $ git diff
diff --git a/lib/librte_eal/common/arch/arm/rte_cpuflags.c
b/lib/librte_eal/common/arch/arm/rte_cpuflags.c
index fba0a61..861ac57 100644
--- a/lib/librte_eal/common/arch/arm/rte_cpuflags.c
+++ b/lib/librte_eal/common/arch/arm/rte_cpuflags.c
@@ -71,6 +71,9 @@ struct feature_entry {
        [RTE_CPUFLAG_##name] = {reg, bit, #name},
 
 #ifdef RTE_ARCH_64
+#define PLATFORM_STR "aarch64"
+typedef Elf64_auxv_t _Elfx_auxv_t
+
 const struct feature_entry rte_cpu_feature_table[] = {
        FEAT_DEF(FP,            REG_HWCAP,    0)
        FEAT_DEF(NEON,          REG_HWCAP,    1)
@@ -83,6 +86,9 @@ const struct feature_entry rte_cpu_feature_table[] = {
        FEAT_DEF(AARCH64,       REG_PLATFORM, 1)
 };
 #else
+#define PLATFORM_STR "v7l"
+typedef Elf32_auxv_t _Elfx_auxv_t
+
 const struct feature_entry rte_cpu_feature_table[] = {
        FEAT_DEF(SWP,       REG_HWCAP,    0)
        FEAT_DEF(HALF,      REG_HWCAP,    1)
@@ -115,6 +121,7 @@ const struct feature_entry rte_cpu_feature_table[] =
{
 };
 #endif
 
+
 /*
  * Read AUXV software register and get cpu features for ARM
  */
@@ -122,11 +129,8 @@ static void
 rte_cpu_get_features(hwcap_registers_t out)
 {
        int auxv_fd;
-#ifdef RTE_ARCH_64
-       Elf64_auxv_t auxv;
-#else
-       Elf32_auxv_t auxv;
-#endif
+
+       _Elfx_auxv_t auxv;
 
        auxv_fd = open("/proc/self/auxv", O_RDONLY);
        assert(auxv_fd);
@@ -136,11 +140,7 @@ rte_cpu_get_features(hwcap_registers_t out)
                } else if (auxv.a_type == AT_HWCAP2) {
                        out[REG_HWCAP2] = auxv.a_un.a_val;
                } else if (auxv.a_type == AT_PLATFORM) {
-#ifdef RTE_ARCH_64
-                       if (!strcmp((const char *)auxv.a_un.a_val, "aarch64"))
-#else
-                       if (!strcmp((const char *)auxv.a_un.a_val, "v7l"))
-#endif
+                       if (!strcmp((const char *)auxv.a_un.a_val, PLATFORM_STR))
                                out[REG_PLATFORM] = 0x0001;
                }
        }

Jerin

  reply	other threads:[~2016-02-03 15:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 22:59 Thomas Monjalon
2016-02-02 22:59 ` [dpdk-dev] [PATCH v1 1/5] eal: get CPU flag name Thomas Monjalon
2016-02-02 23:10 ` [dpdk-dev] [PATCH v1 2/5] eal: move CPU flag functions out of headers Thomas Monjalon
2016-02-02 23:10 ` [dpdk-dev] [PATCH v1 3/5] eal/arm: adapt CPU flags check to the arch Thomas Monjalon
2016-02-02 23:10 ` [dpdk-dev] [PATCH v1 4/5] eal/ppc: " Thomas Monjalon
2016-02-02 23:10 ` [dpdk-dev] [PATCH v1 5/5] eal: remove compiler optimization workaround Thomas Monjalon
2016-02-02 23:51 ` [dpdk-dev] [PATCH v1 0/5] clean-up cpuflags Jan Viktorin
2016-02-03 13:38 ` Jerin Jacob
2016-02-03 14:01   ` Thomas Monjalon
2016-02-03 15:36     ` Jerin Jacob [this message]
2016-02-06 22:17 ` [dpdk-dev] [PATCH v2 " Thomas Monjalon
2016-02-06 22:17   ` [dpdk-dev] [PATCH v2 1/5] eal: get CPU flag name Thomas Monjalon
2016-02-06 22:17   ` [dpdk-dev] [PATCH v2 2/5] eal: move CPU flag functions out of headers Thomas Monjalon
2016-02-08  8:59     ` Jerin Jacob
2016-02-06 22:17   ` [dpdk-dev] [PATCH v2 3/5] eal/arm: adapt CPU flags check to the arch Thomas Monjalon
2016-02-08  9:00     ` Jerin Jacob
2016-02-06 22:17   ` [dpdk-dev] [PATCH v2 4/5] eal/ppc: " Thomas Monjalon
2016-02-06 22:17   ` [dpdk-dev] [PATCH v2 5/5] eal: remove compiler optimization workaround Thomas Monjalon
2016-02-16  7:30   ` [dpdk-dev] [PATCH v2 0/5] clean-up cpuflags Thomas Monjalon

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=20160203153622.GA11424@localhost.localdomain \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=thomas.monjalon@6wind.com \
    --cc=viktorin@rehivetech.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).