1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
5 #include <rte_mempool.h>
6 #include <rte_memzone.h>
7 #include <rte_telemetry.h>
11 #include "cnxk_mempool.h"
12 #include "cnxk_telemetry.h"
14 struct mempool_info_cb_arg {
16 struct rte_tel_data *d;
20 mempool_info_cb(struct rte_mempool *mp, void *arg)
22 struct mempool_info_cb_arg *info = (struct mempool_info_cb_arg *)arg;
25 if (strncmp(mp->name, info->pool_name, RTE_MEMZONE_NAMESIZE))
28 aura_id = roc_npa_aura_handle_to_aura(mp->pool_id);
29 rte_tel_data_add_dict_int(info->d, "aura_id", aura_id);
33 mempool_tel_handle_info(const char *cmd __rte_unused, const char *params,
34 struct rte_tel_data *d)
36 struct mempool_info_cb_arg mp_arg;
37 char name[RTE_MEMZONE_NAMESIZE];
39 if (params == NULL || strlen(params) == 0)
42 rte_strlcpy(name, params, RTE_MEMZONE_NAMESIZE);
44 rte_tel_data_start_dict(d);
45 mp_arg.pool_name = name;
47 rte_mempool_walk(mempool_info_cb, &mp_arg);
52 RTE_INIT(cnxk_mempool_init_telemetry)
54 rte_telemetry_register_cmd(
55 "/cnxk/mempool/info", mempool_tel_handle_info,
56 "Returns mempool info. Parameters: pool_name");