From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id E0E6AA046B for ; Tue, 25 Jun 2019 12:42:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9882B1B9E6; Tue, 25 Jun 2019 12:42:09 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 59BA8559A for ; Tue, 25 Jun 2019 12:42:04 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E38F11A07AF; Tue, 25 Jun 2019 12:42:03 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 477A01A07B6; Tue, 25 Jun 2019 12:42:02 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id C235E402FB; Tue, 25 Jun 2019 18:41:59 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Tue, 25 Jun 2019 16:10:18 +0530 Message-Id: <20190625104019.19287-2-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190625104019.19287-1-hemant.agrawal@nxp.com> References: <20190625104019.19287-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 2/3] bus/dpaa: update dpaa mempool for secondary process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 1. need to use the bpool with rte_malloc instead of rte_free 2. Option to give portal to the seondary process thread. Signed-off-by: Radu Bulie Signed-off-by: Hemant Agrawal Tested-by: Akhil Goyal --- drivers/bus/dpaa/include/compat.h | 10 ++++++---- drivers/mempool/dpaa/dpaa_mempool.c | 11 ++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h index 86cecf67b..277ce6369 100644 --- a/drivers/bus/dpaa/include/compat.h +++ b/drivers/bus/dpaa/include/compat.h @@ -2,6 +2,7 @@ * * Copyright 2011 Freescale Semiconductor, Inc. * All rights reserved. + * Copyright 2019 NXP * */ @@ -40,6 +41,7 @@ #include #include #include +#include /* The following definitions are primarily to allow the single-source driver * interfaces to be included by arbitrary program code. Ie. for interfaces that @@ -339,12 +341,12 @@ static inline void copy_bytes(void *dest, const void *src, size_t sz) #endif /* Allocator stuff */ -#define kmalloc(sz, t) malloc(sz) -#define vmalloc(sz) malloc(sz) -#define kfree(p) { if (p) free(p); } +#define kmalloc(sz, t) rte_malloc(NULL, sz, 0) +#define vmalloc(sz) rte_malloc(NULL, sz, 0) +#define kfree(p) { if (p) rte_free(p); } static inline void *kzalloc(size_t sz, gfp_t __foo __rte_unused) { - void *ptr = malloc(sz); + void *ptr = rte_malloc(NULL, sz, 0); if (ptr) memset(ptr, 0, sz); diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c index 003081772..3551e6d10 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.c +++ b/drivers/mempool/dpaa/dpaa_mempool.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * - * Copyright 2017 NXP + * Copyright 2017,2019 NXP * */ @@ -51,6 +51,15 @@ dpaa_mbuf_create_pool(struct rte_mempool *mp) MEMPOOL_INIT_FUNC_TRACE(); + if (unlikely(!RTE_PER_LCORE(dpaa_io))) { + ret = rte_dpaa_portal_init((void *)0); + if (ret) { + DPAA_MEMPOOL_ERR( + "rte_dpaa_portal_init failed with ret: %d", + ret); + return -1; + } + } bp = bman_new_pool(¶ms); if (!bp) { DPAA_MEMPOOL_ERR("bman_new_pool() failed"); -- 2.17.1