treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / net / ethernet / chelsio / cxgb4 / cudbg_lib.h
blob10ee6ed1d9326e861b4daa0f9eba4f12598ed5a2
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2017 Chelsio Communications. All rights reserved.
4 */
6 #ifndef __CUDBG_LIB_H__
7 #define __CUDBG_LIB_H__
9 int cudbg_collect_reg_dump(struct cudbg_init *pdbg_init,
10 struct cudbg_buffer *dbg_buff,
11 struct cudbg_error *cudbg_err);
12 int cudbg_collect_fw_devlog(struct cudbg_init *pdbg_init,
13 struct cudbg_buffer *dbg_buff,
14 struct cudbg_error *cudbg_err);
15 int cudbg_collect_cim_la(struct cudbg_init *pdbg_init,
16 struct cudbg_buffer *dbg_buff,
17 struct cudbg_error *cudbg_err);
18 int cudbg_collect_cim_ma_la(struct cudbg_init *pdbg_init,
19 struct cudbg_buffer *dbg_buff,
20 struct cudbg_error *cudbg_err);
21 int cudbg_collect_cim_qcfg(struct cudbg_init *pdbg_init,
22 struct cudbg_buffer *dbg_buff,
23 struct cudbg_error *cudbg_err);
24 int cudbg_collect_cim_ibq_tp0(struct cudbg_init *pdbg_init,
25 struct cudbg_buffer *dbg_buff,
26 struct cudbg_error *cudbg_err);
27 int cudbg_collect_cim_ibq_tp1(struct cudbg_init *pdbg_init,
28 struct cudbg_buffer *dbg_buff,
29 struct cudbg_error *cudbg_err);
30 int cudbg_collect_cim_ibq_ulp(struct cudbg_init *pdbg_init,
31 struct cudbg_buffer *dbg_buff,
32 struct cudbg_error *cudbg_err);
33 int cudbg_collect_cim_ibq_sge0(struct cudbg_init *pdbg_init,
34 struct cudbg_buffer *dbg_buff,
35 struct cudbg_error *cudbg_err);
36 int cudbg_collect_cim_ibq_sge1(struct cudbg_init *pdbg_init,
37 struct cudbg_buffer *dbg_buff,
38 struct cudbg_error *cudbg_err);
39 int cudbg_collect_cim_ibq_ncsi(struct cudbg_init *pdbg_init,
40 struct cudbg_buffer *dbg_buff,
41 struct cudbg_error *cudbg_err);
42 int cudbg_collect_cim_obq_ulp0(struct cudbg_init *pdbg_init,
43 struct cudbg_buffer *dbg_buff,
44 struct cudbg_error *cudbg_err);
45 int cudbg_collect_cim_obq_ulp1(struct cudbg_init *pdbg_init,
46 struct cudbg_buffer *dbg_buff,
47 struct cudbg_error *cudbg_err);
48 int cudbg_collect_cim_obq_ulp2(struct cudbg_init *pdbg_init,
49 struct cudbg_buffer *dbg_buff,
50 struct cudbg_error *cudbg_err);
51 int cudbg_collect_cim_obq_ulp3(struct cudbg_init *pdbg_init,
52 struct cudbg_buffer *dbg_buff,
53 struct cudbg_error *cudbg_err);
54 int cudbg_collect_cim_obq_sge(struct cudbg_init *pdbg_init,
55 struct cudbg_buffer *dbg_buff,
56 struct cudbg_error *cudbg_err);
57 int cudbg_collect_cim_obq_ncsi(struct cudbg_init *pdbg_init,
58 struct cudbg_buffer *dbg_buff,
59 struct cudbg_error *cudbg_err);
60 int cudbg_collect_edc0_meminfo(struct cudbg_init *pdbg_init,
61 struct cudbg_buffer *dbg_buff,
62 struct cudbg_error *cudbg_err);
63 int cudbg_collect_edc1_meminfo(struct cudbg_init *pdbg_init,
64 struct cudbg_buffer *dbg_buff,
65 struct cudbg_error *cudbg_err);
66 int cudbg_collect_mc0_meminfo(struct cudbg_init *pdbg_init,
67 struct cudbg_buffer *dbg_buff,
68 struct cudbg_error *cudbg_err);
69 int cudbg_collect_mc1_meminfo(struct cudbg_init *pdbg_init,
70 struct cudbg_buffer *dbg_buff,
71 struct cudbg_error *cudbg_err);
72 int cudbg_collect_rss(struct cudbg_init *pdbg_init,
73 struct cudbg_buffer *dbg_buff,
74 struct cudbg_error *cudbg_err);
75 int cudbg_collect_rss_vf_config(struct cudbg_init *pdbg_init,
76 struct cudbg_buffer *dbg_buff,
77 struct cudbg_error *cudbg_err);
78 int cudbg_collect_tp_indirect(struct cudbg_init *pdbg_init,
79 struct cudbg_buffer *dbg_buff,
80 struct cudbg_error *cudbg_err);
81 int cudbg_collect_path_mtu(struct cudbg_init *pdbg_init,
82 struct cudbg_buffer *dbg_buff,
83 struct cudbg_error *cudbg_err);
84 int cudbg_collect_pm_stats(struct cudbg_init *pdbg_init,
85 struct cudbg_buffer *dbg_buff,
86 struct cudbg_error *cudbg_err);
87 int cudbg_collect_hw_sched(struct cudbg_init *pdbg_init,
88 struct cudbg_buffer *dbg_buff,
89 struct cudbg_error *cudbg_err);
90 int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init,
91 struct cudbg_buffer *dbg_buff,
92 struct cudbg_error *cudbg_err);
93 int cudbg_collect_ulprx_la(struct cudbg_init *pdbg_init,
94 struct cudbg_buffer *dbg_buff,
95 struct cudbg_error *cudbg_err);
96 int cudbg_collect_tp_la(struct cudbg_init *pdbg_init,
97 struct cudbg_buffer *dbg_buff,
98 struct cudbg_error *cudbg_err);
99 int cudbg_collect_meminfo(struct cudbg_init *pdbg_init,
100 struct cudbg_buffer *dbg_buff,
101 struct cudbg_error *cudbg_err);
102 int cudbg_collect_cim_pif_la(struct cudbg_init *pdbg_init,
103 struct cudbg_buffer *dbg_buff,
104 struct cudbg_error *cudbg_err);
105 int cudbg_collect_clk_info(struct cudbg_init *pdbg_init,
106 struct cudbg_buffer *dbg_buff,
107 struct cudbg_error *cudbg_err);
108 int cudbg_collect_obq_sge_rx_q0(struct cudbg_init *pdbg_init,
109 struct cudbg_buffer *dbg_buff,
110 struct cudbg_error *cudbg_err);
111 int cudbg_collect_obq_sge_rx_q1(struct cudbg_init *pdbg_init,
112 struct cudbg_buffer *dbg_buff,
113 struct cudbg_error *cudbg_err);
114 int cudbg_collect_pcie_indirect(struct cudbg_init *pdbg_init,
115 struct cudbg_buffer *dbg_buff,
116 struct cudbg_error *cudbg_err);
117 int cudbg_collect_pm_indirect(struct cudbg_init *pdbg_init,
118 struct cudbg_buffer *dbg_buff,
119 struct cudbg_error *cudbg_err);
120 int cudbg_collect_tid(struct cudbg_init *pdbg_init,
121 struct cudbg_buffer *dbg_buff,
122 struct cudbg_error *cudbg_err);
123 int cudbg_collect_pcie_config(struct cudbg_init *pdbg_init,
124 struct cudbg_buffer *dbg_buff,
125 struct cudbg_error *cudbg_err);
126 int cudbg_collect_dump_context(struct cudbg_init *pdbg_init,
127 struct cudbg_buffer *dbg_buff,
128 struct cudbg_error *cudbg_err);
129 int cudbg_collect_mps_tcam(struct cudbg_init *pdbg_init,
130 struct cudbg_buffer *dbg_buff,
131 struct cudbg_error *cudbg_err);
132 int cudbg_collect_vpd_data(struct cudbg_init *pdbg_init,
133 struct cudbg_buffer *dbg_buff,
134 struct cudbg_error *cudbg_err);
135 int cudbg_collect_le_tcam(struct cudbg_init *pdbg_init,
136 struct cudbg_buffer *dbg_buff,
137 struct cudbg_error *cudbg_err);
138 int cudbg_collect_cctrl(struct cudbg_init *pdbg_init,
139 struct cudbg_buffer *dbg_buff,
140 struct cudbg_error *cudbg_err);
141 int cudbg_collect_ma_indirect(struct cudbg_init *pdbg_init,
142 struct cudbg_buffer *dbg_buff,
143 struct cudbg_error *cudbg_err);
144 int cudbg_collect_ulptx_la(struct cudbg_init *pdbg_init,
145 struct cudbg_buffer *dbg_buff,
146 struct cudbg_error *cudbg_err);
147 int cudbg_collect_up_cim_indirect(struct cudbg_init *pdbg_init,
148 struct cudbg_buffer *dbg_buff,
149 struct cudbg_error *cudbg_err);
150 int cudbg_collect_pbt_tables(struct cudbg_init *pdbg_init,
151 struct cudbg_buffer *dbg_buff,
152 struct cudbg_error *cudbg_err);
153 int cudbg_collect_mbox_log(struct cudbg_init *pdbg_init,
154 struct cudbg_buffer *dbg_buff,
155 struct cudbg_error *cudbg_err);
156 int cudbg_collect_hma_indirect(struct cudbg_init *pdbg_init,
157 struct cudbg_buffer *dbg_buff,
158 struct cudbg_error *cudbg_err);
159 int cudbg_collect_hma_meminfo(struct cudbg_init *pdbg_init,
160 struct cudbg_buffer *dbg_buff,
161 struct cudbg_error *cudbg_err);
162 int cudbg_collect_qdesc(struct cudbg_init *pdbg_init,
163 struct cudbg_buffer *dbg_buff,
164 struct cudbg_error *cudbg_err);
166 struct cudbg_entity_hdr *cudbg_get_entity_hdr(void *outbuf, int i);
167 void cudbg_align_debug_buffer(struct cudbg_buffer *dbg_buff,
168 struct cudbg_entity_hdr *entity_hdr);
169 u32 cudbg_cim_obq_size(struct adapter *padap, int qid);
170 int cudbg_dump_context_size(struct adapter *padap);
172 int cudbg_fill_meminfo(struct adapter *padap,
173 struct cudbg_meminfo *meminfo_buff);
174 void cudbg_fill_le_tcam_info(struct adapter *padap,
175 struct cudbg_tcam *tcam_region);
176 void cudbg_fill_qdesc_num_and_size(const struct adapter *padap,
177 u32 *num, u32 *size);
179 static inline u32 cudbg_uld_txq_to_qtype(u32 uld)
181 switch (uld) {
182 case CXGB4_TX_OFLD:
183 return CUDBG_QTYPE_OFLD_TXQ;
184 case CXGB4_TX_CRYPTO:
185 return CUDBG_QTYPE_CRYPTO_TXQ;
188 return CUDBG_QTYPE_UNKNOWN;
191 static inline u32 cudbg_uld_rxq_to_qtype(u32 uld)
193 switch (uld) {
194 case CXGB4_ULD_RDMA:
195 return CUDBG_QTYPE_RDMA_RXQ;
196 case CXGB4_ULD_ISCSI:
197 return CUDBG_QTYPE_ISCSI_RXQ;
198 case CXGB4_ULD_ISCSIT:
199 return CUDBG_QTYPE_ISCSIT_RXQ;
200 case CXGB4_ULD_CRYPTO:
201 return CUDBG_QTYPE_CRYPTO_RXQ;
202 case CXGB4_ULD_TLS:
203 return CUDBG_QTYPE_TLS_RXQ;
206 return CUDBG_QTYPE_UNKNOWN;
209 static inline u32 cudbg_uld_flq_to_qtype(u32 uld)
211 switch (uld) {
212 case CXGB4_ULD_RDMA:
213 return CUDBG_QTYPE_RDMA_FLQ;
214 case CXGB4_ULD_ISCSI:
215 return CUDBG_QTYPE_ISCSI_FLQ;
216 case CXGB4_ULD_ISCSIT:
217 return CUDBG_QTYPE_ISCSIT_FLQ;
218 case CXGB4_ULD_CRYPTO:
219 return CUDBG_QTYPE_CRYPTO_FLQ;
220 case CXGB4_ULD_TLS:
221 return CUDBG_QTYPE_TLS_FLQ;
224 return CUDBG_QTYPE_UNKNOWN;
227 static inline u32 cudbg_uld_ciq_to_qtype(u32 uld)
229 switch (uld) {
230 case CXGB4_ULD_RDMA:
231 return CUDBG_QTYPE_RDMA_CIQ;
234 return CUDBG_QTYPE_UNKNOWN;
237 static inline void cudbg_fill_qdesc_txq(const struct sge_txq *txq,
238 enum cudbg_qdesc_qtype type,
239 struct cudbg_qdesc_entry *entry)
241 entry->qtype = type;
242 entry->qid = txq->cntxt_id;
243 entry->desc_size = sizeof(struct tx_desc);
244 entry->num_desc = txq->size;
245 entry->data_size = txq->size * sizeof(struct tx_desc);
246 memcpy(entry->data, txq->desc, entry->data_size);
249 static inline void cudbg_fill_qdesc_rxq(const struct sge_rspq *rxq,
250 enum cudbg_qdesc_qtype type,
251 struct cudbg_qdesc_entry *entry)
253 entry->qtype = type;
254 entry->qid = rxq->cntxt_id;
255 entry->desc_size = rxq->iqe_len;
256 entry->num_desc = rxq->size;
257 entry->data_size = rxq->size * rxq->iqe_len;
258 memcpy(entry->data, rxq->desc, entry->data_size);
261 static inline void cudbg_fill_qdesc_flq(const struct sge_fl *flq,
262 enum cudbg_qdesc_qtype type,
263 struct cudbg_qdesc_entry *entry)
265 entry->qtype = type;
266 entry->qid = flq->cntxt_id;
267 entry->desc_size = sizeof(__be64);
268 entry->num_desc = flq->size;
269 entry->data_size = flq->size * sizeof(__be64);
270 memcpy(entry->data, flq->desc, entry->data_size);
273 static inline
274 struct cudbg_qdesc_entry *cudbg_next_qdesc(struct cudbg_qdesc_entry *e)
276 return (struct cudbg_qdesc_entry *)
277 ((u8 *)e + sizeof(*e) + e->data_size);
279 #endif /* __CUDBG_LIB_H__ */