From: Tomasz Duszynski <tduszynski@marvell.com>
To: <dev@dpdk.org>
Cc: <jerinj@marvell.com>, Tomasz Duszynski <tduszynski@marvell.com>,
"Nithin Dabilpuram" <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>,
Jakub Palider <jpalider@marvell.com>
Subject: [dpdk-dev] [PATCH] common/cnxk: support BPHY telemetry
Date: Tue, 5 Oct 2021 09:46:20 +0200 [thread overview]
Message-ID: <20211005074620.2224968-1-tduszynski@marvell.com> (raw)
Add initial support for baseband telemetry.
Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
---
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 <unistd.h>
+
+#include <rte_telemetry.h>
+
+#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 */
--
2.25.1
next reply other threads:[~2021-10-05 7:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-05 7:46 Tomasz Duszynski [this message]
2021-10-19 12:30 ` [dpdk-dev] [EXT] " Harman Kalra
2021-10-22 11:56 ` [dpdk-dev] [PATCH v2] " Tomasz Duszynski
2021-10-29 16:03 ` Jerin Jacob
2021-11-01 14:38 ` Ferruh Yigit
2021-11-02 4:32 ` Jerin Jacob
2021-11-02 10:28 ` Ferruh Yigit
2021-11-02 11:11 ` Jerin Jacob
2021-11-02 11:21 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211005074620.2224968-1-tduszynski@marvell.com \
--to=tduszynski@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=jpalider@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).