LCOV - code coverage report
Current view: top level - drivers/common/cnxk - roc_npa_debug.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 104 0.0 %
Date: 2025-01-02 22:41:34 Functions: 0 4 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 32 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(C) 2021 Marvell.
       3                 :            :  */
       4                 :            : 
       5                 :            : #include "roc_api.h"
       6                 :            : #include "roc_priv.h"
       7                 :            : 
       8                 :            : #define npa_dump plt_dump
       9                 :            : 
      10                 :            : static inline void
      11                 :          0 : npa_pool_dump(__io struct npa_pool_s *pool)
      12                 :            : {
      13                 :          0 :         npa_dump("W0: Stack base\t\t0x%" PRIx64 "", pool->stack_base);
      14                 :          0 :         npa_dump("W1: ena \t\t%d\nW1: nat_align \t\t%d\nW1: stack_caching \t%d",
      15                 :            :                  pool->ena, pool->nat_align, pool->stack_caching);
      16                 :          0 :         npa_dump("W1: stack_way_mask\t%d\nW1: buf_offset\t\t%d",
      17                 :            :                  pool->stack_way_mask, pool->buf_offset);
      18                 :          0 :         npa_dump("W1: buf_size \t\t%d", pool->buf_size);
      19                 :            : 
      20                 :          0 :         npa_dump("W2: stack_max_pages \t%d\nW2: stack_pages\t\t%d",
      21                 :            :                  pool->stack_max_pages, pool->stack_pages);
      22                 :            : 
      23                 :          0 :         npa_dump("W3: op_pc \t\t0x%" PRIx64 "", (uint64_t)pool->op_pc);
      24                 :            : 
      25                 :          0 :         npa_dump("W4: stack_offset\t%d\nW4: shift\t\t%d\nW4: avg_level\t\t%d",
      26                 :            :                  pool->stack_offset, pool->shift, pool->avg_level);
      27                 :          0 :         npa_dump("W4: avg_con \t\t%d\nW4: fc_ena\t\t%d\nW4: fc_stype\t\t%d",
      28                 :            :                  pool->avg_con, pool->fc_ena, pool->fc_stype);
      29                 :          0 :         npa_dump("W4: fc_hyst_bits\t%d\nW4: fc_up_crossing\t%d",
      30                 :            :                  pool->fc_hyst_bits, pool->fc_up_crossing);
      31                 :          0 :         npa_dump("W4: update_time\t\t%d\n", pool->update_time);
      32                 :            : 
      33                 :          0 :         npa_dump("W5: fc_addr\t\t0x%" PRIx64 "\n", pool->fc_addr);
      34                 :            : 
      35                 :          0 :         npa_dump("W6: ptr_start\t\t0x%" PRIx64 "\n", pool->ptr_start);
      36                 :            : 
      37                 :          0 :         npa_dump("W7: ptr_end\t\t0x%" PRIx64 "\n", pool->ptr_end);
      38                 :          0 :         npa_dump("W8: err_int\t\t%d\nW8: err_int_ena\t\t%d", pool->err_int,
      39                 :            :                  pool->err_int_ena);
      40                 :          0 :         npa_dump("W8: thresh_int\t\t%d", pool->thresh_int);
      41                 :            : 
      42                 :          0 :         npa_dump("W8: thresh_int_ena\t%d\nW8: thresh_up\t\t%d",
      43                 :            :                  pool->thresh_int_ena, pool->thresh_up);
      44                 :          0 :         npa_dump("W8: thresh_qint_idx\t%d\nW8: err_qint_idx\t%d",
      45                 :            :                  pool->thresh_qint_idx, pool->err_qint_idx);
      46                 :          0 : }
      47                 :            : 
      48                 :            : static inline void
      49                 :          0 : npa_aura_dump(__io struct npa_aura_s *aura)
      50                 :            : {
      51                 :          0 :         npa_dump("W0: Pool addr\t\t0x%" PRIx64 "\n", aura->pool_addr);
      52                 :            : 
      53                 :          0 :         npa_dump("W1: ena\t\t\t%d\nW1: pool caching\t%d\nW1: pool way mask\t%d",
      54                 :            :                  aura->ena, aura->pool_caching, aura->pool_way_mask);
      55                 :          0 :         npa_dump("W1: avg con\t\t%d\nW1: pool drop ena\t%d", aura->avg_con,
      56                 :            :                  aura->pool_drop_ena);
      57                 :          0 :         npa_dump("W1: aura drop ena\t%d", aura->aura_drop_ena);
      58                 :          0 :         npa_dump("W1: bp_ena\t\t%d\nW1: aura drop\t\t%d\nW1: aura shift\t\t%d",
      59                 :            :                  aura->bp_ena, aura->aura_drop, aura->shift);
      60                 :          0 :         npa_dump("W1: avg_level\t\t%d\n", aura->avg_level);
      61                 :            : 
      62                 :          0 :         npa_dump("W2: count\t\t%" PRIx64 "\nW2: nix0_bpid\t\t%d",
      63                 :            :                  (uint64_t)aura->count, aura->nix0_bpid);
      64                 :          0 :         npa_dump("W2: nix1_bpid\t\t%d", aura->nix1_bpid);
      65                 :            : 
      66                 :          0 :         npa_dump("W3: limit\t\t%" PRIx64 "\nW3: bp\t\t\t%d\nW3: fc_ena\t\t%d\n",
      67                 :            :                  (uint64_t)aura->limit, aura->bp, aura->fc_ena);
      68                 :          0 :         npa_dump("W3: fc_up_crossing\t%d\nW3: fc_stype\t\t%d",
      69                 :            :                  aura->fc_up_crossing, aura->fc_stype);
      70                 :            : 
      71                 :          0 :         npa_dump("W3: fc_hyst_bits\t%d", aura->fc_hyst_bits);
      72                 :            : 
      73                 :          0 :         npa_dump("W4: fc_addr\t\t0x%" PRIx64 "\n", aura->fc_addr);
      74                 :            : 
      75                 :          0 :         npa_dump("W5: pool_drop\t\t%d\nW5: update_time\t\t%d", aura->pool_drop,
      76                 :            :                  aura->update_time);
      77                 :          0 :         npa_dump("W5: err_int\t\t%d", aura->err_int);
      78                 :          0 :         npa_dump("W5: err_int_ena\t\t%d\nW5: thresh_int\t\t%d",
      79                 :            :                  aura->err_int_ena, aura->thresh_int);
      80                 :          0 :         npa_dump("W5: thresh_int_ena\t%d", aura->thresh_int_ena);
      81                 :            : 
      82                 :          0 :         npa_dump("W5: thresh_up\t\t%d\nW5: thresh_qint_idx\t%d",
      83                 :            :                  aura->thresh_up, aura->thresh_qint_idx);
      84                 :          0 :         npa_dump("W5: err_qint_idx\t%d", aura->err_qint_idx);
      85                 :            : 
      86                 :          0 :         npa_dump("W6: thresh\t\t%" PRIx64 "\n", (uint64_t)aura->thresh);
      87                 :          0 : }
      88                 :            : 
      89                 :            : int
      90                 :          0 : roc_npa_ctx_dump(void)
      91                 :            : {
      92                 :            :         struct npa_cn20k_aq_enq_req *aq_cn20k;
      93                 :            :         struct npa_aq_enq_rsp *rsp;
      94                 :            :         struct npa_aq_enq_req *aq;
      95                 :            :         struct mbox *mbox;
      96                 :            :         struct npa_lf *lf;
      97                 :            :         uint32_t q;
      98                 :            :         int rc = 0;
      99                 :            : 
     100                 :          0 :         lf = idev_npa_obj_get();
     101         [ #  # ]:          0 :         if (lf == NULL)
     102                 :            :                 return NPA_ERR_DEVICE_NOT_BOUNDED;
     103                 :          0 :         mbox = mbox_get(lf->mbox);
     104                 :            : 
     105         [ #  # ]:          0 :         for (q = 0; q < lf->nr_pools; q++) {
     106                 :            :                 /* Skip disabled POOL */
     107         [ #  # ]:          0 :                 if (plt_bitmap_get(lf->npa_bmp, q))
     108                 :          0 :                         continue;
     109                 :            : 
     110         [ #  # ]:          0 :                 if (roc_model_is_cn20k()) {
     111                 :          0 :                         aq_cn20k = mbox_alloc_msg_npa_cn20k_aq_enq(mbox);
     112                 :            :                         aq = (struct npa_aq_enq_req *)aq_cn20k;
     113                 :            :                 } else {
     114                 :          0 :                         aq = mbox_alloc_msg_npa_aq_enq(mbox);
     115                 :            :                 }
     116         [ #  # ]:          0 :                 if (aq == NULL) {
     117                 :            :                         rc = -ENOSPC;
     118                 :          0 :                         goto exit;
     119                 :            :                 }
     120                 :          0 :                 aq->aura_id = q;
     121                 :          0 :                 aq->ctype = NPA_AQ_CTYPE_POOL;
     122                 :          0 :                 aq->op = NPA_AQ_INSTOP_READ;
     123                 :            : 
     124                 :            :                 rc = mbox_process_msg(mbox, (void *)&rsp);
     125         [ #  # ]:          0 :                 if (rc) {
     126                 :          0 :                         plt_err("Failed to get pool(%d) context", q);
     127                 :          0 :                         goto exit;
     128                 :            :                 }
     129                 :          0 :                 npa_dump("============== pool=%d ===============\n", q);
     130                 :          0 :                 npa_pool_dump(&rsp->pool);
     131                 :            :         }
     132                 :            : 
     133         [ #  # ]:          0 :         for (q = 0; q < lf->nr_pools; q++) {
     134                 :            :                 /* Skip disabled AURA */
     135         [ #  # ]:          0 :                 if (plt_bitmap_get(lf->npa_bmp, q))
     136                 :          0 :                         continue;
     137                 :            : 
     138         [ #  # ]:          0 :                 if (roc_model_is_cn20k()) {
     139                 :          0 :                         aq_cn20k = mbox_alloc_msg_npa_cn20k_aq_enq(mbox);
     140                 :            :                         aq = (struct npa_aq_enq_req *)aq_cn20k;
     141                 :            :                 } else {
     142                 :          0 :                         aq = mbox_alloc_msg_npa_aq_enq(mbox);
     143                 :            :                 }
     144         [ #  # ]:          0 :                 if (aq == NULL) {
     145                 :            :                         rc = -ENOSPC;
     146                 :          0 :                         goto exit;
     147                 :            :                 }
     148                 :          0 :                 aq->aura_id = q;
     149                 :          0 :                 aq->ctype = NPA_AQ_CTYPE_AURA;
     150                 :          0 :                 aq->op = NPA_AQ_INSTOP_READ;
     151                 :            : 
     152                 :            :                 rc = mbox_process_msg(mbox, (void *)&rsp);
     153         [ #  # ]:          0 :                 if (rc) {
     154                 :          0 :                         plt_err("Failed to get aura(%d) context", q);
     155                 :          0 :                         goto exit;
     156                 :            :                 }
     157                 :          0 :                 npa_dump("============== aura=%d ===============\n", q);
     158                 :          0 :                 npa_aura_dump(&rsp->aura);
     159                 :            :         }
     160                 :            : 
     161                 :          0 : exit:
     162                 :            :         mbox_put(mbox);
     163                 :          0 :         return rc;
     164                 :            : }
     165                 :            : 
     166                 :            : int
     167                 :          0 : roc_npa_dump(void)
     168                 :            : {
     169                 :            :         struct npa_lf *lf;
     170                 :            :         int aura_cnt = 0;
     171                 :            :         uint32_t i;
     172                 :            : 
     173                 :          0 :         lf = idev_npa_obj_get();
     174         [ #  # ]:          0 :         if (lf == NULL)
     175                 :            :                 return NPA_ERR_DEVICE_NOT_BOUNDED;
     176                 :            : 
     177         [ #  # ]:          0 :         for (i = 0; i < lf->nr_pools; i++) {
     178         [ #  # ]:          0 :                 if (plt_bitmap_get(lf->npa_bmp, i))
     179                 :          0 :                         continue;
     180                 :          0 :                 aura_cnt++;
     181                 :            :         }
     182                 :            : 
     183                 :          0 :         npa_dump("npa@%p", lf);
     184         [ #  # ]:          0 :         npa_dump("  pf = %d", dev_get_pf(lf->pf_func));
     185         [ #  # ]:          0 :         npa_dump("  vf = %d", dev_get_vf(lf->pf_func));
     186                 :          0 :         npa_dump("  aura_cnt = %d", aura_cnt);
     187                 :          0 :         npa_dump("  \tpci_dev = %p", lf->pci_dev);
     188                 :          0 :         npa_dump("  \tnpa_bmp = %p", lf->npa_bmp);
     189                 :          0 :         npa_dump("  \tnpa_bmp_mem = %p", lf->npa_bmp_mem);
     190                 :          0 :         npa_dump("  \tnpa_qint_mem = %p", lf->npa_qint_mem);
     191                 :          0 :         npa_dump("  \tintr_handle = %p", lf->intr_handle);
     192                 :          0 :         npa_dump("  \tmbox = %p", lf->mbox);
     193                 :          0 :         npa_dump("  \tbase = 0x%" PRIx64 "", lf->base);
     194                 :          0 :         npa_dump("  \tstack_pg_ptrs = %d", lf->stack_pg_ptrs);
     195                 :          0 :         npa_dump("  \tstack_pg_bytes = %d", lf->stack_pg_bytes);
     196                 :          0 :         npa_dump("  \tnpa_msixoff = 0x%x", lf->npa_msixoff);
     197                 :          0 :         npa_dump("  \tnr_pools = %d", lf->nr_pools);
     198                 :          0 :         npa_dump("  \tpf_func = 0x%x", lf->pf_func);
     199                 :          0 :         npa_dump("  \taura_sz = %d", lf->aura_sz);
     200                 :          0 :         npa_dump("  \tqints = %d", lf->qints);
     201                 :            : 
     202                 :          0 :         return 0;
     203                 :            : }

Generated by: LCOV version 1.14