• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "qlge.h"
2 
3 #ifdef QL_REG_DUMP
ql_dump_intr_states(struct ql_adapter * qdev)4 static void ql_dump_intr_states(struct ql_adapter *qdev)
5 {
6 	int i;
7 	u32 value;
8 	for (i = 0; i < qdev->intr_count; i++) {
9 		ql_write32(qdev, INTR_EN, qdev->intr_context[i].intr_read_mask);
10 		value = ql_read32(qdev, INTR_EN);
11 		printk(KERN_ERR PFX
12 		       "%s: Interrupt %d is %s.\n",
13 		       qdev->ndev->name, i,
14 		       (value & INTR_EN_EN ? "enabled" : "disabled"));
15 	}
16 }
17 
ql_dump_xgmac_control_regs(struct ql_adapter * qdev)18 void ql_dump_xgmac_control_regs(struct ql_adapter *qdev)
19 {
20 	u32 data;
21 	if (ql_sem_spinlock(qdev, qdev->xg_sem_mask)) {
22 		printk(KERN_ERR "%s: Couldn't get xgmac sem.\n", __func__);
23 		return;
24 	}
25 	ql_read_xgmac_reg(qdev, PAUSE_SRC_LO, &data);
26 	printk(KERN_ERR PFX "%s: PAUSE_SRC_LO = 0x%.08x.\n", qdev->ndev->name,
27 	       data);
28 	ql_read_xgmac_reg(qdev, PAUSE_SRC_HI, &data);
29 	printk(KERN_ERR PFX "%s: PAUSE_SRC_HI = 0x%.08x.\n", qdev->ndev->name,
30 	       data);
31 	ql_read_xgmac_reg(qdev, GLOBAL_CFG, &data);
32 	printk(KERN_ERR PFX "%s: GLOBAL_CFG = 0x%.08x.\n", qdev->ndev->name,
33 	       data);
34 	ql_read_xgmac_reg(qdev, TX_CFG, &data);
35 	printk(KERN_ERR PFX "%s: TX_CFG = 0x%.08x.\n", qdev->ndev->name, data);
36 	ql_read_xgmac_reg(qdev, RX_CFG, &data);
37 	printk(KERN_ERR PFX "%s: RX_CFG = 0x%.08x.\n", qdev->ndev->name, data);
38 	ql_read_xgmac_reg(qdev, FLOW_CTL, &data);
39 	printk(KERN_ERR PFX "%s: FLOW_CTL = 0x%.08x.\n", qdev->ndev->name,
40 	       data);
41 	ql_read_xgmac_reg(qdev, PAUSE_OPCODE, &data);
42 	printk(KERN_ERR PFX "%s: PAUSE_OPCODE = 0x%.08x.\n", qdev->ndev->name,
43 	       data);
44 	ql_read_xgmac_reg(qdev, PAUSE_TIMER, &data);
45 	printk(KERN_ERR PFX "%s: PAUSE_TIMER = 0x%.08x.\n", qdev->ndev->name,
46 	       data);
47 	ql_read_xgmac_reg(qdev, PAUSE_FRM_DEST_LO, &data);
48 	printk(KERN_ERR PFX "%s: PAUSE_FRM_DEST_LO = 0x%.08x.\n",
49 	       qdev->ndev->name, data);
50 	ql_read_xgmac_reg(qdev, PAUSE_FRM_DEST_HI, &data);
51 	printk(KERN_ERR PFX "%s: PAUSE_FRM_DEST_HI = 0x%.08x.\n",
52 	       qdev->ndev->name, data);
53 	ql_read_xgmac_reg(qdev, MAC_TX_PARAMS, &data);
54 	printk(KERN_ERR PFX "%s: MAC_TX_PARAMS = 0x%.08x.\n", qdev->ndev->name,
55 	       data);
56 	ql_read_xgmac_reg(qdev, MAC_RX_PARAMS, &data);
57 	printk(KERN_ERR PFX "%s: MAC_RX_PARAMS = 0x%.08x.\n", qdev->ndev->name,
58 	       data);
59 	ql_read_xgmac_reg(qdev, MAC_SYS_INT, &data);
60 	printk(KERN_ERR PFX "%s: MAC_SYS_INT = 0x%.08x.\n", qdev->ndev->name,
61 	       data);
62 	ql_read_xgmac_reg(qdev, MAC_SYS_INT_MASK, &data);
63 	printk(KERN_ERR PFX "%s: MAC_SYS_INT_MASK = 0x%.08x.\n",
64 	       qdev->ndev->name, data);
65 	ql_read_xgmac_reg(qdev, MAC_MGMT_INT, &data);
66 	printk(KERN_ERR PFX "%s: MAC_MGMT_INT = 0x%.08x.\n", qdev->ndev->name,
67 	       data);
68 	ql_read_xgmac_reg(qdev, MAC_MGMT_IN_MASK, &data);
69 	printk(KERN_ERR PFX "%s: MAC_MGMT_IN_MASK = 0x%.08x.\n",
70 	       qdev->ndev->name, data);
71 	ql_read_xgmac_reg(qdev, EXT_ARB_MODE, &data);
72 	printk(KERN_ERR PFX "%s: EXT_ARB_MODE = 0x%.08x.\n", qdev->ndev->name,
73 	       data);
74 	ql_sem_unlock(qdev, qdev->xg_sem_mask);
75 
76 }
77 
ql_dump_ets_regs(struct ql_adapter * qdev)78 static void ql_dump_ets_regs(struct ql_adapter *qdev)
79 {
80 }
81 
ql_dump_cam_entries(struct ql_adapter * qdev)82 static void ql_dump_cam_entries(struct ql_adapter *qdev)
83 {
84 	int i;
85 	u32 value[3];
86 	for (i = 0; i < 4; i++) {
87 		if (ql_get_mac_addr_reg(qdev, MAC_ADDR_TYPE_CAM_MAC, i, value)) {
88 			printk(KERN_ERR PFX
89 			       "%s: Failed read of mac index register.\n",
90 			       __func__);
91 			return;
92 		} else {
93 			if (value[0])
94 				printk(KERN_ERR PFX
95 				       "%s: CAM index %d CAM Lookup Lower = 0x%.08x:%.08x, Output = 0x%.08x.\n",
96 				       qdev->ndev->name, i, value[1], value[0],
97 				       value[2]);
98 		}
99 	}
100 	for (i = 0; i < 32; i++) {
101 		if (ql_get_mac_addr_reg
102 		    (qdev, MAC_ADDR_TYPE_MULTI_MAC, i, value)) {
103 			printk(KERN_ERR PFX
104 			       "%s: Failed read of mac index register.\n",
105 			       __func__);
106 			return;
107 		} else {
108 			if (value[0])
109 				printk(KERN_ERR PFX
110 				       "%s: MCAST index %d CAM Lookup Lower = 0x%.08x:%.08x.\n",
111 				       qdev->ndev->name, i, value[1], value[0]);
112 		}
113 	}
114 }
115 
ql_dump_routing_entries(struct ql_adapter * qdev)116 void ql_dump_routing_entries(struct ql_adapter *qdev)
117 {
118 	int i;
119 	u32 value;
120 	for (i = 0; i < 16; i++) {
121 		value = 0;
122 		if (ql_get_routing_reg(qdev, i, &value)) {
123 			printk(KERN_ERR PFX
124 			       "%s: Failed read of routing index register.\n",
125 			       __func__);
126 			return;
127 		} else {
128 			if (value)
129 				printk(KERN_ERR PFX
130 				       "%s: Routing Mask %d = 0x%.08x.\n",
131 				       qdev->ndev->name, i, value);
132 		}
133 	}
134 }
135 
ql_dump_regs(struct ql_adapter * qdev)136 void ql_dump_regs(struct ql_adapter *qdev)
137 {
138 	printk(KERN_ERR PFX "reg dump for function #%d.\n", qdev->func);
139 	printk(KERN_ERR PFX "SYS	 			= 0x%x.\n",
140 	       ql_read32(qdev, SYS));
141 	printk(KERN_ERR PFX "RST_FO 			= 0x%x.\n",
142 	       ql_read32(qdev, RST_FO));
143 	printk(KERN_ERR PFX "FSC 				= 0x%x.\n",
144 	       ql_read32(qdev, FSC));
145 	printk(KERN_ERR PFX "CSR 				= 0x%x.\n",
146 	       ql_read32(qdev, CSR));
147 	printk(KERN_ERR PFX "ICB_RID 			= 0x%x.\n",
148 	       ql_read32(qdev, ICB_RID));
149 	printk(KERN_ERR PFX "ICB_L 				= 0x%x.\n",
150 	       ql_read32(qdev, ICB_L));
151 	printk(KERN_ERR PFX "ICB_H 				= 0x%x.\n",
152 	       ql_read32(qdev, ICB_H));
153 	printk(KERN_ERR PFX "CFG 				= 0x%x.\n",
154 	       ql_read32(qdev, CFG));
155 	printk(KERN_ERR PFX "BIOS_ADDR 			= 0x%x.\n",
156 	       ql_read32(qdev, BIOS_ADDR));
157 	printk(KERN_ERR PFX "STS 				= 0x%x.\n",
158 	       ql_read32(qdev, STS));
159 	printk(KERN_ERR PFX "INTR_EN			= 0x%x.\n",
160 	       ql_read32(qdev, INTR_EN));
161 	printk(KERN_ERR PFX "INTR_MASK 			= 0x%x.\n",
162 	       ql_read32(qdev, INTR_MASK));
163 	printk(KERN_ERR PFX "ISR1 				= 0x%x.\n",
164 	       ql_read32(qdev, ISR1));
165 	printk(KERN_ERR PFX "ISR2 				= 0x%x.\n",
166 	       ql_read32(qdev, ISR2));
167 	printk(KERN_ERR PFX "ISR3 				= 0x%x.\n",
168 	       ql_read32(qdev, ISR3));
169 	printk(KERN_ERR PFX "ISR4 				= 0x%x.\n",
170 	       ql_read32(qdev, ISR4));
171 	printk(KERN_ERR PFX "REV_ID 			= 0x%x.\n",
172 	       ql_read32(qdev, REV_ID));
173 	printk(KERN_ERR PFX "FRC_ECC_ERR 			= 0x%x.\n",
174 	       ql_read32(qdev, FRC_ECC_ERR));
175 	printk(KERN_ERR PFX "ERR_STS 			= 0x%x.\n",
176 	       ql_read32(qdev, ERR_STS));
177 	printk(KERN_ERR PFX "RAM_DBG_ADDR 			= 0x%x.\n",
178 	       ql_read32(qdev, RAM_DBG_ADDR));
179 	printk(KERN_ERR PFX "RAM_DBG_DATA 			= 0x%x.\n",
180 	       ql_read32(qdev, RAM_DBG_DATA));
181 	printk(KERN_ERR PFX "ECC_ERR_CNT 			= 0x%x.\n",
182 	       ql_read32(qdev, ECC_ERR_CNT));
183 	printk(KERN_ERR PFX "SEM 				= 0x%x.\n",
184 	       ql_read32(qdev, SEM));
185 	printk(KERN_ERR PFX "GPIO_1 			= 0x%x.\n",
186 	       ql_read32(qdev, GPIO_1));
187 	printk(KERN_ERR PFX "GPIO_2 			= 0x%x.\n",
188 	       ql_read32(qdev, GPIO_2));
189 	printk(KERN_ERR PFX "GPIO_3 			= 0x%x.\n",
190 	       ql_read32(qdev, GPIO_3));
191 	printk(KERN_ERR PFX "XGMAC_ADDR 			= 0x%x.\n",
192 	       ql_read32(qdev, XGMAC_ADDR));
193 	printk(KERN_ERR PFX "XGMAC_DATA 			= 0x%x.\n",
194 	       ql_read32(qdev, XGMAC_DATA));
195 	printk(KERN_ERR PFX "NIC_ETS 			= 0x%x.\n",
196 	       ql_read32(qdev, NIC_ETS));
197 	printk(KERN_ERR PFX "CNA_ETS 			= 0x%x.\n",
198 	       ql_read32(qdev, CNA_ETS));
199 	printk(KERN_ERR PFX "FLASH_ADDR 			= 0x%x.\n",
200 	       ql_read32(qdev, FLASH_ADDR));
201 	printk(KERN_ERR PFX "FLASH_DATA 			= 0x%x.\n",
202 	       ql_read32(qdev, FLASH_DATA));
203 	printk(KERN_ERR PFX "CQ_STOP 			= 0x%x.\n",
204 	       ql_read32(qdev, CQ_STOP));
205 	printk(KERN_ERR PFX "PAGE_TBL_RID 			= 0x%x.\n",
206 	       ql_read32(qdev, PAGE_TBL_RID));
207 	printk(KERN_ERR PFX "WQ_PAGE_TBL_LO 		= 0x%x.\n",
208 	       ql_read32(qdev, WQ_PAGE_TBL_LO));
209 	printk(KERN_ERR PFX "WQ_PAGE_TBL_HI 		= 0x%x.\n",
210 	       ql_read32(qdev, WQ_PAGE_TBL_HI));
211 	printk(KERN_ERR PFX "CQ_PAGE_TBL_LO 		= 0x%x.\n",
212 	       ql_read32(qdev, CQ_PAGE_TBL_LO));
213 	printk(KERN_ERR PFX "CQ_PAGE_TBL_HI 		= 0x%x.\n",
214 	       ql_read32(qdev, CQ_PAGE_TBL_HI));
215 	printk(KERN_ERR PFX "COS_DFLT_CQ1 			= 0x%x.\n",
216 	       ql_read32(qdev, COS_DFLT_CQ1));
217 	printk(KERN_ERR PFX "COS_DFLT_CQ2 			= 0x%x.\n",
218 	       ql_read32(qdev, COS_DFLT_CQ2));
219 	printk(KERN_ERR PFX "SPLT_HDR 			= 0x%x.\n",
220 	       ql_read32(qdev, SPLT_HDR));
221 	printk(KERN_ERR PFX "FC_PAUSE_THRES 		= 0x%x.\n",
222 	       ql_read32(qdev, FC_PAUSE_THRES));
223 	printk(KERN_ERR PFX "NIC_PAUSE_THRES 		= 0x%x.\n",
224 	       ql_read32(qdev, NIC_PAUSE_THRES));
225 	printk(KERN_ERR PFX "FC_ETHERTYPE 			= 0x%x.\n",
226 	       ql_read32(qdev, FC_ETHERTYPE));
227 	printk(KERN_ERR PFX "FC_RCV_CFG 			= 0x%x.\n",
228 	       ql_read32(qdev, FC_RCV_CFG));
229 	printk(KERN_ERR PFX "NIC_RCV_CFG 			= 0x%x.\n",
230 	       ql_read32(qdev, NIC_RCV_CFG));
231 	printk(KERN_ERR PFX "FC_COS_TAGS 			= 0x%x.\n",
232 	       ql_read32(qdev, FC_COS_TAGS));
233 	printk(KERN_ERR PFX "NIC_COS_TAGS 			= 0x%x.\n",
234 	       ql_read32(qdev, NIC_COS_TAGS));
235 	printk(KERN_ERR PFX "MGMT_RCV_CFG 			= 0x%x.\n",
236 	       ql_read32(qdev, MGMT_RCV_CFG));
237 	printk(KERN_ERR PFX "XG_SERDES_ADDR 		= 0x%x.\n",
238 	       ql_read32(qdev, XG_SERDES_ADDR));
239 	printk(KERN_ERR PFX "XG_SERDES_DATA 		= 0x%x.\n",
240 	       ql_read32(qdev, XG_SERDES_DATA));
241 	printk(KERN_ERR PFX "PRB_MX_ADDR 			= 0x%x.\n",
242 	       ql_read32(qdev, PRB_MX_ADDR));
243 	printk(KERN_ERR PFX "PRB_MX_DATA 			= 0x%x.\n",
244 	       ql_read32(qdev, PRB_MX_DATA));
245 	ql_dump_intr_states(qdev);
246 	ql_dump_xgmac_control_regs(qdev);
247 	ql_dump_ets_regs(qdev);
248 	ql_dump_cam_entries(qdev);
249 	ql_dump_routing_entries(qdev);
250 }
251 #endif
252 
253 #ifdef QL_STAT_DUMP
ql_dump_stat(struct ql_adapter * qdev)254 void ql_dump_stat(struct ql_adapter *qdev)
255 {
256 	printk(KERN_ERR "%s: Enter.\n", __func__);
257 	printk(KERN_ERR "tx_pkts = %ld\n",
258 	       (unsigned long)qdev->nic_stats.tx_pkts);
259 	printk(KERN_ERR "tx_bytes = %ld\n",
260 	       (unsigned long)qdev->nic_stats.tx_bytes);
261 	printk(KERN_ERR "tx_mcast_pkts = %ld.\n",
262 	       (unsigned long)qdev->nic_stats.tx_mcast_pkts);
263 	printk(KERN_ERR "tx_bcast_pkts = %ld.\n",
264 	       (unsigned long)qdev->nic_stats.tx_bcast_pkts);
265 	printk(KERN_ERR "tx_ucast_pkts = %ld.\n",
266 	       (unsigned long)qdev->nic_stats.tx_ucast_pkts);
267 	printk(KERN_ERR "tx_ctl_pkts = %ld.\n",
268 	       (unsigned long)qdev->nic_stats.tx_ctl_pkts);
269 	printk(KERN_ERR "tx_pause_pkts = %ld.\n",
270 	       (unsigned long)qdev->nic_stats.tx_pause_pkts);
271 	printk(KERN_ERR "tx_64_pkt = %ld.\n",
272 	       (unsigned long)qdev->nic_stats.tx_64_pkt);
273 	printk(KERN_ERR "tx_65_to_127_pkt = %ld.\n",
274 	       (unsigned long)qdev->nic_stats.tx_65_to_127_pkt);
275 	printk(KERN_ERR "tx_128_to_255_pkt = %ld.\n",
276 	       (unsigned long)qdev->nic_stats.tx_128_to_255_pkt);
277 	printk(KERN_ERR "tx_256_511_pkt = %ld.\n",
278 	       (unsigned long)qdev->nic_stats.tx_256_511_pkt);
279 	printk(KERN_ERR "tx_512_to_1023_pkt = %ld.\n",
280 	       (unsigned long)qdev->nic_stats.tx_512_to_1023_pkt);
281 	printk(KERN_ERR "tx_1024_to_1518_pkt = %ld.\n",
282 	       (unsigned long)qdev->nic_stats.tx_1024_to_1518_pkt);
283 	printk(KERN_ERR "tx_1519_to_max_pkt = %ld.\n",
284 	       (unsigned long)qdev->nic_stats.tx_1519_to_max_pkt);
285 	printk(KERN_ERR "tx_undersize_pkt = %ld.\n",
286 	       (unsigned long)qdev->nic_stats.tx_undersize_pkt);
287 	printk(KERN_ERR "tx_oversize_pkt = %ld.\n",
288 	       (unsigned long)qdev->nic_stats.tx_oversize_pkt);
289 	printk(KERN_ERR "rx_bytes = %ld.\n",
290 	       (unsigned long)qdev->nic_stats.rx_bytes);
291 	printk(KERN_ERR "rx_bytes_ok = %ld.\n",
292 	       (unsigned long)qdev->nic_stats.rx_bytes_ok);
293 	printk(KERN_ERR "rx_pkts = %ld.\n",
294 	       (unsigned long)qdev->nic_stats.rx_pkts);
295 	printk(KERN_ERR "rx_pkts_ok = %ld.\n",
296 	       (unsigned long)qdev->nic_stats.rx_pkts_ok);
297 	printk(KERN_ERR "rx_bcast_pkts = %ld.\n",
298 	       (unsigned long)qdev->nic_stats.rx_bcast_pkts);
299 	printk(KERN_ERR "rx_mcast_pkts = %ld.\n",
300 	       (unsigned long)qdev->nic_stats.rx_mcast_pkts);
301 	printk(KERN_ERR "rx_ucast_pkts = %ld.\n",
302 	       (unsigned long)qdev->nic_stats.rx_ucast_pkts);
303 	printk(KERN_ERR "rx_undersize_pkts = %ld.\n",
304 	       (unsigned long)qdev->nic_stats.rx_undersize_pkts);
305 	printk(KERN_ERR "rx_oversize_pkts = %ld.\n",
306 	       (unsigned long)qdev->nic_stats.rx_oversize_pkts);
307 	printk(KERN_ERR "rx_jabber_pkts = %ld.\n",
308 	       (unsigned long)qdev->nic_stats.rx_jabber_pkts);
309 	printk(KERN_ERR "rx_undersize_fcerr_pkts = %ld.\n",
310 	       (unsigned long)qdev->nic_stats.rx_undersize_fcerr_pkts);
311 	printk(KERN_ERR "rx_drop_events = %ld.\n",
312 	       (unsigned long)qdev->nic_stats.rx_drop_events);
313 	printk(KERN_ERR "rx_fcerr_pkts = %ld.\n",
314 	       (unsigned long)qdev->nic_stats.rx_fcerr_pkts);
315 	printk(KERN_ERR "rx_align_err = %ld.\n",
316 	       (unsigned long)qdev->nic_stats.rx_align_err);
317 	printk(KERN_ERR "rx_symbol_err = %ld.\n",
318 	       (unsigned long)qdev->nic_stats.rx_symbol_err);
319 	printk(KERN_ERR "rx_mac_err = %ld.\n",
320 	       (unsigned long)qdev->nic_stats.rx_mac_err);
321 	printk(KERN_ERR "rx_ctl_pkts = %ld.\n",
322 	       (unsigned long)qdev->nic_stats.rx_ctl_pkts);
323 	printk(KERN_ERR "rx_pause_pkts = %ld.\n",
324 	       (unsigned long)qdev->nic_stats.rx_pause_pkts);
325 	printk(KERN_ERR "rx_64_pkts = %ld.\n",
326 	       (unsigned long)qdev->nic_stats.rx_64_pkts);
327 	printk(KERN_ERR "rx_65_to_127_pkts = %ld.\n",
328 	       (unsigned long)qdev->nic_stats.rx_65_to_127_pkts);
329 	printk(KERN_ERR "rx_128_255_pkts = %ld.\n",
330 	       (unsigned long)qdev->nic_stats.rx_128_255_pkts);
331 	printk(KERN_ERR "rx_256_511_pkts = %ld.\n",
332 	       (unsigned long)qdev->nic_stats.rx_256_511_pkts);
333 	printk(KERN_ERR "rx_512_to_1023_pkts = %ld.\n",
334 	       (unsigned long)qdev->nic_stats.rx_512_to_1023_pkts);
335 	printk(KERN_ERR "rx_1024_to_1518_pkts = %ld.\n",
336 	       (unsigned long)qdev->nic_stats.rx_1024_to_1518_pkts);
337 	printk(KERN_ERR "rx_1519_to_max_pkts = %ld.\n",
338 	       (unsigned long)qdev->nic_stats.rx_1519_to_max_pkts);
339 	printk(KERN_ERR "rx_len_err_pkts = %ld.\n",
340 	       (unsigned long)qdev->nic_stats.rx_len_err_pkts);
341 };
342 #endif
343 
344 #ifdef QL_DEV_DUMP
ql_dump_qdev(struct ql_adapter * qdev)345 void ql_dump_qdev(struct ql_adapter *qdev)
346 {
347 	int i;
348 	printk(KERN_ERR PFX "qdev->flags 			= %lx.\n",
349 	       qdev->flags);
350 	printk(KERN_ERR PFX "qdev->vlgrp 			= %p.\n",
351 	       qdev->vlgrp);
352 	printk(KERN_ERR PFX "qdev->pdev 			= %p.\n",
353 	       qdev->pdev);
354 	printk(KERN_ERR PFX "qdev->ndev 			= %p.\n",
355 	       qdev->ndev);
356 	printk(KERN_ERR PFX "qdev->chip_rev_id 		= %d.\n",
357 	       qdev->chip_rev_id);
358 	printk(KERN_ERR PFX "qdev->reg_base 		= %p.\n",
359 	       qdev->reg_base);
360 	printk(KERN_ERR PFX "qdev->doorbell_area 	= %p.\n",
361 	       qdev->doorbell_area);
362 	printk(KERN_ERR PFX "qdev->doorbell_area_size 	= %d.\n",
363 	       qdev->doorbell_area_size);
364 	printk(KERN_ERR PFX "msg_enable 		= %x.\n",
365 	       qdev->msg_enable);
366 	printk(KERN_ERR PFX "qdev->rx_ring_shadow_reg_area	= %p.\n",
367 	       qdev->rx_ring_shadow_reg_area);
368 	printk(KERN_ERR PFX "qdev->rx_ring_shadow_reg_dma 	= %llx.\n",
369 	       (unsigned long long) qdev->rx_ring_shadow_reg_dma);
370 	printk(KERN_ERR PFX "qdev->tx_ring_shadow_reg_area	= %p.\n",
371 	       qdev->tx_ring_shadow_reg_area);
372 	printk(KERN_ERR PFX "qdev->tx_ring_shadow_reg_dma	= %llx.\n",
373 	       (unsigned long long) qdev->tx_ring_shadow_reg_dma);
374 	printk(KERN_ERR PFX "qdev->intr_count 		= %d.\n",
375 	       qdev->intr_count);
376 	if (qdev->msi_x_entry)
377 		for (i = 0; i < qdev->intr_count; i++) {
378 			printk(KERN_ERR PFX
379 			       "msi_x_entry.[%d]vector	= %d.\n", i,
380 			       qdev->msi_x_entry[i].vector);
381 			printk(KERN_ERR PFX
382 			       "msi_x_entry.[%d]entry	= %d.\n", i,
383 			       qdev->msi_x_entry[i].entry);
384 		}
385 	for (i = 0; i < qdev->intr_count; i++) {
386 		printk(KERN_ERR PFX
387 		       "intr_context[%d].qdev		= %p.\n", i,
388 		       qdev->intr_context[i].qdev);
389 		printk(KERN_ERR PFX
390 		       "intr_context[%d].intr		= %d.\n", i,
391 		       qdev->intr_context[i].intr);
392 		printk(KERN_ERR PFX
393 		       "intr_context[%d].hooked		= %d.\n", i,
394 		       qdev->intr_context[i].hooked);
395 		printk(KERN_ERR PFX
396 		       "intr_context[%d].intr_en_mask	= 0x%08x.\n", i,
397 		       qdev->intr_context[i].intr_en_mask);
398 		printk(KERN_ERR PFX
399 		       "intr_context[%d].intr_dis_mask	= 0x%08x.\n", i,
400 		       qdev->intr_context[i].intr_dis_mask);
401 		printk(KERN_ERR PFX
402 		       "intr_context[%d].intr_read_mask	= 0x%08x.\n", i,
403 		       qdev->intr_context[i].intr_read_mask);
404 	}
405 	printk(KERN_ERR PFX "qdev->tx_ring_count = %d.\n", qdev->tx_ring_count);
406 	printk(KERN_ERR PFX "qdev->rx_ring_count = %d.\n", qdev->rx_ring_count);
407 	printk(KERN_ERR PFX "qdev->ring_mem_size = %d.\n", qdev->ring_mem_size);
408 	printk(KERN_ERR PFX "qdev->ring_mem 	= %p.\n", qdev->ring_mem);
409 	printk(KERN_ERR PFX "qdev->intr_count 	= %d.\n", qdev->intr_count);
410 	printk(KERN_ERR PFX "qdev->tx_ring		= %p.\n",
411 	       qdev->tx_ring);
412 	printk(KERN_ERR PFX "qdev->rss_ring_first_cq_id 	= %d.\n",
413 	       qdev->rss_ring_first_cq_id);
414 	printk(KERN_ERR PFX "qdev->rss_ring_count 	= %d.\n",
415 	       qdev->rss_ring_count);
416 	printk(KERN_ERR PFX "qdev->rx_ring	= %p.\n", qdev->rx_ring);
417 	printk(KERN_ERR PFX "qdev->default_rx_queue	= %d.\n",
418 	       qdev->default_rx_queue);
419 	printk(KERN_ERR PFX "qdev->xg_sem_mask		= 0x%08x.\n",
420 	       qdev->xg_sem_mask);
421 	printk(KERN_ERR PFX "qdev->port_link_up		= 0x%08x.\n",
422 	       qdev->port_link_up);
423 	printk(KERN_ERR PFX "qdev->port_init		= 0x%08x.\n",
424 	       qdev->port_init);
425 
426 }
427 #endif
428 
429 #ifdef QL_CB_DUMP
ql_dump_wqicb(struct wqicb * wqicb)430 void ql_dump_wqicb(struct wqicb *wqicb)
431 {
432 	printk(KERN_ERR PFX "Dumping wqicb stuff...\n");
433 	printk(KERN_ERR PFX "wqicb->len = 0x%x.\n", le16_to_cpu(wqicb->len));
434 	printk(KERN_ERR PFX "wqicb->flags = %x.\n", le16_to_cpu(wqicb->flags));
435 	printk(KERN_ERR PFX "wqicb->cq_id_rss = %d.\n",
436 	       le16_to_cpu(wqicb->cq_id_rss));
437 	printk(KERN_ERR PFX "wqicb->rid = 0x%x.\n", le16_to_cpu(wqicb->rid));
438 	printk(KERN_ERR PFX "wqicb->wq_addr = 0x%llx.\n",
439 	       (unsigned long long) le64_to_cpu(wqicb->addr));
440 	printk(KERN_ERR PFX "wqicb->wq_cnsmr_idx_addr = 0x%llx.\n",
441 	       (unsigned long long) le64_to_cpu(wqicb->cnsmr_idx_addr));
442 }
443 
ql_dump_tx_ring(struct tx_ring * tx_ring)444 void ql_dump_tx_ring(struct tx_ring *tx_ring)
445 {
446 	if (tx_ring == NULL)
447 		return;
448 	printk(KERN_ERR PFX
449 	       "===================== Dumping tx_ring %d ===============.\n",
450 	       tx_ring->wq_id);
451 	printk(KERN_ERR PFX "tx_ring->base = %p.\n", tx_ring->wq_base);
452 	printk(KERN_ERR PFX "tx_ring->base_dma = 0x%llx.\n",
453 	       (unsigned long long) tx_ring->wq_base_dma);
454 	printk(KERN_ERR PFX
455 	       "tx_ring->cnsmr_idx_sh_reg, addr = 0x%p, value = %d.\n",
456 	       tx_ring->cnsmr_idx_sh_reg,
457 	       tx_ring->cnsmr_idx_sh_reg
458 			? ql_read_sh_reg(tx_ring->cnsmr_idx_sh_reg) : 0);
459 	printk(KERN_ERR PFX "tx_ring->size = %d.\n", tx_ring->wq_size);
460 	printk(KERN_ERR PFX "tx_ring->len = %d.\n", tx_ring->wq_len);
461 	printk(KERN_ERR PFX "tx_ring->prod_idx_db_reg = %p.\n",
462 	       tx_ring->prod_idx_db_reg);
463 	printk(KERN_ERR PFX "tx_ring->valid_db_reg = %p.\n",
464 	       tx_ring->valid_db_reg);
465 	printk(KERN_ERR PFX "tx_ring->prod_idx = %d.\n", tx_ring->prod_idx);
466 	printk(KERN_ERR PFX "tx_ring->cq_id = %d.\n", tx_ring->cq_id);
467 	printk(KERN_ERR PFX "tx_ring->wq_id = %d.\n", tx_ring->wq_id);
468 	printk(KERN_ERR PFX "tx_ring->q = %p.\n", tx_ring->q);
469 	printk(KERN_ERR PFX "tx_ring->tx_count = %d.\n",
470 	       atomic_read(&tx_ring->tx_count));
471 }
472 
ql_dump_ricb(struct ricb * ricb)473 void ql_dump_ricb(struct ricb *ricb)
474 {
475 	int i;
476 	printk(KERN_ERR PFX
477 	       "===================== Dumping ricb ===============.\n");
478 	printk(KERN_ERR PFX "Dumping ricb stuff...\n");
479 
480 	printk(KERN_ERR PFX "ricb->base_cq = %d.\n", ricb->base_cq & 0x1f);
481 	printk(KERN_ERR PFX "ricb->flags = %s%s%s%s%s%s%s%s%s.\n",
482 	       ricb->base_cq & RSS_L4K ? "RSS_L4K " : "",
483 	       ricb->flags & RSS_L6K ? "RSS_L6K " : "",
484 	       ricb->flags & RSS_LI ? "RSS_LI " : "",
485 	       ricb->flags & RSS_LB ? "RSS_LB " : "",
486 	       ricb->flags & RSS_LM ? "RSS_LM " : "",
487 	       ricb->flags & RSS_RI4 ? "RSS_RI4 " : "",
488 	       ricb->flags & RSS_RT4 ? "RSS_RT4 " : "",
489 	       ricb->flags & RSS_RI6 ? "RSS_RI6 " : "",
490 	       ricb->flags & RSS_RT6 ? "RSS_RT6 " : "");
491 	printk(KERN_ERR PFX "ricb->mask = 0x%.04x.\n", le16_to_cpu(ricb->mask));
492 	for (i = 0; i < 16; i++)
493 		printk(KERN_ERR PFX "ricb->hash_cq_id[%d] = 0x%.08x.\n", i,
494 		       le32_to_cpu(ricb->hash_cq_id[i]));
495 	for (i = 0; i < 10; i++)
496 		printk(KERN_ERR PFX "ricb->ipv6_hash_key[%d] = 0x%.08x.\n", i,
497 		       le32_to_cpu(ricb->ipv6_hash_key[i]));
498 	for (i = 0; i < 4; i++)
499 		printk(KERN_ERR PFX "ricb->ipv4_hash_key[%d] = 0x%.08x.\n", i,
500 		       le32_to_cpu(ricb->ipv4_hash_key[i]));
501 }
502 
ql_dump_cqicb(struct cqicb * cqicb)503 void ql_dump_cqicb(struct cqicb *cqicb)
504 {
505 	printk(KERN_ERR PFX "Dumping cqicb stuff...\n");
506 
507 	printk(KERN_ERR PFX "cqicb->msix_vect = %d.\n", cqicb->msix_vect);
508 	printk(KERN_ERR PFX "cqicb->flags = %x.\n", cqicb->flags);
509 	printk(KERN_ERR PFX "cqicb->len = %d.\n", le16_to_cpu(cqicb->len));
510 	printk(KERN_ERR PFX "cqicb->addr = 0x%llx.\n",
511 	       (unsigned long long) le64_to_cpu(cqicb->addr));
512 	printk(KERN_ERR PFX "cqicb->prod_idx_addr = 0x%llx.\n",
513 	       (unsigned long long) le64_to_cpu(cqicb->prod_idx_addr));
514 	printk(KERN_ERR PFX "cqicb->pkt_delay = 0x%.04x.\n",
515 	       le16_to_cpu(cqicb->pkt_delay));
516 	printk(KERN_ERR PFX "cqicb->irq_delay = 0x%.04x.\n",
517 	       le16_to_cpu(cqicb->irq_delay));
518 	printk(KERN_ERR PFX "cqicb->lbq_addr = 0x%llx.\n",
519 	       (unsigned long long) le64_to_cpu(cqicb->lbq_addr));
520 	printk(KERN_ERR PFX "cqicb->lbq_buf_size = 0x%.04x.\n",
521 	       le16_to_cpu(cqicb->lbq_buf_size));
522 	printk(KERN_ERR PFX "cqicb->lbq_len = 0x%.04x.\n",
523 	       le16_to_cpu(cqicb->lbq_len));
524 	printk(KERN_ERR PFX "cqicb->sbq_addr = 0x%llx.\n",
525 	       (unsigned long long) le64_to_cpu(cqicb->sbq_addr));
526 	printk(KERN_ERR PFX "cqicb->sbq_buf_size = 0x%.04x.\n",
527 	       le16_to_cpu(cqicb->sbq_buf_size));
528 	printk(KERN_ERR PFX "cqicb->sbq_len = 0x%.04x.\n",
529 	       le16_to_cpu(cqicb->sbq_len));
530 }
531 
ql_dump_rx_ring(struct rx_ring * rx_ring)532 void ql_dump_rx_ring(struct rx_ring *rx_ring)
533 {
534 	if (rx_ring == NULL)
535 		return;
536 	printk(KERN_ERR PFX
537 	       "===================== Dumping rx_ring %d ===============.\n",
538 	       rx_ring->cq_id);
539 	printk(KERN_ERR PFX "Dumping rx_ring %d, type = %s%s%s.\n",
540 	       rx_ring->cq_id, rx_ring->type == DEFAULT_Q ? "DEFAULT" : "",
541 	       rx_ring->type == TX_Q ? "OUTBOUND COMPLETIONS" : "",
542 	       rx_ring->type == RX_Q ? "INBOUND_COMPLETIONS" : "");
543 	printk(KERN_ERR PFX "rx_ring->cqicb = %p.\n", &rx_ring->cqicb);
544 	printk(KERN_ERR PFX "rx_ring->cq_base = %p.\n", rx_ring->cq_base);
545 	printk(KERN_ERR PFX "rx_ring->cq_base_dma = %llx.\n",
546 	       (unsigned long long) rx_ring->cq_base_dma);
547 	printk(KERN_ERR PFX "rx_ring->cq_size = %d.\n", rx_ring->cq_size);
548 	printk(KERN_ERR PFX "rx_ring->cq_len = %d.\n", rx_ring->cq_len);
549 	printk(KERN_ERR PFX
550 	       "rx_ring->prod_idx_sh_reg, addr = 0x%p, value = %d.\n",
551 	       rx_ring->prod_idx_sh_reg,
552 	       rx_ring->prod_idx_sh_reg
553 			? ql_read_sh_reg(rx_ring->prod_idx_sh_reg) : 0);
554 	printk(KERN_ERR PFX "rx_ring->prod_idx_sh_reg_dma = %llx.\n",
555 	       (unsigned long long) rx_ring->prod_idx_sh_reg_dma);
556 	printk(KERN_ERR PFX "rx_ring->cnsmr_idx_db_reg = %p.\n",
557 	       rx_ring->cnsmr_idx_db_reg);
558 	printk(KERN_ERR PFX "rx_ring->cnsmr_idx = %d.\n", rx_ring->cnsmr_idx);
559 	printk(KERN_ERR PFX "rx_ring->curr_entry = %p.\n", rx_ring->curr_entry);
560 	printk(KERN_ERR PFX "rx_ring->valid_db_reg = %p.\n",
561 	       rx_ring->valid_db_reg);
562 
563 	printk(KERN_ERR PFX "rx_ring->lbq_base = %p.\n", rx_ring->lbq_base);
564 	printk(KERN_ERR PFX "rx_ring->lbq_base_dma = %llx.\n",
565 	       (unsigned long long) rx_ring->lbq_base_dma);
566 	printk(KERN_ERR PFX "rx_ring->lbq_base_indirect = %p.\n",
567 	       rx_ring->lbq_base_indirect);
568 	printk(KERN_ERR PFX "rx_ring->lbq_base_indirect_dma = %llx.\n",
569 	       (unsigned long long) rx_ring->lbq_base_indirect_dma);
570 	printk(KERN_ERR PFX "rx_ring->lbq = %p.\n", rx_ring->lbq);
571 	printk(KERN_ERR PFX "rx_ring->lbq_len = %d.\n", rx_ring->lbq_len);
572 	printk(KERN_ERR PFX "rx_ring->lbq_size = %d.\n", rx_ring->lbq_size);
573 	printk(KERN_ERR PFX "rx_ring->lbq_prod_idx_db_reg = %p.\n",
574 	       rx_ring->lbq_prod_idx_db_reg);
575 	printk(KERN_ERR PFX "rx_ring->lbq_prod_idx = %d.\n",
576 	       rx_ring->lbq_prod_idx);
577 	printk(KERN_ERR PFX "rx_ring->lbq_curr_idx = %d.\n",
578 	       rx_ring->lbq_curr_idx);
579 	printk(KERN_ERR PFX "rx_ring->lbq_clean_idx = %d.\n",
580 	       rx_ring->lbq_clean_idx);
581 	printk(KERN_ERR PFX "rx_ring->lbq_free_cnt = %d.\n",
582 	       rx_ring->lbq_free_cnt);
583 	printk(KERN_ERR PFX "rx_ring->lbq_buf_size = %d.\n",
584 	       rx_ring->lbq_buf_size);
585 
586 	printk(KERN_ERR PFX "rx_ring->sbq_base = %p.\n", rx_ring->sbq_base);
587 	printk(KERN_ERR PFX "rx_ring->sbq_base_dma = %llx.\n",
588 	       (unsigned long long) rx_ring->sbq_base_dma);
589 	printk(KERN_ERR PFX "rx_ring->sbq_base_indirect = %p.\n",
590 	       rx_ring->sbq_base_indirect);
591 	printk(KERN_ERR PFX "rx_ring->sbq_base_indirect_dma = %llx.\n",
592 	       (unsigned long long) rx_ring->sbq_base_indirect_dma);
593 	printk(KERN_ERR PFX "rx_ring->sbq = %p.\n", rx_ring->sbq);
594 	printk(KERN_ERR PFX "rx_ring->sbq_len = %d.\n", rx_ring->sbq_len);
595 	printk(KERN_ERR PFX "rx_ring->sbq_size = %d.\n", rx_ring->sbq_size);
596 	printk(KERN_ERR PFX "rx_ring->sbq_prod_idx_db_reg addr = %p.\n",
597 	       rx_ring->sbq_prod_idx_db_reg);
598 	printk(KERN_ERR PFX "rx_ring->sbq_prod_idx = %d.\n",
599 	       rx_ring->sbq_prod_idx);
600 	printk(KERN_ERR PFX "rx_ring->sbq_curr_idx = %d.\n",
601 	       rx_ring->sbq_curr_idx);
602 	printk(KERN_ERR PFX "rx_ring->sbq_clean_idx = %d.\n",
603 	       rx_ring->sbq_clean_idx);
604 	printk(KERN_ERR PFX "rx_ring->sbq_free_cnt = %d.\n",
605 	       rx_ring->sbq_free_cnt);
606 	printk(KERN_ERR PFX "rx_ring->sbq_buf_size = %d.\n",
607 	       rx_ring->sbq_buf_size);
608 	printk(KERN_ERR PFX "rx_ring->cq_id = %d.\n", rx_ring->cq_id);
609 	printk(KERN_ERR PFX "rx_ring->irq = %d.\n", rx_ring->irq);
610 	printk(KERN_ERR PFX "rx_ring->cpu = %d.\n", rx_ring->cpu);
611 	printk(KERN_ERR PFX "rx_ring->qdev = %p.\n", rx_ring->qdev);
612 }
613 
ql_dump_hw_cb(struct ql_adapter * qdev,int size,u32 bit,u16 q_id)614 void ql_dump_hw_cb(struct ql_adapter *qdev, int size, u32 bit, u16 q_id)
615 {
616 	void *ptr;
617 
618 	printk(KERN_ERR PFX "%s: Enter.\n", __func__);
619 
620 	ptr = kmalloc(size, GFP_ATOMIC);
621 	if (ptr == NULL) {
622 		printk(KERN_ERR PFX "%s: Couldn't allocate a buffer.\n",
623 		       __func__);
624 		return;
625 	}
626 
627 	if (ql_write_cfg(qdev, ptr, size, bit, q_id)) {
628 		printk(KERN_ERR "%s: Failed to upload control block!\n",
629 		       __func__);
630 		goto fail_it;
631 	}
632 	switch (bit) {
633 	case CFG_DRQ:
634 		ql_dump_wqicb((struct wqicb *)ptr);
635 		break;
636 	case CFG_DCQ:
637 		ql_dump_cqicb((struct cqicb *)ptr);
638 		break;
639 	case CFG_DR:
640 		ql_dump_ricb((struct ricb *)ptr);
641 		break;
642 	default:
643 		printk(KERN_ERR PFX "%s: Invalid bit value = %x.\n",
644 		       __func__, bit);
645 		break;
646 	}
647 fail_it:
648 	kfree(ptr);
649 }
650 #endif
651 
652 #ifdef QL_OB_DUMP
ql_dump_tx_desc(struct tx_buf_desc * tbd)653 void ql_dump_tx_desc(struct tx_buf_desc *tbd)
654 {
655 	printk(KERN_ERR PFX "tbd->addr  = 0x%llx\n",
656 	       le64_to_cpu((u64) tbd->addr));
657 	printk(KERN_ERR PFX "tbd->len   = %d\n",
658 	       le32_to_cpu(tbd->len & TX_DESC_LEN_MASK));
659 	printk(KERN_ERR PFX "tbd->flags = %s %s\n",
660 	       tbd->len & TX_DESC_C ? "C" : ".",
661 	       tbd->len & TX_DESC_E ? "E" : ".");
662 	tbd++;
663 	printk(KERN_ERR PFX "tbd->addr  = 0x%llx\n",
664 	       le64_to_cpu((u64) tbd->addr));
665 	printk(KERN_ERR PFX "tbd->len   = %d\n",
666 	       le32_to_cpu(tbd->len & TX_DESC_LEN_MASK));
667 	printk(KERN_ERR PFX "tbd->flags = %s %s\n",
668 	       tbd->len & TX_DESC_C ? "C" : ".",
669 	       tbd->len & TX_DESC_E ? "E" : ".");
670 	tbd++;
671 	printk(KERN_ERR PFX "tbd->addr  = 0x%llx\n",
672 	       le64_to_cpu((u64) tbd->addr));
673 	printk(KERN_ERR PFX "tbd->len   = %d\n",
674 	       le32_to_cpu(tbd->len & TX_DESC_LEN_MASK));
675 	printk(KERN_ERR PFX "tbd->flags = %s %s\n",
676 	       tbd->len & TX_DESC_C ? "C" : ".",
677 	       tbd->len & TX_DESC_E ? "E" : ".");
678 
679 }
680 
ql_dump_ob_mac_iocb(struct ob_mac_iocb_req * ob_mac_iocb)681 void ql_dump_ob_mac_iocb(struct ob_mac_iocb_req *ob_mac_iocb)
682 {
683 	struct ob_mac_tso_iocb_req *ob_mac_tso_iocb =
684 	    (struct ob_mac_tso_iocb_req *)ob_mac_iocb;
685 	struct tx_buf_desc *tbd;
686 	u16 frame_len;
687 
688 	printk(KERN_ERR PFX "%s\n", __func__);
689 	printk(KERN_ERR PFX "opcode         = %s\n",
690 	       (ob_mac_iocb->opcode == OPCODE_OB_MAC_IOCB) ? "MAC" : "TSO");
691 	printk(KERN_ERR PFX "flags1          = %s %s %s %s %s\n",
692 	       ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_OI ? "OI" : "",
693 	       ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_I ? "I" : "",
694 	       ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_D ? "D" : "",
695 	       ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_IP4 ? "IP4" : "",
696 	       ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_IP6 ? "IP6" : "");
697 	printk(KERN_ERR PFX "flags2          = %s %s %s\n",
698 	       ob_mac_tso_iocb->flags2 & OB_MAC_TSO_IOCB_LSO ? "LSO" : "",
699 	       ob_mac_tso_iocb->flags2 & OB_MAC_TSO_IOCB_UC ? "UC" : "",
700 	       ob_mac_tso_iocb->flags2 & OB_MAC_TSO_IOCB_TC ? "TC" : "");
701 	printk(KERN_ERR PFX "flags3          = %s %s %s \n",
702 	       ob_mac_tso_iocb->flags3 & OB_MAC_TSO_IOCB_IC ? "IC" : "",
703 	       ob_mac_tso_iocb->flags3 & OB_MAC_TSO_IOCB_DFP ? "DFP" : "",
704 	       ob_mac_tso_iocb->flags3 & OB_MAC_TSO_IOCB_V ? "V" : "");
705 	printk(KERN_ERR PFX "tid = %x\n", ob_mac_iocb->tid);
706 	printk(KERN_ERR PFX "txq_idx = %d\n", ob_mac_iocb->txq_idx);
707 	printk(KERN_ERR PFX "vlan_tci      = %x\n", ob_mac_tso_iocb->vlan_tci);
708 	if (ob_mac_iocb->opcode == OPCODE_OB_MAC_TSO_IOCB) {
709 		printk(KERN_ERR PFX "frame_len      = %d\n",
710 		       le32_to_cpu(ob_mac_tso_iocb->frame_len));
711 		printk(KERN_ERR PFX "mss      = %d\n",
712 		       le16_to_cpu(ob_mac_tso_iocb->mss));
713 		printk(KERN_ERR PFX "prot_hdr_len   = %d\n",
714 		       le16_to_cpu(ob_mac_tso_iocb->total_hdrs_len));
715 		printk(KERN_ERR PFX "hdr_offset     = 0x%.04x\n",
716 		       le16_to_cpu(ob_mac_tso_iocb->net_trans_offset));
717 		frame_len = le32_to_cpu(ob_mac_tso_iocb->frame_len);
718 	} else {
719 		printk(KERN_ERR PFX "frame_len      = %d\n",
720 		       le16_to_cpu(ob_mac_iocb->frame_len));
721 		frame_len = le16_to_cpu(ob_mac_iocb->frame_len);
722 	}
723 	tbd = &ob_mac_iocb->tbd[0];
724 	ql_dump_tx_desc(tbd);
725 }
726 
ql_dump_ob_mac_rsp(struct ob_mac_iocb_rsp * ob_mac_rsp)727 void ql_dump_ob_mac_rsp(struct ob_mac_iocb_rsp *ob_mac_rsp)
728 {
729 	printk(KERN_ERR PFX "%s\n", __func__);
730 	printk(KERN_ERR PFX "opcode         = %d\n", ob_mac_rsp->opcode);
731 	printk(KERN_ERR PFX "flags          = %s %s %s %s %s %s %s\n",
732 	       ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_OI ? "OI" : ".",
733 	       ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_I ? "I" : ".",
734 	       ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_E ? "E" : ".",
735 	       ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_S ? "S" : ".",
736 	       ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_L ? "L" : ".",
737 	       ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_P ? "P" : ".",
738 	       ob_mac_rsp->flags2 & OB_MAC_IOCB_RSP_B ? "B" : ".");
739 	printk(KERN_ERR PFX "tid = %x\n", ob_mac_rsp->tid);
740 }
741 #endif
742 
743 #ifdef QL_IB_DUMP
ql_dump_ib_mac_rsp(struct ib_mac_iocb_rsp * ib_mac_rsp)744 void ql_dump_ib_mac_rsp(struct ib_mac_iocb_rsp *ib_mac_rsp)
745 {
746 	printk(KERN_ERR PFX "%s\n", __func__);
747 	printk(KERN_ERR PFX "opcode         = 0x%x\n", ib_mac_rsp->opcode);
748 	printk(KERN_ERR PFX "flags1 = %s%s%s%s%s%s\n",
749 	       ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_OI ? "OI " : "",
750 	       ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_I ? "I " : "",
751 	       ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_TE ? "TE " : "",
752 	       ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_NU ? "NU " : "",
753 	       ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_IE ? "IE " : "",
754 	       ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_B ? "B " : "");
755 
756 	if (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK)
757 		printk(KERN_ERR PFX "%s%s%s Multicast.\n",
758 		       (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK) ==
759 		       IB_MAC_IOCB_RSP_M_HASH ? "Hash" : "",
760 		       (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK) ==
761 		       IB_MAC_IOCB_RSP_M_REG ? "Registered" : "",
762 		       (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK) ==
763 		       IB_MAC_IOCB_RSP_M_PROM ? "Promiscuous" : "");
764 
765 	printk(KERN_ERR PFX "flags2 = %s%s%s%s%s\n",
766 	       (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_P) ? "P " : "",
767 	       (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) ? "V " : "",
768 	       (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_U) ? "U " : "",
769 	       (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_T) ? "T " : "",
770 	       (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_FO) ? "FO " : "");
771 
772 	if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK)
773 		printk(KERN_ERR PFX "%s%s%s%s%s error.\n",
774 		       (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) ==
775 		       IB_MAC_IOCB_RSP_ERR_OVERSIZE ? "oversize" : "",
776 		       (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) ==
777 		       IB_MAC_IOCB_RSP_ERR_UNDERSIZE ? "undersize" : "",
778 		       (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) ==
779 		       IB_MAC_IOCB_RSP_ERR_PREAMBLE ? "preamble" : "",
780 		       (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) ==
781 		       IB_MAC_IOCB_RSP_ERR_FRAME_LEN ? "frame length" : "",
782 		       (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) ==
783 		       IB_MAC_IOCB_RSP_ERR_CRC ? "CRC" : "");
784 
785 	printk(KERN_ERR PFX "flags3 = %s%s.\n",
786 	       ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_DS ? "DS " : "",
787 	       ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_DL ? "DL " : "");
788 
789 	if (ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK)
790 		printk(KERN_ERR PFX "RSS flags = %s%s%s%s.\n",
791 		       ((ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) ==
792 			IB_MAC_IOCB_RSP_M_IPV4) ? "IPv4 RSS" : "",
793 		       ((ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) ==
794 			IB_MAC_IOCB_RSP_M_IPV6) ? "IPv6 RSS " : "",
795 		       ((ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) ==
796 			IB_MAC_IOCB_RSP_M_TCP_V4) ? "TCP/IPv4 RSS" : "",
797 		       ((ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) ==
798 			IB_MAC_IOCB_RSP_M_TCP_V6) ? "TCP/IPv6 RSS" : "");
799 
800 	printk(KERN_ERR PFX "data_len	= %d\n",
801 	       le32_to_cpu(ib_mac_rsp->data_len));
802 	printk(KERN_ERR PFX "data_addr    = 0x%llx\n",
803 	       (unsigned long long) le64_to_cpu(ib_mac_rsp->data_addr));
804 	if (ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK)
805 		printk(KERN_ERR PFX "rss    = %x\n",
806 		       le32_to_cpu(ib_mac_rsp->rss));
807 	if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V)
808 		printk(KERN_ERR PFX "vlan_id    = %x\n",
809 		       le16_to_cpu(ib_mac_rsp->vlan_id));
810 
811 	printk(KERN_ERR PFX "flags4 = %s%s%s.\n",
812 		ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV ? "HV " : "",
813 		ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HS ? "HS " : "",
814 		ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HL ? "HL " : "");
815 
816 	if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) {
817 		printk(KERN_ERR PFX "hdr length	= %d.\n",
818 		       le32_to_cpu(ib_mac_rsp->hdr_len));
819 		printk(KERN_ERR PFX "hdr addr    = 0x%llx.\n",
820 		       (unsigned long long) le64_to_cpu(ib_mac_rsp->hdr_addr));
821 	}
822 }
823 #endif
824 
825 #ifdef QL_ALL_DUMP
ql_dump_all(struct ql_adapter * qdev)826 void ql_dump_all(struct ql_adapter *qdev)
827 {
828 	int i;
829 
830 	QL_DUMP_REGS(qdev);
831 	QL_DUMP_QDEV(qdev);
832 	for (i = 0; i < qdev->tx_ring_count; i++) {
833 		QL_DUMP_TX_RING(&qdev->tx_ring[i]);
834 		QL_DUMP_WQICB((struct wqicb *)&qdev->tx_ring[i]);
835 	}
836 	for (i = 0; i < qdev->rx_ring_count; i++) {
837 		QL_DUMP_RX_RING(&qdev->rx_ring[i]);
838 		QL_DUMP_CQICB((struct cqicb *)&qdev->rx_ring[i]);
839 	}
840 }
841 #endif
842