[dpdk-dev] [PATCH v6 3/4] ena: Amazon ENA communication layer for DPDK platform

Thomas Monjalon thomas.monjalon at 6wind.com
Mon Mar 14 20:19:53 CET 2016


> +#ifndef unlikely
> +#define unlikely(c) __builtin_expect(!!(c), 0)
> +#endif
> +#ifndef likely
> +#define likely(c) __builtin_expect(!!(c), 1)
> +#endif

Including lib/librte_eal/common/include/rte_branch_prediction.h should
be enough.

> +#define max_t(type, x, y) ({			\
> +	type __max1 = (x);                      \
> +	type __max2 = (y);                      \
> +	__max1 > __max2 ? __max1 : __max2; })
> +
> +#define min_t(type, x, y) ({			\
> +	type __min1 = (x);			\
> +	type __min2 = (y);			\
> +	__min1 < __min2 ? __min1 : __min2; })
> +
> +#define ENA_MAX32(x, y) max_t(u32, (x), (y))
> +#define ENA_MAX16(x, y) max_t(u16, (x), (y))
> +#define ENA_MAX8(x, y) max_t(u8, (x), (y))
> +#define ENA_MIN32(x, y) min_t(u32, (x), (y))
> +#define ENA_MIN16(x, y) min_t(u16, (x), (y))
> +#define ENA_MIN8(x, y) min_t(u8, (x), (y))

There are RTE_MIN and RTE_MAX in lib/librte_eal/common/include/rte_common.h.



More information about the dev mailing list