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 D83BDA0547; Wed, 29 Sep 2021 08:55:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44693410EF; Wed, 29 Sep 2021 08:55:25 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 24042410ED for ; Wed, 29 Sep 2021 08:55:23 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18T37l5E008419 for ; Tue, 28 Sep 2021 23:55:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=qnRGHdnygh+KGz1ZDowAihJF5lEReLU2OBb2fMgZKZE=; b=Z+4fqx3pJFynx5FnskFVL3OSdo9pqIwLrp/8Rf4C9nyLF9zSc758E0GEA9iuIdPQH1j6 q5y3RRwOFfVCM6ZvwwbikCP6UoHhZ53YubzwZadrfl8ifnduyFTjNG8bVOF+pRVDKiZo iXrt4vtkv4315FM+4pSmzb9gg6JlKgNhe/It6Nre4ij4buSMRucKSKcxhhDHTmDjgEHm EbU2TSDt2Fk2Rq32dw85akEv0KE9q1ocyDgtCNacc8rmKGMR2/brxlKey5pKjfdeCz+y Df5cWKydHdQJ5ynjLoixITZ6hiBT2bNWEps5B/XImKxIncOb3avIwOCm1P6epTDZARCa rw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3bc7eyjmtx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 28 Sep 2021 23:55:23 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 28 Sep 2021 23:55:21 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 28 Sep 2021 23:55:21 -0700 Received: from localhost.localdomain (unknown [10.28.34.38]) by maili.marvell.com (Postfix) with ESMTP id 3FE223F7085; Tue, 28 Sep 2021 23:55:19 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: , , , , , , , Gowrishankar Muthukrishnan Date: Wed, 29 Sep 2021 12:25:03 +0530 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: YDrY4I9l4qoCrEodzwAHY7wCIGvhkuPa X-Proofpoint-ORIG-GUID: YDrY4I9l4qoCrEodzwAHY7wCIGvhkuPa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-29_02,2021-09-28_01,2020-04-07_01 Subject: [dpdk-dev] [v9 4/4] net/cnxk: add telemetry endpoints to ethdev 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 Sender: "dev" Add telemetry endpoints to ethdev. Signed-off-by: Gowrishankar Muthukrishnan --- drivers/net/cnxk/cnxk_ethdev_telemetry.c | 93 ++++++++++++++++++++++++ drivers/net/cnxk/meson.build | 1 + 2 files changed, 94 insertions(+) create mode 100644 drivers/net/cnxk/cnxk_ethdev_telemetry.c diff --git a/drivers/net/cnxk/cnxk_ethdev_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_telemetry.c new file mode 100644 index 0000000000..83bc65848c --- /dev/null +++ b/drivers/net/cnxk/cnxk_ethdev_telemetry.c @@ -0,0 +1,93 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2021 Marvell International Ltd. + */ + +#include + +#include "cnxk_ethdev.h" + +/* Macro to count no of words in eth_info_s size */ +#define ETH_INFO_SZ \ + (RTE_ALIGN_CEIL(sizeof(struct eth_info_s), sizeof(uint64_t)) / \ + sizeof(uint64_t)) +#define MACADDR_LEN 18 + +static int +ethdev_tel_handle_info(const char *cmd __rte_unused, + const char *params __rte_unused, struct rte_tel_data *d) +{ + struct rte_eth_dev *eth_dev; + struct rte_tel_data *i_data; + struct cnxk_eth_dev *dev; + union eth_info_u { + struct eth_info_s { + /** PF/VF information */ + uint16_t pf_func; + uint8_t max_mac_entries; + bool dmac_filter_ena; + uint8_t dmac_filter_count; + uint8_t ptype_disable; + bool scalar_ena; + bool ptp_ena; + /* Platform specific offload flags */ + uint16_t rx_offload_flags; + uint16_t tx_offload_flags; + } info; + uint64_t val[ETH_INFO_SZ]; + } eth_info; + struct eth_info_s *info; + unsigned int i, j = 0; + int n_ports; + + n_ports = rte_eth_dev_count_avail(); + if (!n_ports) { + plt_err("No active ethernet ports found."); + return -1; + } + + rte_tel_data_start_dict(d); + rte_tel_data_add_dict_int(d, "n_ports", n_ports); + + i_data = rte_tel_data_alloc(); + rte_tel_data_start_array(i_data, RTE_TEL_U64_VAL); + + for (i = 0; i < RTE_MAX_ETHPORTS; i++) { + /* Skip if port is unused */ + if (!rte_eth_dev_is_valid_port(i)) + continue; + + eth_dev = &rte_eth_devices[i]; + if (eth_dev) { + memset(ð_info, 0, sizeof(eth_info)); + info = ð_info.info; + dev = cnxk_eth_pmd_priv(eth_dev); + if (dev) { + info->pf_func = roc_nix_get_pf_func(&dev->nix); + info->max_mac_entries = dev->max_mac_entries; + info->dmac_filter_ena = dev->dmac_filter_enable; + info->dmac_filter_count = + dev->dmac_filter_count; + info->ptype_disable = dev->ptype_disable; + info->scalar_ena = dev->scalar_ena; + info->ptp_ena = dev->ptp_en; + info->rx_offload_flags = dev->rx_offload_flags; + info->tx_offload_flags = dev->tx_offload_flags; + } + + for (j = 0; j < ETH_INFO_SZ; j++) + rte_tel_data_add_array_u64(i_data, + eth_info.val[j]); + + j++; + } + } + + rte_tel_data_add_dict_container(d, "info", i_data, 0); + return 0; +} + +RTE_INIT(cnxk_ethdev_init_telemetry) +{ + rte_telemetry_register_cmd("/cnxk/ethdev/info", ethdev_tel_handle_info, + "Returns ethdev device information"); +} diff --git a/drivers/net/cnxk/meson.build b/drivers/net/cnxk/meson.build index d1d4b4e15e..5b3b8422fb 100644 --- a/drivers/net/cnxk/meson.build +++ b/drivers/net/cnxk/meson.build @@ -13,6 +13,7 @@ sources = files( 'cnxk_ethdev_devargs.c', 'cnxk_ethdev_ops.c', 'cnxk_ethdev_sec.c', + 'cnxk_ethdev_telemetry.c', 'cnxk_link.c', 'cnxk_lookup.c', 'cnxk_ptp.c', -- 2.25.1