X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Fcommon%2Finclude%2Farch%2Fx86%2Frte_spinlock.h;h=5675c2b45c6daa45c6417c69dcf8f94349258e35;hb=c0e2821041392c17594786d9e46ba5c83de097b5;hp=20ef0a794a9ba69490010d5fcb0d861c2f21a0dc;hpb=ba7468997ea6dd7a019ea00367c56867eb6431e9;p=dpdk.git diff --git a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h index 20ef0a794a..5675c2b45c 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h +++ b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h @@ -43,6 +43,7 @@ extern "C" { #include "rte_cpuflags.h" #include "rte_branch_prediction.h" #include "rte_common.h" +#include "rte_pause.h" #define RTE_RTM_MAX_RETRIES (10) #define RTE_XABORT_LOCK_BUSY (0xff) @@ -90,28 +91,21 @@ rte_spinlock_trylock (rte_spinlock_t *sl) : "[lockval]" (lockval) : "memory"); - return (lockval == 0); + return lockval == 0; } #endif -static uint8_t rtm_supported; /* cache the flag to avoid the overhead - of the rte_cpu_get_flag_enabled function */ - -static inline void __attribute__((constructor)) -rte_rtm_init(void) -{ - rtm_supported = rte_cpu_get_flag_enabled(RTE_CPUFLAG_RTM); -} +extern uint8_t rte_rtm_supported; static inline int rte_tm_supported(void) { - return rtm_supported; + return rte_rtm_supported; } static inline int rte_try_tm(volatile int *lock) { - if (!rtm_supported) + if (!rte_rtm_supported) return 0; int retries = RTE_RTM_MAX_RETRIES;