DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] common/cnxk: support BPHY telemetry
@ 2021-10-05  7:46 Tomasz Duszynski
  2021-10-19 12:30 ` [dpdk-dev] [EXT] " Harman Kalra
  2021-10-22 11:56 ` [dpdk-dev] [PATCH v2] " Tomasz Duszynski
  0 siblings, 2 replies; 9+ messages in thread
From: Tomasz Duszynski @ 2021-10-05  7:46 UTC (permalink / raw)
  To: dev
  Cc: jerinj, Tomasz Duszynski, Nithin Dabilpuram, Kiran Kumar K,
	Sunil Kumar Kori, Satha Rao, Jakub Palider

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [EXT]  [PATCH] common/cnxk: support BPHY telemetry
  2021-10-05  7:46 [dpdk-dev] [PATCH] common/cnxk: support BPHY telemetry Tomasz Duszynski
@ 2021-10-19 12:30 ` Harman Kalra
  2021-10-22 11:56 ` [dpdk-dev] [PATCH v2] " Tomasz Duszynski
  1 sibling, 0 replies; 9+ messages in thread
From: Harman Kalra @ 2021-10-19 12:30 UTC (permalink / raw)
  To: Tomasz Duszynski, dev
  Cc: Jerin Jacob Kollanukkaran, Tomasz Duszynski,
	Nithin Kumar Dabilpuram, Kiran Kumar Kokkilagadda,
	Sunil Kumar Kori, Satha Koteswara Rao Kottidi, Jakub Palider

Hi Tomasz

Please find my comments inline

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Tomasz Duszynski
> Sent: Tuesday, October 5, 2021 1:16 PM
> To: dev@dpdk.org
> Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Tomasz Duszynski
> <tduszynski@marvell.com>; Nithin Kumar Dabilpuram
> <ndabilpuram@marvell.com>; Kiran Kumar Kokkilagadda
> <kirankumark@marvell.com>; Sunil Kumar Kori <skori@marvell.com>; Satha
> Koteswara Rao Kottidi <skoteshwar@marvell.com>; Jakub Palider
> <jpalider@marvell.com>
> Subject: [EXT] [dpdk-dev] [PATCH] common/cnxk: support BPHY telemetry
> 
> External Email
> 
> ----------------------------------------------------------------------
> 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)

I think this command should be enables only for platforms which have BPHY devices.
May be we should register this telemetry command after successful BPHY device probe.

Thanks
Harman

> +{
> +	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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH v2] common/cnxk: support BPHY telemetry
  2021-10-05  7:46 [dpdk-dev] [PATCH] common/cnxk: support BPHY telemetry Tomasz Duszynski
  2021-10-19 12:30 ` [dpdk-dev] [EXT] " Harman Kalra
@ 2021-10-22 11:56 ` Tomasz Duszynski
  2021-10-29 16:03   ` Jerin Jacob
  2021-11-01 14:38   ` Ferruh Yigit
  1 sibling, 2 replies; 9+ messages in thread
From: Tomasz Duszynski @ 2021-10-22 11:56 UTC (permalink / raw)
  To: dev
  Cc: jerinj, hkalra, Tomasz Duszynski, Nithin Dabilpuram,
	Kiran Kumar K, Sunil Kumar Kori, Satha Rao, Jakub Palider

Add initial support for baseband telemetry.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
---
v2:
- make bphy telemetry available only on platforms supporting baseband
- use platform types where possible
- remove unused header

 drivers/common/cnxk/cnxk_telemetry_bphy.c | 52 +++++++++++++++++++++++
 drivers/common/cnxk/meson.build           |  3 +-
 drivers/common/cnxk/roc_model.h           |  5 +++
 drivers/raw/cnxk_bphy/cnxk_bphy.c         | 11 +++++
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.h     |  1 +
 5 files changed, 71 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..95f84888b7
--- /dev/null
+++ b/drivers/common/cnxk/cnxk_telemetry_bphy.c
@@ -0,0 +1,52 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cnxk_telemetry.h"
+#include "roc_api.h"
+#include "roc_priv.h"
+
+static int
+cnxk_tel_bphy(struct plt_tel_data *d)
+{
+	struct idev_cfg *idev;
+
+	idev = idev_get_cfg();
+	if (!idev || !idev->bphy)
+		return -ENODEV;
+
+	plt_tel_data_add_dict_int(d, "sso_pf_func", roc_bphy_sso_pf_func_get());
+	plt_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 __plt_unused,
+			  const char *params __plt_unused,
+			  struct plt_tel_data *d)
+{
+	plt_tel_data_start_dict(d);
+
+	return cnxk_tel_bphy(d);
+}
+
+static int
+cnxk_bphy_telemetry_register(void)
+{
+	if (!(roc_model->flag & ROC_MODEL_CNF9K) &&
+	    !(roc_model->flag & ROC_MODEL_CNF10K))
+		return 0;
+
+	plt_telemetry_register_cmd(
+		"/cnxk/bphy/info", cnxk_bphy_tel_handle_info,
+		"Returns bphy information. Takes no parameters");
+
+	return 0;
+}
+
+PLT_INIT(cnxk_telemetry_bphy_init)
+{
+	roc_plt_init_cb_register(cnxk_bphy_telemetry_register);
+}
diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build
index d9871a6b45..aca99b84e7 100644
--- a/drivers/common/cnxk/meson.build
+++ b/drivers/common/cnxk/meson.build
@@ -74,7 +74,8 @@ includes += include_directories('../../../lib/ethdev')
 includes += include_directories('../../../lib/meter')

 # Telemetry common code
-sources += files('cnxk_telemetry_npa.c',
+sources += files('cnxk_telemetry_bphy.c',
+                 'cnxk_telemetry_npa.c',
                  'cnxk_telemetry_nix.c')

 deps += ['bus_pci', 'net', 'telemetry']
diff --git a/drivers/common/cnxk/roc_model.h b/drivers/common/cnxk/roc_model.h
index 3779a88bca..cee06779bc 100644
--- a/drivers/common/cnxk/roc_model.h
+++ b/drivers/common/cnxk/roc_model.h
@@ -40,12 +40,17 @@ struct roc_model {
 	 ROC_MODEL_CNF95xx_B0 | ROC_MODEL_CNF95xxMM_A0 |                       \
 	 ROC_MODEL_CNF95xxO_A0 | ROC_MODEL_CNF95xxN_A0 | ROC_MODEL_CN98xx_A0 | \
 	 ROC_MODEL_CNF95xxN_A1)
+#define ROC_MODEL_CNF9K                                                        \
+	(ROC_MODEL_CNF95xx_A0 | ROC_MODEL_CNF95xx_B0 |                         \
+	 ROC_MODEL_CNF95xxMM_A0 | ROC_MODEL_CNF95xxO_A0 |                      \
+	 ROC_MODEL_CNF95xxN_A0 | ROC_MODEL_CNF95xxN_A1)

 #define ROC_MODEL_CN106xx   (ROC_MODEL_CN106xx_A0)
 #define ROC_MODEL_CNF105xx  (ROC_MODEL_CNF105xx_A0)
 #define ROC_MODEL_CNF105xxN (ROC_MODEL_CNF105xxN_A0)
 #define ROC_MODEL_CN10K                                                        \
 	(ROC_MODEL_CN106xx | ROC_MODEL_CNF105xx | ROC_MODEL_CNF105xxN)
+#define ROC_MODEL_CNF10K (ROC_MODEL_CNF105xx | ROC_MODEL_CNF105xxN)

 /* Runtime variants */
 static inline uint64_t
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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] common/cnxk: support BPHY telemetry
  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
  1 sibling, 0 replies; 9+ messages in thread
From: Jerin Jacob @ 2021-10-29 16:03 UTC (permalink / raw)
  To: Tomasz Duszynski, Ferruh Yigit
  Cc: dpdk-dev, Jerin Jacob, Harman Kalra, Nithin Dabilpuram,
	Kiran Kumar K, Sunil Kumar Kori, Satha Rao, Jakub Palider

On Fri, Oct 22, 2021 at 5:27 PM Tomasz Duszynski <tduszynski@marvell.com> wrote:
>
> Add initial support for baseband telemetry.
>
> Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
> ---


Updated as
    raw/cnxk_bphy: support telemetry

    Added /cnxk/bphy/info telemetry endpoint.

    Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
    Acked-by: Jerin Jacob <jerinj@marvell.com>



Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-net-mrvl/for-next-net. Thanks

> v2:
> - make bphy telemetry available only on platforms supporting baseband
> - use platform types where possible
> - remove unused header
>
>  drivers/common/cnxk/cnxk_telemetry_bphy.c | 52 +++++++++++++++++++++++
>  drivers/common/cnxk/meson.build           |  3 +-
>  drivers/common/cnxk/roc_model.h           |  5 +++
>  drivers/raw/cnxk_bphy/cnxk_bphy.c         | 11 +++++
>  drivers/raw/cnxk_bphy/cnxk_bphy_irq.h     |  1 +
>  5 files changed, 71 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..95f84888b7
> --- /dev/null
> +++ b/drivers/common/cnxk/cnxk_telemetry_bphy.c
> @@ -0,0 +1,52 @@
> +
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(C) 2021 Marvell.
> + */
> +
> +#include "cnxk_telemetry.h"
> +#include "roc_api.h"
> +#include "roc_priv.h"
> +
> +static int
> +cnxk_tel_bphy(struct plt_tel_data *d)
> +{
> +       struct idev_cfg *idev;
> +
> +       idev = idev_get_cfg();
> +       if (!idev || !idev->bphy)
> +               return -ENODEV;
> +
> +       plt_tel_data_add_dict_int(d, "sso_pf_func", roc_bphy_sso_pf_func_get());
> +       plt_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 __plt_unused,
> +                         const char *params __plt_unused,
> +                         struct plt_tel_data *d)
> +{
> +       plt_tel_data_start_dict(d);
> +
> +       return cnxk_tel_bphy(d);
> +}
> +
> +static int
> +cnxk_bphy_telemetry_register(void)
> +{
> +       if (!(roc_model->flag & ROC_MODEL_CNF9K) &&
> +           !(roc_model->flag & ROC_MODEL_CNF10K))
> +               return 0;
> +
> +       plt_telemetry_register_cmd(
> +               "/cnxk/bphy/info", cnxk_bphy_tel_handle_info,
> +               "Returns bphy information. Takes no parameters");
> +
> +       return 0;
> +}
> +
> +PLT_INIT(cnxk_telemetry_bphy_init)
> +{
> +       roc_plt_init_cb_register(cnxk_bphy_telemetry_register);
> +}
> diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build
> index d9871a6b45..aca99b84e7 100644
> --- a/drivers/common/cnxk/meson.build
> +++ b/drivers/common/cnxk/meson.build
> @@ -74,7 +74,8 @@ includes += include_directories('../../../lib/ethdev')
>  includes += include_directories('../../../lib/meter')
>
>  # Telemetry common code
> -sources += files('cnxk_telemetry_npa.c',
> +sources += files('cnxk_telemetry_bphy.c',
> +                 'cnxk_telemetry_npa.c',
>                   'cnxk_telemetry_nix.c')
>
>  deps += ['bus_pci', 'net', 'telemetry']
> diff --git a/drivers/common/cnxk/roc_model.h b/drivers/common/cnxk/roc_model.h
> index 3779a88bca..cee06779bc 100644
> --- a/drivers/common/cnxk/roc_model.h
> +++ b/drivers/common/cnxk/roc_model.h
> @@ -40,12 +40,17 @@ struct roc_model {
>          ROC_MODEL_CNF95xx_B0 | ROC_MODEL_CNF95xxMM_A0 |                       \
>          ROC_MODEL_CNF95xxO_A0 | ROC_MODEL_CNF95xxN_A0 | ROC_MODEL_CN98xx_A0 | \
>          ROC_MODEL_CNF95xxN_A1)
> +#define ROC_MODEL_CNF9K                                                        \
> +       (ROC_MODEL_CNF95xx_A0 | ROC_MODEL_CNF95xx_B0 |                         \
> +        ROC_MODEL_CNF95xxMM_A0 | ROC_MODEL_CNF95xxO_A0 |                      \
> +        ROC_MODEL_CNF95xxN_A0 | ROC_MODEL_CNF95xxN_A1)
>
>  #define ROC_MODEL_CN106xx   (ROC_MODEL_CN106xx_A0)
>  #define ROC_MODEL_CNF105xx  (ROC_MODEL_CNF105xx_A0)
>  #define ROC_MODEL_CNF105xxN (ROC_MODEL_CNF105xxN_A0)
>  #define ROC_MODEL_CN10K                                                        \
>         (ROC_MODEL_CN106xx | ROC_MODEL_CNF105xx | ROC_MODEL_CNF105xxN)
> +#define ROC_MODEL_CNF10K (ROC_MODEL_CNF105xx | ROC_MODEL_CNF105xxN)
>
>  /* Runtime variants */
>  static inline uint64_t
> 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
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] common/cnxk: support BPHY telemetry
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Ferruh Yigit @ 2021-11-01 14:38 UTC (permalink / raw)
  To: Tomasz Duszynski, dev
  Cc: jerinj, hkalra, Nithin Dabilpuram, Kiran Kumar K,
	Sunil Kumar Kori, Satha Rao, Jakub Palider

On 10/22/2021 12:56 PM, Tomasz Duszynski wrote:
> Add initial support for baseband telemetry.
> 
> Signed-off-by: Tomasz Duszynski<tduszynski@marvell.com>
> ---
> v2:
> - make bphy telemetry available only on platforms supporting baseband
> - use platform types where possible
> - remove unused header
> 
>   drivers/common/cnxk/cnxk_telemetry_bphy.c | 52 +++++++++++++++++++++++

Since the telemetry support is for 'raw/cnxk_bphy', why it is implemented
in common code, instead of driver?

>   drivers/common/cnxk/meson.build           |  3 +-
>   drivers/common/cnxk/roc_model.h           |  5 +++
>   drivers/raw/cnxk_bphy/cnxk_bphy.c         | 11 +++++
>   drivers/raw/cnxk_bphy/cnxk_bphy_irq.h     |  1 +
>   5 files changed, 71 insertions(+), 1 deletion(-)
>   create mode 100644 drivers/common/cnxk/cnxk_telemetry_bphy.c


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] common/cnxk: support BPHY telemetry
  2021-11-01 14:38   ` Ferruh Yigit
@ 2021-11-02  4:32     ` Jerin Jacob
  2021-11-02 10:28       ` Ferruh Yigit
  0 siblings, 1 reply; 9+ messages in thread
From: Jerin Jacob @ 2021-11-02  4:32 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Tomasz Duszynski, dpdk-dev, Jerin Jacob, Harman Kalra,
	Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Jakub Palider

On Mon, Nov 1, 2021 at 8:32 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> On 10/22/2021 12:56 PM, Tomasz Duszynski wrote:
> > Add initial support for baseband telemetry.
> >
> > Signed-off-by: Tomasz Duszynski<tduszynski@marvell.com>
> > ---
> > v2:
> > - make bphy telemetry available only on platforms supporting baseband
> > - use platform types where possible
> > - remove unused header
> >
> >   drivers/common/cnxk/cnxk_telemetry_bphy.c | 52 +++++++++++++++++++++++
>
> Since the telemetry support is for 'raw/cnxk_bphy', why it is implemented
> in common code, instead of driver?

It can be raw/cnxk_bphy, thought of keeping it in common due to
1) To reuse it for another common code consumer
2) roc_bphy_sso_pf_func_get() and roc_bphy_npa_pf_func_get() manged by
common code. aka there is no reverse dependency on the raw driver framework
in common code.

>
> >   drivers/common/cnxk/meson.build           |  3 +-
> >   drivers/common/cnxk/roc_model.h           |  5 +++
> >   drivers/raw/cnxk_bphy/cnxk_bphy.c         | 11 +++++
> >   drivers/raw/cnxk_bphy/cnxk_bphy_irq.h     |  1 +
> >   5 files changed, 71 insertions(+), 1 deletion(-)
> >   create mode 100644 drivers/common/cnxk/cnxk_telemetry_bphy.c
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] common/cnxk: support BPHY telemetry
  2021-11-02  4:32     ` Jerin Jacob
@ 2021-11-02 10:28       ` Ferruh Yigit
  2021-11-02 11:11         ` Jerin Jacob
  0 siblings, 1 reply; 9+ messages in thread
From: Ferruh Yigit @ 2021-11-02 10:28 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: Tomasz Duszynski, dpdk-dev, Jerin Jacob, Harman Kalra,
	Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Jakub Palider

On 11/2/2021 4:32 AM, Jerin Jacob wrote:
> On Mon, Nov 1, 2021 at 8:32 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>
>> On 10/22/2021 12:56 PM, Tomasz Duszynski wrote:
>>> Add initial support for baseband telemetry.
>>>
>>> Signed-off-by: Tomasz Duszynski<tduszynski@marvell.com>
>>> ---
>>> v2:
>>> - make bphy telemetry available only on platforms supporting baseband
>>> - use platform types where possible
>>> - remove unused header
>>>
>>>    drivers/common/cnxk/cnxk_telemetry_bphy.c | 52 +++++++++++++++++++++++
>>
>> Since the telemetry support is for 'raw/cnxk_bphy', why it is implemented
>> in common code, instead of driver?
> 
> It can be raw/cnxk_bphy, thought of keeping it in common due to
> 1) To reuse it for another common code consumer

Is it reusable, since the code is to get telemetry data from raw device?

> 2) roc_bphy_sso_pf_func_get() and roc_bphy_npa_pf_func_get() manged by
> common code. aka there is no reverse dependency on the raw driver framework
> in common code.

If telemetry code moved to raw driver, dependency will be from driver to
common code, which is correct dependency order I think.

It just looks wrong to have rawdev related telemetry function in the common
code, but I may be missing details, trying to understand.

thanks,
ferruh

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] common/cnxk: support BPHY telemetry
  2021-11-02 10:28       ` Ferruh Yigit
@ 2021-11-02 11:11         ` Jerin Jacob
  2021-11-02 11:21           ` Ferruh Yigit
  0 siblings, 1 reply; 9+ messages in thread
From: Jerin Jacob @ 2021-11-02 11:11 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Tomasz Duszynski, dpdk-dev, Jerin Jacob, Harman Kalra,
	Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Jakub Palider

On Tue, Nov 2, 2021 at 3:58 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> On 11/2/2021 4:32 AM, Jerin Jacob wrote:
> > On Mon, Nov 1, 2021 at 8:32 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> >>
> >> On 10/22/2021 12:56 PM, Tomasz Duszynski wrote:
> >>> Add initial support for baseband telemetry.
> >>>
> >>> Signed-off-by: Tomasz Duszynski<tduszynski@marvell.com>
> >>> ---
> >>> v2:
> >>> - make bphy telemetry available only on platforms supporting baseband
> >>> - use platform types where possible
> >>> - remove unused header
> >>>
> >>>    drivers/common/cnxk/cnxk_telemetry_bphy.c | 52 +++++++++++++++++++++++
> >>
> >> Since the telemetry support is for 'raw/cnxk_bphy', why it is implemented
> >> in common code, instead of driver?
> >
> > It can be raw/cnxk_bphy, thought of keeping it in common due to
> > 1) To reuse it for another common code consumer
>
> Is it reusable, since the code is to get telemetry data from raw device?

Yes. I meant, common code is reused on another library that has
telemetry support too.

>
> > 2) roc_bphy_sso_pf_func_get() and roc_bphy_npa_pf_func_get() manged by
> > common code. aka there is no reverse dependency on the raw driver framework
> > in common code.
>
> If telemetry code moved to raw driver, dependency will be from driver to
> common code, which is correct dependency order I think.
>
> It just looks wrong to have rawdev related telemetry function in the common
> code, but I may be missing details, trying to understand.

Currently, we are doing like this:
- implementing HW specific telemetry endpoints in driver/common/cnxk
- ethdev/mempool/eventdev/cryptodev driver-specific telemetry endpoint
in driver/.../cnxk.
The criteria for deciding what is the second category is, if it uses
any ethdev/mempool/eventdev/cryptodev/rawdev
symbols or if telemetry-related raw dev driver implementation details.
i.e common code does not have
any raw driver dependency.




>
> thanks,
> ferruh

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] common/cnxk: support BPHY telemetry
  2021-11-02 11:11         ` Jerin Jacob
@ 2021-11-02 11:21           ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2021-11-02 11:21 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: Tomasz Duszynski, dpdk-dev, Jerin Jacob, Harman Kalra,
	Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Jakub Palider

On 11/2/2021 11:11 AM, Jerin Jacob wrote:
> On Tue, Nov 2, 2021 at 3:58 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>
>> On 11/2/2021 4:32 AM, Jerin Jacob wrote:
>>> On Mon, Nov 1, 2021 at 8:32 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>>>
>>>> On 10/22/2021 12:56 PM, Tomasz Duszynski wrote:
>>>>> Add initial support for baseband telemetry.
>>>>>
>>>>> Signed-off-by: Tomasz Duszynski<tduszynski@marvell.com>
>>>>> ---
>>>>> v2:
>>>>> - make bphy telemetry available only on platforms supporting baseband
>>>>> - use platform types where possible
>>>>> - remove unused header
>>>>>
>>>>>     drivers/common/cnxk/cnxk_telemetry_bphy.c | 52 +++++++++++++++++++++++
>>>>
>>>> Since the telemetry support is for 'raw/cnxk_bphy', why it is implemented
>>>> in common code, instead of driver?
>>>
>>> It can be raw/cnxk_bphy, thought of keeping it in common due to
>>> 1) To reuse it for another common code consumer
>>
>> Is it reusable, since the code is to get telemetry data from raw device?
> 
> Yes. I meant, common code is reused on another library that has
> telemetry support too.
> 
>>
>>> 2) roc_bphy_sso_pf_func_get() and roc_bphy_npa_pf_func_get() manged by
>>> common code. aka there is no reverse dependency on the raw driver framework
>>> in common code.
>>
>> If telemetry code moved to raw driver, dependency will be from driver to
>> common code, which is correct dependency order I think.
>>
>> It just looks wrong to have rawdev related telemetry function in the common
>> code, but I may be missing details, trying to understand.
> 
> Currently, we are doing like this:
> - implementing HW specific telemetry endpoints in driver/common/cnxk
> - ethdev/mempool/eventdev/cryptodev driver-specific telemetry endpoint
> in driver/.../cnxk.
> The criteria for deciding what is the second category is, if it uses
> any ethdev/mempool/eventdev/cryptodev/rawdev
> symbols or if telemetry-related raw dev driver implementation details.
> i.e common code does not have
> any raw driver dependency.
> 

Got it, so I am proceeding as it is.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-11-02 11:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05  7:46 [dpdk-dev] [PATCH] common/cnxk: support BPHY telemetry Tomasz Duszynski
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

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).