get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/10334/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 10334,
    "url": "http://patchwork.dpdk.org/api/patches/10334/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1454454626-4483-1-git-send-email-thomas.monjalon@6wind.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1454454626-4483-1-git-send-email-thomas.monjalon@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1454454626-4483-1-git-send-email-thomas.monjalon@6wind.com",
    "date": "2016-02-02T23:10:23",
    "name": "[dpdk-dev,v1,2/5] eal: move CPU flag functions out of headers",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "11fa79c87d78c8296201c0c84918a9ec0fb93a75",
    "submitter": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/people/1/?format=api",
        "name": "Thomas Monjalon",
        "email": "thomas.monjalon@6wind.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1454454626-4483-1-git-send-email-thomas.monjalon@6wind.com/mbox/",
    "series": [],
    "comments": "http://patchwork.dpdk.org/api/patches/10334/comments/",
    "check": "pending",
    "checks": "http://patchwork.dpdk.org/api/patches/10334/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 55F5493C0;\n\tWed,  3 Feb 2016 00:11:43 +0100 (CET)",
            "from mail-wm0-f53.google.com (mail-wm0-f53.google.com\n\t[74.125.82.53]) by dpdk.org (Postfix) with ESMTP id 566478E5D\n\tfor <dev@dpdk.org>; Wed,  3 Feb 2016 00:11:42 +0100 (CET)",
            "by mail-wm0-f53.google.com with SMTP id l66so45561797wml.0\n\tfor <dev@dpdk.org>; Tue, 02 Feb 2016 15:11:42 -0800 (PST)",
            "from localhost.localdomain (136-92-190-109.dsl.ovh.fr.\n\t[109.190.92.136]) by smtp.gmail.com with ESMTPSA id\n\tlw7sm3588848wjb.19.2016.02.02.15.11.39\n\t(version=TLSv1/SSLv3 cipher=OTHER);\n\tTue, 02 Feb 2016 15:11:41 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=Dd1AlCxPjM5WLqBLIBVMNgl8I5NBfNBXcAD2dyf6Lgk=;\n\tb=qTNmvwNPhppXyKOEt4P8Jp3xh8/9n1QWbuMoXc2vHsBU6jzWMU010Mn2TEoxUqrFVe\n\tiOPu8M13fVDQSJ8fmVLZKd1oMdjfD7y53zqUC/WBUMJ7xBNJ5kaJ7ZVTRsQrGoRxLdcw\n\teyT9brYmp6MKQatzouy/dF63JRuP0rHYRLkyDDA8BlMPjHOxAvoHjR7T3Uz84sN5GjEH\n\tqIEyKUtUm3gY/eI2tbCJhMOuqTRv81HODFDAPEeIdp9rxR1/gBxKdgZrOxNJ3n1APrLI\n\tg1CjT4K+mHXdlv52SYEBm9R74PSs3tDUSTht07KI8EtLabUU4F7Vxj9iJhEZ/3VI58JT\n\t+90Q==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=Dd1AlCxPjM5WLqBLIBVMNgl8I5NBfNBXcAD2dyf6Lgk=;\n\tb=OJyzYDBPbxsjQQ5kvMvy2fqSuiLfoKuXOlhL7/ksXHOlkRGpaojDtbIf6RCrugn6Kb\n\t1DfxPZaO7XPEAUQ8Ntv/+GMdHp2ZKQq8TwsMe8PrLF3YaHjJcZuP+vb0v+8U7i8CUQfS\n\tb6noMkIDfYBYMpoAHwojrj7P3G3pdzlryDJwu44CM35ZxZ17+1ZLbmRSaaHpbzD2v8Mc\n\tEnUS5vQ/AAccFxab9sTCTrjuKFIBafj01WE5wY+uEiTi9Zv6dArcaM1zK7msEAaDsVOE\n\tZz2BPZJR6sdlkh02BxTZJbHKPoQt2YT2QjIMQA1O9xbX5UJY2Lyp090yawvVFKYJlHaf\n\tfWlg==",
        "X-Gm-Message-State": "AG10YOTmRRTXu8UYxUBACXWfZ0LZTaNGCswV/IlELhO44u2wt7SaKM7vf1Z3EpXTP2RjT3k3",
        "X-Received": "by 10.194.171.66 with SMTP id as2mr31053589wjc.73.1454454701935; \n\tTue, 02 Feb 2016 15:11:41 -0800 (PST)",
        "From": "Thomas Monjalon <thomas.monjalon@6wind.com>",
        "To": "david.marchand@6wind.com,\n\tferruh.yigit@intel.com",
        "Date": "Wed,  3 Feb 2016 00:10:23 +0100",
        "Message-Id": "<1454454626-4483-1-git-send-email-thomas.monjalon@6wind.com>",
        "X-Mailer": "git-send-email 2.7.0",
        "In-Reply-To": "<1454453993-3903-1-git-send-email-thomas.monjalon@6wind.com>",
        "References": "<1454453993-3903-1-git-send-email-thomas.monjalon@6wind.com>",
        "Cc": "dev@dpdk.org, viktorin@rehivetech.com",
        "Subject": "[dpdk-dev] [PATCH v1 2/5] eal: move CPU flag functions out of\n\theaders",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The patch c344eab3ee has moved the hardware definition of CPU flags.\nNow the functions checking these hardware flags are also moved.\nThe function rte_cpu_get_flag_enabled() is no more inline.\n\nThe benefits are:\n- remove rte_cpu_feature_table from the ABI (recently added)\n- hide hardware details from the API\n- allow to adapt structures per arch (done in next patch)\n\nSigned-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>\n---\n app/test/test_hash_scaling.c                       |  2 +\n lib/librte_eal/bsdapp/eal/rte_eal_version.map      |  1 -\n lib/librte_eal/common/arch/arm/rte_cpuflags.c      | 99 ++++++++++++++++++++++\n lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c   | 79 +++++++++++++++++\n lib/librte_eal/common/arch/tile/rte_cpuflags.c     | 11 +++\n lib/librte_eal/common/arch/x86/rte_cpuflags.c      | 83 ++++++++++++++++++\n lib/librte_eal/common/eal_common_cpuflags.c        |  3 +\n .../common/include/arch/arm/rte_cpuflags_32.h      | 78 -----------------\n .../common/include/arch/arm/rte_cpuflags_64.h      | 79 -----------------\n .../common/include/arch/ppc_64/rte_cpuflags.h      | 64 --------------\n .../common/include/arch/tile/rte_cpuflags.h        | 29 -------\n .../common/include/arch/x86/rte_cpuflags.h         | 66 ---------------\n .../common/include/generic/rte_cpuflags.h          | 50 +----------\n lib/librte_eal/linuxapp/eal/rte_eal_version.map    |  1 -\n 14 files changed, 278 insertions(+), 367 deletions(-)",
    "diff": "diff --git a/app/test/test_hash_scaling.c b/app/test/test_hash_scaling.c\nindex 744e5e3..1c4c75d 100644\n--- a/app/test/test_hash_scaling.c\n+++ b/app/test/test_hash_scaling.c\n@@ -31,6 +31,8 @@\n  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n  */\n \n+#include <stdio.h>\n+\n #include <rte_cycles.h>\n #include <rte_hash.h>\n #include <rte_hash_crc.h>\ndiff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\nindex 1280cb2..f0aa698 100644\n--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n@@ -139,7 +139,6 @@ DPDK_2.2 {\n DPDK_2.3 {\n \tglobal:\n \n-\trte_cpu_feature_table;\n \trte_cpu_get_flag_name;\n \n } DPDK_2.2;\ndiff --git a/lib/librte_eal/common/arch/arm/rte_cpuflags.c b/lib/librte_eal/common/arch/arm/rte_cpuflags.c\nindex 62e0791..664f527 100644\n--- a/lib/librte_eal/common/arch/arm/rte_cpuflags.c\n+++ b/lib/librte_eal/common/arch/arm/rte_cpuflags.c\n@@ -2,6 +2,7 @@\n  *   BSD LICENSE\n  *\n  *   Copyright (C) Cavium networks Ltd. 2015.\n+ *   Copyright(c) 2015 RehiveTech. All rights reserved.\n  *\n  *   Redistribution and use in source and binary forms, with or without\n  *   modification, are permitted provided that the following conditions\n@@ -32,6 +33,46 @@\n \n #include \"rte_cpuflags.h\"\n \n+#include <elf.h>\n+#include <fcntl.h>\n+#include <assert.h>\n+#include <unistd.h>\n+#include <string.h>\n+\n+#ifndef AT_HWCAP\n+#define AT_HWCAP 16\n+#endif\n+\n+#ifndef AT_HWCAP2\n+#define AT_HWCAP2 26\n+#endif\n+\n+#ifndef AT_PLATFORM\n+#define AT_PLATFORM 15\n+#endif\n+\n+enum cpu_register_t {\n+\tREG_HWCAP = 0,\n+\tREG_HWCAP2,\n+};\n+\n+typedef uint32_t cpuid_registers_t[4];\n+\n+/**\n+ * Struct to hold a processor feature entry\n+ */\n+struct feature_entry {\n+\tuint32_t leaf;\t\t\t\t/**< cpuid leaf */\n+\tuint32_t subleaf;\t\t\t/**< cpuid subleaf */\n+\tuint32_t reg;\t\t\t\t/**< cpuid register */\n+\tuint32_t bit;\t\t\t\t/**< cpuid register bit */\n+#define CPU_FLAG_NAME_MAX_LEN 64\n+\tchar name[CPU_FLAG_NAME_MAX_LEN];       /**< String for printing */\n+};\n+\n+#define FEAT_DEF(name, leaf, subleaf, reg, bit) \\\n+\t[RTE_CPUFLAG_##name] = {leaf, subleaf, reg, bit, #name },\n+\n #ifdef RTE_ARCH_64\n const struct feature_entry rte_cpu_feature_table[] = {\n \tFEAT_DEF(FP,\t\t0x00000001, 0, REG_HWCAP,  0)\n@@ -77,6 +118,64 @@ const struct feature_entry rte_cpu_feature_table[] = {\n };\n #endif\n \n+/*\n+ * Read AUXV software register and get cpu features for ARM\n+ */\n+static void\n+rte_cpu_get_features(__attribute__((unused)) uint32_t leaf,\n+\t__attribute__((unused)) uint32_t subleaf, cpuid_registers_t out)\n+{\n+\tint auxv_fd;\n+#ifdef RTE_ARCH_64\n+\tElf64_auxv_t auxv;\n+#else\n+\tElf32_auxv_t auxv;\n+#endif\n+\n+\tauxv_fd = open(\"/proc/self/auxv\", O_RDONLY);\n+\tassert(auxv_fd);\n+\twhile (read(auxv_fd, &auxv, sizeof(auxv)) == sizeof(auxv)) {\n+\t\tif (auxv.a_type == AT_HWCAP) {\n+\t\t\tout[REG_HWCAP] = auxv.a_un.a_val;\n+\t\t} else if (auxv.a_type == AT_HWCAP2) {\n+\t\t\tout[REG_HWCAP2] = auxv.a_un.a_val;\n+\t\t} else if (auxv.a_type == AT_PLATFORM) {\n+#ifdef RTE_ARCH_64\n+\t\t\tif (!strcmp((const char *)auxv.a_un.a_val, \"aarch64\"))\n+#else\n+\t\t\tif (!strcmp((const char *)auxv.a_un.a_val, \"v7l\"))\n+#endif\n+\t\t\t\tout[REG_PLATFORM] = 0x0001;\n+\t\t}\n+\t}\n+}\n+\n+/*\n+ * Checks if a particular flag is available on current machine.\n+ */\n+int\n+rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)\n+{\n+\tconst struct feature_entry *feat;\n+\tcpuid_registers_t regs = {0};\n+\n+\tif (feature >= RTE_CPUFLAG_NUMFLAGS)\n+\t\t/* Flag does not match anything in the feature tables */\n+\t\treturn -ENOENT;\n+\n+\tfeat = &rte_cpu_feature_table[feature];\n+\n+\tif (!feat->leaf)\n+\t\t/* This entry in the table wasn't filled out! */\n+\t\treturn -EFAULT;\n+\n+\t/* get the cpuid leaf containing the desired feature */\n+\trte_cpu_get_features(feat->leaf, feat->subleaf, regs);\n+\n+\t/* check if the feature is enabled */\n+\treturn (regs[feat->reg] >> feat->bit) & 1;\n+}\n+\n const char *\n rte_cpu_get_flag_name(enum rte_cpu_flag_t feature)\n {\ndiff --git a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c\nindex a270ccc..b7e0b72 100644\n--- a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c\n+++ b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c\n@@ -32,6 +32,38 @@\n \n #include \"rte_cpuflags.h\"\n \n+#include <elf.h>\n+#include <fcntl.h>\n+#include <assert.h>\n+#include <unistd.h>\n+\n+/* Symbolic values for the entries in the auxiliary table */\n+#define AT_HWCAP  16\n+#define AT_HWCAP2 26\n+\n+/* software based registers */\n+enum cpu_register_t {\n+\tREG_HWCAP = 0,\n+\tREG_HWCAP2,\n+};\n+\n+typedef uint32_t cpuid_registers_t[4];\n+\n+/**\n+ * Struct to hold a processor feature entry\n+ */\n+struct feature_entry {\n+\tuint32_t leaf;\t\t\t\t/**< cpuid leaf */\n+\tuint32_t subleaf;\t\t\t/**< cpuid subleaf */\n+\tuint32_t reg;\t\t\t\t/**< cpuid register */\n+\tuint32_t bit;\t\t\t\t/**< cpuid register bit */\n+#define CPU_FLAG_NAME_MAX_LEN 64\n+\tchar name[CPU_FLAG_NAME_MAX_LEN];       /**< String for printing */\n+};\n+\n+#define FEAT_DEF(name, leaf, subleaf, reg, bit) \\\n+\t[RTE_CPUFLAG_##name] = {leaf, subleaf, reg, bit, #name },\n+\n const struct feature_entry rte_cpu_feature_table[] = {\n \tFEAT_DEF(PPC_LE, 0x00000001, 0, REG_HWCAP,  0)\n \tFEAT_DEF(TRUE_LE, 0x00000001, 0, REG_HWCAP,  1)\n@@ -69,6 +101,53 @@ const struct feature_entry rte_cpu_feature_table[] = {\n \tFEAT_DEF(ARCH_2_07, 0x00000001, 0, REG_HWCAP2,  31)\n };\n \n+/*\n+ * Read AUXV software register and get cpu features for Power\n+ */\n+static void\n+rte_cpu_get_features(__attribute__((unused)) uint32_t leaf,\n+\t__attribute__((unused)) uint32_t subleaf, cpuid_registers_t out)\n+{\n+\tint auxv_fd;\n+\tElf64_auxv_t auxv;\n+\n+\tauxv_fd = open(\"/proc/self/auxv\", O_RDONLY);\n+\tassert(auxv_fd);\n+\twhile (read(auxv_fd, &auxv,\n+\t\tsizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t)) {\n+\t\tif (auxv.a_type == AT_HWCAP)\n+\t\t\tout[REG_HWCAP] = auxv.a_un.a_val;\n+\t\telse if (auxv.a_type == AT_HWCAP2)\n+\t\t\tout[REG_HWCAP2] = auxv.a_un.a_val;\n+\t}\n+}\n+\n+/*\n+ * Checks if a particular flag is available on current machine.\n+ */\n+int\n+rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)\n+{\n+\tconst struct feature_entry *feat;\n+\tcpuid_registers_t regs = {0};\n+\n+\tif (feature >= RTE_CPUFLAG_NUMFLAGS)\n+\t\t/* Flag does not match anything in the feature tables */\n+\t\treturn -ENOENT;\n+\n+\tfeat = &rte_cpu_feature_table[feature];\n+\n+\tif (!feat->leaf)\n+\t\t/* This entry in the table wasn't filled out! */\n+\t\treturn -EFAULT;\n+\n+\t/* get the cpuid leaf containing the desired feature */\n+\trte_cpu_get_features(feat->leaf, feat->subleaf, regs);\n+\n+\t/* check if the feature is enabled */\n+\treturn (regs[feat->reg] >> feat->bit) & 1;\n+}\n+\n const char *\n rte_cpu_get_flag_name(enum rte_cpu_flag_t feature)\n {\ndiff --git a/lib/librte_eal/common/arch/tile/rte_cpuflags.c b/lib/librte_eal/common/arch/tile/rte_cpuflags.c\nindex 4ca0a7b..a2b6c51 100644\n--- a/lib/librte_eal/common/arch/tile/rte_cpuflags.c\n+++ b/lib/librte_eal/common/arch/tile/rte_cpuflags.c\n@@ -32,5 +32,16 @@\n \n #include \"rte_cpuflags.h\"\n \n+#include <errno.h>\n+\n const struct feature_entry rte_cpu_feature_table[] = {\n };\n+\n+/*\n+ * Checks if a particular flag is available on current machine.\n+ */\n+int\n+rte_cpu_get_flag_enabled(__attribute__((unused)) enum rte_cpu_flag_t feature)\n+{\n+\treturn -ENOENT;\n+}\ndiff --git a/lib/librte_eal/common/arch/x86/rte_cpuflags.c b/lib/librte_eal/common/arch/x86/rte_cpuflags.c\nindex 3346fde..0138257 100644\n--- a/lib/librte_eal/common/arch/x86/rte_cpuflags.c\n+++ b/lib/librte_eal/common/arch/x86/rte_cpuflags.c\n@@ -33,6 +33,34 @@\n \n #include \"rte_cpuflags.h\"\n \n+#include <stdio.h>\n+#include <errno.h>\n+#include <stdint.h>\n+\n+enum cpu_register_t {\n+\tRTE_REG_EAX = 0,\n+\tRTE_REG_EBX,\n+\tRTE_REG_ECX,\n+\tRTE_REG_EDX,\n+};\n+\n+typedef uint32_t cpuid_registers_t[4];\n+\n+/**\n+ * Struct to hold a processor feature entry\n+ */\n+struct feature_entry {\n+\tuint32_t leaf;\t\t\t\t/**< cpuid leaf */\n+\tuint32_t subleaf;\t\t\t/**< cpuid subleaf */\n+\tuint32_t reg;\t\t\t\t/**< cpuid register */\n+\tuint32_t bit;\t\t\t\t/**< cpuid register bit */\n+#define CPU_FLAG_NAME_MAX_LEN 64\n+\tchar name[CPU_FLAG_NAME_MAX_LEN];       /**< String for printing */\n+};\n+\n+#define FEAT_DEF(name, leaf, subleaf, reg, bit) \\\n+\t[RTE_CPUFLAG_##name] = {leaf, subleaf, reg, bit, #name },\n+\n const struct feature_entry rte_cpu_feature_table[] = {\n \tFEAT_DEF(SSE3, 0x00000001, 0, RTE_REG_ECX,  0)\n \tFEAT_DEF(PCLMULQDQ, 0x00000001, 0, RTE_REG_ECX,  1)\n@@ -128,6 +156,61 @@ const struct feature_entry rte_cpu_feature_table[] = {\n \tFEAT_DEF(INVTSC, 0x80000007, 0, RTE_REG_EDX,  8)\n };\n \n+/*\n+ * Execute CPUID instruction and get contents of a specific register\n+ *\n+ * This function, when compiled with GCC, will generate architecture-neutral\n+ * code, as per GCC manual.\n+ */\n+static void\n+rte_cpu_get_features(uint32_t leaf, uint32_t subleaf, cpuid_registers_t out)\n+{\n+#if defined(__i386__) && defined(__PIC__)\n+\t/* %ebx is a forbidden register if we compile with -fPIC or -fPIE */\n+\tasm volatile(\"movl %%ebx,%0 ; cpuid ; xchgl %%ebx,%0\"\n+\t\t : \"=r\" (out[RTE_REG_EBX]),\n+\t\t   \"=a\" (out[RTE_REG_EAX]),\n+\t\t   \"=c\" (out[RTE_REG_ECX]),\n+\t\t   \"=d\" (out[RTE_REG_EDX])\n+\t\t : \"a\" (leaf), \"c\" (subleaf));\n+#else\n+\tasm volatile(\"cpuid\"\n+\t\t : \"=a\" (out[RTE_REG_EAX]),\n+\t\t   \"=b\" (out[RTE_REG_EBX]),\n+\t\t   \"=c\" (out[RTE_REG_ECX]),\n+\t\t   \"=d\" (out[RTE_REG_EDX])\n+\t\t : \"a\" (leaf), \"c\" (subleaf));\n+#endif\n+}\n+\n+int\n+rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)\n+{\n+\tconst struct feature_entry *feat;\n+\tcpuid_registers_t regs;\n+\n+\tif (feature >= RTE_CPUFLAG_NUMFLAGS)\n+\t\t/* Flag does not match anything in the feature tables */\n+\t\treturn -ENOENT;\n+\n+\tfeat = &rte_cpu_feature_table[feature];\n+\n+\tif (!feat->leaf)\n+\t\t/* This entry in the table wasn't filled out! */\n+\t\treturn -EFAULT;\n+\n+\trte_cpu_get_features(feat->leaf & 0xffff0000, 0, regs);\n+\tif (((regs[RTE_REG_EAX] ^ feat->leaf) & 0xffff0000) ||\n+\t      regs[RTE_REG_EAX] < feat->leaf)\n+\t\treturn 0;\n+\n+\t/* get the cpuid leaf containing the desired feature */\n+\trte_cpu_get_features(feat->leaf, feat->subleaf, regs);\n+\n+\t/* check if the feature is enabled */\n+\treturn (regs[feat->reg] >> feat->bit) & 1;\n+}\n+\n const char *\n rte_cpu_get_flag_name(enum rte_cpu_flag_t feature)\n {\ndiff --git a/lib/librte_eal/common/eal_common_cpuflags.c b/lib/librte_eal/common/eal_common_cpuflags.c\nindex 8c0576d..a4c5a29 100644\n--- a/lib/librte_eal/common/eal_common_cpuflags.c\n+++ b/lib/librte_eal/common/eal_common_cpuflags.c\n@@ -30,6 +30,9 @@\n  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n  */\n+\n+#include <stdio.h>\n+\n #include <rte_common.h>\n #include <rte_cpuflags.h>\n \ndiff --git a/lib/librte_eal/common/include/arch/arm/rte_cpuflags_32.h b/lib/librte_eal/common/include/arch/arm/rte_cpuflags_32.h\nindex 2ec0c2e..373fd46 100644\n--- a/lib/librte_eal/common/include/arch/arm/rte_cpuflags_32.h\n+++ b/lib/librte_eal/common/include/arch/arm/rte_cpuflags_32.h\n@@ -37,35 +37,8 @@\n extern \"C\" {\n #endif\n \n-#include <elf.h>\n-#include <fcntl.h>\n-#include <assert.h>\n-#include <unistd.h>\n-#include <string.h>\n-\n #include \"generic/rte_cpuflags.h\"\n \n-extern const struct feature_entry rte_cpu_feature_table[];\n-\n-#ifndef AT_HWCAP\n-#define AT_HWCAP 16\n-#endif\n-\n-#ifndef AT_HWCAP2\n-#define AT_HWCAP2 26\n-#endif\n-\n-#ifndef AT_PLATFORM\n-#define AT_PLATFORM 15\n-#endif\n-\n-/* software based registers */\n-enum cpu_register_t {\n-\tREG_HWCAP = 0,\n-\tREG_HWCAP2,\n-\tREG_PLATFORM,\n-};\n-\n /**\n  * Enumeration of all CPU features supported\n  */\n@@ -102,57 +75,6 @@ enum rte_cpu_flag_t {\n \tRTE_CPUFLAG_NUMFLAGS,/**< This should always be the last! */\n };\n \n-/*\n- * Read AUXV software register and get cpu features for ARM\n- */\n-static inline void\n-rte_cpu_get_features(__attribute__((unused)) uint32_t leaf,\n-\t__attribute__((unused)) uint32_t subleaf, cpuid_registers_t out)\n-{\n-\tint auxv_fd;\n-\tElf32_auxv_t auxv;\n-\n-\tauxv_fd = open(\"/proc/self/auxv\", O_RDONLY);\n-\tassert(auxv_fd);\n-\twhile (read(auxv_fd, &auxv,\n-\t\tsizeof(Elf32_auxv_t)) == sizeof(Elf32_auxv_t)) {\n-\t\tif (auxv.a_type == AT_HWCAP)\n-\t\t\tout[REG_HWCAP] = auxv.a_un.a_val;\n-\t\telse if (auxv.a_type == AT_HWCAP2)\n-\t\t\tout[REG_HWCAP2] = auxv.a_un.a_val;\n-\t\telse if (auxv.a_type == AT_PLATFORM) {\n-\t\t\tif (!strcmp((const char *)auxv.a_un.a_val, \"v7l\"))\n-\t\t\t\tout[REG_PLATFORM] = 0x0001;\n-\t\t}\n-\t}\n-}\n-\n-/*\n- * Checks if a particular flag is available on current machine.\n- */\n-static inline int\n-rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)\n-{\n-\tconst struct feature_entry *feat;\n-\tcpuid_registers_t regs = {0};\n-\n-\tif (feature >= RTE_CPUFLAG_NUMFLAGS)\n-\t\t/* Flag does not match anything in the feature tables */\n-\t\treturn -ENOENT;\n-\n-\tfeat = &rte_cpu_feature_table[feature];\n-\n-\tif (!feat->leaf)\n-\t\t/* This entry in the table wasn't filled out! */\n-\t\treturn -EFAULT;\n-\n-\t/* get the cpuid leaf containing the desired feature */\n-\trte_cpu_get_features(feat->leaf, feat->subleaf, regs);\n-\n-\t/* check if the feature is enabled */\n-\treturn (regs[feat->reg] >> feat->bit) & 1;\n-}\n-\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_eal/common/include/arch/arm/rte_cpuflags_64.h b/lib/librte_eal/common/include/arch/arm/rte_cpuflags_64.h\nindex b36040b..4cf4759 100644\n--- a/lib/librte_eal/common/include/arch/arm/rte_cpuflags_64.h\n+++ b/lib/librte_eal/common/include/arch/arm/rte_cpuflags_64.h\n@@ -37,35 +37,8 @@\n extern \"C\" {\n #endif\n \n-#include <elf.h>\n-#include <fcntl.h>\n-#include <assert.h>\n-#include <unistd.h>\n-#include <string.h>\n-\n #include \"generic/rte_cpuflags.h\"\n \n-extern const struct feature_entry rte_cpu_feature_table[];\n-\n-#ifndef AT_HWCAP\n-#define AT_HWCAP 16\n-#endif\n-\n-#ifndef AT_HWCAP2\n-#define AT_HWCAP2 26\n-#endif\n-\n-#ifndef AT_PLATFORM\n-#define AT_PLATFORM 15\n-#endif\n-\n-/* software based registers */\n-enum cpu_register_t {\n-\tREG_HWCAP = 0,\n-\tREG_HWCAP2,\n-\tREG_PLATFORM,\n-};\n-\n /**\n  * Enumeration of all CPU features supported\n  */\n@@ -83,58 +56,6 @@ enum rte_cpu_flag_t {\n \tRTE_CPUFLAG_NUMFLAGS,/**< This should always be the last! */\n };\n \n-/*\n- * Read AUXV software register and get cpu features for ARM\n- */\n-static inline void\n-rte_cpu_get_features(__attribute__((unused)) uint32_t leaf,\n-\t\t     __attribute__((unused)) uint32_t subleaf,\n-\t\t     cpuid_registers_t out)\n-{\n-\tint auxv_fd;\n-\tElf64_auxv_t auxv;\n-\n-\tauxv_fd = open(\"/proc/self/auxv\", O_RDONLY);\n-\tassert(auxv_fd);\n-\twhile (read(auxv_fd, &auxv,\n-\t\t    sizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t)) {\n-\t\tif (auxv.a_type == AT_HWCAP) {\n-\t\t\tout[REG_HWCAP] = auxv.a_un.a_val;\n-\t\t} else if (auxv.a_type == AT_HWCAP2) {\n-\t\t\tout[REG_HWCAP2] = auxv.a_un.a_val;\n-\t\t} else if (auxv.a_type == AT_PLATFORM) {\n-\t\t\tif (!strcmp((const char *)auxv.a_un.a_val, \"aarch64\"))\n-\t\t\t\tout[REG_PLATFORM] = 0x0001;\n-\t\t}\n-\t}\n-}\n-\n-/*\n- * Checks if a particular flag is available on current machine.\n- */\n-static inline int\n-rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)\n-{\n-\tconst struct feature_entry *feat;\n-\tcpuid_registers_t regs = {0};\n-\n-\tif (feature >= RTE_CPUFLAG_NUMFLAGS)\n-\t\t/* Flag does not match anything in the feature tables */\n-\t\treturn -ENOENT;\n-\n-\tfeat = &rte_cpu_feature_table[feature];\n-\n-\tif (!feat->leaf)\n-\t\t/* This entry in the table wasn't filled out! */\n-\t\treturn -EFAULT;\n-\n-\t/* get the cpuid leaf containing the desired feature */\n-\trte_cpu_get_features(feat->leaf, feat->subleaf, regs);\n-\n-\t/* check if the feature is enabled */\n-\treturn (regs[feat->reg] >> feat->bit) & 1;\n-}\n-\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h b/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h\nindex 85c4c1a..04d4c27 100644\n--- a/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h\n+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h\n@@ -37,25 +37,8 @@\n extern \"C\" {\n #endif\n \n-#include <elf.h>\n-#include <fcntl.h>\n-#include <assert.h>\n-#include <unistd.h>\n-\n #include \"generic/rte_cpuflags.h\"\n \n-extern const struct feature_entry rte_cpu_feature_table[];\n-\n-/* Symbolic values for the entries in the auxiliary table */\n-#define AT_HWCAP  16\n-#define AT_HWCAP2 26\n-\n-/* software based registers */\n-enum cpu_register_t {\n-\tREG_HWCAP = 0,\n-\tREG_HWCAP2,\n-};\n-\n /**\n  * Enumeration of all CPU features supported\n  */\n@@ -98,53 +81,6 @@ enum rte_cpu_flag_t {\n \tRTE_CPUFLAG_NUMFLAGS,/**< This should always be the last! */\n };\n \n-/*\n- * Read AUXV software register and get cpu features for Power\n- */\n-static inline void\n-rte_cpu_get_features(__attribute__((unused)) uint32_t leaf,\n-\t__attribute__((unused)) uint32_t subleaf, cpuid_registers_t out)\n-{\n-\tint auxv_fd;\n-\tElf64_auxv_t auxv;\n-\n-\tauxv_fd = open(\"/proc/self/auxv\", O_RDONLY);\n-\tassert(auxv_fd);\n-\twhile (read(auxv_fd, &auxv,\n-\t\tsizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t)) {\n-\t\tif (auxv.a_type == AT_HWCAP)\n-\t\t\tout[REG_HWCAP] = auxv.a_un.a_val;\n-\t\telse if (auxv.a_type == AT_HWCAP2)\n-\t\t\tout[REG_HWCAP2] = auxv.a_un.a_val;\n-\t}\n-}\n-\n-/*\n- * Checks if a particular flag is available on current machine.\n- */\n-static inline int\n-rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)\n-{\n-\tconst struct feature_entry *feat;\n-\tcpuid_registers_t regs = {0};\n-\n-\tif (feature >= RTE_CPUFLAG_NUMFLAGS)\n-\t\t/* Flag does not match anything in the feature tables */\n-\t\treturn -ENOENT;\n-\n-\tfeat = &rte_cpu_feature_table[feature];\n-\n-\tif (!feat->leaf)\n-\t\t/* This entry in the table wasn't filled out! */\n-\t\treturn -EFAULT;\n-\n-\t/* get the cpuid leaf containing the desired feature */\n-\trte_cpu_get_features(feat->leaf, feat->subleaf, regs);\n-\n-\t/* check if the feature is enabled */\n-\treturn (regs[feat->reg] >> feat->bit) & 1;\n-}\n-\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_eal/common/include/arch/tile/rte_cpuflags.h b/lib/librte_eal/common/include/arch/tile/rte_cpuflags.h\nindex a415857..994884b 100644\n--- a/lib/librte_eal/common/include/arch/tile/rte_cpuflags.h\n+++ b/lib/librte_eal/common/include/arch/tile/rte_cpuflags.h\n@@ -37,18 +37,8 @@\n extern \"C\" {\n #endif\n \n-#include <elf.h>\n-#include <fcntl.h>\n-#include <assert.h>\n-#include <unistd.h>\n-\n #include \"generic/rte_cpuflags.h\"\n \n-/* software based registers */\n-enum cpu_register_t {\n-\tREG_DUMMY = 0\n-};\n-\n /**\n  * Enumeration of all CPU features supported\n  */\n@@ -56,25 +46,6 @@ enum rte_cpu_flag_t {\n \tRTE_CPUFLAG_NUMFLAGS /**< This should always be the last! */\n };\n \n-/*\n- * Read AUXV software register and get cpu features for Power\n- */\n-static inline void\n-rte_cpu_get_features(__attribute__((unused)) uint32_t leaf,\n-\t\t     __attribute__((unused)) uint32_t subleaf,\n-\t\t     __attribute__((unused)) cpuid_registers_t out)\n-{\n-}\n-\n-/*\n- * Checks if a particular flag is available on current machine.\n- */\n-static inline int\n-rte_cpu_get_flag_enabled(__attribute__((unused)) enum rte_cpu_flag_t feature)\n-{\n-\treturn -ENOENT;\n-}\n-\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h\nindex 120ea24..117fed2 100644\n--- a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h\n+++ b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h\n@@ -38,15 +38,8 @@\n extern \"C\" {\n #endif\n \n-#include <stdlib.h>\n-#include <stdio.h>\n-#include <errno.h>\n-#include <stdint.h>\n-\n #include \"generic/rte_cpuflags.h\"\n \n-extern const struct feature_entry rte_cpu_feature_table[];\n-\n enum rte_cpu_flag_t {\n \t/* (EAX 01h) ECX features*/\n \tRTE_CPUFLAG_SSE3 = 0,               /**< SSE3 */\n@@ -153,65 +146,6 @@ enum rte_cpu_flag_t {\n \tRTE_CPUFLAG_NUMFLAGS,               /**< This should always be the last! */\n };\n \n-enum cpu_register_t {\n-\tRTE_REG_EAX = 0,\n-\tRTE_REG_EBX,\n-\tRTE_REG_ECX,\n-\tRTE_REG_EDX,\n-};\n-\n-static inline void\n-rte_cpu_get_features(uint32_t leaf, uint32_t subleaf, cpuid_registers_t out)\n-{\n-#if defined(__i386__) && defined(__PIC__)\n-    /* %ebx is a forbidden register if we compile with -fPIC or -fPIE */\n-    asm volatile(\"movl %%ebx,%0 ; cpuid ; xchgl %%ebx,%0\"\n-\t\t : \"=r\" (out[RTE_REG_EBX]),\n-\t\t   \"=a\" (out[RTE_REG_EAX]),\n-\t\t   \"=c\" (out[RTE_REG_ECX]),\n-\t\t   \"=d\" (out[RTE_REG_EDX])\n-\t\t : \"a\" (leaf), \"c\" (subleaf));\n-#else\n-\n-    asm volatile(\"cpuid\"\n-\t\t : \"=a\" (out[RTE_REG_EAX]),\n-\t\t   \"=b\" (out[RTE_REG_EBX]),\n-\t\t   \"=c\" (out[RTE_REG_ECX]),\n-\t\t   \"=d\" (out[RTE_REG_EDX])\n-\t\t : \"a\" (leaf), \"c\" (subleaf));\n-\n-#endif\n-}\n-\n-static inline int\n-rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)\n-{\n-\tconst struct feature_entry *feat;\n-\tcpuid_registers_t regs;\n-\n-\n-\tif (feature >= RTE_CPUFLAG_NUMFLAGS)\n-\t\t/* Flag does not match anything in the feature tables */\n-\t\treturn -ENOENT;\n-\n-\tfeat = &rte_cpu_feature_table[feature];\n-\n-\tif (!feat->leaf)\n-\t\t/* This entry in the table wasn't filled out! */\n-\t\treturn -EFAULT;\n-\n-\trte_cpu_get_features(feat->leaf & 0xffff0000, 0, regs);\n-\tif (((regs[RTE_REG_EAX] ^ feat->leaf) & 0xffff0000) ||\n-\t      regs[RTE_REG_EAX] < feat->leaf)\n-\t\treturn 0;\n-\n-\t/* get the cpuid leaf containing the desired feature */\n-\trte_cpu_get_features(feat->leaf, feat->subleaf, regs);\n-\n-\t/* check if the feature is enabled */\n-\treturn (regs[feat->reg] >> feat->bit) & 1;\n-}\n-\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_eal/common/include/generic/rte_cpuflags.h b/lib/librte_eal/common/include/generic/rte_cpuflags.h\nindex 3ca2e36..c1da357 100644\n--- a/lib/librte_eal/common/include/generic/rte_cpuflags.h\n+++ b/lib/librte_eal/common/include/generic/rte_cpuflags.h\n@@ -39,10 +39,7 @@\n  * Architecture specific API to determine available CPU features at runtime.\n  */\n \n-#include <stdlib.h>\n-#include <stdio.h>\n #include <errno.h>\n-#include <stdint.h>\n \n /**\n  * Enumeration of all CPU features supported\n@@ -50,49 +47,6 @@\n enum rte_cpu_flag_t;\n \n /**\n- * Enumeration of CPU registers\n- */\n-#ifdef __DOXYGEN__\n-enum cpu_register_t;\n-#endif\n-\n-typedef uint32_t cpuid_registers_t[4];\n-\n-#define CPU_FLAG_NAME_MAX_LEN 64\n-\n-/**\n- * Struct to hold a processor feature entry\n- */\n-struct feature_entry {\n-\tuint32_t leaf;\t\t\t\t/**< cpuid leaf */\n-\tuint32_t subleaf;\t\t\t/**< cpuid subleaf */\n-\tuint32_t reg;\t\t\t\t/**< cpuid register */\n-\tuint32_t bit;\t\t\t\t/**< cpuid register bit */\n-\tchar name[CPU_FLAG_NAME_MAX_LEN];       /**< String for printing */\n-};\n-\n-#define FEAT_DEF(name, leaf, subleaf, reg, bit) \\\n-\t[RTE_CPUFLAG_##name] = {leaf, subleaf, reg, bit, #name },\n-\n-/**\n- * An array that holds feature entries\n- *\n- * Defined in arch-specific rte_cpuflags.h.\n- */\n-#ifdef __DOXYGEN__\n-static const struct feature_entry cpu_feature_table[];\n-#endif\n-\n-/**\n- * Execute CPUID instruction and get contents of a specific register\n- *\n- * This function, when compiled with GCC, will generate architecture-neutral\n- * code, as per GCC manual.\n- */\n-static inline void\n-rte_cpu_get_features(uint32_t leaf, uint32_t subleaf, cpuid_registers_t out);\n-\n-/**\n  * Get name of CPU flag\n  *\n  * @param feature\n@@ -114,10 +68,8 @@ rte_cpu_get_flag_name(enum rte_cpu_flag_t feature);\n  *     0 if flag is not available\n  *     -ENOENT if flag is invalid\n  */\n-#ifdef __DOXYGEN__\n-static inline int\n+int\n rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);\n-#endif\n \n /**\n  * This function checks that the currently used CPU supports the CPU features\ndiff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\nindex d8a5978..b06825a 100644\n--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n@@ -142,7 +142,6 @@ DPDK_2.2 {\n DPDK_2.3 {\n \tglobal:\n \n-\trte_cpu_feature_table;\n \trte_cpu_get_flag_name;\n \n } DPDK_2.2;\n",
    "prefixes": [
        "dpdk-dev",
        "v1",
        "2/5"
    ]
}