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 43AFAA0547; Thu, 26 Aug 2021 19:15:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 01F2A4124A; Thu, 26 Aug 2021 19:15:44 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D22764123E for ; Thu, 26 Aug 2021 19:15:41 +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 17QC3S9K017041; Thu, 26 Aug 2021 10:15:41 -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=KAB873IbTcCg0Ay4lAQz8x3PTg7oVGwQdQwgHyXlxIs=; b=ScclO3ixY2HiNCG6PRVimnMG0HTZN2scp7dviXvTfHSL/EW2cvCXuCsihjCXDz0CcsA3 ZoGbB//kL4SDCQWf8Yn1vraWuVz5OLfRIgJLDtxJMBJ5roIWbKgz8TThWoiZIek1Gju7 sa/fe7qg1LEL+D30Ofn/LF2tLQLZPa1nJ5CFH6QE5BmkRmACQRCUa+6irOMmGBblA0T/ v3egfePOpZ1L4mn+zTVoZm4IyfzZYpy3eR7oWu5z5njUE6nZJzGd2b3hVEAr3GYljmz5 gqEnbvyixTWRWLxFPiThvqJLR/r1qWdKTYXzU75WwefhuAJ9XPH6cvL4aKU58rH4KALu zA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3apamh19xr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 26 Aug 2021 10:15:40 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 26 Aug 2021 10:15:39 -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; Thu, 26 Aug 2021 10:15:39 -0700 Received: from localhost.localdomain (unknown [10.28.34.38]) by maili.marvell.com (Postfix) with ESMTP id A4AF93F7053; Thu, 26 Aug 2021 10:15:36 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: , , , , , , , , Gowrishankar Muthukrishnan Date: Thu, 26 Aug 2021 22:45:11 +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: gJLye5PlOV8YSEiXkMcnI7I5CZAcvcMF X-Proofpoint-ORIG-GUID: gJLye5PlOV8YSEiXkMcnI7I5CZAcvcMF 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-26_05,2021-08-26_02,2020-04-07_01 Subject: [dpdk-dev] [v4, 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 | 1 + 2 files changed, 101 insertions(+) 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..d5d1978569 100644 --- a/drivers/mempool/cnxk/meson.build +++ b/drivers/mempool/cnxk/meson.build @@ -11,6 +11,7 @@ endif sources = files( 'cnxk_mempool.c', 'cnxk_mempool_ops.c', + 'cnxk_mempool_telemetry.c', 'cn9k_mempool_ops.c', 'cn10k_mempool_ops.c', ) -- 2.25.1