]> git.droids-corp.org - dpdk.git/commitdiff
eal: get CPU flag name
authorThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 2 Feb 2016 22:59:49 +0000 (23:59 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 16 Feb 2016 07:28:00 +0000 (08:28 +0100)
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 <thomas.monjalon@6wind.com>
lib/librte_eal/bsdapp/eal/rte_eal_version.map
lib/librte_eal/common/arch/arm/rte_cpuflags.c
lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
lib/librte_eal/common/arch/x86/rte_cpuflags.c
lib/librte_eal/common/eal_common_cpuflags.c
lib/librte_eal/common/include/generic/rte_cpuflags.h
lib/librte_eal/linuxapp/eal/rte_eal_version.map

index d8ac7f7cd061614915bb58f6b246d44f08448f13..9bea0e273c6457dd36c0ceba3351f04c68fd09a7 100644 (file)
@@ -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;
index 4348574093a0591b58d89790994bfeb41f00ef5b..62e079186da5de3f31311ca81194f20da8229dc0 100644 (file)
@@ -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;
+}
index 7f4e6dd10bfa4e089b166c20876f5c350723d94e..a270ccc019e4853983ab0057f00f928b99bba883 100644 (file)
@@ -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;
+}
index 22dc57213f848115836bb875f8919ce2a96141bc..3346fde249c2032266fd208ee3679d7215203e95 100644 (file)
@@ -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;
+}
index 9ba9b1e70df2d48396433dbbd3e13cc2ce63b803..8c0576d439d2827f4e9fdbb53fa69e5ff6c74d03 100644 (file)
@@ -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);
                }
        }
index 5738a2a73a6f3c08ba254f6619ce72ece6343f6b..3ca2e3660eaf0cf518f948a668073b5f49189f74 100644 (file)
@@ -47,9 +47,7 @@
 /**
  * Enumeration of all CPU features supported
  */
-#ifdef __DOXYGEN__
 enum rte_cpu_flag_t;
-#endif
 
 /**
  * Enumeration of CPU registers
@@ -94,6 +92,18 @@ static const struct feature_entry cpu_feature_table[];
 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
  *
index 4c09c0be6f13ffc52e755afaa71f32fe8a46294a..48e8e4f1f10c47115c67f2529d18e18331ac026e 100644 (file)
@@ -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;