[dpdk-dev] [PATCH] examples/l2fwd: increase pktmbuf pool size

Stephen Hemminger stephen at networkplumber.org
Thu Dec 28 21:36:42 CET 2017


On Fri, 29 Dec 2017 01:49:06 +0530
Pavan Nikhilesh <pbhagavatula at caviumnetworks.com> wrote:

> +/*
> + * This expression is used to calculate the number of mbufs needed
> + * depending on user input, taking  into account memory for rx and
> + * tx hardware rings, cache per lcore and mbuf pkt burst per port
> + * per lcore. RTE_MAX is used to ensure that NB_MBUF never goes below
> + * a minimum value of 8192
> + */
> +#define NB_MBUF RTE_MAX(\
> +		nb_ports * (nb_rxd + nb_txd + MAX_PKT_BURST +\
> +		nb_lcores * MEMPOOL_CACHE_SIZE), (unsigned int)8192)

Why not put this inplace where it is used, rather than keeping
the define? Also good practice with macros is to not have the
macro depend on variables that are in context at that point.

You also don't need a cast of (unsigned int)8192, use 8192u instead


More information about the dev mailing list