FreeBSD kernel CXGBE device code
cudbg_lib.h
Go to the documentation of this file.
1/*-
2 * Copyright (c) 2017 Chelsio Communications, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 *
28 */
29
30#ifndef __CUDBG_LIB_H__
31#define __CUDBG_LIB_H__
32
33#ifndef min_t
34#define min_t(type, _a, _b) (((type)(_a) < (type)(_b)) ? (type)(_a) : (type)(_b))
35#endif
36
37static int collect_reg_dump(struct cudbg_init *, struct cudbg_buffer *,
38 struct cudbg_error *);
39static int collect_fw_devlog(struct cudbg_init *, struct cudbg_buffer *,
40 struct cudbg_error *);
41static int collect_cim_qcfg(struct cudbg_init *, struct cudbg_buffer *,
42 struct cudbg_error *);
43static int collect_cim_la(struct cudbg_init *, struct cudbg_buffer *,
44 struct cudbg_error *);
45static int collect_cim_ma_la(struct cudbg_init *, struct cudbg_buffer *,
46 struct cudbg_error *);
47static int collect_cim_obq_ulp0(struct cudbg_init *, struct cudbg_buffer *,
48 struct cudbg_error *);
49static int collect_cim_obq_ulp1(struct cudbg_init *, struct cudbg_buffer *,
50 struct cudbg_error *);
51static int collect_cim_obq_ulp2(struct cudbg_init *, struct cudbg_buffer *,
52 struct cudbg_error *);
53static int collect_cim_obq_ulp3(struct cudbg_init *, struct cudbg_buffer *,
54 struct cudbg_error *);
55static int collect_cim_obq_sge(struct cudbg_init *, struct cudbg_buffer *,
56 struct cudbg_error *);
57static int collect_cim_obq_ncsi(struct cudbg_init *, struct cudbg_buffer *,
58 struct cudbg_error *);
59static int collect_cim_ibq_tp0(struct cudbg_init *, struct cudbg_buffer *,
60 struct cudbg_error *);
61static int collect_cim_ibq_tp1(struct cudbg_init *, struct cudbg_buffer *,
62 struct cudbg_error *);
63static int collect_cim_ibq_ulp(struct cudbg_init *, struct cudbg_buffer *,
64 struct cudbg_error *);
65static int collect_cim_ibq_sge0(struct cudbg_init *, struct cudbg_buffer *,
66 struct cudbg_error *);
67static int collect_cim_ibq_sge1(struct cudbg_init *, struct cudbg_buffer *,
68 struct cudbg_error *);
69static int collect_cim_ibq_ncsi(struct cudbg_init *, struct cudbg_buffer *,
70 struct cudbg_error *);
71static int collect_edc0_meminfo(struct cudbg_init *, struct cudbg_buffer *,
72 struct cudbg_error *);
73static int collect_edc1_meminfo(struct cudbg_init *, struct cudbg_buffer *,
74 struct cudbg_error *);
75static int collect_mc0_meminfo(struct cudbg_init *, struct cudbg_buffer *,
76 struct cudbg_error *);
77static int collect_mc1_meminfo(struct cudbg_init *, struct cudbg_buffer *,
78 struct cudbg_error *);
79static int collect_rss(struct cudbg_init *, struct cudbg_buffer *,
80 struct cudbg_error *);
81static int collect_rss_key(struct cudbg_init *, struct cudbg_buffer *,
82 struct cudbg_error *);
83static int collect_rss_pf_config(struct cudbg_init *, struct cudbg_buffer *,
84 struct cudbg_error *);
85static int collect_rss_vf_config(struct cudbg_init *, struct cudbg_buffer *,
86 struct cudbg_error *);
87static int collect_rss_config(struct cudbg_init *, struct cudbg_buffer *,
88 struct cudbg_error *);
89static int collect_path_mtu(struct cudbg_init *, struct cudbg_buffer *,
90 struct cudbg_error *);
91static int collect_sw_state(struct cudbg_init *, struct cudbg_buffer *,
92 struct cudbg_error *);
93int collect_wtp_data(struct cudbg_init *, struct cudbg_buffer *,
94 struct cudbg_error *);
95static int collect_pm_stats(struct cudbg_init *, struct cudbg_buffer *,
96 struct cudbg_error *);
97static int collect_hw_sched(struct cudbg_init *, struct cudbg_buffer *,
98 struct cudbg_error *);
99static int collect_tcp_stats(struct cudbg_init *, struct cudbg_buffer *,
100 struct cudbg_error *);
101static int collect_tp_err_stats(struct cudbg_init *, struct cudbg_buffer *,
102 struct cudbg_error *);
103static int collect_fcoe_stats(struct cudbg_init *, struct cudbg_buffer *,
104 struct cudbg_error *);
105static int collect_rdma_stats(struct cudbg_init *, struct cudbg_buffer *,
106 struct cudbg_error *);
107static int collect_tp_indirect(struct cudbg_init *, struct cudbg_buffer *,
108 struct cudbg_error *);
109static int collect_sge_indirect(struct cudbg_init *, struct cudbg_buffer *,
110 struct cudbg_error *);
111static int collect_cpl_stats(struct cudbg_init *, struct cudbg_buffer *,
112 struct cudbg_error *);
113static int collect_ddp_stats(struct cudbg_init *, struct cudbg_buffer *,
114 struct cudbg_error *);
115static int collect_wc_stats(struct cudbg_init *, struct cudbg_buffer *,
116 struct cudbg_error *);
117static int collect_ulprx_la(struct cudbg_init *, struct cudbg_buffer *,
118 struct cudbg_error *);
119static int collect_lb_stats(struct cudbg_init *, struct cudbg_buffer *,
120 struct cudbg_error *);
121static int collect_tp_la(struct cudbg_init *, struct cudbg_buffer *,
122 struct cudbg_error *);
123static int collect_meminfo(struct cudbg_init *, struct cudbg_buffer *,
124 struct cudbg_error *);
125static int collect_cim_pif_la(struct cudbg_init *, struct cudbg_buffer *,
126 struct cudbg_error *);
127static int collect_clk_info(struct cudbg_init *, struct cudbg_buffer *,
128 struct cudbg_error *);
129static int collect_obq_sge_rx_q0(struct cudbg_init *, struct cudbg_buffer *,
130 struct cudbg_error *);
131static int collect_obq_sge_rx_q1(struct cudbg_init *, struct cudbg_buffer *,
132 struct cudbg_error *);
133static int collect_macstats(struct cudbg_init *, struct cudbg_buffer *,
134 struct cudbg_error *);
135static int collect_pcie_indirect(struct cudbg_init *, struct cudbg_buffer *,
136 struct cudbg_error *);
137static int collect_pm_indirect(struct cudbg_init *, struct cudbg_buffer *,
138 struct cudbg_error *);
139static int collect_full(struct cudbg_init *, struct cudbg_buffer *,
140 struct cudbg_error *);
141static int collect_tx_rate(struct cudbg_init *, struct cudbg_buffer *,
142 struct cudbg_error *);
143static int collect_tid(struct cudbg_init *, struct cudbg_buffer *,
144 struct cudbg_error *);
145static int collect_pcie_config(struct cudbg_init *, struct cudbg_buffer *,
146 struct cudbg_error *);
147static int collect_dump_context(struct cudbg_init *, struct cudbg_buffer *,
148 struct cudbg_error *);
149static int collect_mps_tcam(struct cudbg_init *, struct cudbg_buffer *,
150 struct cudbg_error *);
151static int collect_vpd_data(struct cudbg_init *, struct cudbg_buffer *,
152 struct cudbg_error *);
153static int collect_le_tcam(struct cudbg_init *, struct cudbg_buffer *,
154 struct cudbg_error *);
155static int collect_cctrl(struct cudbg_init *, struct cudbg_buffer *,
156 struct cudbg_error *);
157static int collect_ma_indirect(struct cudbg_init *, struct cudbg_buffer *,
158 struct cudbg_error *);
159static int collect_ulptx_la(struct cudbg_init *, struct cudbg_buffer *,
160 struct cudbg_error *);
161static int collect_up_cim_indirect(struct cudbg_init *, struct cudbg_buffer *,
162 struct cudbg_error *);
163static int collect_pbt_tables(struct cudbg_init *, struct cudbg_buffer *,
164 struct cudbg_error *);
165static int collect_mbox_log(struct cudbg_init *, struct cudbg_buffer *,
166 struct cudbg_error *);
167static int collect_hma_indirect(struct cudbg_init *, struct cudbg_buffer *,
168 struct cudbg_error *);
169
170static int (*process_entity[])
171 (struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *) = {
174 collect_cim_la, /*3*/
193 collect_rss, /*22*/
197 collect_rss_config, /*26*/
198 collect_path_mtu, /*27*/
234 NULL, /* ext entity */
239 };
240
244 int priority; /* 1 is high priority */
245};
246
247static int read_cim_ibq(struct cudbg_init *, struct cudbg_buffer *,
248 struct cudbg_error * , int);
249static int read_cim_obq(struct cudbg_init *, struct cudbg_buffer *,
250 struct cudbg_error *, int);
251int get_entity_hdr(void *outbuf, int i, u32 size, struct cudbg_entity_hdr **);
252void skip_entity(int entity_code);
253void reset_skip_entity(void);
254int is_large_entity(int entity_code);
255#endif
static int collect_obq_sge_rx_q1(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_tid(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_cim_ma_la(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_reg_dump(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
static int collect_meminfo(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
int get_entity_hdr(void *outbuf, int i, u32 size, struct cudbg_entity_hdr **)
Definition: cudbg_lib.c:555
static int collect_clk_info(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_tp_la(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_wc_stats(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_cim_obq_ulp2(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
static int(* process_entity[])(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
Definition: cudbg_lib.h:171
static int collect_mc0_meminfo(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_mbox_log(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_sw_state(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 collect_cim_obq_ulp0(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_ulptx_la(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_edc0_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_cim_obq_ulp1(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
static int collect_cctrl(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
void reset_skip_entity(void)
Definition: cudbg_lib.c:525
static int collect_fw_devlog(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_up_cim_indirect(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
void skip_entity(int entity_code)
Definition: cudbg_lib.c:533
static int collect_cim_obq_ncsi(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_mps_tcam(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
static int collect_cim_qcfg(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
int is_large_entity(int entity_code)
Definition: cudbg_lib.c:543
static int collect_cim_ibq_ulp(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_sge_indirect(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_cim_ibq_tp1(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_la(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_rss_pf_config(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_cim_ibq_sge1(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
static int read_cim_ibq(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *, int)
static int collect_rss_vf_config(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_macstats(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_ddp_stats(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_tp_err_stats(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_cim_ibq_sge0(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
int collect_wtp_data(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
Definition: cudbg_wtp.c:1297
static int collect_cim_pif_la(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
static int read_cim_obq(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *, int)
static int collect_pm_stats(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_hw_sched(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_rdma_stats(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_cim_ibq_tp0(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
static int collect_pcie_indirect(struct cudbg_init *, struct cudbg_buffer *, struct cudbg_error *)
uint32_t u32
Definition: osdep.h:61
int entity_code
Definition: cudbg_lib.h:242