> -----Original Message-----
> From: dev <dev-boun...@dpdk.org> On Behalf Of Gowrishankar
> Muthukrishnan
> Sent: Wednesday, September 29, 2021 12:25 PM
> To: dev@dpdk.org
> Cc: Jerin Jacob Kollanukkaran <jer...@marvell.com>; Kiran Kumar
> Kokkilagadda <kirankum...@marvell.com>; Nithin Kumar Dabilpuram
> <ndabilpu...@marvell.com>; Sunil Kumar Kori <sk...@marvell.com>; Satha
> Koteswara Rao Kottidi <skotesh...@marvell.com>; Ashwin Sekhar
> Thalakalath Kottilveetil <asek...@marvell.com>; Pavan Nikhilesh
> Bhagavatula <pbhagavat...@marvell.com>; Gowrishankar Muthukrishnan
> <gmuthukri...@marvell.com>
> Subject: [EXT] [dpdk-dev] [v9 3/4] mempool/cnxk: add telemetry endpoints
> mempool
> 
> External Email
> 
> ----------------------------------------------------------------------
> Adding telemetry endpoints to cnxk mempool driver.
> 
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukri...@marvell.com>

LGTM

Reviewed-by: Harman Kalra <hka...@marvell.com>

Thanks
Harman

> ---
>  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 <rte_mempool.h>
> +#include <rte_memzone.h>
> +#include <rte_telemetry.h>
> +
> +#include <roc_api.h>
> +
> +#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

Reply via email to