From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 3B6375946 for ; Sat, 6 Feb 2016 23:18:37 +0100 (CET) Received: by mail-wm0-f47.google.com with SMTP id p63so70808964wmp.1 for ; Sat, 06 Feb 2016 14:18:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QSoIHTzD/UL6/022cZbpebILyDysZcDNXj5XPTUXouI=; b=0SCeRMq7aunTXFrWil/FGX8He0wbshjTczq5EaWFN4UKn/sYYnmul5gxmHHKfTUI5L vjUTY7fRj7nmBv/Zdc4O9ChMV7bos/XZJi7RSnd3IMSgOxHr6jcqYxu3IgWU6JcS7sOG W3XsRLk8yIj2MrMQF5Jk6JVFo31LENrFlhPQnqLPqDJdhCyCe2kFUdxWK0xLys5XIesj C+lkR8TPyflaauSSVawbmqNVsR2KGnCZGX3ctroVUN1UifPYlPWon/4JG+AdO8ilSEz5 0Sou2r3fmfkyta5xdd0il3tcCZeH3P1QSLOtAza/jrIFqh2LWkRCHsAWKOrstN5Zx9Jf Gfvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QSoIHTzD/UL6/022cZbpebILyDysZcDNXj5XPTUXouI=; b=Yo8IlbRvxcX3e8mc25wT+u841fWeT0IZnVHje8iAPJwkHAQwmD5RdADFeVkMM0/w5g BACa9TkoC8K4MpGoVDKFJ3tKzLeGZV74K+kfN1NXEefXjZuJkBij1vAUgw5jgfpGQjQG GeKZcSV673N/qT+Gxk7heYVYDPhkglYV/Kmn5g9SJQSTMW4Q/PLKlZDBpKgWoNcvJxTn EzNxWdvOVCDSAdTdve1+v31hPwr6Yc2vjpZeHea4U3Ix8KjnFndKxujkZqpxgweZEo2J d14wItdNutQEbE3ofL7kBxKS21T3zxfyUwKp3bwILFXNHRnZXR03EBwvDCsUgYfbfgzD PE+w== X-Gm-Message-State: AG10YORnl51hh0cp8SuvA7QqSVzavOwPiNi7b8ijWOsiiUAZ6oZYWP8iv/UMaNukaqGDX4Zw X-Received: by 10.194.238.162 with SMTP id vl2mr19699957wjc.91.1454797117117; Sat, 06 Feb 2016 14:18:37 -0800 (PST) Received: from localhost.localdomain (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by smtp.gmail.com with ESMTPSA id e9sm22167710wja.25.2016.02.06.14.18.35 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 06 Feb 2016 14:18:36 -0800 (PST) From: Thomas Monjalon To: david.marchand@6wind.com, ferruh.yigit@intel.com Date: Sat, 6 Feb 2016 23:17:09 +0100 Message-Id: <1454797033-24057-2-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1454797033-24057-1-git-send-email-thomas.monjalon@6wind.com> References: <1454453993-3903-1-git-send-email-thomas.monjalon@6wind.com> <1454797033-24057-1-git-send-email-thomas.monjalon@6wind.com> Cc: dev@dpdk.org, viktorin@rehivetech.com Subject: [dpdk-dev] [PATCH v2 1/5] eal: get CPU flag name X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2016 22:18:37 -0000 The new function rte_cpu_get_flag_name() is added to the EAL API. It is implemented (duplicated) in each arch because the next patch will remove the public exposure of the feature tables. Signed-off-by: Thomas Monjalon --- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 + lib/librte_eal/common/arch/arm/rte_cpuflags.c | 7 +++++++ lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c | 8 ++++++++ lib/librte_eal/common/arch/x86/rte_cpuflags.c | 8 ++++++++ lib/librte_eal/common/eal_common_cpuflags.c | 2 +- lib/librte_eal/common/include/generic/rte_cpuflags.h | 14 ++++++++++++-- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 + 7 files changed, 38 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index d8ac7f7..9bea0e2 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -139,6 +139,7 @@ DPDK_2.2 { DPDK_2.3 { global: + rte_cpu_get_flag_name; rte_eal_pci_map_device; rte_eal_pci_unmap_device; rte_cpu_feature_table; diff --git a/lib/librte_eal/common/arch/arm/rte_cpuflags.c b/lib/librte_eal/common/arch/arm/rte_cpuflags.c index 4348574..62e0791 100644 --- a/lib/librte_eal/common/arch/arm/rte_cpuflags.c +++ b/lib/librte_eal/common/arch/arm/rte_cpuflags.c @@ -77,3 +77,10 @@ const struct feature_entry rte_cpu_feature_table[] = { }; #endif +const char * +rte_cpu_get_flag_name(enum rte_cpu_flag_t feature) +{ + if (feature >= RTE_CPUFLAG_NUMFLAGS) + return NULL; + return rte_cpu_feature_table[feature].name; +} diff --git a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c index 7f4e6dd..a270ccc 100644 --- a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c +++ b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c @@ -68,3 +68,11 @@ const struct feature_entry rte_cpu_feature_table[] = { FEAT_DEF(HTM, 0x00000001, 0, REG_HWCAP2, 30) FEAT_DEF(ARCH_2_07, 0x00000001, 0, REG_HWCAP2, 31) }; + +const char * +rte_cpu_get_flag_name(enum rte_cpu_flag_t feature) +{ + if (feature >= RTE_CPUFLAG_NUMFLAGS) + return NULL; + return rte_cpu_feature_table[feature].name; +} diff --git a/lib/librte_eal/common/arch/x86/rte_cpuflags.c b/lib/librte_eal/common/arch/x86/rte_cpuflags.c index 22dc572..3346fde 100644 --- a/lib/librte_eal/common/arch/x86/rte_cpuflags.c +++ b/lib/librte_eal/common/arch/x86/rte_cpuflags.c @@ -127,3 +127,11 @@ const struct feature_entry rte_cpu_feature_table[] = { FEAT_DEF(INVTSC, 0x80000007, 0, RTE_REG_EDX, 8) }; + +const char * +rte_cpu_get_flag_name(enum rte_cpu_flag_t feature) +{ + if (feature >= RTE_CPUFLAG_NUMFLAGS) + return NULL; + return rte_cpu_feature_table[feature].name; +} diff --git a/lib/librte_eal/common/eal_common_cpuflags.c b/lib/librte_eal/common/eal_common_cpuflags.c index 9ba9b1e..8c0576d 100644 --- a/lib/librte_eal/common/eal_common_cpuflags.c +++ b/lib/librte_eal/common/eal_common_cpuflags.c @@ -79,7 +79,7 @@ rte_cpu_check_supported(void) fprintf(stderr, "ERROR: This system does not support \"%s\".\n" "Please check that RTE_MACHINE is set correctly.\n", - rte_cpu_feature_table[compile_time_flags[i]].name); + rte_cpu_get_flag_name(compile_time_flags[i])); exit(1); } } diff --git a/lib/librte_eal/common/include/generic/rte_cpuflags.h b/lib/librte_eal/common/include/generic/rte_cpuflags.h index 5738a2a..3ca2e36 100644 --- a/lib/librte_eal/common/include/generic/rte_cpuflags.h +++ b/lib/librte_eal/common/include/generic/rte_cpuflags.h @@ -47,9 +47,7 @@ /** * Enumeration of all CPU features supported */ -#ifdef __DOXYGEN__ enum rte_cpu_flag_t; -#endif /** * Enumeration of CPU registers @@ -95,6 +93,18 @@ static inline void rte_cpu_get_features(uint32_t leaf, uint32_t subleaf, cpuid_registers_t out); /** + * Get name of CPU flag + * + * @param feature + * CPU flag ID + * @return + * flag name + * NULL if flag ID is invalid + */ +const char * +rte_cpu_get_flag_name(enum rte_cpu_flag_t feature); + +/** * Function for checking a CPU flag availability * * @param feature diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 4c09c0b..48e8e4f 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -142,6 +142,7 @@ DPDK_2.2 { DPDK_2.3 { global: + rte_cpu_get_flag_name; rte_eal_pci_map_device; rte_eal_pci_unmap_device; rte_cpu_feature_table; -- 2.7.0