LCOV - code coverage report
Current view: top level - drivers/mempool/cnxk - cnxk_mempool_telemetry.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 3 14 21.4 %
Date: 2025-02-01 18:54:23 Functions: 1 3 33.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 6 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(C) 2021 Marvell.
       3                 :            :  */
       4                 :            : 
       5                 :            : #include <rte_mempool.h>
       6                 :            : #include <rte_memzone.h>
       7                 :            : #include <rte_telemetry.h>
       8                 :            : 
       9                 :            : #include <roc_api.h>
      10                 :            : 
      11                 :            : #include "cnxk_mempool.h"
      12                 :            : #include "cnxk_telemetry.h"
      13                 :            : 
      14                 :            : struct mempool_info_cb_arg {
      15                 :            :         char *pool_name;
      16                 :            :         struct rte_tel_data *d;
      17                 :            : };
      18                 :            : 
      19                 :            : static void
      20                 :          0 : mempool_info_cb(struct rte_mempool *mp, void *arg)
      21                 :            : {
      22                 :            :         struct mempool_info_cb_arg *info = (struct mempool_info_cb_arg *)arg;
      23                 :            :         int aura_id;
      24                 :            : 
      25         [ #  # ]:          0 :         if (strncmp(mp->name, info->pool_name, RTE_MEMZONE_NAMESIZE))
      26                 :            :                 return;
      27                 :            : 
      28                 :          0 :         aura_id = roc_npa_aura_handle_to_aura(mp->pool_id);
      29                 :          0 :         rte_tel_data_add_dict_int(info->d, "aura_id", aura_id);
      30                 :            : }
      31                 :            : 
      32                 :            : static int
      33                 :          0 : mempool_tel_handle_info(const char *cmd __rte_unused, const char *params,
      34                 :            :                         struct rte_tel_data *d)
      35                 :            : {
      36                 :            :         struct mempool_info_cb_arg mp_arg;
      37                 :            :         char name[RTE_MEMZONE_NAMESIZE];
      38                 :            : 
      39   [ #  #  #  # ]:          0 :         if (params == NULL || strlen(params) == 0)
      40                 :            :                 return -EINVAL;
      41                 :            : 
      42                 :            :         rte_strlcpy(name, params, RTE_MEMZONE_NAMESIZE);
      43                 :            : 
      44                 :          0 :         rte_tel_data_start_dict(d);
      45                 :          0 :         mp_arg.pool_name = name;
      46                 :          0 :         mp_arg.d = d;
      47                 :          0 :         rte_mempool_walk(mempool_info_cb, &mp_arg);
      48                 :            : 
      49                 :          0 :         return 0;
      50                 :            : }
      51                 :            : 
      52                 :        252 : RTE_INIT(cnxk_mempool_init_telemetry)
      53                 :            : {
      54                 :        252 :         rte_telemetry_register_cmd(
      55                 :            :                 "/cnxk/mempool/info", mempool_tel_handle_info,
      56                 :            :                 "Returns mempool info. Parameters: pool_name");
      57                 :        252 : }

Generated by: LCOV version 1.14