[dpdk-dev] [PATCH] examples/ip_reassembly: use pktmbuf to create pool

Ananyev, Konstantin konstantin.ananyev at intel.com
Thu Oct 12 12:38:38 CEST 2017



> -----Original Message-----
> From: Hemant Agrawal [mailto:hemant.agrawal at nxp.com]
> Sent: Wednesday, September 6, 2017 10:34 AM
> To: dev at dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev at intel.com>; ashish.jain at nxp.com
> Subject: [PATCH] examples/ip_reassembly: use pktmbuf to create pool
> 
> From: Ashish Jain <ashish.jain at nxp.com>
> 
> Use 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 else
> it may not work on implementation using the HW buffer pool
> 
> Signed-off-by: Ashish Jain <ashish.jain at nxp.com>
> ---
>  examples/ip_reassembly/main.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
> index e62636c..20caeb3 100644
> --- a/examples/ip_reassembly/main.c
> +++ b/examples/ip_reassembly/main.c
> @@ -84,8 +84,7 @@
>  #define MAX_JUMBO_PKT_LEN  9600
> 
>  #define	BUF_SIZE	RTE_MBUF_DEFAULT_DATAROOM
> -#define MBUF_SIZE	\
> -	(BUF_SIZE + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
> +#define	MBUF_DATA_SIZE	RTE_MBUF_DEFAULT_BUF_SIZE
> 
>  #define NB_MBUF 8192
> 
> @@ -909,11 +908,11 @@ setup_queue_tbl(struct rx_queue *rxq, uint32_t lcore, uint32_t queue)
> 
>  	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, 0,
> +			MBUF_DATA_SIZE, socket);

As we can't pass SC|SP anymore can we then setup mempool cache size to some non-zero value?
Konstantin

> +	if (rxq->pool == NULL) {
> +		RTE_LOG(ERR, IP_RSMBL,
> +			"rte_pktmbuf_pool_create(%s) failed", buf);
>  		return -1;
>  	}
> 
> --
> 2.7.4



More information about the dev mailing list