From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23A45A04A6; Mon, 24 Jan 2022 10:05:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F38040DFD; Mon, 24 Jan 2022 10:05:52 +0100 (CET) Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by mails.dpdk.org (Postfix) with ESMTP id 72A7440040 for ; Mon, 24 Jan 2022 10:05:51 +0100 (CET) Received: by mail-io1-f43.google.com with SMTP id e79so18596349iof.13 for ; Mon, 24 Jan 2022 01:05:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9ZHRYdUlILD3F9AU7nEY9rPGUPFzmv3iJ2fHOndT3GI=; b=bsjEnRlignaMsxBfrJyR/aH7d59NU3XS1gQg4ZZ5tEmA+Sc0isu3MybWxUUtNBflwO iWbGQQhiP3FB+SbeI0Tau/BYeUdHMnFm6npbDpQveESsDxp6wm+59elI8ve60nSiNHHD EuZJxB9YrdmJiHjFJkcYgpIwTY8OpxmHG3E9OPyqQPIycExVwI3DvwASWXU1BEJSPkZK 3DrlT8pbWfVtpeaXnHlBdjaeOM5Rz9sQZJDtIP9/Gcj4NJaf2N7Noyt8vuhQVf7G1zxH tadGUePfcwRulsSRZ0DJ1UpneLXd+pr+fd5rTfUWy93DbsZGL8H90DPuJ/d9J5OznNTk cB4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9ZHRYdUlILD3F9AU7nEY9rPGUPFzmv3iJ2fHOndT3GI=; b=c6SP8ikV8z0o673ckKUlNpfmO7ahdIAtV3Wfc4DA78yz5bEzCsx5AFMXRTWUokjDvv dGaA4nXFCAIS211gEthayLAIUb5g4ec7xe9463aww/AXnn5f67AqMIA+MgX8BjRnBPpD t+o0ODPb12DitXPPqeh/sKXvm0LXXznqR1qG5nTbr6RkCagbSWoSDx9XoCMBEwj23765 NBBnfp3gTZyAaQfe1/YIYrzcXtd68vzMi7oBPrMtdJTNBBANn9lYH+iuAWYtaJ2Vve5P mXIuSALdMBFqHQBwKshZu8/l/SUfGHiQ1hy9/IsCVcDKIUP0X0eobgiJaajG+FuXQv2a Sm3g== X-Gm-Message-State: AOAM53080O9Jae8vCrxUk5dRYR204V7bLk8FNE26sTFUc3Nv1QqUYMkM l2G0B4mAON0JVJrFxEhSoXTgR3A3XN8vI1ykCRo= X-Google-Smtp-Source: ABdhPJzH421wAykJWULdHUpzNY6Z207G/GGb53ZP1vc9Z0xmscbSfT73GJseyJ9kpOd7Yjgi5XCTwgClsdmzbV7I3j8= X-Received: by 2002:a05:6602:200b:: with SMTP id y11mr7464016iod.121.1643015150749; Mon, 24 Jan 2022 01:05:50 -0800 (PST) MIME-Version: 1.0 References: <20211213204309.5432-1-pbhagavatula@marvell.com> In-Reply-To: <20211213204309.5432-1-pbhagavatula@marvell.com> From: Jerin Jacob Date: Mon, 24 Jan 2022 14:35:23 +0530 Message-ID: Subject: Re: [PATCH] common/cnxk: add telemetry endpoints to SSO To: Pavan Nikhilesh Cc: Jerin Jacob , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , dpdk-dev Content-Type: text/plain; charset="UTF-8" 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 On Tue, Dec 14, 2021 at 2:13 AM wrote: > > From: Pavan Nikhilesh > > Add common telemetry endpoints for SSO. > > Signed-off-by: Pavan Nikhilesh Applied to dpdk-next-net-eventdev/for-main. Thanks > --- > drivers/common/cnxk/cnxk_telemetry_sso.c | 50 ++++++++++++++++++++++++ > drivers/common/cnxk/meson.build | 4 +- > 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, 81 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 > + > +#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 4928f7e549..88407af828 100644 > --- a/drivers/common/cnxk/meson.build > +++ b/drivers/common/cnxk/meson.build > @@ -77,6 +77,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'] > diff --git a/drivers/common/cnxk/roc_idev.c b/drivers/common/cnxk/roc_idev.c > index 648f37b3bb..b1f38fb5fc 100644 > --- a/drivers/common/cnxk/roc_idev.c > +++ b/drivers/common/cnxk/roc_idev.c > @@ -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); > +} > diff --git a/drivers/common/cnxk/roc_idev_priv.h b/drivers/common/cnxk/roc_idev_priv.h > index 2c8309b8fd..46eebffcbb 100644 > --- a/drivers/common/cnxk/roc_idev_priv.h > +++ b/drivers/common/cnxk/roc_idev_priv.h > @@ -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); > diff --git a/drivers/common/cnxk/roc_sso.c b/drivers/common/cnxk/roc_sso.c > index 45ff16ca0e..1b85f04970 100644 > --- a/drivers/common/cnxk/roc_sso.c > +++ b/drivers/common/cnxk/roc_sso.c > @@ -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; > diff --git a/drivers/common/cnxk/roc_sso_priv.h b/drivers/common/cnxk/roc_sso_priv.h > index 2e1b025d1c..09729d4f62 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 f1b5ef3b70..495e62a315 100644 > --- a/drivers/common/cnxk/roc_utils.c > +++ b/drivers/common/cnxk/roc_utils.c > @@ -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; > -- > 2.17.1 >