#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)
: "[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;