[PATCH v3 4/5] mempool: avoid floating point expression in static assertion
Andrew Rybchenko
andrew.rybchenko at oktetlabs.ru
Wed Jan 17 09:06:42 CET 2024
On 1/16/24 21:41, Stephen Hemminger wrote:
> Clang does not handle casts in static_assert() expressions.
> It doesn't like use of floating point to calculate threshold.
> Use a different expression with same effect; yes this will cause
> checkpatch nag.
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
> lib/mempool/rte_mempool.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
> index b7a19bea7185..ba3a54cfc298 100644
> --- a/lib/mempool/rte_mempool.c
> +++ b/lib/mempool/rte_mempool.c
> @@ -50,9 +50,7 @@ static void
> mempool_event_callback_invoke(enum rte_mempool_event event,
> struct rte_mempool *mp);
>
> -#define CACHE_FLUSHTHRESH_MULTIPLIER 1.5
drivers/net/mlx5/mlx5_rxq.c:1447: * CACHE_FLUSHTHRESH_MULTIPLIER
is defined in a C file, so using a
> -#define CALC_CACHE_FLUSHTHRESH(c) \
> - ((typeof(c))((c) * CACHE_FLUSHTHRESH_MULTIPLIER))
> +#define CALC_CACHE_FLUSHTHRESH(c) ((c) + (c) / 2)
Maybe ((c) * 3 / 2) to avoid double usage of arg in macro?
>
> #if defined(RTE_ARCH_X86)
> /*
More information about the dev
mailing list