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 A216CA0C43; Fri, 27 Aug 2021 08:42:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6DD9841249; Fri, 27 Aug 2021 08:42:15 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 0DE9E4121F for ; Fri, 27 Aug 2021 08:42:13 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 17R3s37B012747; Thu, 26 Aug 2021 23:42:13 -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=YCkb7k6ihP50LGAh8wWFWp27i+xlUW7XZrY8R0FvwmE=; b=hBysk5Wi4j+VDrFVn855hlqeOoo2fqe/5MSwIcuisFVvlnMbdXrquKrvRWpXZ9DWiRXW RYRyaQKle7+WYXLm0iEDfwgluNV/7nTARftR5/yp7X5trwddSuv5En2odOhpjbS9VGCR XO3TgODeBrdvEi7keh+jgBvDI9sdlNfxNcYe9DmcsT6z6o64yBe+aOJ9rb7wWNTFk4zY dMrkCeRp83ynmq5O3ETkLrjaw4qqqQI9qo+quA7kHBduFj2siI1JzvLhnJNizdLyn5GJ Z1G8KEihgfOp9VVNhHU+b7t0pPUqAzlGcWxTkKHt/cVm5nV5HO5VSv09G3ZO5kLnd859 Mw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3aprj60g4w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 26 Aug 2021 23:42:13 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 26 Aug 2021 23:42:11 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 26 Aug 2021 23:42:11 -0700 Received: from localhost.localdomain (unknown [10.28.34.38]) by maili.marvell.com (Postfix) with ESMTP id EDC675B692B; Thu, 26 Aug 2021 23:42:08 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: , , , , , , , , Gowrishankar Muthukrishnan Date: Fri, 27 Aug 2021 12:11:59 +0530 Message-ID: <62f65b58824532acbb53784d64ef260d5c9c90a1.1630046292.git.gmuthukrishn@marvell.com> 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-ORIG-GUID: 2pIQyHM0dAUmbSAYn_Qy28nxkvqL9HGD X-Proofpoint-GUID: 2pIQyHM0dAUmbSAYn_Qy28nxkvqL9HGD 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-08-27_02,2021-08-26_02,2020-04-07_01 Subject: [dpdk-dev] [v5, 2/2] mempool/cnxk: add telemetry end points 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" Adding telemetry end points to cnxk mempool driver. Signed-off-by: Gowrishankar Muthukrishnan --- drivers/mempool/cnxk/cnxk_mempool_telemetry.c | 100 ++++++++++++++++++ drivers/mempool/cnxk/meson.build | 3 +- 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/mempool/cnxk/cnxk_mempool_telemetry.c diff --git a/drivers/mempool/cnxk/cnxk_mempool_telemetry.c b/drivers/mempool/cnxk/cnxk_mempool_telemetry.c new file mode 100644 index 0000000000..690f557f62 --- /dev/null +++ b/drivers/mempool/cnxk/cnxk_mempool_telemetry.c @@ -0,0 +1,100 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2021 Marvell. + */ + +#include +#include +#include + +#include + +#include "cnxk_mempool.h" +#include "cnxk_telemetry.h" + +static void +mempool_list_cb(struct rte_mempool *mp, void *arg) +{ + struct rte_tel_data *d = (struct rte_tel_data *)arg; + + rte_tel_data_add_array_string(d, mp->name); +} + +static int +mempool_tel_handle_list(const char *cmd __rte_unused, + const char *params __rte_unused, struct rte_tel_data *d) +{ + rte_tel_data_start_array(d, RTE_TEL_STRING_VAL); + rte_mempool_walk(mempool_list_cb, d); + return 0; +} + +struct mempool_info_cb_arg { + char *pool_name; + struct rte_tel_data *d; +}; + +static void +mempool_info_cb(struct rte_mempool *mp, void *arg) +{ + struct mempool_info_cb_arg *info = (struct mempool_info_cb_arg *)arg; + const struct rte_memzone *mz; + int aura_id; + + if (strncmp(mp->name, info->pool_name, RTE_MEMZONE_NAMESIZE)) + return; + + CNXK_TEL_DICT_STR(info->d, mp, name); + CNXK_TEL_DICT_INT(info->d, mp, pool_id); + CNXK_TEL_DICT_INT(info->d, mp, flags); + CNXK_TEL_DICT_INT(info->d, mp, socket_id); + CNXK_TEL_DICT_INT(info->d, mp, size); + CNXK_TEL_DICT_INT(info->d, mp, cache_size); + CNXK_TEL_DICT_INT(info->d, mp, elt_size); + CNXK_TEL_DICT_INT(info->d, mp, header_size); + CNXK_TEL_DICT_INT(info->d, mp, trailer_size); + CNXK_TEL_DICT_INT(info->d, mp, private_data_size); + CNXK_TEL_DICT_INT(info->d, mp, ops_index); + CNXK_TEL_DICT_INT(info->d, mp, populated_size); + + aura_id = roc_npa_aura_handle_to_aura(mp->pool_id); + rte_tel_data_add_dict_int(info->d, "aura_id", aura_id); + + mz = mp->mz; + CNXK_TEL_DICT_STR(info->d, mz, name, mz_); + CNXK_TEL_DICT_PTR(info->d, mz, iova, mz_); + CNXK_TEL_DICT_PTR(info->d, mz, addr, mz_); + CNXK_TEL_DICT_INT(info->d, mz, len, mz_); + CNXK_TEL_DICT_U64(info->d, mz, hugepage_sz, mz_); + CNXK_TEL_DICT_INT(info->d, mz, socket_id, mz_); + CNXK_TEL_DICT_INT(info->d, mz, flags, mz_); +} + +static int +mempool_tel_handle_info(const char *cmd __rte_unused, const char *params, + struct rte_tel_data *d) +{ + struct mempool_info_cb_arg mp_arg; + char name[RTE_MEMZONE_NAMESIZE]; + + if (params == NULL || strlen(params) == 0) + return -1; + + rte_strlcpy(name, params, RTE_MEMZONE_NAMESIZE); + + rte_tel_data_start_dict(d); + mp_arg.pool_name = name; + mp_arg.d = d; + rte_mempool_walk(mempool_info_cb, &mp_arg); + + return 0; +} + +RTE_INIT(cnxk_mempool_init_telemetry) +{ + rte_telemetry_register_cmd( + "/cnxk/mempool/list", mempool_tel_handle_list, + "Returns list of available mempools. Takes no parameters"); + rte_telemetry_register_cmd( + "/cnxk/mempool/info", mempool_tel_handle_info, + "Returns mempool info. Parameters: pool_name"); +} diff --git a/drivers/mempool/cnxk/meson.build b/drivers/mempool/cnxk/meson.build index e28a9e044d..7834a19118 100644 --- a/drivers/mempool/cnxk/meson.build +++ b/drivers/mempool/cnxk/meson.build @@ -11,8 +11,9 @@ endif sources = files( 'cnxk_mempool.c', 'cnxk_mempool_ops.c', + 'cnxk_mempool_telemetry.c', 'cn9k_mempool_ops.c', 'cn10k_mempool_ops.c', ) -deps += ['eal', 'mbuf', 'kvargs', 'bus_pci', 'common_cnxk', 'mempool'] +deps += ['eal', 'mbuf', 'kvargs', 'bus_pci', 'common_cnxk', 'mempool', 'telemetry'] -- 2.25.1