linux/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h
<<
>>
Prefs
   1/*
   2 *  Copyright (C) 2017 Chelsio Communications.  All rights reserved.
   3 *
   4 *  This program is free software; you can redistribute it and/or modify it
   5 *  under the terms and conditions of the GNU General Public License,
   6 *  version 2, as published by the Free Software Foundation.
   7 *
   8 *  This program is distributed in the hope it will be useful, but WITHOUT
   9 *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10 *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  11 *  more details.
  12 *
  13 *  The full GNU General Public License is included in this distribution in
  14 *  the file called "COPYING".
  15 *
  16 */
  17
  18#ifndef __CUDBG_LIB_H__
  19#define __CUDBG_LIB_H__
  20
  21int cudbg_collect_reg_dump(struct cudbg_init *pdbg_init,
  22                           struct cudbg_buffer *dbg_buff,
  23                           struct cudbg_error *cudbg_err);
  24int cudbg_collect_fw_devlog(struct cudbg_init *pdbg_init,
  25                            struct cudbg_buffer *dbg_buff,
  26                            struct cudbg_error *cudbg_err);
  27int cudbg_collect_cim_la(struct cudbg_init *pdbg_init,
  28                         struct cudbg_buffer *dbg_buff,
  29                         struct cudbg_error *cudbg_err);
  30int cudbg_collect_cim_ma_la(struct cudbg_init *pdbg_init,
  31                            struct cudbg_buffer *dbg_buff,
  32                            struct cudbg_error *cudbg_err);
  33int cudbg_collect_cim_qcfg(struct cudbg_init *pdbg_init,
  34                           struct cudbg_buffer *dbg_buff,
  35                           struct cudbg_error *cudbg_err);
  36int cudbg_collect_cim_ibq_tp0(struct cudbg_init *pdbg_init,
  37                              struct cudbg_buffer *dbg_buff,
  38                              struct cudbg_error *cudbg_err);
  39int cudbg_collect_cim_ibq_tp1(struct cudbg_init *pdbg_init,
  40                              struct cudbg_buffer *dbg_buff,
  41                              struct cudbg_error *cudbg_err);
  42int cudbg_collect_cim_ibq_ulp(struct cudbg_init *pdbg_init,
  43                              struct cudbg_buffer *dbg_buff,
  44                              struct cudbg_error *cudbg_err);
  45int cudbg_collect_cim_ibq_sge0(struct cudbg_init *pdbg_init,
  46                               struct cudbg_buffer *dbg_buff,
  47                               struct cudbg_error *cudbg_err);
  48int cudbg_collect_cim_ibq_sge1(struct cudbg_init *pdbg_init,
  49                               struct cudbg_buffer *dbg_buff,
  50                               struct cudbg_error *cudbg_err);
  51int cudbg_collect_cim_ibq_ncsi(struct cudbg_init *pdbg_init,
  52                               struct cudbg_buffer *dbg_buff,
  53                               struct cudbg_error *cudbg_err);
  54int cudbg_collect_cim_obq_ulp0(struct cudbg_init *pdbg_init,
  55                               struct cudbg_buffer *dbg_buff,
  56                               struct cudbg_error *cudbg_err);
  57int cudbg_collect_cim_obq_ulp1(struct cudbg_init *pdbg_init,
  58                               struct cudbg_buffer *dbg_buff,
  59                               struct cudbg_error *cudbg_err);
  60int cudbg_collect_cim_obq_ulp2(struct cudbg_init *pdbg_init,
  61                               struct cudbg_buffer *dbg_buff,
  62                               struct cudbg_error *cudbg_err);
  63int cudbg_collect_cim_obq_ulp3(struct cudbg_init *pdbg_init,
  64                               struct cudbg_buffer *dbg_buff,
  65                               struct cudbg_error *cudbg_err);
  66int cudbg_collect_cim_obq_sge(struct cudbg_init *pdbg_init,
  67                              struct cudbg_buffer *dbg_buff,
  68                              struct cudbg_error *cudbg_err);
  69int cudbg_collect_cim_obq_ncsi(struct cudbg_init *pdbg_init,
  70                               struct cudbg_buffer *dbg_buff,
  71                               struct cudbg_error *cudbg_err);
  72int cudbg_collect_edc0_meminfo(struct cudbg_init *pdbg_init,
  73                               struct cudbg_buffer *dbg_buff,
  74                               struct cudbg_error *cudbg_err);
  75int cudbg_collect_edc1_meminfo(struct cudbg_init *pdbg_init,
  76                               struct cudbg_buffer *dbg_buff,
  77                               struct cudbg_error *cudbg_err);
  78int cudbg_collect_mc0_meminfo(struct cudbg_init *pdbg_init,
  79                              struct cudbg_buffer *dbg_buff,
  80                              struct cudbg_error *cudbg_err);
  81int cudbg_collect_mc1_meminfo(struct cudbg_init *pdbg_init,
  82                              struct cudbg_buffer *dbg_buff,
  83                              struct cudbg_error *cudbg_err);
  84int cudbg_collect_rss(struct cudbg_init *pdbg_init,
  85                      struct cudbg_buffer *dbg_buff,
  86                      struct cudbg_error *cudbg_err);
  87int cudbg_collect_rss_vf_config(struct cudbg_init *pdbg_init,
  88                                struct cudbg_buffer *dbg_buff,
  89                                struct cudbg_error *cudbg_err);
  90int cudbg_collect_tp_indirect(struct cudbg_init *pdbg_init,
  91                              struct cudbg_buffer *dbg_buff,
  92                              struct cudbg_error *cudbg_err);
  93int cudbg_collect_path_mtu(struct cudbg_init *pdbg_init,
  94                           struct cudbg_buffer *dbg_buff,
  95                           struct cudbg_error *cudbg_err);
  96int cudbg_collect_pm_stats(struct cudbg_init *pdbg_init,
  97                           struct cudbg_buffer *dbg_buff,
  98                           struct cudbg_error *cudbg_err);
  99int cudbg_collect_hw_sched(struct cudbg_init *pdbg_init,
 100                           struct cudbg_buffer *dbg_buff,
 101                           struct cudbg_error *cudbg_err);
 102int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init,
 103                               struct cudbg_buffer *dbg_buff,
 104                               struct cudbg_error *cudbg_err);
 105int cudbg_collect_ulprx_la(struct cudbg_init *pdbg_init,
 106                           struct cudbg_buffer *dbg_buff,
 107                           struct cudbg_error *cudbg_err);
 108int cudbg_collect_tp_la(struct cudbg_init *pdbg_init,
 109                        struct cudbg_buffer *dbg_buff,
 110                        struct cudbg_error *cudbg_err);
 111int cudbg_collect_meminfo(struct cudbg_init *pdbg_init,
 112                          struct cudbg_buffer *dbg_buff,
 113                          struct cudbg_error *cudbg_err);
 114int cudbg_collect_cim_pif_la(struct cudbg_init *pdbg_init,
 115                             struct cudbg_buffer *dbg_buff,
 116                             struct cudbg_error *cudbg_err);
 117int cudbg_collect_clk_info(struct cudbg_init *pdbg_init,
 118                           struct cudbg_buffer *dbg_buff,
 119                           struct cudbg_error *cudbg_err);
 120int cudbg_collect_obq_sge_rx_q0(struct cudbg_init *pdbg_init,
 121                                struct cudbg_buffer *dbg_buff,
 122                                struct cudbg_error *cudbg_err);
 123int cudbg_collect_obq_sge_rx_q1(struct cudbg_init *pdbg_init,
 124                                struct cudbg_buffer *dbg_buff,
 125                                struct cudbg_error *cudbg_err);
 126int cudbg_collect_pcie_indirect(struct cudbg_init *pdbg_init,
 127                                struct cudbg_buffer *dbg_buff,
 128                                struct cudbg_error *cudbg_err);
 129int cudbg_collect_pm_indirect(struct cudbg_init *pdbg_init,
 130                              struct cudbg_buffer *dbg_buff,
 131                              struct cudbg_error *cudbg_err);
 132int cudbg_collect_tid(struct cudbg_init *pdbg_init,
 133                      struct cudbg_buffer *dbg_buff,
 134                      struct cudbg_error *cudbg_err);
 135int cudbg_collect_pcie_config(struct cudbg_init *pdbg_init,
 136                              struct cudbg_buffer *dbg_buff,
 137                              struct cudbg_error *cudbg_err);
 138int cudbg_collect_dump_context(struct cudbg_init *pdbg_init,
 139                               struct cudbg_buffer *dbg_buff,
 140                               struct cudbg_error *cudbg_err);
 141int cudbg_collect_mps_tcam(struct cudbg_init *pdbg_init,
 142                           struct cudbg_buffer *dbg_buff,
 143                           struct cudbg_error *cudbg_err);
 144int cudbg_collect_vpd_data(struct cudbg_init *pdbg_init,
 145                           struct cudbg_buffer *dbg_buff,
 146                           struct cudbg_error *cudbg_err);
 147int cudbg_collect_le_tcam(struct cudbg_init *pdbg_init,
 148                          struct cudbg_buffer *dbg_buff,
 149                          struct cudbg_error *cudbg_err);
 150int cudbg_collect_cctrl(struct cudbg_init *pdbg_init,
 151                        struct cudbg_buffer *dbg_buff,
 152                        struct cudbg_error *cudbg_err);
 153int cudbg_collect_ma_indirect(struct cudbg_init *pdbg_init,
 154                              struct cudbg_buffer *dbg_buff,
 155                              struct cudbg_error *cudbg_err);
 156int cudbg_collect_ulptx_la(struct cudbg_init *pdbg_init,
 157                           struct cudbg_buffer *dbg_buff,
 158                           struct cudbg_error *cudbg_err);
 159int cudbg_collect_up_cim_indirect(struct cudbg_init *pdbg_init,
 160                                  struct cudbg_buffer *dbg_buff,
 161                                  struct cudbg_error *cudbg_err);
 162int cudbg_collect_pbt_tables(struct cudbg_init *pdbg_init,
 163                             struct cudbg_buffer *dbg_buff,
 164                             struct cudbg_error *cudbg_err);
 165int cudbg_collect_mbox_log(struct cudbg_init *pdbg_init,
 166                           struct cudbg_buffer *dbg_buff,
 167                           struct cudbg_error *cudbg_err);
 168int cudbg_collect_hma_indirect(struct cudbg_init *pdbg_init,
 169                               struct cudbg_buffer *dbg_buff,
 170                               struct cudbg_error *cudbg_err);
 171int cudbg_collect_hma_meminfo(struct cudbg_init *pdbg_init,
 172                              struct cudbg_buffer *dbg_buff,
 173                              struct cudbg_error *cudbg_err);
 174int cudbg_collect_qdesc(struct cudbg_init *pdbg_init,
 175                        struct cudbg_buffer *dbg_buff,
 176                        struct cudbg_error *cudbg_err);
 177
 178struct cudbg_entity_hdr *cudbg_get_entity_hdr(void *outbuf, int i);
 179void cudbg_align_debug_buffer(struct cudbg_buffer *dbg_buff,
 180                              struct cudbg_entity_hdr *entity_hdr);
 181u32 cudbg_cim_obq_size(struct adapter *padap, int qid);
 182int cudbg_dump_context_size(struct adapter *padap);
 183
 184int cudbg_fill_meminfo(struct adapter *padap,
 185                       struct cudbg_meminfo *meminfo_buff);
 186void cudbg_fill_le_tcam_info(struct adapter *padap,
 187                             struct cudbg_tcam *tcam_region);
 188void cudbg_fill_qdesc_num_and_size(const struct adapter *padap,
 189                                   u32 *num, u32 *size);
 190
 191static inline u32 cudbg_uld_txq_to_qtype(u32 uld)
 192{
 193        switch (uld) {
 194        case CXGB4_TX_OFLD:
 195                return CUDBG_QTYPE_OFLD_TXQ;
 196        case CXGB4_TX_CRYPTO:
 197                return CUDBG_QTYPE_CRYPTO_TXQ;
 198        }
 199
 200        return CUDBG_QTYPE_UNKNOWN;
 201}
 202
 203static inline u32 cudbg_uld_rxq_to_qtype(u32 uld)
 204{
 205        switch (uld) {
 206        case CXGB4_ULD_RDMA:
 207                return CUDBG_QTYPE_RDMA_RXQ;
 208        case CXGB4_ULD_ISCSI:
 209                return CUDBG_QTYPE_ISCSI_RXQ;
 210        case CXGB4_ULD_ISCSIT:
 211                return CUDBG_QTYPE_ISCSIT_RXQ;
 212        case CXGB4_ULD_CRYPTO:
 213                return CUDBG_QTYPE_CRYPTO_RXQ;
 214        case CXGB4_ULD_TLS:
 215                return CUDBG_QTYPE_TLS_RXQ;
 216        }
 217
 218        return CUDBG_QTYPE_UNKNOWN;
 219}
 220
 221static inline u32 cudbg_uld_flq_to_qtype(u32 uld)
 222{
 223        switch (uld) {
 224        case CXGB4_ULD_RDMA:
 225                return CUDBG_QTYPE_RDMA_FLQ;
 226        case CXGB4_ULD_ISCSI:
 227                return CUDBG_QTYPE_ISCSI_FLQ;
 228        case CXGB4_ULD_ISCSIT:
 229                return CUDBG_QTYPE_ISCSIT_FLQ;
 230        case CXGB4_ULD_CRYPTO:
 231                return CUDBG_QTYPE_CRYPTO_FLQ;
 232        case CXGB4_ULD_TLS:
 233                return CUDBG_QTYPE_TLS_FLQ;
 234        }
 235
 236        return CUDBG_QTYPE_UNKNOWN;
 237}
 238
 239static inline u32 cudbg_uld_ciq_to_qtype(u32 uld)
 240{
 241        switch (uld) {
 242        case CXGB4_ULD_RDMA:
 243                return CUDBG_QTYPE_RDMA_CIQ;
 244        }
 245
 246        return CUDBG_QTYPE_UNKNOWN;
 247}
 248
 249static inline void cudbg_fill_qdesc_txq(const struct sge_txq *txq,
 250                                        enum cudbg_qdesc_qtype type,
 251                                        struct cudbg_qdesc_entry *entry)
 252{
 253        entry->qtype = type;
 254        entry->qid = txq->cntxt_id;
 255        entry->desc_size = sizeof(struct tx_desc);
 256        entry->num_desc = txq->size;
 257        entry->data_size = txq->size * sizeof(struct tx_desc);
 258        memcpy(entry->data, txq->desc, entry->data_size);
 259}
 260
 261static inline void cudbg_fill_qdesc_rxq(const struct sge_rspq *rxq,
 262                                        enum cudbg_qdesc_qtype type,
 263                                        struct cudbg_qdesc_entry *entry)
 264{
 265        entry->qtype = type;
 266        entry->qid = rxq->cntxt_id;
 267        entry->desc_size = rxq->iqe_len;
 268        entry->num_desc = rxq->size;
 269        entry->data_size = rxq->size * rxq->iqe_len;
 270        memcpy(entry->data, rxq->desc, entry->data_size);
 271}
 272
 273static inline void cudbg_fill_qdesc_flq(const struct sge_fl *flq,
 274                                        enum cudbg_qdesc_qtype type,
 275                                        struct cudbg_qdesc_entry *entry)
 276{
 277        entry->qtype = type;
 278        entry->qid = flq->cntxt_id;
 279        entry->desc_size = sizeof(__be64);
 280        entry->num_desc = flq->size;
 281        entry->data_size = flq->size * sizeof(__be64);
 282        memcpy(entry->data, flq->desc, entry->data_size);
 283}
 284
 285static inline
 286struct cudbg_qdesc_entry *cudbg_next_qdesc(struct cudbg_qdesc_entry *e)
 287{
 288        return (struct cudbg_qdesc_entry *)
 289               ((u8 *)e + sizeof(*e) + e->data_size);
 290}
 291#endif /* __CUDBG_LIB_H__ */
 292