From 277ff5bb75b05480c3f42597a4c5019d51833fdf Mon Sep 17 00:00:00 2001 From: Intel Date: Thu, 20 Dec 2012 00:00:00 +0100 Subject: [PATCH] eal: always check CPU support at runtime Signed-off-by: Intel --- lib/librte_eal/common/eal_common_cpuflags.c | 6 ++++-- lib/librte_eal/common/include/rte_cpuflags.h | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/common/eal_common_cpuflags.c b/lib/librte_eal/common/eal_common_cpuflags.c index b3d03e5748..8312614b65 100644 --- a/lib/librte_eal/common/eal_common_cpuflags.c +++ b/lib/librte_eal/common/eal_common_cpuflags.c @@ -243,7 +243,10 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) * with ICC, the check is generated by the compiler. */ #ifndef __INTEL_COMPILER -static void __attribute__ ((__constructor__)) +void __attribute__ ((__constructor__)) +#else +void +#endif rte_cpu_check_supported(void) { /* This is generated at compile-time by the build system */ @@ -261,4 +264,3 @@ rte_cpu_check_supported(void) exit(1); } } -#endif diff --git a/lib/librte_eal/common/include/rte_cpuflags.h b/lib/librte_eal/common/include/rte_cpuflags.h index cb22396437..abd48005fd 100644 --- a/lib/librte_eal/common/include/rte_cpuflags.h +++ b/lib/librte_eal/common/include/rte_cpuflags.h @@ -156,15 +156,23 @@ enum rte_cpu_flag_t { * Function for checking a CPU flag availability * * @param flag - * CPU flag to query CPU for + * CPU flag to query CPU for * @return - * 1 if flag is available - * 0 if flag is not available - * -ENOENT if flag is invalid + * 1 if flag is available + * 0 if flag is not available + * -ENOENT if flag is invalid */ int rte_cpu_get_flag_enabled(enum rte_cpu_flag_t flag); +/** + * This function checks that the currently used CPU supports the CPU features + * that were specified at compile time. It is called automatically within the + * EAL, so does not need to be used by applications. + */ +void +rte_cpu_check_supported(void); + #ifdef __cplusplus } #endif -- 2.20.1