From 9b5f64904b1fb01310e94a6c884b4a7f8e51b3a0 Mon Sep 17 00:00:00 2001 From: Xiaoyun Wang Date: Mon, 14 Sep 2020 22:31:46 +0800 Subject: [PATCH] net/hinic/base: fix clock definition with glibc version Sync the repair of patch("fix compile error for old glibc caused by CLOCK_MONOTONIC_RAW") in the community. Fixes: efeed0894e9c ("net/hinic/base: avoid system time jump") Cc: stable@dpdk.org Signed-off-by: Xiaoyun Wang --- drivers/net/hinic/base/hinic_compat.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/hinic/base/hinic_compat.h b/drivers/net/hinic/base/hinic_compat.h index 7036b031c5..6dd210ec06 100644 --- a/drivers/net/hinic/base/hinic_compat.h +++ b/drivers/net/hinic/base/hinic_compat.h @@ -166,11 +166,17 @@ static inline u32 readl(const volatile void *addr) #define spin_lock(spinlock_prt) rte_spinlock_lock(spinlock_prt) #define spin_unlock(spinlock_prt) rte_spinlock_unlock(spinlock_prt) +#ifdef CLOCK_MONOTONIC_RAW /* Defined in glibc bits/time.h */ +#define CLOCK_TYPE CLOCK_MONOTONIC_RAW +#else +#define CLOCK_TYPE CLOCK_MONOTONIC +#endif + static inline unsigned long clock_gettime_ms(void) { struct timespec tv; - (void)clock_gettime(CLOCK_MONOTONIC, &tv); + (void)clock_gettime(CLOCK_TYPE, &tv); return (unsigned long)tv.tv_sec * 1000 + (unsigned long)tv.tv_nsec / 1000000; -- 2.20.1