From patchwork Wed May 24 10:04:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127311 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D6BB42B8C; Wed, 24 May 2023 12:07:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C889842FBA; Wed, 24 May 2023 12:05:31 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D7B7542FBA for ; Wed, 24 May 2023 12:05:30 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34O4qPOO025150 for ; Wed, 24 May 2023 03:05:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=FPvW2ZCf8hMabLK14AvQKjf76l7c1JJ/ZzmnBFoHcu4=; b=HJEpMP80P2VTOCCMg2iK33QJN8uWpXxYHd8/eorPCtLKQlj0+UlLGIAKsoGCjXXSPmXH J2WXw7gtRtI10K5F9n9i8c4seE8afSP4oO396sb26J4p34T597iE8zj+4YvlS7FSNAFN xhk52z2qxJLZLRWCwlrKzqJerbC75nhFPN4cxu7jZenEVsgcTggvDmrCNrzB1dl7uqNp mW2QPTUCXY6dd61rHtOFGnyBfmnokxBf02Og5kH0ZQBuAFWul/aZgkgf8v/bTWsZ6XOe M09zZZ8vWhajkOXeR6HakZ6eQ/o3ewk7GISbQ7u85/6t1lOYsa71WW2w7R3p/BfsDeeb dg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qsbxes2wk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 24 May 2023 03:05:29 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 24 May 2023 03:05:28 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 24 May 2023 03:05:28 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 31BE73F7043; Wed, 24 May 2023 03:05:25 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH v2 25/32] common/cnxk: avoid inline dev CPT lf detach multiple times Date: Wed, 24 May 2023 15:34:00 +0530 Message-ID: <20230524100407.3796139-25-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230524100407.3796139-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230524100407.3796139-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: B2lAOy8tIlum8Htcsk77OM7hKqXm3kRU X-Proofpoint-GUID: B2lAOy8tIlum8Htcsk77OM7hKqXm3kRU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_05,2023-05-23_02,2023-05-22_02 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 CPT LF detach is done along with all other LF's of inline device. Hence remove it from nix_inl_cpt_release(). Also provide ROC API for setup and release of CPT LF separately. Signed-off-by: Nithin Dabilpuram --- drivers/common/cnxk/roc_nix_inl.h | 2 + drivers/common/cnxk/roc_nix_inl_dev.c | 59 ++++++++++++++++++++------- drivers/common/cnxk/version.map | 2 + 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/drivers/common/cnxk/roc_nix_inl.h b/drivers/common/cnxk/roc_nix_inl.h index 885d95335e..ab1e9c0f98 100644 --- a/drivers/common/cnxk/roc_nix_inl.h +++ b/drivers/common/cnxk/roc_nix_inl.h @@ -158,6 +158,8 @@ void __roc_api roc_nix_inl_dev_unlock(void); int __roc_api roc_nix_inl_dev_xaq_realloc(uint64_t aura_handle); int __roc_api roc_nix_inl_dev_stats_get(struct roc_nix_stats *stats); uint16_t __roc_api roc_nix_inl_dev_pffunc_get(void); +int __roc_api roc_nix_inl_dev_cpt_setup(bool use_inl_dev_sso); +int __roc_api roc_nix_inl_dev_cpt_release(void); /* NIX Inline Inbound API */ int __roc_api roc_nix_inl_inb_init(struct roc_nix *roc_nix); diff --git a/drivers/common/cnxk/roc_nix_inl_dev.c b/drivers/common/cnxk/roc_nix_inl_dev.c index ca948d3bc7..d76158e30d 100644 --- a/drivers/common/cnxk/roc_nix_inl_dev.c +++ b/drivers/common/cnxk/roc_nix_inl_dev.c @@ -172,7 +172,7 @@ nix_inl_nix_ipsec_cfg(struct nix_inl_dev *inl_dev, bool ena) } static int -nix_inl_cpt_setup(struct nix_inl_dev *inl_dev) +nix_inl_cpt_setup(struct nix_inl_dev *inl_dev, bool inl_dev_sso) { struct roc_cpt_lf *lf = &inl_dev->cpt_lf; struct dev *dev = &inl_dev->dev; @@ -186,7 +186,7 @@ nix_inl_cpt_setup(struct nix_inl_dev *inl_dev) eng_grpmask = (1ULL << ROC_CPT_DFLT_ENG_GRP_SE | 1ULL << ROC_CPT_DFLT_ENG_GRP_SE_IE | 1ULL << ROC_CPT_DFLT_ENG_GRP_AE); - rc = cpt_lfs_alloc(dev, eng_grpmask, RVU_BLOCK_ADDR_CPT0, false); + rc = cpt_lfs_alloc(dev, eng_grpmask, RVU_BLOCK_ADDR_CPT0, inl_dev_sso); if (rc) { plt_err("Failed to alloc CPT LF resources, rc=%d", rc); return rc; @@ -218,7 +218,7 @@ nix_inl_cpt_release(struct nix_inl_dev *inl_dev) { struct roc_cpt_lf *lf = &inl_dev->cpt_lf; struct dev *dev = &inl_dev->dev; - int rc, ret = 0; + int rc; if (!inl_dev->attach_cptlf) return 0; @@ -228,17 +228,11 @@ nix_inl_cpt_release(struct nix_inl_dev *inl_dev) /* Free LF resources */ rc = cpt_lfs_free(dev); - if (rc) + if (!rc) + lf->dev = NULL; + else plt_err("Failed to free CPT LF resources, rc=%d", rc); - ret |= rc; - - /* Detach LF */ - rc = cpt_lfs_detach(dev); - if (rc) - plt_err("Failed to detach CPT LF, rc=%d", rc); - ret |= rc; - - return ret; + return rc; } static int @@ -940,7 +934,7 @@ roc_nix_inl_dev_init(struct roc_nix_inl_dev *roc_inl_dev) goto nix_release; /* Setup CPT LF */ - rc = nix_inl_cpt_setup(inl_dev); + rc = nix_inl_cpt_setup(inl_dev, false); if (rc) goto sso_release; @@ -1035,8 +1029,11 @@ roc_nix_inl_dev_fini(struct roc_nix_inl_dev *roc_inl_dev) /* Flush Inbound CTX cache entries */ nix_inl_cpt_ctx_cache_sync(inl_dev); + /* Release CPT */ + rc = nix_inl_cpt_release(inl_dev); + /* Release SSO */ - rc = nix_inl_sso_release(inl_dev); + rc |= nix_inl_sso_release(inl_dev); /* Release NIX */ rc |= nix_inl_nix_release(inl_dev); @@ -1052,3 +1049,35 @@ roc_nix_inl_dev_fini(struct roc_nix_inl_dev *roc_inl_dev) idev->nix_inl_dev = NULL; return 0; } + +int +roc_nix_inl_dev_cpt_setup(bool use_inl_dev_sso) +{ + struct idev_cfg *idev = idev_get_cfg(); + struct nix_inl_dev *inl_dev = NULL; + + if (!idev || !idev->nix_inl_dev) + return -ENOENT; + inl_dev = idev->nix_inl_dev; + + if (inl_dev->cpt_lf.dev != NULL) + return -EBUSY; + + return nix_inl_cpt_setup(inl_dev, use_inl_dev_sso); +} + +int +roc_nix_inl_dev_cpt_release(void) +{ + struct idev_cfg *idev = idev_get_cfg(); + struct nix_inl_dev *inl_dev = NULL; + + if (!idev || !idev->nix_inl_dev) + return -ENOENT; + inl_dev = idev->nix_inl_dev; + + if (inl_dev->cpt_lf.dev == NULL) + return 0; + + return nix_inl_cpt_release(inl_dev); +} diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index c76564b46e..e1335e9068 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -174,6 +174,8 @@ INTERNAL { roc_nix_inl_cb_register; roc_nix_inl_cb_unregister; roc_nix_inl_ctx_write; + roc_nix_inl_dev_cpt_setup; + roc_nix_inl_dev_cpt_release; roc_nix_inl_dev_dump; roc_nix_inl_dev_fini; roc_nix_inl_dev_init;