LCOV - code coverage report
Current view: top level - drivers/common/cnxk - cnxk_telemetry_nix.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 11 481 2.3 %
Date: 2024-01-22 15:55:54 Functions: 1 21 4.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 106 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(C) 2021 Marvell.
       3                 :            :  */
       4                 :            : 
       5                 :            : #include <ctype.h>
       6                 :            : #include "cnxk_telemetry.h"
       7                 :            : #include "roc_api.h"
       8                 :            : #include "roc_priv.h"
       9                 :            : 
      10                 :            : struct nix_tel_node {
      11                 :            :         TAILQ_ENTRY(nix_tel_node) node;
      12                 :            :         struct roc_nix *nix;
      13                 :            :         uint16_t n_rq;
      14                 :            :         uint16_t n_cq;
      15                 :            :         uint16_t n_sq;
      16                 :            :         struct roc_nix_rq **rqs;
      17                 :            :         struct roc_nix_cq **cqs;
      18                 :            :         struct roc_nix_sq **sqs;
      19                 :            : };
      20                 :            : 
      21                 :            : TAILQ_HEAD(nix_tel_node_list, nix_tel_node);
      22                 :            : static struct nix_tel_node_list nix_list;
      23                 :            : 
      24                 :            : static struct nix_tel_node *
      25                 :            : nix_tel_node_get(struct roc_nix *roc_nix)
      26                 :            : {
      27                 :            :         struct nix_tel_node *node, *roc_node = NULL;
      28                 :            : 
      29   [ #  #  #  #  :          0 :         TAILQ_FOREACH(node, &nix_list, node) {
             #  #  #  # ]
      30   [ #  #  #  #  :          0 :                 if (node->nix == roc_nix) {
             #  #  #  # ]
      31                 :            :                         roc_node = node;
      32                 :            :                         break;
      33                 :            :                 }
      34                 :            :         }
      35                 :            : 
      36                 :            :         return roc_node;
      37                 :            : }
      38                 :            : 
      39                 :            : int
      40                 :          0 : nix_tel_node_add(struct roc_nix *roc_nix)
      41                 :            : {
      42                 :            :         struct nix *nix = roc_nix_to_nix_priv(roc_nix);
      43                 :            :         struct nix_tel_node *node;
      44                 :            : 
      45                 :            :         node = nix_tel_node_get(roc_nix);
      46         [ #  # ]:          0 :         if (node) {
      47         [ #  # ]:          0 :                 if (nix->nb_rx_queues == node->n_rq &&
      48         [ #  # ]:          0 :                     nix->nb_tx_queues == node->n_sq)
      49                 :            :                         return 0;
      50                 :            : 
      51                 :          0 :                 nix_tel_node_del(roc_nix);
      52                 :            :         }
      53                 :            : 
      54                 :          0 :         node = plt_zmalloc(sizeof(struct nix_tel_node), 0);
      55         [ #  # ]:          0 :         if (!node)
      56                 :            :                 return -1;
      57                 :            : 
      58                 :          0 :         node->nix = roc_nix;
      59                 :          0 :         node->rqs =
      60                 :          0 :                 plt_zmalloc(nix->nb_rx_queues * sizeof(struct roc_nix_rq *), 0);
      61                 :          0 :         node->cqs =
      62                 :          0 :                 plt_zmalloc(nix->nb_rx_queues * sizeof(struct roc_nix_cq *), 0);
      63                 :          0 :         node->sqs =
      64                 :          0 :                 plt_zmalloc(nix->nb_tx_queues * sizeof(struct roc_nix_sq *), 0);
      65                 :          0 :         TAILQ_INSERT_TAIL(&nix_list, node, node);
      66                 :            : 
      67                 :          0 :         return 0;
      68                 :            : }
      69                 :            : 
      70                 :            : void
      71                 :          0 : nix_tel_node_del(struct roc_nix *roc_nix)
      72                 :            : {
      73                 :            :         struct nix_tel_node *node;
      74                 :            : 
      75         [ #  # ]:          0 :         TAILQ_FOREACH(node, &nix_list, node) {
      76         [ #  # ]:          0 :                 if (node->nix == roc_nix) {
      77                 :          0 :                         plt_free(node->rqs);
      78                 :          0 :                         plt_free(node->cqs);
      79                 :          0 :                         plt_free(node->sqs);
      80         [ #  # ]:          0 :                         TAILQ_REMOVE(&nix_list, node, node);
      81                 :            :                 }
      82                 :            :         }
      83                 :            : 
      84                 :          0 :         plt_free(node);
      85                 :          0 : }
      86                 :            : 
      87                 :            : static struct nix_tel_node *
      88                 :          0 : nix_tel_node_get_by_pcidev_name(const char *name)
      89                 :            : {
      90                 :            :         struct nix_tel_node *node, *roc_node = NULL;
      91                 :            : 
      92         [ #  # ]:          0 :         TAILQ_FOREACH(node, &nix_list, node) {
      93         [ #  # ]:          0 :                 if (!strncmp(node->nix->pci_dev->name, name,
      94                 :            :                              PCI_PRI_STR_SIZE)) {
      95                 :            :                         roc_node = node;
      96                 :            :                         break;
      97                 :            :                 }
      98                 :            :         }
      99                 :            : 
     100                 :          0 :         return roc_node;
     101                 :            : }
     102                 :            : 
     103                 :            : int
     104                 :          0 : nix_tel_node_add_rq(struct roc_nix_rq *rq)
     105                 :            : {
     106                 :            :         struct nix_tel_node *node;
     107                 :            : 
     108                 :          0 :         node = nix_tel_node_get(rq->roc_nix);
     109         [ #  # ]:          0 :         if (!node)
     110                 :            :                 return -1;
     111                 :            : 
     112                 :          0 :         node->rqs[rq->qid] = rq;
     113                 :          0 :         node->n_rq++;
     114                 :          0 :         return 0;
     115                 :            : }
     116                 :            : 
     117                 :            : int
     118                 :          0 : nix_tel_node_add_cq(struct roc_nix_cq *cq)
     119                 :            : {
     120                 :            :         struct nix_tel_node *node;
     121                 :            : 
     122                 :          0 :         node = nix_tel_node_get(cq->roc_nix);
     123         [ #  # ]:          0 :         if (!node)
     124                 :            :                 return -1;
     125                 :            : 
     126                 :          0 :         node->cqs[cq->qid] = cq;
     127                 :          0 :         node->n_cq++;
     128                 :          0 :         return 0;
     129                 :            : }
     130                 :            : 
     131                 :            : int
     132                 :          0 : nix_tel_node_add_sq(struct roc_nix_sq *sq)
     133                 :            : {
     134                 :            :         struct nix_tel_node *node;
     135                 :            : 
     136                 :          0 :         node = nix_tel_node_get(sq->roc_nix);
     137         [ #  # ]:          0 :         if (!node)
     138                 :            :                 return -1;
     139                 :            : 
     140                 :          0 :         node->sqs[sq->qid] = sq;
     141                 :          0 :         node->n_sq++;
     142                 :          0 :         return 0;
     143                 :            : }
     144                 :            : 
     145                 :            : static int
     146                 :          0 : cnxk_tel_nix(struct roc_nix *roc_nix, struct plt_tel_data *d)
     147                 :            : {
     148                 :            :         struct nix *nix = roc_nix_to_nix_priv(roc_nix);
     149                 :            : 
     150                 :            :         struct dev *dev = &nix->dev;
     151                 :            : 
     152                 :          0 :         plt_tel_data_add_dict_ptr(d, "nix", nix);
     153                 :          0 :         plt_tel_data_add_dict_int(d, "pf_func", dev->pf_func);
     154                 :          0 :         plt_tel_data_add_dict_int(d, "pf", dev_get_pf(dev->pf_func));
     155                 :          0 :         plt_tel_data_add_dict_int(d, "vf", dev_get_vf(dev->pf_func));
     156                 :            : 
     157                 :          0 :         CNXK_TEL_DICT_PTR(d, dev, bar2);
     158                 :          0 :         CNXK_TEL_DICT_PTR(d, dev, bar4);
     159                 :          0 :         CNXK_TEL_DICT_INT(d, roc_nix, port_id);
     160                 :          0 :         CNXK_TEL_DICT_INT(d, roc_nix, rss_tag_as_xor);
     161                 :          0 :         CNXK_TEL_DICT_INT(d, roc_nix, max_sqb_count);
     162                 :          0 :         CNXK_TEL_DICT_PTR(d, nix, pci_dev);
     163                 :          0 :         CNXK_TEL_DICT_PTR(d, nix, base);
     164                 :          0 :         CNXK_TEL_DICT_PTR(d, nix, lmt_base);
     165                 :          0 :         CNXK_TEL_DICT_INT(d, nix, reta_sz);
     166                 :          0 :         CNXK_TEL_DICT_INT(d, nix, tx_chan_base);
     167                 :          0 :         CNXK_TEL_DICT_INT(d, nix, rx_chan_base);
     168                 :          0 :         CNXK_TEL_DICT_INT(d, nix, nb_tx_queues);
     169                 :          0 :         CNXK_TEL_DICT_INT(d, nix, nb_rx_queues);
     170                 :          0 :         CNXK_TEL_DICT_INT(d, nix, lso_tsov6_idx);
     171                 :          0 :         CNXK_TEL_DICT_INT(d, nix, lso_tsov4_idx);
     172                 :            : 
     173                 :          0 :         plt_tel_data_add_dict_int(d, "lso_udp_tun_v4v4",
     174                 :          0 :                                   nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V4]);
     175                 :          0 :         plt_tel_data_add_dict_int(d, "lso_udp_tun_v4v6",
     176                 :          0 :                                   nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V6]);
     177                 :          0 :         plt_tel_data_add_dict_int(d, "lso_udp_tun_v6v4",
     178                 :          0 :                                   nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V4]);
     179                 :          0 :         plt_tel_data_add_dict_int(d, "lso_udp_tun_v6v6",
     180                 :          0 :                                   nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V6]);
     181                 :          0 :         plt_tel_data_add_dict_int(d, "lso_tun_v4v4",
     182                 :          0 :                                   nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V4]);
     183                 :          0 :         plt_tel_data_add_dict_int(d, "lso_tun_v4v6",
     184                 :          0 :                                   nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V6]);
     185                 :          0 :         plt_tel_data_add_dict_int(d, "lso_tun_v6v4",
     186                 :          0 :                                   nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V4]);
     187                 :          0 :         plt_tel_data_add_dict_int(d, "lso_tun_v6v6",
     188                 :          0 :                                   nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V6]);
     189                 :            : 
     190                 :          0 :         CNXK_TEL_DICT_INT(d, nix, lf_tx_stats);
     191                 :          0 :         CNXK_TEL_DICT_INT(d, nix, lf_rx_stats);
     192                 :          0 :         CNXK_TEL_DICT_INT(d, nix, cgx_links);
     193                 :          0 :         CNXK_TEL_DICT_INT(d, nix, lbk_links);
     194                 :          0 :         CNXK_TEL_DICT_INT(d, nix, sdp_links);
     195                 :          0 :         CNXK_TEL_DICT_INT(d, nix, tx_link);
     196                 :          0 :         CNXK_TEL_DICT_INT(d, nix, sqb_size);
     197                 :          0 :         CNXK_TEL_DICT_INT(d, nix, msixoff);
     198                 :          0 :         CNXK_TEL_DICT_INT(d, nix, cints);
     199                 :          0 :         CNXK_TEL_DICT_INT(d, nix, qints);
     200                 :          0 :         CNXK_TEL_DICT_INT(d, nix, sdp_link);
     201                 :          0 :         CNXK_TEL_DICT_INT(d, nix, ptp_en);
     202                 :          0 :         CNXK_TEL_DICT_INT(d, nix, rss_alg_idx);
     203                 :          0 :         CNXK_TEL_DICT_INT(d, nix, tx_pause);
     204                 :            : 
     205                 :          0 :         return 0;
     206                 :            : }
     207                 :            : 
     208                 :            : static int
     209                 :          0 : cnxk_tel_nix_rq(struct roc_nix_rq *rq, struct plt_tel_data *d)
     210                 :            : {
     211                 :          0 :         plt_tel_data_add_dict_ptr(d, "nix_rq", rq);
     212                 :          0 :         CNXK_TEL_DICT_INT(d, rq, qid);
     213                 :          0 :         CNXK_TEL_DICT_PTR(d, rq, aura_handle);
     214                 :          0 :         CNXK_TEL_DICT_INT(d, rq, ipsech_ena);
     215                 :          0 :         CNXK_TEL_DICT_INT(d, rq, first_skip);
     216                 :          0 :         CNXK_TEL_DICT_INT(d, rq, later_skip);
     217                 :          0 :         CNXK_TEL_DICT_INT(d, rq, lpb_size);
     218                 :          0 :         CNXK_TEL_DICT_INT(d, rq, sso_ena);
     219                 :          0 :         CNXK_TEL_DICT_INT(d, rq, tag_mask);
     220                 :          0 :         CNXK_TEL_DICT_INT(d, rq, flow_tag_width);
     221                 :          0 :         CNXK_TEL_DICT_INT(d, rq, tt);
     222                 :          0 :         CNXK_TEL_DICT_INT(d, rq, hwgrp);
     223                 :          0 :         CNXK_TEL_DICT_INT(d, rq, vwqe_ena);
     224                 :          0 :         CNXK_TEL_DICT_INT(d, rq, vwqe_first_skip);
     225                 :          0 :         CNXK_TEL_DICT_INT(d, rq, vwqe_max_sz_exp);
     226                 :          0 :         CNXK_TEL_DICT_INT(d, rq, vwqe_wait_tmo);
     227                 :          0 :         CNXK_TEL_DICT_INT(d, rq, vwqe_aura_handle);
     228                 :          0 :         CNXK_TEL_DICT_PTR(d, rq, roc_nix);
     229                 :            : 
     230                 :          0 :         return 0;
     231                 :            : }
     232                 :            : 
     233                 :            : static int
     234                 :          0 : cnxk_tel_nix_cq(struct roc_nix_cq *cq, struct plt_tel_data *d)
     235                 :            : {
     236                 :          0 :         plt_tel_data_add_dict_ptr(d, "nix_cq", cq);
     237                 :          0 :         CNXK_TEL_DICT_INT(d, cq, qid);
     238                 :          0 :         CNXK_TEL_DICT_INT(d, cq, nb_desc);
     239                 :          0 :         CNXK_TEL_DICT_PTR(d, cq, roc_nix);
     240                 :          0 :         CNXK_TEL_DICT_PTR(d, cq, door);
     241                 :          0 :         CNXK_TEL_DICT_PTR(d, cq, status);
     242                 :          0 :         CNXK_TEL_DICT_PTR(d, cq, wdata);
     243                 :          0 :         CNXK_TEL_DICT_PTR(d, cq, desc_base);
     244                 :          0 :         CNXK_TEL_DICT_INT(d, cq, qmask);
     245                 :            : 
     246                 :          0 :         return 0;
     247                 :            : }
     248                 :            : 
     249                 :            : static int
     250                 :          0 : cnxk_tel_nix_sq(struct roc_nix_sq *sq, struct plt_tel_data *d)
     251                 :            : {
     252                 :          0 :         plt_tel_data_add_dict_ptr(d, "nix_sq", sq);
     253                 :          0 :         CNXK_TEL_DICT_INT(d, sq, qid);
     254                 :          0 :         CNXK_TEL_DICT_INT(d, sq, max_sqe_sz);
     255                 :          0 :         CNXK_TEL_DICT_INT(d, sq, nb_desc);
     256                 :          0 :         CNXK_TEL_DICT_INT(d, sq, sqes_per_sqb_log2);
     257                 :          0 :         CNXK_TEL_DICT_PTR(d, sq, roc_nix);
     258                 :          0 :         CNXK_TEL_DICT_PTR(d, sq, aura_handle);
     259                 :          0 :         CNXK_TEL_DICT_INT(d, sq, nb_sqb_bufs_adj);
     260                 :          0 :         CNXK_TEL_DICT_INT(d, sq, nb_sqb_bufs);
     261                 :          0 :         CNXK_TEL_DICT_PTR(d, sq, io_addr);
     262                 :          0 :         CNXK_TEL_DICT_PTR(d, sq, lmt_addr);
     263                 :          0 :         CNXK_TEL_DICT_PTR(d, sq, sqe_mem);
     264                 :          0 :         CNXK_TEL_DICT_PTR(d, sq, fc);
     265                 :            : 
     266                 :          0 :         return 0;
     267                 :            : }
     268                 :            : 
     269                 :            : static void
     270                 :          0 : nix_rq_ctx_cn9k(volatile void *qctx, struct plt_tel_data *d)
     271                 :            : {
     272                 :            :         volatile struct nix_rq_ctx_s *ctx;
     273                 :            : 
     274                 :            :         ctx = (volatile struct nix_rq_ctx_s *)qctx;
     275                 :            : 
     276                 :            :         /* W0 */
     277                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
     278                 :          0 :         CNXK_TEL_DICT_BF_PTR(d, ctx, substream, w0_);
     279                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
     280                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ena_wqwd, w0_);
     281                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ipsech_ena, w0_);
     282                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sso_ena, w0_);
     283                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
     284                 :            : 
     285                 :            :         /* W1 */
     286                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_drop_ena, w1_);
     287                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_drop_ena, w1_);
     288                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xqe_drop_ena, w1_);
     289                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, wqe_caching, w1_);
     290                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, pb_caching, w1_);
     291                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sso_tt, w1_);
     292                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sso_grp, w1_);
     293                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_aura, w1_);
     294                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_aura, w1_);
     295                 :            : 
     296                 :            :         /* W2 */
     297                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xqe_hdr_split, w2_);
     298                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xqe_imm_copy, w2_);
     299                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xqe_imm_size, w2_);
     300                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, later_skip, w2_);
     301                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, first_skip, w2_);
     302                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_sizem1, w2_);
     303                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_ena, w2_);
     304                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, wqe_skip, w2_);
     305                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_sizem1, w2_);
     306                 :            : 
     307                 :            :         /* W3 */
     308                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_pool_pass, w3_);
     309                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_pool_drop, w3_);
     310                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_aura_pass, w3_);
     311                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_aura_drop, w3_);
     312                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, wqe_pool_pass, w3_);
     313                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, wqe_pool_drop, w3_);
     314                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xqe_pass, w3_);
     315                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xqe_drop, w3_);
     316                 :            : 
     317                 :            :         /* W4 */
     318                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, qint_idx, w4_);
     319                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, rq_int_ena, w4_);
     320                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, rq_int, w4_);
     321                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_pool_pass, w4_);
     322                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_pool_drop, w4_);
     323                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_aura_pass, w4_);
     324                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_aura_drop, w4_);
     325                 :            : 
     326                 :            :         /* W5 */
     327                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, flow_tagw, w5_);
     328                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, bad_utag, w5_);
     329                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, good_utag, w5_);
     330                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ltag, w5_);
     331                 :            : 
     332                 :            :         /* W6 */
     333                 :          0 :         CNXK_TEL_DICT_U64(d, ctx, octs, w6_);
     334                 :            : 
     335                 :            :         /* W7 */
     336                 :          0 :         CNXK_TEL_DICT_U64(d, ctx, pkts, w7_);
     337                 :            : 
     338                 :            :         /* W8 */
     339                 :          0 :         CNXK_TEL_DICT_U64(d, ctx, drop_octs, w8_);
     340                 :            : 
     341                 :            :         /* W9 */
     342                 :          0 :         CNXK_TEL_DICT_U64(d, ctx, drop_pkts, w9_);
     343                 :            : 
     344                 :            :         /* W10 */
     345                 :          0 :         CNXK_TEL_DICT_U64(d, ctx, re_pkts, w10_);
     346                 :          0 : }
     347                 :            : 
     348                 :            : static void
     349                 :          0 : nix_rq_ctx(volatile void *qctx, struct plt_tel_data *d)
     350                 :            : {
     351                 :            :         volatile struct nix_cn10k_rq_ctx_s *ctx;
     352                 :            : 
     353                 :            :         ctx = (volatile struct nix_cn10k_rq_ctx_s *)qctx;
     354                 :            : 
     355                 :            :         /* W0 */
     356                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
     357                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, len_ol3_dis, w0_);
     358                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, len_ol4_dis, w0_);
     359                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, len_il3_dis, w0_);
     360                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, len_il4_dis, w0_);
     361                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, csum_ol4_dis, w0_);
     362                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lenerr_dis, w0_);
     363                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ena_wqwd, w0);
     364                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ipsech_ena, w0);
     365                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sso_ena, w0);
     366                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ena, w0);
     367                 :            : 
     368                 :            :         /* W1 */
     369                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, chi_ena, w1_);
     370                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ipsecd_drop_en, w1_);
     371                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, pb_stashing, w1_);
     372                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_drop_ena, w1_);
     373                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_drop_ena, w1_);
     374                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xqe_drop_ena, w1_);
     375                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, wqe_caching, w1_);
     376                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, pb_caching, w1_);
     377                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sso_tt, w1_);
     378                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sso_grp, w1_);
     379                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_aura, w1_);
     380                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_aura, w1_);
     381                 :            : 
     382                 :            :         /* W2 */
     383                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xqe_hdr_split, w2_);
     384                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xqe_imm_copy, w2_);
     385                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xqe_imm_size, w2_);
     386                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, later_skip, w2_);
     387                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, first_skip, w2_);
     388                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_sizem1, w2_);
     389                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_ena, w2_);
     390                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, wqe_skip, w2_);
     391                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_sizem1, w2_);
     392                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, policer_ena, w2_);
     393                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, band_prof_id, w2_);
     394                 :            : 
     395                 :            :         /* W3 */
     396                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_pool_pass, w3_);
     397                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_pool_drop, w3_);
     398                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_aura_pass, w3_);
     399                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, spb_aura_drop, w3_);
     400                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, wqe_pool_pass, w3_);
     401                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, wqe_pool_drop, w3_);
     402                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xqe_pass, w3_);
     403                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xqe_drop, w3_);
     404                 :            : 
     405                 :            :         /* W4 */
     406                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, qint_idx, w4_);
     407                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, rq_int_ena, w4_);
     408                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, rq_int, w4_);
     409                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_pool_pass, w4_);
     410                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_pool_drop, w4_);
     411                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_aura_pass, w4_);
     412                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lpb_aura_drop, w4_);
     413                 :            : 
     414                 :            :         /* W5 */
     415                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vwqe_skip, w5_);
     416                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, max_vsize_exp, w5_);
     417                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vtime_wait, w5_);
     418                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vwqe_ena, w5_);
     419                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ipsec_vwqe, w5_);
     420                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, flow_tagw, w5_);
     421                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, bad_utag, w5_);
     422                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, good_utag, w5_);
     423                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ltag, w5_);
     424                 :            : 
     425                 :            :         /* W6 */
     426                 :          0 :         CNXK_TEL_DICT_U64(d, ctx, octs, w6_);
     427                 :            : 
     428                 :            :         /* W7 */
     429                 :          0 :         CNXK_TEL_DICT_U64(d, ctx, pkts, w7_);
     430                 :            : 
     431                 :            :         /* W8 */
     432                 :          0 :         CNXK_TEL_DICT_U64(d, ctx, drop_octs, w8_);
     433                 :            : 
     434                 :            :         /* W9 */
     435                 :          0 :         CNXK_TEL_DICT_U64(d, ctx, drop_pkts, w9_);
     436                 :            : 
     437                 :            :         /* W10 */
     438                 :          0 :         CNXK_TEL_DICT_U64(d, ctx, re_pkts, w10_);
     439                 :          0 : }
     440                 :            : 
     441                 :            : static int
     442                 :          0 : cnxk_tel_nix_rq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
     443                 :            : {
     444                 :            :         struct nix *nix = roc_nix_to_nix_priv(roc_nix);
     445                 :          0 :         struct dev *dev = &nix->dev;
     446                 :            :         struct npa_lf *npa_lf;
     447                 :            :         volatile void *qctx;
     448                 :            :         int rc = -1;
     449                 :            : 
     450                 :          0 :         npa_lf = idev_npa_obj_get();
     451         [ #  # ]:          0 :         if (npa_lf == NULL)
     452                 :            :                 return NPA_ERR_DEVICE_NOT_BOUNDED;
     453                 :            : 
     454                 :          0 :         rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_RQ, n, &qctx);
     455         [ #  # ]:          0 :         if (rc) {
     456                 :          0 :                 plt_err("Failed to get rq context");
     457                 :          0 :                 return rc;
     458                 :            :         }
     459                 :            : 
     460         [ #  # ]:          0 :         if (roc_model_is_cn9k())
     461                 :          0 :                 nix_rq_ctx_cn9k(qctx, d);
     462                 :            :         else
     463                 :          0 :                 nix_rq_ctx(qctx, d);
     464                 :            : 
     465                 :            :         return 0;
     466                 :            : }
     467                 :            : 
     468                 :            : static int
     469                 :          0 : cnxk_tel_nix_cq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
     470                 :            : {
     471                 :            :         struct nix *nix = roc_nix_to_nix_priv(roc_nix);
     472                 :          0 :         struct dev *dev = &nix->dev;
     473                 :            :         struct npa_lf *npa_lf;
     474                 :            :         volatile struct nix_cq_ctx_s *ctx;
     475                 :            :         int rc = -1;
     476                 :            : 
     477                 :          0 :         npa_lf = idev_npa_obj_get();
     478         [ #  # ]:          0 :         if (npa_lf == NULL)
     479                 :            :                 return NPA_ERR_DEVICE_NOT_BOUNDED;
     480                 :            : 
     481                 :          0 :         rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_CQ, n, (void *)&ctx);
     482         [ #  # ]:          0 :         if (rc) {
     483                 :          0 :                 plt_err("Failed to get cq context");
     484                 :          0 :                 return rc;
     485                 :            :         }
     486                 :            : 
     487                 :            :         /* W0 */
     488                 :          0 :         CNXK_TEL_DICT_PTR(d, ctx, base, w0_);
     489                 :            : 
     490                 :            :         /* W1 */
     491                 :          0 :         CNXK_TEL_DICT_U64(d, ctx, wrptr, w1_);
     492                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, avg_con, w1_);
     493                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, cint_idx, w1_);
     494                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, cq_err, w1_);
     495                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, qint_idx, w1_);
     496                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, bpid, w1_);
     497                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, bp_ena, w1_);
     498                 :            : 
     499                 :            :         /* W2 */
     500                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, update_time, w2_);
     501                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, avg_level, w2_);
     502                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, head, w2_);
     503                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, tail, w2_);
     504                 :            : 
     505                 :            :         /* W3 */
     506                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, cq_err_int_ena, w3_);
     507                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, cq_err_int, w3_);
     508                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, qsize, w3_);
     509                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, caching, w3_);
     510                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, substream, w3_);
     511                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ena, w3_);
     512                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, drop_ena, w3_);
     513                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, drop, w3_);
     514                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, bp, w3_);
     515                 :            : 
     516                 :          0 :         return 0;
     517                 :            : }
     518                 :            : 
     519                 :            : static void
     520                 :          0 : nix_sq_ctx_cn9k(volatile void *qctx, struct plt_tel_data *d)
     521                 :            : {
     522                 :            :         volatile struct nix_sq_ctx_s *ctx;
     523                 :            : 
     524                 :            :         ctx = (volatile struct nix_sq_ctx_s *)qctx;
     525                 :            : 
     526                 :            :         /* W0 */
     527                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
     528                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
     529                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sdp_mcast, w0_);
     530                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, substream, w0_);
     531                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, qint_idx, w0_);
     532                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
     533                 :            : 
     534                 :            :         /* W1 */
     535                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sqb_count, w1_);
     536                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, default_chan, w1_);
     537                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_rr_quantum, w1_);
     538                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sso_ena, w1_);
     539                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xoff, w1_);
     540                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, cq_ena, w1_);
     541                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq, w1_);
     542                 :            : 
     543                 :            :         /* W2 */
     544                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sqe_stype, w2_);
     545                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sq_int_ena, w2_);
     546                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sq_int, w2_);
     547                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sqb_aura, w2_);
     548                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_rr_count, w2_);
     549                 :            : 
     550                 :            :         /* W3 */
     551                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_next_sq_vld, w3_);
     552                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_pend, w3_);
     553                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smenq_next_sqb_vld, w3_);
     554                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, head_offset, w3_);
     555                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smenq_offset, w3_);
     556                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, tail_offset, w3_);
     557                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_lso_segnum, w3_);
     558                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_next_sq, w3_);
     559                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, mnq_dis, w3_);
     560                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lmt_dis, w3_);
     561                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, cq_limit, w3_);
     562                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, max_sqe_size, w3_);
     563                 :            : 
     564                 :            :         /* W4 */
     565                 :          0 :         CNXK_TEL_DICT_PTR(d, ctx, next_sqb, w4_);
     566                 :            : 
     567                 :            :         /* W5 */
     568                 :          0 :         CNXK_TEL_DICT_PTR(d, ctx, tail_sqb, w5_);
     569                 :            : 
     570                 :            :         /* W6 */
     571                 :          0 :         CNXK_TEL_DICT_PTR(d, ctx, smenq_sqb, w6_);
     572                 :            : 
     573                 :            :         /* W7 */
     574                 :          0 :         CNXK_TEL_DICT_PTR(d, ctx, smenq_next_sqb, w7_);
     575                 :            : 
     576                 :            :         /* W8 */
     577                 :          0 :         CNXK_TEL_DICT_PTR(d, ctx, head_sqb, w8_);
     578                 :            : 
     579                 :            :         /* W9 */
     580                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vld, w9_);
     581                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan1_ins_ena, w9_);
     582                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan0_ins_ena, w9_);
     583                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_mps, w9_);
     584                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sb, w9_);
     585                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sizem1, w9_);
     586                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_total, w9_);
     587                 :            : 
     588                 :            :         /* W10 */
     589                 :          0 :         CNXK_TEL_DICT_BF_PTR(d, ctx, scm_lso_rem, w10_);
     590                 :            : 
     591                 :            :         /* W11 */
     592                 :          0 :         CNXK_TEL_DICT_BF_PTR(d, ctx, octs, w11_);
     593                 :            : 
     594                 :            :         /* W12 */
     595                 :          0 :         CNXK_TEL_DICT_BF_PTR(d, ctx, pkts, w12_);
     596                 :            : 
     597                 :            :         /* W14 */
     598                 :          0 :         CNXK_TEL_DICT_BF_PTR(d, ctx, drop_octs, w14_);
     599                 :            : 
     600                 :            :         /* W15 */
     601                 :          0 :         CNXK_TEL_DICT_BF_PTR(d, ctx, drop_pkts, w15_);
     602                 :          0 : }
     603                 :            : 
     604                 :            : static void
     605                 :          0 : nix_sq_ctx(volatile void *qctx, struct plt_tel_data *d)
     606                 :            : {
     607                 :            :         volatile struct nix_cn10k_sq_ctx_s *ctx;
     608                 :            : 
     609                 :            :         ctx = (volatile struct nix_cn10k_sq_ctx_s *)qctx;
     610                 :            : 
     611                 :            :         /* W0 */
     612                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
     613                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
     614                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sdp_mcast, w0_);
     615                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, substream, w0_);
     616                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, qint_idx, w0_);
     617                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
     618                 :            : 
     619                 :            :         /* W1 */
     620                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sqb_count, w1_);
     621                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, default_chan, w1_);
     622                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_rr_weight, w1_);
     623                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sso_ena, w1_);
     624                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, xoff, w1_);
     625                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, cq_ena, w1_);
     626                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq, w1_);
     627                 :            : 
     628                 :            :         /* W2 */
     629                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sqe_stype, w2_);
     630                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sq_int_ena, w2_);
     631                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sq_int, w2_);
     632                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, sqb_aura, w2_);
     633                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_rr_count_ub, w2_);
     634                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_rr_count_lb, w2_);
     635                 :            : 
     636                 :            :         /* W3 */
     637                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_next_sq_vld, w3_);
     638                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_pend, w3_);
     639                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smenq_next_sqb_vld, w3_);
     640                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, head_offset, w3_);
     641                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smenq_offset, w3_);
     642                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, tail_offset, w3_);
     643                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_lso_segnum, w3_);
     644                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, smq_next_sq, w3_);
     645                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, mnq_dis, w3_);
     646                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, lmt_dis, w3_);
     647                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, cq_limit, w3_);
     648                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, max_sqe_size, w3_);
     649                 :            : 
     650                 :            :         /* W4 */
     651                 :          0 :         CNXK_TEL_DICT_PTR(d, ctx, next_sqb, w4_);
     652                 :            : 
     653                 :            :         /* W5 */
     654                 :          0 :         CNXK_TEL_DICT_PTR(d, ctx, tail_sqb, w5_);
     655                 :            : 
     656                 :            :         /* W6 */
     657                 :          0 :         CNXK_TEL_DICT_PTR(d, ctx, smenq_sqb, w6_);
     658                 :            : 
     659                 :            :         /* W7 */
     660                 :          0 :         CNXK_TEL_DICT_PTR(d, ctx, smenq_next_sqb, w7_);
     661                 :            : 
     662                 :            :         /* W8 */
     663                 :          0 :         CNXK_TEL_DICT_PTR(d, ctx, head_sqb, w8_);
     664                 :            : 
     665                 :            :         /* W9 */
     666                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vld, w9_);
     667                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan1_ins_ena, w9_);
     668                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan0_ins_ena, w9_);
     669                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_mps, w9_);
     670                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sb, w9_);
     671                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sizem1, w9_);
     672                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, vfi_lso_total, w9_);
     673                 :            : 
     674                 :            :         /* W10 */
     675                 :          0 :         CNXK_TEL_DICT_BF_PTR(d, ctx, scm_lso_rem, w10_);
     676                 :            : 
     677                 :            :         /* W11 */
     678                 :          0 :         CNXK_TEL_DICT_BF_PTR(d, ctx, octs, w11_);
     679                 :            : 
     680                 :            :         /* W12 */
     681                 :          0 :         CNXK_TEL_DICT_BF_PTR(d, ctx, pkts, w12_);
     682                 :            : 
     683                 :            :         /* W13 */
     684                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, aged_drop_octs, w13_);
     685                 :          0 :         CNXK_TEL_DICT_INT(d, ctx, aged_drop_pkts, w13_);
     686                 :            : 
     687                 :            :         /* W14 */
     688                 :          0 :         CNXK_TEL_DICT_BF_PTR(d, ctx, drop_octs, w14_);
     689                 :            : 
     690                 :            :         /* W15 */
     691                 :          0 :         CNXK_TEL_DICT_BF_PTR(d, ctx, drop_pkts, w15_);
     692                 :          0 : }
     693                 :            : 
     694                 :            : static int
     695                 :          0 : cnxk_tel_nix_sq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
     696                 :            : {
     697                 :            :         struct nix *nix = roc_nix_to_nix_priv(roc_nix);
     698                 :          0 :         struct dev *dev = &nix->dev;
     699                 :            :         struct npa_lf *npa_lf;
     700                 :            :         volatile void *qctx;
     701                 :            :         int rc = -1;
     702                 :            : 
     703                 :          0 :         npa_lf = idev_npa_obj_get();
     704         [ #  # ]:          0 :         if (npa_lf == NULL)
     705                 :            :                 return NPA_ERR_DEVICE_NOT_BOUNDED;
     706                 :            : 
     707                 :          0 :         rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_SQ, n, &qctx);
     708         [ #  # ]:          0 :         if (rc) {
     709                 :          0 :                 plt_err("Failed to get rq context");
     710                 :          0 :                 return rc;
     711                 :            :         }
     712                 :            : 
     713         [ #  # ]:          0 :         if (roc_model_is_cn9k())
     714                 :          0 :                 nix_sq_ctx_cn9k(qctx, d);
     715                 :            :         else
     716                 :          0 :                 nix_sq_ctx(qctx, d);
     717                 :            : 
     718                 :            :         return 0;
     719                 :            : }
     720                 :            : 
     721                 :            : static int
     722                 :          0 : cnxk_nix_tel_handle_list(const char *cmd __plt_unused,
     723                 :            :                          const char *params __plt_unused,
     724                 :            :                          struct plt_tel_data *d)
     725                 :            : {
     726                 :            :         struct nix_tel_node *node;
     727                 :            :         struct roc_nix *roc_nix;
     728                 :            : 
     729                 :          0 :         plt_tel_data_start_array(d, PLT_TEL_STRING_VAL);
     730                 :            : 
     731         [ #  # ]:          0 :         TAILQ_FOREACH(node, &nix_list, node) {
     732                 :          0 :                 roc_nix = node->nix;
     733                 :          0 :                 plt_tel_data_add_array_string(d, roc_nix->pci_dev->name);
     734                 :            :         }
     735                 :            : 
     736                 :          0 :         return 0;
     737                 :            : }
     738                 :            : 
     739                 :            : static int
     740                 :          0 : cnxk_nix_tel_handle_info(const char *cmd __plt_unused, const char *params,
     741                 :            :                          struct plt_tel_data *d)
     742                 :            : {
     743                 :            :         char name[PCI_PRI_STR_SIZE];
     744                 :            :         struct nix_tel_node *node;
     745                 :            : 
     746   [ #  #  #  #  :          0 :         if (params == NULL || strlen(params) == 0 || !isdigit(*params))
                   #  # ]
     747                 :            :                 return -1;
     748                 :            : 
     749                 :            :         plt_strlcpy(name, params, PCI_PRI_STR_SIZE);
     750                 :            : 
     751                 :          0 :         node = nix_tel_node_get_by_pcidev_name(name);
     752         [ #  # ]:          0 :         if (!node)
     753                 :            :                 return -1;
     754                 :            : 
     755                 :          0 :         plt_tel_data_start_dict(d);
     756                 :          0 :         return cnxk_tel_nix(node->nix, d);
     757                 :            : }
     758                 :            : 
     759                 :            : static int
     760                 :          0 : cnxk_nix_tel_handle_info_x(const char *cmd, const char *params,
     761                 :            :                            struct plt_tel_data *d)
     762                 :            : {
     763                 :            :         struct nix_tel_node *node;
     764                 :            :         char *name, *param;
     765                 :            :         char buf[1024];
     766                 :            :         int rc = -1;
     767                 :            : 
     768   [ #  #  #  #  :          0 :         if (params == NULL || strlen(params) == 0 || !isdigit(*params))
                   #  # ]
     769                 :          0 :                 goto exit;
     770                 :            : 
     771                 :            :         plt_strlcpy(buf, params, PCI_PRI_STR_SIZE + 1);
     772                 :          0 :         name = strtok(buf, ",");
     773         [ #  # ]:          0 :         if (name == NULL)
     774                 :          0 :                 goto exit;
     775                 :            : 
     776                 :          0 :         param = strtok(NULL, "\0");
     777                 :            : 
     778                 :          0 :         node = nix_tel_node_get_by_pcidev_name(name);
     779         [ #  # ]:          0 :         if (!node)
     780                 :          0 :                 goto exit;
     781                 :            : 
     782                 :          0 :         plt_tel_data_start_dict(d);
     783                 :            : 
     784         [ #  # ]:          0 :         if (strstr(cmd, "rq")) {
     785                 :          0 :                 char *tok = strtok(param, ",");
     786                 :            :                 int rq;
     787                 :            : 
     788         [ #  # ]:          0 :                 if (!tok)
     789                 :          0 :                         goto exit;
     790                 :            : 
     791                 :          0 :                 rq = strtol(tok, NULL, 10);
     792   [ #  #  #  # ]:          0 :                 if ((node->n_rq <= rq) || (rq < 0))
     793                 :          0 :                         goto exit;
     794                 :            : 
     795         [ #  # ]:          0 :                 if (strstr(cmd, "ctx"))
     796                 :          0 :                         rc = cnxk_tel_nix_rq_ctx(node->nix, rq, d);
     797                 :            :                 else
     798                 :          0 :                         rc = cnxk_tel_nix_rq(node->rqs[rq], d);
     799                 :            : 
     800         [ #  # ]:          0 :         } else if (strstr(cmd, "cq")) {
     801                 :          0 :                 char *tok = strtok(param, ",");
     802                 :            :                 int cq;
     803                 :            : 
     804         [ #  # ]:          0 :                 if (!tok)
     805                 :          0 :                         goto exit;
     806                 :            : 
     807                 :          0 :                 cq = strtol(tok, NULL, 10);
     808   [ #  #  #  # ]:          0 :                 if ((node->n_cq <= cq) || (cq < 0))
     809                 :          0 :                         goto exit;
     810                 :            : 
     811         [ #  # ]:          0 :                 if (strstr(cmd, "ctx"))
     812                 :          0 :                         rc = cnxk_tel_nix_cq_ctx(node->nix, cq, d);
     813                 :            :                 else
     814                 :          0 :                         rc = cnxk_tel_nix_cq(node->cqs[cq], d);
     815                 :            : 
     816         [ #  # ]:          0 :         } else if (strstr(cmd, "sq")) {
     817                 :          0 :                 char *tok = strtok(param, ",");
     818                 :            :                 int sq;
     819                 :            : 
     820         [ #  # ]:          0 :                 if (!tok)
     821                 :          0 :                         goto exit;
     822                 :            : 
     823                 :          0 :                 sq = strtol(tok, NULL, 10);
     824   [ #  #  #  # ]:          0 :                 if ((node->n_sq <= sq) || (sq < 0))
     825                 :          0 :                         goto exit;
     826                 :            : 
     827         [ #  # ]:          0 :                 if (strstr(cmd, "ctx"))
     828                 :          0 :                         rc = cnxk_tel_nix_sq_ctx(node->nix, sq, d);
     829                 :            :                 else
     830                 :          0 :                         rc = cnxk_tel_nix_sq(node->sqs[sq], d);
     831                 :            :         }
     832                 :            : 
     833                 :          0 : exit:
     834                 :          0 :         return rc;
     835                 :            : }
     836                 :            : 
     837                 :        235 : PLT_INIT(cnxk_telemetry_nix_init)
     838                 :            : {
     839                 :        235 :         TAILQ_INIT(&nix_list);
     840                 :            : 
     841                 :        235 :         plt_telemetry_register_cmd(
     842                 :            :                 "/cnxk/nix/list", cnxk_nix_tel_handle_list,
     843                 :            :                 "Returns list of available NIX devices. Takes no parameters");
     844                 :        235 :         plt_telemetry_register_cmd(
     845                 :            :                 "/cnxk/nix/info", cnxk_nix_tel_handle_info,
     846                 :            :                 "Returns nix information. Parameters: pci id");
     847                 :        235 :         plt_telemetry_register_cmd(
     848                 :            :                 "/cnxk/nix/rq/info", cnxk_nix_tel_handle_info_x,
     849                 :            :                 "Returns nix rq information. Parameters: pci id, rq id");
     850                 :        235 :         plt_telemetry_register_cmd(
     851                 :            :                 "/cnxk/nix/rq/ctx", cnxk_nix_tel_handle_info_x,
     852                 :            :                 "Returns nix rq context. Parameters: pci id, rq id");
     853                 :        235 :         plt_telemetry_register_cmd(
     854                 :            :                 "/cnxk/nix/cq/info", cnxk_nix_tel_handle_info_x,
     855                 :            :                 "Returns nix cq information. Parameters: pci id, cq id");
     856                 :        235 :         plt_telemetry_register_cmd(
     857                 :            :                 "/cnxk/nix/cq/ctx", cnxk_nix_tel_handle_info_x,
     858                 :            :                 "Returns nix cq context. Parameters: pci id, cq id");
     859                 :        235 :         plt_telemetry_register_cmd(
     860                 :            :                 "/cnxk/nix/sq/info", cnxk_nix_tel_handle_info_x,
     861                 :            :                 "Returns nix sq information. Parameters: pci id, sq id");
     862                 :        235 :         plt_telemetry_register_cmd(
     863                 :            :                 "/cnxk/nix/sq/ctx", cnxk_nix_tel_handle_info_x,
     864                 :            :                 "Returns nix sq context. Parameters: pci id, sq id");
     865                 :        235 : }

Generated by: LCOV version 1.14