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 394FCA0C40; Fri, 25 Jun 2021 07:37:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 036CC410D7; Fri, 25 Jun 2021 07:37:32 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 5175140E46 for ; Fri, 25 Jun 2021 07:37:30 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15P5ZvfQ016396; Thu, 24 Jun 2021 22:37:29 -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=Iaj73as4PcRwUJ8E3uAI2S8kPkhsC7vvqCZRbctfp/g=; b=jbtk/zeRftxthFmWVBh7ijbMl5aErMzNZiQ0Cp+c2csWErIVT9RCw8K2eO0Yc3bSBiND qs331vkuWIuB1d/wn6gijC9seB6+wFe3bs+tGoY2YkF+z/jSXTtBX1fp3aapAPBVSWq1 cS6ERYkR9X3rCHwIQggYSCQsa5LgJKzJGUxKkxJuHRPr0CZn2k2nlVJVocEV3ZFxAfgh uutlZgDvL3NOH3B2rGRpA7gSm9IuqYYMkVkKyVpSloAAe7AleX+vbK6lFnIb2ddyUx9p 57NnA+P7ru0yumsEawarmfYlwhYh52KcZnQhZxVDR2EgYwiTRWpAx87ByGUIO9sEuIEl 4A== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com with ESMTP id 39d241sg48-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 24 Jun 2021 22:37:29 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 24 Jun 2021 22:37:27 -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.18 via Frontend Transport; Thu, 24 Jun 2021 22:37:27 -0700 Received: from HY-LT1002.marvell.com (HY-LT1002.marvell.com [10.28.176.218]) by maili.marvell.com (Postfix) with ESMTP id 78D4A3F7041; Thu, 24 Jun 2021 22:37:24 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Thomas Monjalon CC: Anoob Joseph , Jerin Jacob , "Ankur Dwivedi" , Tejasree Kondoj , Date: Fri, 25 Jun 2021 11:06:36 +0530 Message-ID: <1624599410-29689-5-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1624599410-29689-1-git-send-email-anoobj@marvell.com> References: <1624599410-29689-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: CmEfaOIvtDzaS-JVRR1UQnDZLp2dwqhC X-Proofpoint-ORIG-GUID: CmEfaOIvtDzaS-JVRR1UQnDZLp2dwqhC X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-25_01:2021-06-24, 2021-06-25 signatures=0 Subject: [dpdk-dev] [PATCH v2 04/17] common/cnxk: add idev CPT set - get 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 Sender: "dev" Add APIs to set & get CPT device. Signed-off-by: Anoob Joseph --- drivers/common/cnxk/roc_cpt.c | 8 ++++++++ drivers/common/cnxk/roc_idev.c | 21 +++++++++++++++++++++ drivers/common/cnxk/roc_idev.h | 3 +++ drivers/common/cnxk/roc_idev_priv.h | 2 ++ drivers/common/cnxk/version.map | 2 ++ 5 files changed, 36 insertions(+) diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c index 2376125..d891a3b 100644 --- a/drivers/common/cnxk/roc_cpt.c +++ b/drivers/common/cnxk/roc_cpt.c @@ -230,6 +230,10 @@ roc_cpt_dev_init(struct roc_cpt *roc_cpt) dev->roc_cpt = roc_cpt; + /* Set it to idev if not already present */ + if (!roc_idev_cpt_get()) + roc_idev_cpt_set(roc_cpt); + return 0; fail: @@ -244,6 +248,10 @@ roc_cpt_dev_fini(struct roc_cpt *roc_cpt) if (cpt == NULL) return -EINVAL; + /* Remove idev references */ + if (roc_idev_cpt_get() == roc_cpt) + roc_idev_cpt_set(NULL); + roc_cpt->nb_lf_avail = 0; roc_cpt->lmt_base = 0; diff --git a/drivers/common/cnxk/roc_idev.c b/drivers/common/cnxk/roc_idev.c index 63cc040..b40ae82 100644 --- a/drivers/common/cnxk/roc_idev.c +++ b/drivers/common/cnxk/roc_idev.c @@ -36,6 +36,7 @@ idev_set_defaults(struct idev_cfg *idev) idev->lmt_pf_func = 0; idev->lmt_base_addr = 0; idev->num_lmtlines = 0; + idev->cpt = NULL; __atomic_store_n(&idev->npa_refcnt, 0, __ATOMIC_RELEASE); } @@ -170,6 +171,26 @@ roc_idev_num_lmtlines_get(void) return num_lmtlines; } +struct roc_cpt * +roc_idev_cpt_get(void) +{ + struct idev_cfg *idev = idev_get_cfg(); + + if (idev != NULL) + return idev->cpt; + + return NULL; +} + +void +roc_idev_cpt_set(struct roc_cpt *cpt) +{ + struct idev_cfg *idev = idev_get_cfg(); + + if (idev != NULL) + __atomic_store_n(&idev->cpt, cpt, __ATOMIC_RELEASE); +} + struct roc_nix * roc_idev_npa_nix_get(void) { diff --git a/drivers/common/cnxk/roc_idev.h b/drivers/common/cnxk/roc_idev.h index 043e8af..16793c2 100644 --- a/drivers/common/cnxk/roc_idev.h +++ b/drivers/common/cnxk/roc_idev.h @@ -12,6 +12,9 @@ void __roc_api roc_idev_npa_maxpools_set(uint32_t max_pools); uint64_t __roc_api roc_idev_lmt_base_addr_get(void); uint16_t __roc_api roc_idev_num_lmtlines_get(void); +struct roc_cpt *__roc_api roc_idev_cpt_get(void); +void __roc_api roc_idev_cpt_set(struct roc_cpt *cpt); + struct roc_nix *__roc_api roc_idev_npa_nix_get(void); #endif /* _ROC_IDEV_H_ */ diff --git a/drivers/common/cnxk/roc_idev_priv.h b/drivers/common/cnxk/roc_idev_priv.h index ff10a90..95b2389 100644 --- a/drivers/common/cnxk/roc_idev_priv.h +++ b/drivers/common/cnxk/roc_idev_priv.h @@ -7,6 +7,7 @@ /* Intra device related functions */ struct npa_lf; +struct roc_cpt; struct idev_cfg { uint16_t sso_pf_func; uint16_t npa_pf_func; @@ -16,6 +17,7 @@ struct idev_cfg { uint16_t lmt_pf_func; uint16_t num_lmtlines; uint64_t lmt_base_addr; + struct roc_cpt *cpt; }; /* Generic */ diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index f8e286e..f36127c 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -17,6 +17,8 @@ INTERNAL { roc_cpt_dev_init; roc_cpt_eng_grp_add; roc_error_msg_get; + roc_idev_cpt_get; + roc_idev_cpt_set; roc_idev_lmt_base_addr_get; roc_idev_npa_maxpools_get; roc_idev_npa_maxpools_set; -- 2.7.4