From patchwork Tue Oct 5 07:46:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Duszynski X-Patchwork-Id: 100488 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 AAB98A0C41; Tue, 5 Oct 2021 09:47:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3B02D412BA; Tue, 5 Oct 2021 09:47:10 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 24A67412B3 for ; Tue, 5 Oct 2021 09:47:07 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1954xBLN031485 for ; Tue, 5 Oct 2021 00:47:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=62n2wdf2mJXLYSFrkali18Olg+vVmDhnpEtvVK5AC18=; b=b22pb/sDDvuMzhK07S7XmHDW1SZwfMHgGJ0YMSDildg0nielao26Ri5QWVUij5itnNwV nX7YcIM428Jg+JDlnnL0MnEWEi0wtUAXrq/wLZRohi4vwBgZ4pkbeNu/zVh5glScBOe5 8VFZpuQHeQS57l9nYT03KLM+JKh80D9luodJsePgs0FcMvLgVB2ht+j1WFUeNOLpgDxa 3ok2axvPNxkIX5QfAtL2KK4IhHGy4Fp3Uvh/pr+/Z/UmpgQeXmDLe+FI7ijni7vAPgX6 /09DmY4CqoPv3K3fQouCS6yYPd1N/Yd+vnanZUJcbGwIN747bFYQwRgaBjlGs2cm+yqp Zg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3bgg5k8e03-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 05 Oct 2021 00:47:07 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 5 Oct 2021 00:47:05 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 5 Oct 2021 00:47:05 -0700 Received: from localhost.localdomain (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id 55D413F7077; Tue, 5 Oct 2021 00:47:03 -0700 (PDT) From: Tomasz Duszynski To: CC: , Tomasz Duszynski , "Nithin Dabilpuram" , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Jakub Palider Date: Tue, 5 Oct 2021 09:46:20 +0200 Message-ID: <20211005074620.2224968-1-tduszynski@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-GUID: remJeeKtpiY6mx8cH1yrXPtkDRWHbIHf X-Proofpoint-ORIG-GUID: remJeeKtpiY6mx8cH1yrXPtkDRWHbIHf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-10-04_05,2021-10-04_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH] common/cnxk: support BPHY telemetry 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 initial support for baseband telemetry. Signed-off-by: Tomasz Duszynski --- drivers/common/cnxk/cnxk_telemetry_bphy.c | 43 +++++++++++++++++++++++ drivers/common/cnxk/meson.build | 7 +++- drivers/raw/cnxk_bphy/cnxk_bphy.c | 11 ++++++ drivers/raw/cnxk_bphy/cnxk_bphy_irq.h | 1 + 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 drivers/common/cnxk/cnxk_telemetry_bphy.c diff --git a/drivers/common/cnxk/cnxk_telemetry_bphy.c b/drivers/common/cnxk/cnxk_telemetry_bphy.c new file mode 100644 index 0000000000..d60729c437 --- /dev/null +++ b/drivers/common/cnxk/cnxk_telemetry_bphy.c @@ -0,0 +1,43 @@ + +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2021 Marvell. + */ + +#include + +#include + +#include "roc_api.h" +#include "roc_priv.h" + +static int +cnxk_tel_bphy(struct rte_tel_data *d) +{ + struct idev_cfg *idev; + + idev = idev_get_cfg(); + if (!idev || !idev->bphy) + return -ENODEV; + + rte_tel_data_add_dict_int(d, "sso_pf_func", roc_bphy_sso_pf_func_get()); + rte_tel_data_add_dict_int(d, "npa_pf_func", roc_bphy_npa_pf_func_get()); + + return 0; +} + +static int +cnxk_bphy_tel_handle_info(const char *cmd __rte_unused, + const char *params __rte_unused, + struct rte_tel_data *d) +{ + rte_tel_data_start_dict(d); + + return cnxk_tel_bphy(d); +} + +RTE_INIT(cnxk_telemetry_bphy_init) +{ + rte_telemetry_register_cmd( + "/cnxk/bphy/info", cnxk_bphy_tel_handle_info, + "Returns bphy information. Takes no parameters"); +} diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build index 258429d54b..dd52f50dcd 100644 --- a/drivers/common/cnxk/meson.build +++ b/drivers/common/cnxk/meson.build @@ -9,7 +9,7 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64') endif config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' -deps = ['eal', 'pci', 'bus_pci', 'mbuf', 'security'] +deps = ['eal', 'pci', 'bus_pci', 'mbuf', 'security', 'telemetry'] sources = files( 'roc_ae.c', 'roc_ae_fpm_tables.c', @@ -61,6 +61,11 @@ sources = files( # Security common code sources += files('cnxk_security.c') +# Telemetry common code +sources += files( + 'cnxk_telemetry_bphy.c', +) + # common DPDK utilities code sources += files('cnxk_utils.c') diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c index 6bfda71761..558ebfa85e 100644 --- a/drivers/raw/cnxk_bphy/cnxk_bphy.c +++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c @@ -341,6 +341,13 @@ bphy_rawdev_probe(struct rte_pci_driver *pci_drv, bphy_dev = (struct bphy_device *)bphy_rawdev->dev_private; bphy_dev->mem.res0 = pci_dev->mem_resource[0]; bphy_dev->mem.res2 = pci_dev->mem_resource[2]; + bphy_dev->bphy.pci_dev = pci_dev; + + ret = roc_bphy_dev_init(&bphy_dev->bphy); + if (ret) { + rte_rawdev_pmd_release(bphy_rawdev); + return ret; + } return 0; } @@ -349,6 +356,7 @@ static int bphy_rawdev_remove(struct rte_pci_device *pci_dev) { char name[RTE_RAWDEV_NAME_MAX_LEN]; + struct bphy_device *bphy_dev; struct rte_rawdev *rawdev; if (rte_eal_process_type() != RTE_PROC_PRIMARY) @@ -366,6 +374,9 @@ bphy_rawdev_remove(struct rte_pci_device *pci_dev) return -EINVAL; } + bphy_dev = (struct bphy_device *)rawdev->dev_private; + roc_bphy_dev_fini(&bphy_dev->bphy); + return rte_rawdev_pmd_release(rawdev); } diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.h b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.h index f141677e2a..63d7285055 100644 --- a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.h +++ b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.h @@ -24,6 +24,7 @@ struct bphy_irq_queue { struct bphy_device { #define BPHY_QUEUE_CNT 1 + struct roc_bphy bphy; struct roc_bphy_irq_chip *irq_chip; struct bphy_mem mem; /* bphy irq interface supports single queue only */