[dpdk-dev] [PATCH v2] mbuf: use pktmbuf helper to create the pool

Olivier Matz olivier.matz at 6wind.com
Tue Jan 31 10:55:35 CET 2017


Hi Hemant,

Sorry for the delay.

On Fri, 20 Jan 2017 12:41:20 +0530, Hemant Agrawal
<hemant.agrawal at nxp.com> wrote:
> When possible, replace the uses of rte_mempool_create() with
> the helper provided in librte_mbuf: rte_pktmbuf_pool_create().
> 
> This is the preferred way to create a mbuf pool.
> 
> This also updates the documentation.
> 
> Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal at nxp.com>
> 
> [...]
> 
> --- a/examples/ip_reassembly/main.c
> @@ -909,11 +908,13 @@ struct rte_lpm6_config lpm6_config = {
>  
>  	snprintf(buf, sizeof(buf), "mbuf_pool_%u_%u", lcore, queue);
>  
> -	if ((rxq->pool = rte_mempool_create(buf, nb_mbuf, MBUF_SIZE,
> 0,
> -			sizeof(struct rte_pktmbuf_pool_private),
> -			rte_pktmbuf_pool_init, NULL,
> rte_pktmbuf_init, NULL,
> -			socket, MEMPOOL_F_SP_PUT |
> MEMPOOL_F_SC_GET)) == NULL) { 
> -		RTE_LOG(ERR, IP_RSMBL, "mempool_create(%s) failed",
> buf);
> +	rxq->pool = rte_pktmbuf_pool_create(buf, nb_mbuf,
> +		0, /* cache size */
> +		0, /* priv size */
> +		MBUF_DATA_SIZE, socket);
> +	if (rxq->pool == NULL) {
> +		RTE_LOG(ERR, IP_RSMBL,
> +			"rte_pktmbuf_pool_create(%s) failed", buf);
>  		return -1;

Here we loose the SP/SC flags. In the ip reassembly example, it looks
there is one mbuf pool per rx core since the beginning (commit
cc8f4d020). It's probably not critical, but I think we should remove
the ip reass part of the patch, what do you think?

Note that this issue was also in my RFC patch, so it's my
mistake :)


Apart from that, the patch looks good.

Thanks
Olivier


More information about the dev mailing list