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 176DAA0547; Wed, 29 Sep 2021 08:55:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F4DE41102; Wed, 29 Sep 2021 08:55:22 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id EE628410F6 for ; Wed, 29 Sep 2021 08:55:20 +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 18T3TGUs008641 for ; Tue, 28 Sep 2021 23:55:20 -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=vwCm9uK6sDyeV9hTNZrLrPlfEnu4dZRCMpLIevyFjaw=; b=J1RK2TcbKSsUMJS2E7oR/FaGygOzUznBDO+DCaaB/Xs4PGxn3iHUTpfzMw0gyoI3z5mP EVbX87vMnim9AaEJIzpNyTl6FpJlb3UcTZyhMa5BEN4Al9V5HmywJJDm15Y4ahkfB1r8 tpdEmdHWwDyOXobFy3DhDQM7ShTsZLUtSwYARXJzJ3nGB7HMTr5Cv54lkzyLKmkjGwT9 PHwbH+foa/auyeDv49UHiy/JmI5LrNmKMkAXZ7WoP4FPEthwLTguggoPyyz3qo377Xge OYIV3MmSQXnqyZ2GseyUJNCRRwKC16nNBEBN5qlRr9VPWSoBPt3tTCLUuIxWK0LHnxEQ hw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3bc7eyjmtg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 28 Sep 2021 23:55:20 -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:18 -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:18 -0700 Received: from localhost.localdomain (unknown [10.28.34.38]) by maili.marvell.com (Postfix) with ESMTP id 1C6873F707E; Tue, 28 Sep 2021 23:55:15 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: , , , , , , , Gowrishankar Muthukrishnan Date: Wed, 29 Sep 2021 12:25:02 +0530 Message-ID: <8f64ea3b3ebf1a37e7d7ea7ec74e7bf55c15f590.1632896495.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-GUID: hucVER3E10Q3ZcbwDQfB1et76HfvFQxn X-Proofpoint-ORIG-GUID: hucVER3E10Q3ZcbwDQfB1et76HfvFQxn 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 3/4] mempool/cnxk: add telemetry endpoints mempool 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 endpoints to cnxk mempool driver. Signed-off-by: Gowrishankar Muthukrishnan --- drivers/mempool/cnxk/cnxk_mempool_telemetry.c | 57 +++++++++++++++++++ drivers/mempool/cnxk/meson.build | 1 + 2 files changed, 58 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..c71798d7fd --- /dev/null +++ b/drivers/mempool/cnxk/cnxk_mempool_telemetry.c @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2021 Marvell. + */ + +#include +#include +#include + +#include + +#include "cnxk_mempool.h" +#include "cnxk_telemetry.h" + +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; + int aura_id; + + if (strncmp(mp->name, info->pool_name, RTE_MEMZONE_NAMESIZE)) + return; + + aura_id = roc_npa_aura_handle_to_aura(mp->pool_id); + rte_tel_data_add_dict_int(info->d, "aura_id", aura_id); +} + +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 -EINVAL; + + 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/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