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 2662B45AE7; Tue, 8 Oct 2024 20:50:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 72ABE40E3E; Tue, 8 Oct 2024 20:49:49 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id E5E2F40E72 for ; Tue, 8 Oct 2024 20:49:45 +0200 (CEST) Received: from pps.filterd (m0431383.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 498D0HaB019789; Tue, 8 Oct 2024 11:49:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=Y Au5VoZOIOpv+CiSCWK50guqoftBhaAEKXOy2sB/Ed8=; b=Py1XY6m59bNaEiXJd Xj8F2A5ZiHgfVGP9flBeumd5ggHRD/NYxUMwiSmilb3C2go8oPk7lFzwMEFhaq8v ZJBs1YDcymj/n87oLhKXWkfPoqOZjqi7+0B11xng385MAWuMUmz/YdgA6qvZ2KoC +kEsKy6lxU5VKemvGOf05KWYrRTWnrscJWoEx/VeG0uzNDyEzHEZzciOjoLD0NJG a0uoreMgqjy67yc9+lOGPwFBstYP7VdtRbIFpEdd9tKhwjChUjQylUqBEN0+bNYv Cz7PExaH+FNc8iMZkegg8QN4w0mRTDc2L1woFWRBILYK7tdmgvm9dr+DoPldc8lK ZABYA== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 42557x8upe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Oct 2024 11:49:45 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 8 Oct 2024 11:49:44 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 8 Oct 2024 11:49:44 -0700 Received: from localhost.localdomain (unknown [10.28.36.102]) by maili.marvell.com (Postfix) with ESMTP id 168C93F7043; Tue, 8 Oct 2024 11:49:41 -0700 (PDT) From: Akhil Goyal To: CC: , , , , , "Akhil Goyal" Subject: [PATCH v3 9/9] raw/cnxk_rvu_lf: add PMD API to get device pffunc Date: Wed, 9 Oct 2024 00:19:15 +0530 Message-ID: <20241008184915.1356089-10-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241008184915.1356089-1-gakhil@marvell.com> References: <20241008105415.1026962-1-gakhil@marvell.com> <20241008184915.1356089-1-gakhil@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 0XsDX5mR6VSIgb7Ds2gizqEthnlAddvN X-Proofpoint-ORIG-GUID: 0XsDX5mR6VSIgb7Ds2gizqEthnlAddvN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.687,Hydra:6.0.235,FMLib:17.0.607.475 definitions=2020-10-13_15,2020-10-13_02,2020-04-07_01 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 Added ``rte_pmd_rvu_lf_pf_func_get`` API to get RVU LF device pffunc for the application use. Signed-off-by: Akhil Goyal --- drivers/common/cnxk/roc_rvu_lf.c | 2 +- drivers/common/cnxk/roc_rvu_lf.h | 2 ++ drivers/common/cnxk/version.map | 1 + drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c | 19 +++++++++++++++++++ drivers/raw/cnxk_rvu_lf/rte_pmd_cnxk_rvu_lf.h | 12 ++++++++++++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/common/cnxk/roc_rvu_lf.c b/drivers/common/cnxk/roc_rvu_lf.c index 471dfa7a46..862a201135 100644 --- a/drivers/common/cnxk/roc_rvu_lf.c +++ b/drivers/common/cnxk/roc_rvu_lf.c @@ -62,7 +62,7 @@ roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf) return dev_fini(&rvu->dev, rvu->pci_dev); } -static uint16_t +uint16_t roc_rvu_lf_pf_func_get(struct roc_rvu_lf *roc_rvu_lf) { struct rvu_lf *rvu = roc_rvu_lf_to_rvu_priv(roc_rvu_lf); diff --git a/drivers/common/cnxk/roc_rvu_lf.h b/drivers/common/cnxk/roc_rvu_lf.h index 6b4819666a..8c71876cbc 100644 --- a/drivers/common/cnxk/roc_rvu_lf.h +++ b/drivers/common/cnxk/roc_rvu_lf.h @@ -21,6 +21,8 @@ TAILQ_HEAD(roc_rvu_lf_head, roc_rvu_lf); int __roc_api roc_rvu_lf_dev_init(struct roc_rvu_lf *roc_rvu_lf); int __roc_api roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf); +uint16_t __roc_api roc_rvu_lf_pf_func_get(struct roc_rvu_lf *roc_rvu_lf); + int __roc_api roc_rvu_lf_msg_process(struct roc_rvu_lf *roc_rvu_lf, uint16_t vf, uint16_t msg_id, void *req_data, uint16_t req_len, diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index cd177a7920..980b770d9b 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -557,6 +557,7 @@ INTERNAL { roc_rvu_lf_msg_id_range_check; roc_rvu_lf_msg_id_range_set; roc_rvu_lf_msg_process; + roc_rvu_lf_pf_func_get; local: *; }; diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c index 209af006f3..5262b45569 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c @@ -73,6 +73,10 @@ rvu_lf_rawdev_selftest(uint16_t dev_id) if (pf_func == 0) CNXK_RVU_LF_LOG(WARNING, "SSO pf_func is invalid"); + pf_func = rte_pmd_rvu_lf_pf_func_get(dev_id); + if (pf_func == 0) + CNXK_RVU_LF_LOG(WARNING, "RVU LF pf_func is invalid"); + ret = rte_pmd_rvu_lf_msg_id_range_set(dev_id, MSG_ID_FROM, MSG_ID_TO); if (ret) { CNXK_RVU_LF_LOG(ERR, "RVU message ID range invalid"); @@ -273,6 +277,21 @@ rte_pmd_rvu_lf_sso_pf_func_get(void) return roc_sso_pf_func_get(); } +uint16_t +rte_pmd_rvu_lf_pf_func_get(uint8_t dev_id) +{ + struct roc_rvu_lf *roc_rvu_lf; + struct rte_rawdev *rawdev; + + rawdev = rte_rawdev_pmd_get_dev(dev_id); + if (rawdev == NULL) + return 0; + + roc_rvu_lf = (struct roc_rvu_lf *)rawdev->dev_private; + + return roc_rvu_lf_pf_func_get(roc_rvu_lf); +} + static const struct rte_rawdev_ops rvu_lf_rawdev_ops = { .dev_selftest = rvu_lf_rawdev_selftest, }; diff --git a/drivers/raw/cnxk_rvu_lf/rte_pmd_cnxk_rvu_lf.h b/drivers/raw/cnxk_rvu_lf/rte_pmd_cnxk_rvu_lf.h index b79bd8ba8e..5d167c55a0 100644 --- a/drivers/raw/cnxk_rvu_lf/rte_pmd_cnxk_rvu_lf.h +++ b/drivers/raw/cnxk_rvu_lf/rte_pmd_cnxk_rvu_lf.h @@ -44,6 +44,18 @@ uint16_t rte_pmd_rvu_lf_npa_pf_func_get(void); __rte_experimental uint16_t rte_pmd_rvu_lf_sso_pf_func_get(void); +/** + * Obtain RVU LF device PF func + * + * @param dev_id + * device id of RVU LF device + * + * @return + * Returns RVU LF pf_func on success, 0 in case of invalid pf_func. + */ +__rte_experimental +uint16_t rte_pmd_rvu_lf_pf_func_get(uint8_t dev_id); + /** * Get BAR addresses for the RVU LF device. * -- 2.25.1