From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hemant Agrawal Subject: [PATCH v2] examples/ip_reassembly: use pktmbuf to create pool Date: Thu, 12 Oct 2017 18:55:17 +0530 Message-ID: <1507814717-13306-1-git-send-email-hemant.agrawal@nxp.com> References: <1504690460-30616-1-git-send-email-hemant.agrawal@nxp.com> Mime-Version: 1.0 Content-Type: text/plain To: , Return-path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0064.outbound.protection.outlook.com [104.47.33.64]) by dpdk.org (Postfix) with ESMTP id 0F1711B28A for ; Thu, 12 Oct 2017 15:25:56 +0200 (CEST) In-Reply-To: <1504690460-30616-1-git-send-email-hemant.agrawal@nxp.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Ashish Jain 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 --- v2: add mempool caches - as suggested by Konstantin examples/ip_reassembly/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index cadf4c5..2f662ba 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -84,10 +84,10 @@ #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 +#define MEMPOOL_CACHE_SIZE 256 /* allow max jumbo frame 9.5 KB */ #define JUMBO_FRAME_MAX_SIZE 0x2600 @@ -909,11 +909,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, MEMPOOL_CACHE_SIZE, 0, + MBUF_DATA_SIZE, socket); + if (rxq->pool == NULL) { + RTE_LOG(ERR, IP_RSMBL, + "rte_pktmbuf_pool_create(%s) failed", buf); return -1; } -- 2.7.4