[V11 02/18] net/hinic3: add basic header files
Stephen Hemminger
stephen at networkplumber.org
Thu Sep 18 18:13:16 CEST 2025
On Wed, 17 Sep 2025 18:15:36 +0800
Feifei Wang <wff_light at vip.163.com> wrote:
> +
> +#ifdef CLOCK_MONOTONIC_RAW /**< Defined in glibc bits/time.h . */
> +#define CLOCK_TYPE CLOCK_MONOTONIC_RAW
> +#else
> +#define CLOCK_TYPE CLOCK_MONOTONIC
> +#endif
Defined but not used.
> +#define HINIC3_S_TO_MS_UNIT 1000
> +#define HINIC3_S_TO_NS_UNIT 1000000
> +
> +#define cycles rte_get_timer_cycles()
> +#define msecs_to_cycles(ms) ((ms) * rte_get_timer_hz() / HINIC3_S_TO_MS_UNIT)
> +#define time_before(now, end) ((now) < (end))
That version of time_before() is not safe if TSC wraps around.
Other places use:
#define time_before(now, end) ((int64_t)((now) - (end)) < 0)
More information about the dev
mailing list