common/cnxk: add telemetry endpoints to SSO

Add common telemetry endpoints for SSO.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
This commit is contained in:
Pavan Nikhilesh 2021-12-14 02:13:08 +05:30 committed by Jerin Jacob
parent e21aa23bed
commit cb0e45cb0c
7 changed files with 81 additions and 1 deletions

View File

@ -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");
}

View File

@ -78,6 +78,8 @@ includes += include_directories('../../../lib/meter')
# Telemetry common code
sources += files('cnxk_telemetry_bphy.c',
'cnxk_telemetry_npa.c',
'cnxk_telemetry_nix.c')
'cnxk_telemetry_nix.c',
'cnxk_telemetry_sso.c',
)
deps += ['bus_pci', 'net', 'telemetry']

View File

@ -206,3 +206,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);
}

View File

@ -21,6 +21,7 @@ struct idev_cfg {
uint64_t lmt_base_addr;
struct roc_bphy *bphy;
struct roc_cpt *cpt;
struct roc_sso *sso;
struct nix_inl_dev *nix_inl_dev;
plt_spinlock_t nix_inl_dev_lock;
};
@ -39,6 +40,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);

View File

@ -726,6 +726,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;

View File

@ -26,6 +26,7 @@ struct sso {
enum sso_err_status {
SSO_ERR_PARAM = -4096,
SSO_ERR_DEVICE_NOT_BOUNDED = -4097,
};
enum sso_lf_type {

View File

@ -220,6 +220,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;