summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/cxgbe/t4nex/cudbg_lib.h
blob: c6b59991e5ad99eb0b5ca2736ad2adfb43a1ffad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/*
 * This file and its contents are supplied under the terms of the
 * Common Development and Distribution License ("CDDL"), version 1.0.
 * You may only use this file in accordance with the terms of version
 * 1.0 of the CDDL.
 *
 * A full copy of the text of the CDDL should have accompanied this
 * source. A copy of the CDDL is also available via the Internet at
 * http://www.illumos.org/license/CDDL.
 */

/*-
 * Copyright (c) 2017 Chelsio Communications, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#ifndef __CUDBG_LIB_H__
#define __CUDBG_LIB_H__

#ifndef min_t
#define min_t(type, _a, _b)   (((type)(_a) < (type)(_b)) ? (type)(_a) : (type)(_b))
#endif

static int collect_reg_dump(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_fw_devlog(struct cudbg_init *, struct cudbg_buffer *,
			     struct cudbg_error *);
static int collect_cim_qcfg(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_cim_la(struct cudbg_init *, struct cudbg_buffer *,
			  struct cudbg_error *);
static int collect_cim_ma_la(struct cudbg_init *, struct cudbg_buffer *,
			     struct cudbg_error *);
static int collect_cim_obq_ulp0(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_cim_obq_ulp1(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_cim_obq_ulp2(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_cim_obq_ulp3(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_cim_obq_sge(struct cudbg_init *, struct cudbg_buffer *,
			       struct cudbg_error *);
static int collect_cim_obq_ncsi(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_cim_ibq_tp0(struct cudbg_init *, struct cudbg_buffer *,
			       struct cudbg_error *);
static int collect_cim_ibq_tp1(struct cudbg_init *, struct cudbg_buffer *,
			       struct cudbg_error *);
static int collect_cim_ibq_ulp(struct cudbg_init *, struct cudbg_buffer *,
			       struct cudbg_error *);
static int collect_cim_ibq_sge0(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_cim_ibq_sge1(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_cim_ibq_ncsi(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_edc0_meminfo(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_edc1_meminfo(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_mc0_meminfo(struct cudbg_init *, struct cudbg_buffer *,
			       struct cudbg_error *);
static int collect_mc1_meminfo(struct cudbg_init *, struct cudbg_buffer *,
			       struct cudbg_error *);
static int collect_rss(struct cudbg_init *, struct cudbg_buffer *,
		       struct cudbg_error *);
static int collect_rss_key(struct cudbg_init *, struct cudbg_buffer *,
			   struct cudbg_error *);
static int collect_rss_pf_config(struct cudbg_init *, struct cudbg_buffer *,
				 struct cudbg_error *);
static int collect_rss_vf_config(struct cudbg_init *, struct cudbg_buffer *,
				 struct cudbg_error *);
static int collect_rss_config(struct cudbg_init *, struct cudbg_buffer *,
			      struct cudbg_error *);
static int collect_path_mtu(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_sw_state(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
int collect_wtp_data(struct cudbg_init *, struct cudbg_buffer *,
		     struct cudbg_error *);
static int collect_pm_stats(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_hw_sched(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_tcp_stats(struct cudbg_init *, struct cudbg_buffer *,
			     struct cudbg_error *);
static int collect_tp_err_stats(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_fcoe_stats(struct cudbg_init *, struct cudbg_buffer *,
			      struct cudbg_error *);
static int collect_rdma_stats(struct cudbg_init *, struct cudbg_buffer *,
			      struct cudbg_error *);
static int collect_tp_indirect(struct cudbg_init *, struct cudbg_buffer *,
			       struct cudbg_error *);
static int collect_sge_indirect(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_cpl_stats(struct cudbg_init *, struct cudbg_buffer *,
			     struct cudbg_error *);
static int collect_ddp_stats(struct cudbg_init *, struct cudbg_buffer *,
			     struct cudbg_error *);
static int collect_wc_stats(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_ulprx_la(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_lb_stats(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_tp_la(struct cudbg_init *, struct cudbg_buffer *,
			 struct cudbg_error *);
static int collect_meminfo(struct cudbg_init *, struct cudbg_buffer *,
			   struct cudbg_error *);
static int collect_cim_pif_la(struct cudbg_init *, struct cudbg_buffer *,
			      struct cudbg_error *);
static int collect_clk_info(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_obq_sge_rx_q0(struct cudbg_init *, struct cudbg_buffer *,
				 struct cudbg_error *);
static int collect_obq_sge_rx_q1(struct cudbg_init *, struct cudbg_buffer *,
				 struct cudbg_error *);
static int collect_macstats(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_pcie_indirect(struct cudbg_init *, struct cudbg_buffer *,
				 struct cudbg_error *);
static int collect_pm_indirect(struct cudbg_init *, struct cudbg_buffer *,
			       struct cudbg_error *);
static int collect_full(struct cudbg_init *, struct cudbg_buffer *,
			struct cudbg_error *);
static int collect_tx_rate(struct cudbg_init *, struct cudbg_buffer *,
			   struct cudbg_error *);
static int collect_tid(struct cudbg_init *, struct cudbg_buffer *,
		       struct cudbg_error *);
static int collect_pcie_config(struct cudbg_init *, struct cudbg_buffer *,
			       struct cudbg_error *);
static int collect_dump_context(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);
static int collect_mps_tcam(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_vpd_data(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_le_tcam(struct cudbg_init *, struct cudbg_buffer *,
			   struct cudbg_error *);
static int collect_cctrl(struct cudbg_init *, struct cudbg_buffer *,
			 struct cudbg_error *);
static int collect_ma_indirect(struct cudbg_init *, struct cudbg_buffer *,
			       struct cudbg_error *);
static int collect_ulptx_la(struct cudbg_init *, struct cudbg_buffer *,
		struct cudbg_error *);
static int collect_up_cim_indirect(struct cudbg_init *, struct cudbg_buffer *,
				   struct cudbg_error *);
static int collect_pbt_tables(struct cudbg_init *, struct cudbg_buffer *,
			      struct cudbg_error *);
static int collect_mbox_log(struct cudbg_init *, struct cudbg_buffer *,
			    struct cudbg_error *);
static int collect_hma_indirect(struct cudbg_init *, struct cudbg_buffer *,
				struct cudbg_error *);

static int (*process_entity[])
	(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *) = {
		collect_reg_dump,
		collect_fw_devlog,
		collect_cim_la,		/*3*/
		collect_cim_ma_la,
		collect_cim_qcfg,
		collect_cim_ibq_tp0,
		collect_cim_ibq_tp1,
		collect_cim_ibq_ulp,
		collect_cim_ibq_sge0,
		collect_cim_ibq_sge1,
		collect_cim_ibq_ncsi,
		collect_cim_obq_ulp0,
		collect_cim_obq_ulp1,	/*13*/
		collect_cim_obq_ulp2,
		collect_cim_obq_ulp3,
		collect_cim_obq_sge,
		collect_cim_obq_ncsi,
		collect_edc0_meminfo,
		collect_edc1_meminfo,
		collect_mc0_meminfo,
		collect_mc1_meminfo,
		collect_rss,		/*22*/
		collect_rss_pf_config,
		collect_rss_key,
		collect_rss_vf_config,
		collect_rss_config,	/*26*/
		collect_path_mtu,	/*27*/
		collect_sw_state,
		collect_wtp_data,
		collect_pm_stats,
		collect_hw_sched,
		collect_tcp_stats,
		collect_tp_err_stats,
		collect_fcoe_stats,
		collect_rdma_stats,
		collect_tp_indirect,
		collect_sge_indirect,
		collect_cpl_stats,
		collect_ddp_stats,
		collect_wc_stats,
		collect_ulprx_la,
		collect_lb_stats,
		collect_tp_la,
		collect_meminfo,
		collect_cim_pif_la,
		collect_clk_info,
		collect_obq_sge_rx_q0,
		collect_obq_sge_rx_q1,
		collect_macstats,
		collect_pcie_indirect,
		collect_pm_indirect,
		collect_full,
		collect_tx_rate,
		collect_tid,
		collect_pcie_config,
		collect_dump_context,
		collect_mps_tcam,
		collect_vpd_data,
		collect_le_tcam,
		collect_cctrl,
		collect_ma_indirect,
		collect_ulptx_la,
		NULL,			/* ext entity */
		collect_up_cim_indirect,
		collect_pbt_tables,
		collect_mbox_log,
		collect_hma_indirect,
	};

struct large_entity {
	int entity_code;
	int skip_flag;
	int priority; /* 1 is high priority */
};

static int read_cim_ibq(struct cudbg_init *, struct cudbg_buffer *,
			struct cudbg_error * , int);
static int read_cim_obq(struct cudbg_init *, struct cudbg_buffer *,
			struct cudbg_error *, int);
int get_entity_hdr(void *outbuf, int i, u32 size, struct cudbg_entity_hdr **);
void skip_entity(int entity_code);
void reset_skip_entity(void);
int is_large_entity(int entity_code);
#endif