[dpdk-dev] [PATCH 2/4] mempool: make cache flush threshold macro public

Olivier MATZ olivier.matz at 6wind.com
Tue Aug 23 17:09:21 CEST 2016


Hi Robert,

On 08/01/2016 10:42 PM, Robert Sanford wrote:
> Rename macros that calculate a mempool cache flush threshold, and
> move them from rte_mempool.c to rte_mempool.h, so that the bonding
> driver can accurately calculate its mbuf requirements.
>
> Signed-off-by: Robert Sanford <rsanford at akamai.com>
> ---
>   lib/librte_mempool/rte_mempool.c |    8 ++------
>   lib/librte_mempool/rte_mempool.h |    7 +++++++
>   2 files changed, 9 insertions(+), 6 deletions(-)
>
> [...]
>
> --- a/lib/librte_mempool/rte_mempool.h
> +++ b/lib/librte_mempool/rte_mempool.h
> @@ -263,6 +263,13 @@ struct rte_mempool {
>   #define MEMPOOL_F_NO_PHYS_CONTIG 0x0020 /**< Don't need physically contiguous objs. */
>
>   /**
> + * Calculate the threshold before we flush excess elements.
> + */
> +#define RTE_MEMPOOL_CACHE_FLUSHTHRESH_MULTIPLIER 1.5
> +#define RTE_MEMPOOL_CALC_CACHE_FLUSHTHRESH(c)	\
> +	((typeof(c))((c) * RTE_MEMPOOL_CACHE_FLUSHTHRESH_MULTIPLIER))
> +
> +/**
>    * @internal When debug is enabled, store some statistics.
>    *
>    * @param mp
>

What do you think of using a static inline function instead of a macro ?


Regards,
Olivier


More information about the dev mailing list