DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] common/cnxk: add telemetry endpoints to sso
@ 2021-09-02  7:51 pbhagavatula
  2021-10-30 13:32 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: pbhagavatula @ 2021-09-02  7:51 UTC (permalink / raw)
  To: jerinj, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao
  Cc: dev, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Add telemetry endpoints for sso

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 Depends-on: series-18491 ("cnxk: enable npa and mempool telemetry")

 drivers/common/cnxk/cnxk_telemetry_sso.c | 50 ++++++++++++++++++++++++
 drivers/common/cnxk/meson.build          |  3 +-
 drivers/common/cnxk/roc_idev.c           | 20 ++++++++++
 drivers/common/cnxk/roc_idev_priv.h      |  3 ++
 drivers/common/cnxk/roc_sso.c            |  1 +
 drivers/common/cnxk/roc_sso_priv.h       |  1 +
 drivers/common/cnxk/roc_utils.c          |  3 ++
 7 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100644 drivers/common/cnxk/cnxk_telemetry_sso.c

diff --git a/drivers/common/cnxk/cnxk_telemetry_sso.c b/drivers/common/cnxk/cnxk_telemetry_sso.c
new file mode 100644
index 0000000000..822934ebd7
--- /dev/null
+++ b/drivers/common/cnxk/cnxk_telemetry_sso.c
@@ -0,0 +1,50 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include <unistd.h>
+
+#include "cnxk_telemetry.h"
+#include "roc_api.h"
+#include "roc_priv.h"
+
+static int
+cnxk_tel_sso(struct plt_tel_data *d)
+{
+	struct roc_sso *roc_sso;
+	struct sso *sso;
+
+	roc_sso = idev_sso_get();
+	if (roc_sso == NULL)
+		return SSO_ERR_DEVICE_NOT_BOUNDED;
+
+	sso = roc_sso_to_sso_priv(roc_sso);
+	plt_tel_data_add_dict_ptr(d, "roc_sso", roc_sso);
+	plt_tel_data_add_dict_ptr(d, "sso", sso);
+	plt_tel_data_add_dict_int(d, "max_hws", roc_sso->max_hws);
+	plt_tel_data_add_dict_int(d, "max_hwgrp", roc_sso->max_hwgrp);
+	plt_tel_data_add_dict_int(d, "nb_hws", roc_sso->nb_hws);
+	plt_tel_data_add_dict_int(d, "nb_hwgrp", roc_sso->nb_hwgrp);
+	plt_tel_data_add_dict_int(d, "pf_func", sso->dev.pf_func);
+	plt_tel_data_add_dict_int(d, "pid", getpid());
+
+	return 0;
+}
+
+static int
+cnxk_sso_tel_handle_info(const char *cmd __plt_unused,
+			 const char *params __plt_unused,
+			 struct plt_tel_data *d)
+{
+	plt_tel_data_start_dict(d);
+	cnxk_tel_sso(d);
+	return 0;
+}
+
+PLT_INIT(cnxk_telemetry_sso_init)
+{
+	plt_telemetry_register_cmd(
+		"/cnxk/sso/info", cnxk_sso_tel_handle_info,
+		"Returns sso information. Takes no parameters");
+}
diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build
index 6fdb5451cb..9b778e4aff 100644
--- a/drivers/common/cnxk/meson.build
+++ b/drivers/common/cnxk/meson.build
@@ -61,6 +61,7 @@ sources = files(
 sources += files('cnxk_security.c')

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

 deps += ['bus_pci', 'net', 'telemetry']
diff --git a/drivers/common/cnxk/roc_idev.c b/drivers/common/cnxk/roc_idev.c
index 1494187e3b..126b81e13e 100644
--- a/drivers/common/cnxk/roc_idev.c
+++ b/drivers/common/cnxk/roc_idev.c
@@ -204,3 +204,23 @@ roc_idev_npa_nix_get(void)
 	dev = container_of(npa_lf, struct dev, npa);
 	return dev->roc_nix;
 }
+
+struct roc_sso *
+idev_sso_get(void)
+{
+	struct idev_cfg *idev = idev_get_cfg();
+
+	if (idev != NULL)
+		return __atomic_load_n(&idev->sso, __ATOMIC_ACQUIRE);
+
+	return NULL;
+}
+
+void
+idev_sso_set(struct roc_sso *sso)
+{
+	struct idev_cfg *idev = idev_get_cfg();
+
+	if (idev != NULL)
+		__atomic_store_n(&idev->sso, sso, __ATOMIC_RELEASE);
+}
diff --git a/drivers/common/cnxk/roc_idev_priv.h b/drivers/common/cnxk/roc_idev_priv.h
index 84e6f1ef2d..c6423aded3 100644
--- a/drivers/common/cnxk/roc_idev_priv.h
+++ b/drivers/common/cnxk/roc_idev_priv.h
@@ -20,6 +20,7 @@ struct idev_cfg {
 	uint64_t lmt_base_addr;
 	struct roc_bphy *bphy;
 	struct roc_cpt *cpt;
+	struct roc_sso *sso;
 };

 /* Generic */
@@ -36,6 +37,8 @@ uint16_t idev_npa_lf_active(struct dev *dev);
 /* idev sso */
 void idev_sso_pffunc_set(uint16_t sso_pf_func);
 uint16_t idev_sso_pffunc_get(void);
+struct roc_sso *idev_sso_get(void);
+void idev_sso_set(struct roc_sso *sso);

 /* idev lmt */
 uint16_t idev_lmt_pffunc_get(void);
diff --git a/drivers/common/cnxk/roc_sso.c b/drivers/common/cnxk/roc_sso.c
index 1ccf2626bd..f56913f403 100644
--- a/drivers/common/cnxk/roc_sso.c
+++ b/drivers/common/cnxk/roc_sso.c
@@ -588,6 +588,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso)
 		link_mem = PLT_PTR_ADD(link_mem, link_map_sz);
 	}
 	idev_sso_pffunc_set(sso->dev.pf_func);
+	idev_sso_set(roc_sso);
 	sso->pci_dev = pci_dev;
 	sso->dev.drv_inited = true;
 	roc_sso->lmt_base = sso->dev.lmt_base;
diff --git a/drivers/common/cnxk/roc_sso_priv.h b/drivers/common/cnxk/roc_sso_priv.h
index 5361d4f980..78cf9458b2 100644
--- a/drivers/common/cnxk/roc_sso_priv.h
+++ b/drivers/common/cnxk/roc_sso_priv.h
@@ -26,6 +26,7 @@ struct sso {

 enum sso_err_status {
 	SSO_ERR_PARAM = -4096,
+	SSO_ERR_DEVICE_NOT_BOUNDED = -4097,
 };

 enum sso_lf_type {
diff --git a/drivers/common/cnxk/roc_utils.c b/drivers/common/cnxk/roc_utils.c
index 9cb8708a74..27c746c036 100644
--- a/drivers/common/cnxk/roc_utils.c
+++ b/drivers/common/cnxk/roc_utils.c
@@ -211,6 +211,9 @@ roc_error_msg_get(int errorcode)
 	case NIX_AF_ERR_PTP_CONFIG_FAIL:
 		err_msg = "PTP config failed";
 		break;
+	case SSO_ERR_DEVICE_NOT_BOUNDED:
+		err_msg = "SSO pf/vf not found";
+		break;
 	case UTIL_ERR_FS:
 		err_msg = "file operation failed";
 		break;
--
2.32.0


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

* Re: [dpdk-dev] [PATCH] common/cnxk: add telemetry endpoints to sso
  2021-09-02  7:51 [dpdk-dev] [PATCH] common/cnxk: add telemetry endpoints to sso pbhagavatula
@ 2021-10-30 13:32 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2021-10-30 13:32 UTC (permalink / raw)
  To: Pavan Nikhilesh
  Cc: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
	Satha Rao, dpdk-dev

On Thu, Sep 2, 2021 at 1:23 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Add telemetry endpoints for sso
>

sso -> SSO

Please rebase

for-main]dell[dpdk-next-eventdev] $ git pw series apply 18616
Applying: common/cnxk: add telemetry endpoints to sso
error: sha1 information is lacking or useless (drivers/common/cnxk/meson.build).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 common/cnxk: add telemetry endpoints to sso
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.

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

end of thread, other threads:[~2021-10-30 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-02  7:51 [dpdk-dev] [PATCH] common/cnxk: add telemetry endpoints to sso pbhagavatula
2021-10-30 13:32 ` Jerin Jacob

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