From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A847AA04A5; Mon, 27 Dec 2021 17:17:33 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9A4B41168; Mon, 27 Dec 2021 17:17:01 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id B13FA4113E for ; Mon, 27 Dec 2021 17:16:51 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 82CDE1A1B81; Mon, 27 Dec 2021 17:16:51 +0100 (CET) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 2270D1A1539; Mon, 27 Dec 2021 17:16:51 +0100 (CET) Received: from lsv03274.swis.in-blr01.nxp.com (lsv03274.swis.in-blr01.nxp.com [92.120.147.114]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 8B377183ACDE; Tue, 28 Dec 2021 00:16:50 +0800 (+08) From: nipun.gupta@nxp.com To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@intel.com, hemant.agrawal@nxp.com, Jun Yang Subject: [PATCH v2 08/16] net/dpaa2: secondary process handling for dpni Date: Mon, 27 Dec 2021 21:46:37 +0530 Message-Id: <20211227161645.24359-9-nipun.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211227161645.24359-1-nipun.gupta@nxp.com> References: <20211206121824.3493-1-nipun.gupta@nxp.com> <20211227161645.24359-1-nipun.gupta@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Jun Yang This change uses 'dev->process_private' instead of 'priv->hw' to get dpmcp per process while setting flow distribution, as priv->hw is only valid for primary process. It also initialize rte_dpaa2_bpid_info in secondary process. Signed-off-by: Jun Yang --- drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 23 +++++++++++++++++++++++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 15 +++++++++++++++ drivers/mempool/dpaa2/version.map | 1 + drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 5 ++--- drivers/net/dpaa2/dpaa2_ethdev.c | 10 ++++++++-- drivers/net/dpaa2/dpaa2_ethdev.h | 3 ++- 6 files changed, 51 insertions(+), 6 deletions(-) diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 39c6252a63..56c629c681 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -263,6 +263,29 @@ rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused, } } +int rte_dpaa2_bpid_info_init(struct rte_mempool *mp) +{ + struct dpaa2_bp_info *bp_info = mempool_to_bpinfo(mp); + uint32_t bpid = bp_info->bpid; + + if (!rte_dpaa2_bpid_info) { + rte_dpaa2_bpid_info = (struct dpaa2_bp_info *)rte_malloc(NULL, + sizeof(struct dpaa2_bp_info) * MAX_BPID, + RTE_CACHE_LINE_SIZE); + if (rte_dpaa2_bpid_info == NULL) + return -ENOMEM; + memset(rte_dpaa2_bpid_info, 0, + sizeof(struct dpaa2_bp_info) * MAX_BPID); + } + + rte_dpaa2_bpid_info[bpid].meta_data_size = sizeof(struct rte_mbuf) + + rte_pktmbuf_priv_size(mp); + rte_dpaa2_bpid_info[bpid].bp_list = bp_info->bp_list; + rte_dpaa2_bpid_info[bpid].bpid = bpid; + + return 0; +} + uint16_t rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp) { diff --git a/drivers/mempool/dpaa2/rte_dpaa2_mempool.h b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h index 4a22b7c42e..28dea74326 100644 --- a/drivers/mempool/dpaa2/rte_dpaa2_mempool.h +++ b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h @@ -46,6 +46,21 @@ rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp); struct rte_mbuf * rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr); +/** + * Initialize the rte_dpaa2_bpid_info + * In generial, it is called in the secondary process and + * mp has been created in the primary process. + * + * @param mp + * memory pool + * + * @return + * - 0 on success. + * - (<0) on failure. + */ +__rte_internal +int rte_dpaa2_bpid_info_init(struct rte_mempool *mp); + #ifdef __cplusplus } #endif diff --git a/drivers/mempool/dpaa2/version.map b/drivers/mempool/dpaa2/version.map index 49c460ec54..cfd4ae617a 100644 --- a/drivers/mempool/dpaa2/version.map +++ b/drivers/mempool/dpaa2/version.map @@ -11,5 +11,6 @@ INTERNAL { global: rte_dpaa2_bpid_info; + rte_dpaa2_bpid_info_init; rte_dpaa2_mbuf_alloc_bulk; }; diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index 3170694841..9509f6e8a3 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -95,7 +95,7 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev, uint64_t req_dist_set, int tc_index) { struct dpaa2_dev_priv *priv = eth_dev->data->dev_private; - struct fsl_mc_io *dpni = priv->hw; + struct fsl_mc_io *dpni = eth_dev->process_private; struct dpni_rx_dist_cfg tc_cfg; struct dpkg_profile_cfg kg_cfg; void *p_params; @@ -457,13 +457,12 @@ dpaa2_distset_to_dpkg_profile_cfg( int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, - void *blist) + struct fsl_mc_io *dpni, void *blist) { /* Function to attach a DPNI with a buffer pool list. Buffer pool list * handle is passed in blist. */ int32_t retcode; - struct fsl_mc_io *dpni = priv->hw; struct dpni_pools_cfg bpool_cfg; struct dpaa2_bp_list *bp_list = (struct dpaa2_bp_list *)blist; struct dpni_buffer_layout layout; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index b91e773605..a45beed75f 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -18,6 +18,7 @@ #include #include #include +#include "rte_dpaa2_mempool.h" #include "dpaa2_pmd_logs.h" #include @@ -712,9 +713,14 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev, } if (!priv->bp_list || priv->bp_list->mp != mb_pool) { + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + ret = rte_dpaa2_bpid_info_init(mb_pool); + if (ret) + return ret; + } bpid = mempool_to_bpid(mb_pool); - ret = dpaa2_attach_bp_list(priv, - rte_dpaa2_bpid_info[bpid].bp_list); + ret = dpaa2_attach_bp_list(priv, dpni, + rte_dpaa2_bpid_info[bpid].bp_list); if (ret) return ret; } diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index 1fc2fc367e..bd33a22a8e 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -208,7 +208,8 @@ int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev, int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev, uint8_t tc_index); -int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist); +int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, + struct fsl_mc_io *dpni, void *blist); __rte_internal int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev, -- 2.17.1