Linux 2.6.33-rc8
[linux-2.6/lguest.git] / drivers / net / qlge / qlge_dbg.c
blob9f58c47107618762c5f0fe761cd5a593c967b408
1 #include "qlge.h"
4 static int ql_get_ets_regs(struct ql_adapter *qdev, u32 * buf)
6 int status = 0;
7 int i;
9 for (i = 0; i < 8; i++, buf++) {
10 ql_write32(qdev, NIC_ETS, i << 29 | 0x08000000);
11 *buf = ql_read32(qdev, NIC_ETS);
14 for (i = 0; i < 2; i++, buf++) {
15 ql_write32(qdev, CNA_ETS, i << 29 | 0x08000000);
16 *buf = ql_read32(qdev, CNA_ETS);
19 return status;
22 static void ql_get_intr_states(struct ql_adapter *qdev, u32 * buf)
24 int i;
26 for (i = 0; i < qdev->rx_ring_count; i++, buf++) {
27 ql_write32(qdev, INTR_EN,
28 qdev->intr_context[i].intr_read_mask);
29 *buf = ql_read32(qdev, INTR_EN);
33 static int ql_get_cam_entries(struct ql_adapter *qdev, u32 * buf)
35 int i, status;
36 u32 value[3];
38 status = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK);
39 if (status)
40 return status;
42 for (i = 0; i < 16; i++) {
43 status = ql_get_mac_addr_reg(qdev,
44 MAC_ADDR_TYPE_CAM_MAC, i, value);
45 if (status) {
46 QPRINTK(qdev, DRV, ERR,
47 "Failed read of mac index register.\n");
48 goto err;
50 *buf++ = value[0]; /* lower MAC address */
51 *buf++ = value[1]; /* upper MAC address */
52 *buf++ = value[2]; /* output */
54 for (i = 0; i < 32; i++) {
55 status = ql_get_mac_addr_reg(qdev,
56 MAC_ADDR_TYPE_MULTI_MAC, i, value);
57 if (status) {
58 QPRINTK(qdev, DRV, ERR,
59 "Failed read of mac index register.\n");
60 goto err;
62 *buf++ = value[0]; /* lower Mcast address */
63 *buf++ = value[1]; /* upper Mcast address */
65 err:
66 ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK);
67 return status;
70 static int ql_get_routing_entries(struct ql_adapter *qdev, u32 * buf)
72 int status;
73 u32 value, i;
75 status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
76 if (status)
77 return status;
79 for (i = 0; i < 16; i++) {
80 status = ql_get_routing_reg(qdev, i, &value);
81 if (status) {
82 QPRINTK(qdev, DRV, ERR,
83 "Failed read of routing index register.\n");
84 goto err;
85 } else {
86 *buf++ = value;
89 err:
90 ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
91 return status;
94 /* Create a coredump segment header */
95 static void ql_build_coredump_seg_header(
96 struct mpi_coredump_segment_header *seg_hdr,
97 u32 seg_number, u32 seg_size, u8 *desc)
99 memset(seg_hdr, 0, sizeof(struct mpi_coredump_segment_header));
100 seg_hdr->cookie = MPI_COREDUMP_COOKIE;
101 seg_hdr->segNum = seg_number;
102 seg_hdr->segSize = seg_size;
103 memcpy(seg_hdr->description, desc, (sizeof(seg_hdr->description)) - 1);
106 void ql_gen_reg_dump(struct ql_adapter *qdev,
107 struct ql_reg_dump *mpi_coredump)
109 int i, status;
112 memset(&(mpi_coredump->mpi_global_header), 0,
113 sizeof(struct mpi_coredump_global_header));
114 mpi_coredump->mpi_global_header.cookie = MPI_COREDUMP_COOKIE;
115 mpi_coredump->mpi_global_header.headerSize =
116 sizeof(struct mpi_coredump_global_header);
117 mpi_coredump->mpi_global_header.imageSize =
118 sizeof(struct ql_reg_dump);
119 memcpy(mpi_coredump->mpi_global_header.idString, "MPI Coredump",
120 sizeof(mpi_coredump->mpi_global_header.idString));
123 /* segment 16 */
124 ql_build_coredump_seg_header(&mpi_coredump->misc_nic_seg_hdr,
125 MISC_NIC_INFO_SEG_NUM,
126 sizeof(struct mpi_coredump_segment_header)
127 + sizeof(mpi_coredump->misc_nic_info),
128 "MISC NIC INFO");
129 mpi_coredump->misc_nic_info.rx_ring_count = qdev->rx_ring_count;
130 mpi_coredump->misc_nic_info.tx_ring_count = qdev->tx_ring_count;
131 mpi_coredump->misc_nic_info.intr_count = qdev->intr_count;
132 mpi_coredump->misc_nic_info.function = qdev->func;
134 /* Segment 16, Rev C. Step 18 */
135 ql_build_coredump_seg_header(&mpi_coredump->nic_regs_seg_hdr,
136 NIC1_CONTROL_SEG_NUM,
137 sizeof(struct mpi_coredump_segment_header)
138 + sizeof(mpi_coredump->nic_regs),
139 "NIC Registers");
140 /* Get generic reg dump */
141 for (i = 0; i < 64; i++)
142 mpi_coredump->nic_regs[i] = ql_read32(qdev, i * sizeof(u32));
144 /* Segment 31 */
145 /* Get indexed register values. */
146 ql_build_coredump_seg_header(&mpi_coredump->intr_states_seg_hdr,
147 INTR_STATES_SEG_NUM,
148 sizeof(struct mpi_coredump_segment_header)
149 + sizeof(mpi_coredump->intr_states),
150 "INTR States");
151 ql_get_intr_states(qdev, &mpi_coredump->intr_states[0]);
153 ql_build_coredump_seg_header(&mpi_coredump->cam_entries_seg_hdr,
154 CAM_ENTRIES_SEG_NUM,
155 sizeof(struct mpi_coredump_segment_header)
156 + sizeof(mpi_coredump->cam_entries),
157 "CAM Entries");
158 status = ql_get_cam_entries(qdev, &mpi_coredump->cam_entries[0]);
159 if (status)
160 return;
162 ql_build_coredump_seg_header(&mpi_coredump->nic_routing_words_seg_hdr,
163 ROUTING_WORDS_SEG_NUM,
164 sizeof(struct mpi_coredump_segment_header)
165 + sizeof(mpi_coredump->nic_routing_words),
166 "Routing Words");
167 status = ql_get_routing_entries(qdev,
168 &mpi_coredump->nic_routing_words[0]);
169 if (status)
170 return;
172 /* Segment 34 (Rev C. step 23) */
173 ql_build_coredump_seg_header(&mpi_coredump->ets_seg_hdr,
174 ETS_SEG_NUM,
175 sizeof(struct mpi_coredump_segment_header)
176 + sizeof(mpi_coredump->ets),
177 "ETS Registers");
178 status = ql_get_ets_regs(qdev, &mpi_coredump->ets[0]);
179 if (status)
180 return;
183 #ifdef QL_REG_DUMP
184 static void ql_dump_intr_states(struct ql_adapter *qdev)
186 int i;
187 u32 value;
188 for (i = 0; i < qdev->intr_count; i++) {
189 ql_write32(qdev, INTR_EN, qdev->intr_context[i].intr_read_mask);
190 value = ql_read32(qdev, INTR_EN);
191 printk(KERN_ERR PFX
192 "%s: Interrupt %d is %s.\n",
193 qdev->ndev->name, i,
194 (value & INTR_EN_EN ? "enabled" : "disabled"));
198 void ql_dump_xgmac_control_regs(struct ql_adapter *qdev)
200 u32 data;
201 if (ql_sem_spinlock(qdev, qdev->xg_sem_mask)) {
202 printk(KERN_ERR "%s: Couldn't get xgmac sem.\n", __func__);
203 return;
205 ql_read_xgmac_reg(qdev, PAUSE_SRC_LO, &data);
206 printk(KERN_ERR PFX "%s: PAUSE_SRC_LO = 0x%.08x.\n", qdev->ndev->name,
207 data);
208 ql_read_xgmac_reg(qdev, PAUSE_SRC_HI, &data);
209 printk(KERN_ERR PFX "%s: PAUSE_SRC_HI = 0x%.08x.\n", qdev->ndev->name,
210 data);
211 ql_read_xgmac_reg(qdev, GLOBAL_CFG, &data);
212 printk(KERN_ERR PFX "%s: GLOBAL_CFG = 0x%.08x.\n", qdev->ndev->name,
213 data);
214 ql_read_xgmac_reg(qdev, TX_CFG, &data);
215 printk(KERN_ERR PFX "%s: TX_CFG = 0x%.08x.\n", qdev->ndev->name, data);
216 ql_read_xgmac_reg(qdev, RX_CFG, &data);
217 printk(KERN_ERR PFX "%s: RX_CFG = 0x%.08x.\n", qdev->ndev->name, data);
218 ql_read_xgmac_reg(qdev, FLOW_CTL, &data);
219 printk(KERN_ERR PFX "%s: FLOW_CTL = 0x%.08x.\n", qdev->ndev->name,
220 data);
221 ql_read_xgmac_reg(qdev, PAUSE_OPCODE, &data);
222 printk(KERN_ERR PFX "%s: PAUSE_OPCODE = 0x%.08x.\n", qdev->ndev->name,
223 data);
224 ql_read_xgmac_reg(qdev, PAUSE_TIMER, &data);
225 printk(KERN_ERR PFX "%s: PAUSE_TIMER = 0x%.08x.\n", qdev->ndev->name,
226 data);
227 ql_read_xgmac_reg(qdev, PAUSE_FRM_DEST_LO, &data);
228 printk(KERN_ERR PFX "%s: PAUSE_FRM_DEST_LO = 0x%.08x.\n",
229 qdev->ndev->name, data);
230 ql_read_xgmac_reg(qdev, PAUSE_FRM_DEST_HI, &data);
231 printk(KERN_ERR PFX "%s: PAUSE_FRM_DEST_HI = 0x%.08x.\n",
232 qdev->ndev->name, data);
233 ql_read_xgmac_reg(qdev, MAC_TX_PARAMS, &data);
234 printk(KERN_ERR PFX "%s: MAC_TX_PARAMS = 0x%.08x.\n", qdev->ndev->name,
235 data);
236 ql_read_xgmac_reg(qdev, MAC_RX_PARAMS, &data);
237 printk(KERN_ERR PFX "%s: MAC_RX_PARAMS = 0x%.08x.\n", qdev->ndev->name,
238 data);
239 ql_read_xgmac_reg(qdev, MAC_SYS_INT, &data);
240 printk(KERN_ERR PFX "%s: MAC_SYS_INT = 0x%.08x.\n", qdev->ndev->name,
241 data);
242 ql_read_xgmac_reg(qdev, MAC_SYS_INT_MASK, &data);
243 printk(KERN_ERR PFX "%s: MAC_SYS_INT_MASK = 0x%.08x.\n",
244 qdev->ndev->name, data);
245 ql_read_xgmac_reg(qdev, MAC_MGMT_INT, &data);
246 printk(KERN_ERR PFX "%s: MAC_MGMT_INT = 0x%.08x.\n", qdev->ndev->name,
247 data);
248 ql_read_xgmac_reg(qdev, MAC_MGMT_IN_MASK, &data);
249 printk(KERN_ERR PFX "%s: MAC_MGMT_IN_MASK = 0x%.08x.\n",
250 qdev->ndev->name, data);
251 ql_read_xgmac_reg(qdev, EXT_ARB_MODE, &data);
252 printk(KERN_ERR PFX "%s: EXT_ARB_MODE = 0x%.08x.\n", qdev->ndev->name,
253 data);
254 ql_sem_unlock(qdev, qdev->xg_sem_mask);
258 static void ql_dump_ets_regs(struct ql_adapter *qdev)
262 static void ql_dump_cam_entries(struct ql_adapter *qdev)
264 int i;
265 u32 value[3];
267 i = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK);
268 if (i)
269 return;
270 for (i = 0; i < 4; i++) {
271 if (ql_get_mac_addr_reg(qdev, MAC_ADDR_TYPE_CAM_MAC, i, value)) {
272 printk(KERN_ERR PFX
273 "%s: Failed read of mac index register.\n",
274 __func__);
275 return;
276 } else {
277 if (value[0])
278 printk(KERN_ERR PFX
279 "%s: CAM index %d CAM Lookup Lower = 0x%.08x:%.08x, Output = 0x%.08x.\n",
280 qdev->ndev->name, i, value[1], value[0],
281 value[2]);
284 for (i = 0; i < 32; i++) {
285 if (ql_get_mac_addr_reg
286 (qdev, MAC_ADDR_TYPE_MULTI_MAC, i, value)) {
287 printk(KERN_ERR PFX
288 "%s: Failed read of mac index register.\n",
289 __func__);
290 return;
291 } else {
292 if (value[0])
293 printk(KERN_ERR PFX
294 "%s: MCAST index %d CAM Lookup Lower = 0x%.08x:%.08x.\n",
295 qdev->ndev->name, i, value[1], value[0]);
298 ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK);
301 void ql_dump_routing_entries(struct ql_adapter *qdev)
303 int i;
304 u32 value;
305 i = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
306 if (i)
307 return;
308 for (i = 0; i < 16; i++) {
309 value = 0;
310 if (ql_get_routing_reg(qdev, i, &value)) {
311 printk(KERN_ERR PFX
312 "%s: Failed read of routing index register.\n",
313 __func__);
314 return;
315 } else {
316 if (value)
317 printk(KERN_ERR PFX
318 "%s: Routing Mask %d = 0x%.08x.\n",
319 qdev->ndev->name, i, value);
322 ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
325 void ql_dump_regs(struct ql_adapter *qdev)
327 printk(KERN_ERR PFX "reg dump for function #%d.\n", qdev->func);
328 printk(KERN_ERR PFX "SYS = 0x%x.\n",
329 ql_read32(qdev, SYS));
330 printk(KERN_ERR PFX "RST_FO = 0x%x.\n",
331 ql_read32(qdev, RST_FO));
332 printk(KERN_ERR PFX "FSC = 0x%x.\n",
333 ql_read32(qdev, FSC));
334 printk(KERN_ERR PFX "CSR = 0x%x.\n",
335 ql_read32(qdev, CSR));
336 printk(KERN_ERR PFX "ICB_RID = 0x%x.\n",
337 ql_read32(qdev, ICB_RID));
338 printk(KERN_ERR PFX "ICB_L = 0x%x.\n",
339 ql_read32(qdev, ICB_L));
340 printk(KERN_ERR PFX "ICB_H = 0x%x.\n",
341 ql_read32(qdev, ICB_H));
342 printk(KERN_ERR PFX "CFG = 0x%x.\n",
343 ql_read32(qdev, CFG));
344 printk(KERN_ERR PFX "BIOS_ADDR = 0x%x.\n",
345 ql_read32(qdev, BIOS_ADDR));
346 printk(KERN_ERR PFX "STS = 0x%x.\n",
347 ql_read32(qdev, STS));
348 printk(KERN_ERR PFX "INTR_EN = 0x%x.\n",
349 ql_read32(qdev, INTR_EN));
350 printk(KERN_ERR PFX "INTR_MASK = 0x%x.\n",
351 ql_read32(qdev, INTR_MASK));
352 printk(KERN_ERR PFX "ISR1 = 0x%x.\n",
353 ql_read32(qdev, ISR1));
354 printk(KERN_ERR PFX "ISR2 = 0x%x.\n",
355 ql_read32(qdev, ISR2));
356 printk(KERN_ERR PFX "ISR3 = 0x%x.\n",
357 ql_read32(qdev, ISR3));
358 printk(KERN_ERR PFX "ISR4 = 0x%x.\n",
359 ql_read32(qdev, ISR4));
360 printk(KERN_ERR PFX "REV_ID = 0x%x.\n",
361 ql_read32(qdev, REV_ID));
362 printk(KERN_ERR PFX "FRC_ECC_ERR = 0x%x.\n",
363 ql_read32(qdev, FRC_ECC_ERR));
364 printk(KERN_ERR PFX "ERR_STS = 0x%x.\n",
365 ql_read32(qdev, ERR_STS));
366 printk(KERN_ERR PFX "RAM_DBG_ADDR = 0x%x.\n",
367 ql_read32(qdev, RAM_DBG_ADDR));
368 printk(KERN_ERR PFX "RAM_DBG_DATA = 0x%x.\n",
369 ql_read32(qdev, RAM_DBG_DATA));
370 printk(KERN_ERR PFX "ECC_ERR_CNT = 0x%x.\n",
371 ql_read32(qdev, ECC_ERR_CNT));
372 printk(KERN_ERR PFX "SEM = 0x%x.\n",
373 ql_read32(qdev, SEM));
374 printk(KERN_ERR PFX "GPIO_1 = 0x%x.\n",
375 ql_read32(qdev, GPIO_1));
376 printk(KERN_ERR PFX "GPIO_2 = 0x%x.\n",
377 ql_read32(qdev, GPIO_2));
378 printk(KERN_ERR PFX "GPIO_3 = 0x%x.\n",
379 ql_read32(qdev, GPIO_3));
380 printk(KERN_ERR PFX "XGMAC_ADDR = 0x%x.\n",
381 ql_read32(qdev, XGMAC_ADDR));
382 printk(KERN_ERR PFX "XGMAC_DATA = 0x%x.\n",
383 ql_read32(qdev, XGMAC_DATA));
384 printk(KERN_ERR PFX "NIC_ETS = 0x%x.\n",
385 ql_read32(qdev, NIC_ETS));
386 printk(KERN_ERR PFX "CNA_ETS = 0x%x.\n",
387 ql_read32(qdev, CNA_ETS));
388 printk(KERN_ERR PFX "FLASH_ADDR = 0x%x.\n",
389 ql_read32(qdev, FLASH_ADDR));
390 printk(KERN_ERR PFX "FLASH_DATA = 0x%x.\n",
391 ql_read32(qdev, FLASH_DATA));
392 printk(KERN_ERR PFX "CQ_STOP = 0x%x.\n",
393 ql_read32(qdev, CQ_STOP));
394 printk(KERN_ERR PFX "PAGE_TBL_RID = 0x%x.\n",
395 ql_read32(qdev, PAGE_TBL_RID));
396 printk(KERN_ERR PFX "WQ_PAGE_TBL_LO = 0x%x.\n",
397 ql_read32(qdev, WQ_PAGE_TBL_LO));
398 printk(KERN_ERR PFX "WQ_PAGE_TBL_HI = 0x%x.\n",
399 ql_read32(qdev, WQ_PAGE_TBL_HI));
400 printk(KERN_ERR PFX "CQ_PAGE_TBL_LO = 0x%x.\n",
401 ql_read32(qdev, CQ_PAGE_TBL_LO));
402 printk(KERN_ERR PFX "CQ_PAGE_TBL_HI = 0x%x.\n",
403 ql_read32(qdev, CQ_PAGE_TBL_HI));
404 printk(KERN_ERR PFX "COS_DFLT_CQ1 = 0x%x.\n",
405 ql_read32(qdev, COS_DFLT_CQ1));
406 printk(KERN_ERR PFX "COS_DFLT_CQ2 = 0x%x.\n",
407 ql_read32(qdev, COS_DFLT_CQ2));
408 printk(KERN_ERR PFX "SPLT_HDR = 0x%x.\n",
409 ql_read32(qdev, SPLT_HDR));
410 printk(KERN_ERR PFX "FC_PAUSE_THRES = 0x%x.\n",
411 ql_read32(qdev, FC_PAUSE_THRES));
412 printk(KERN_ERR PFX "NIC_PAUSE_THRES = 0x%x.\n",
413 ql_read32(qdev, NIC_PAUSE_THRES));
414 printk(KERN_ERR PFX "FC_ETHERTYPE = 0x%x.\n",
415 ql_read32(qdev, FC_ETHERTYPE));
416 printk(KERN_ERR PFX "FC_RCV_CFG = 0x%x.\n",
417 ql_read32(qdev, FC_RCV_CFG));
418 printk(KERN_ERR PFX "NIC_RCV_CFG = 0x%x.\n",
419 ql_read32(qdev, NIC_RCV_CFG));
420 printk(KERN_ERR PFX "FC_COS_TAGS = 0x%x.\n",
421 ql_read32(qdev, FC_COS_TAGS));
422 printk(KERN_ERR PFX "NIC_COS_TAGS = 0x%x.\n",
423 ql_read32(qdev, NIC_COS_TAGS));
424 printk(KERN_ERR PFX "MGMT_RCV_CFG = 0x%x.\n",
425 ql_read32(qdev, MGMT_RCV_CFG));
426 printk(KERN_ERR PFX "XG_SERDES_ADDR = 0x%x.\n",
427 ql_read32(qdev, XG_SERDES_ADDR));
428 printk(KERN_ERR PFX "XG_SERDES_DATA = 0x%x.\n",
429 ql_read32(qdev, XG_SERDES_DATA));
430 printk(KERN_ERR PFX "PRB_MX_ADDR = 0x%x.\n",
431 ql_read32(qdev, PRB_MX_ADDR));
432 printk(KERN_ERR PFX "PRB_MX_DATA = 0x%x.\n",
433 ql_read32(qdev, PRB_MX_DATA));
434 ql_dump_intr_states(qdev);
435 ql_dump_xgmac_control_regs(qdev);
436 ql_dump_ets_regs(qdev);
437 ql_dump_cam_entries(qdev);
438 ql_dump_routing_entries(qdev);
440 #endif
442 #ifdef QL_STAT_DUMP
443 void ql_dump_stat(struct ql_adapter *qdev)
445 printk(KERN_ERR "%s: Enter.\n", __func__);
446 printk(KERN_ERR "tx_pkts = %ld\n",
447 (unsigned long)qdev->nic_stats.tx_pkts);
448 printk(KERN_ERR "tx_bytes = %ld\n",
449 (unsigned long)qdev->nic_stats.tx_bytes);
450 printk(KERN_ERR "tx_mcast_pkts = %ld.\n",
451 (unsigned long)qdev->nic_stats.tx_mcast_pkts);
452 printk(KERN_ERR "tx_bcast_pkts = %ld.\n",
453 (unsigned long)qdev->nic_stats.tx_bcast_pkts);
454 printk(KERN_ERR "tx_ucast_pkts = %ld.\n",
455 (unsigned long)qdev->nic_stats.tx_ucast_pkts);
456 printk(KERN_ERR "tx_ctl_pkts = %ld.\n",
457 (unsigned long)qdev->nic_stats.tx_ctl_pkts);
458 printk(KERN_ERR "tx_pause_pkts = %ld.\n",
459 (unsigned long)qdev->nic_stats.tx_pause_pkts);
460 printk(KERN_ERR "tx_64_pkt = %ld.\n",
461 (unsigned long)qdev->nic_stats.tx_64_pkt);
462 printk(KERN_ERR "tx_65_to_127_pkt = %ld.\n",
463 (unsigned long)qdev->nic_stats.tx_65_to_127_pkt);
464 printk(KERN_ERR "tx_128_to_255_pkt = %ld.\n",
465 (unsigned long)qdev->nic_stats.tx_128_to_255_pkt);
466 printk(KERN_ERR "tx_256_511_pkt = %ld.\n",
467 (unsigned long)qdev->nic_stats.tx_256_511_pkt);
468 printk(KERN_ERR "tx_512_to_1023_pkt = %ld.\n",
469 (unsigned long)qdev->nic_stats.tx_512_to_1023_pkt);
470 printk(KERN_ERR "tx_1024_to_1518_pkt = %ld.\n",
471 (unsigned long)qdev->nic_stats.tx_1024_to_1518_pkt);
472 printk(KERN_ERR "tx_1519_to_max_pkt = %ld.\n",
473 (unsigned long)qdev->nic_stats.tx_1519_to_max_pkt);
474 printk(KERN_ERR "tx_undersize_pkt = %ld.\n",
475 (unsigned long)qdev->nic_stats.tx_undersize_pkt);
476 printk(KERN_ERR "tx_oversize_pkt = %ld.\n",
477 (unsigned long)qdev->nic_stats.tx_oversize_pkt);
478 printk(KERN_ERR "rx_bytes = %ld.\n",
479 (unsigned long)qdev->nic_stats.rx_bytes);
480 printk(KERN_ERR "rx_bytes_ok = %ld.\n",
481 (unsigned long)qdev->nic_stats.rx_bytes_ok);
482 printk(KERN_ERR "rx_pkts = %ld.\n",
483 (unsigned long)qdev->nic_stats.rx_pkts);
484 printk(KERN_ERR "rx_pkts_ok = %ld.\n",
485 (unsigned long)qdev->nic_stats.rx_pkts_ok);
486 printk(KERN_ERR "rx_bcast_pkts = %ld.\n",
487 (unsigned long)qdev->nic_stats.rx_bcast_pkts);
488 printk(KERN_ERR "rx_mcast_pkts = %ld.\n",
489 (unsigned long)qdev->nic_stats.rx_mcast_pkts);
490 printk(KERN_ERR "rx_ucast_pkts = %ld.\n",
491 (unsigned long)qdev->nic_stats.rx_ucast_pkts);
492 printk(KERN_ERR "rx_undersize_pkts = %ld.\n",
493 (unsigned long)qdev->nic_stats.rx_undersize_pkts);
494 printk(KERN_ERR "rx_oversize_pkts = %ld.\n",
495 (unsigned long)qdev->nic_stats.rx_oversize_pkts);
496 printk(KERN_ERR "rx_jabber_pkts = %ld.\n",
497 (unsigned long)qdev->nic_stats.rx_jabber_pkts);
498 printk(KERN_ERR "rx_undersize_fcerr_pkts = %ld.\n",
499 (unsigned long)qdev->nic_stats.rx_undersize_fcerr_pkts);
500 printk(KERN_ERR "rx_drop_events = %ld.\n",
501 (unsigned long)qdev->nic_stats.rx_drop_events);
502 printk(KERN_ERR "rx_fcerr_pkts = %ld.\n",
503 (unsigned long)qdev->nic_stats.rx_fcerr_pkts);
504 printk(KERN_ERR "rx_align_err = %ld.\n",
505 (unsigned long)qdev->nic_stats.rx_align_err);
506 printk(KERN_ERR "rx_symbol_err = %ld.\n",
507 (unsigned long)qdev->nic_stats.rx_symbol_err);
508 printk(KERN_ERR "rx_mac_err = %ld.\n",
509 (unsigned long)qdev->nic_stats.rx_mac_err);
510 printk(KERN_ERR "rx_ctl_pkts = %ld.\n",
511 (unsigned long)qdev->nic_stats.rx_ctl_pkts);
512 printk(KERN_ERR "rx_pause_pkts = %ld.\n",
513 (unsigned long)qdev->nic_stats.rx_pause_pkts);
514 printk(KERN_ERR "rx_64_pkts = %ld.\n",
515 (unsigned long)qdev->nic_stats.rx_64_pkts);
516 printk(KERN_ERR "rx_65_to_127_pkts = %ld.\n",
517 (unsigned long)qdev->nic_stats.rx_65_to_127_pkts);
518 printk(KERN_ERR "rx_128_255_pkts = %ld.\n",
519 (unsigned long)qdev->nic_stats.rx_128_255_pkts);
520 printk(KERN_ERR "rx_256_511_pkts = %ld.\n",
521 (unsigned long)qdev->nic_stats.rx_256_511_pkts);
522 printk(KERN_ERR "rx_512_to_1023_pkts = %ld.\n",
523 (unsigned long)qdev->nic_stats.rx_512_to_1023_pkts);
524 printk(KERN_ERR "rx_1024_to_1518_pkts = %ld.\n",
525 (unsigned long)qdev->nic_stats.rx_1024_to_1518_pkts);
526 printk(KERN_ERR "rx_1519_to_max_pkts = %ld.\n",
527 (unsigned long)qdev->nic_stats.rx_1519_to_max_pkts);
528 printk(KERN_ERR "rx_len_err_pkts = %ld.\n",
529 (unsigned long)qdev->nic_stats.rx_len_err_pkts);
531 #endif
533 #ifdef QL_DEV_DUMP
534 void ql_dump_qdev(struct ql_adapter *qdev)
536 int i;
537 printk(KERN_ERR PFX "qdev->flags = %lx.\n",
538 qdev->flags);
539 printk(KERN_ERR PFX "qdev->vlgrp = %p.\n",
540 qdev->vlgrp);
541 printk(KERN_ERR PFX "qdev->pdev = %p.\n",
542 qdev->pdev);
543 printk(KERN_ERR PFX "qdev->ndev = %p.\n",
544 qdev->ndev);
545 printk(KERN_ERR PFX "qdev->chip_rev_id = %d.\n",
546 qdev->chip_rev_id);
547 printk(KERN_ERR PFX "qdev->reg_base = %p.\n",
548 qdev->reg_base);
549 printk(KERN_ERR PFX "qdev->doorbell_area = %p.\n",
550 qdev->doorbell_area);
551 printk(KERN_ERR PFX "qdev->doorbell_area_size = %d.\n",
552 qdev->doorbell_area_size);
553 printk(KERN_ERR PFX "msg_enable = %x.\n",
554 qdev->msg_enable);
555 printk(KERN_ERR PFX "qdev->rx_ring_shadow_reg_area = %p.\n",
556 qdev->rx_ring_shadow_reg_area);
557 printk(KERN_ERR PFX "qdev->rx_ring_shadow_reg_dma = %llx.\n",
558 (unsigned long long) qdev->rx_ring_shadow_reg_dma);
559 printk(KERN_ERR PFX "qdev->tx_ring_shadow_reg_area = %p.\n",
560 qdev->tx_ring_shadow_reg_area);
561 printk(KERN_ERR PFX "qdev->tx_ring_shadow_reg_dma = %llx.\n",
562 (unsigned long long) qdev->tx_ring_shadow_reg_dma);
563 printk(KERN_ERR PFX "qdev->intr_count = %d.\n",
564 qdev->intr_count);
565 if (qdev->msi_x_entry)
566 for (i = 0; i < qdev->intr_count; i++) {
567 printk(KERN_ERR PFX
568 "msi_x_entry.[%d]vector = %d.\n", i,
569 qdev->msi_x_entry[i].vector);
570 printk(KERN_ERR PFX
571 "msi_x_entry.[%d]entry = %d.\n", i,
572 qdev->msi_x_entry[i].entry);
574 for (i = 0; i < qdev->intr_count; i++) {
575 printk(KERN_ERR PFX
576 "intr_context[%d].qdev = %p.\n", i,
577 qdev->intr_context[i].qdev);
578 printk(KERN_ERR PFX
579 "intr_context[%d].intr = %d.\n", i,
580 qdev->intr_context[i].intr);
581 printk(KERN_ERR PFX
582 "intr_context[%d].hooked = %d.\n", i,
583 qdev->intr_context[i].hooked);
584 printk(KERN_ERR PFX
585 "intr_context[%d].intr_en_mask = 0x%08x.\n", i,
586 qdev->intr_context[i].intr_en_mask);
587 printk(KERN_ERR PFX
588 "intr_context[%d].intr_dis_mask = 0x%08x.\n", i,
589 qdev->intr_context[i].intr_dis_mask);
590 printk(KERN_ERR PFX
591 "intr_context[%d].intr_read_mask = 0x%08x.\n", i,
592 qdev->intr_context[i].intr_read_mask);
594 printk(KERN_ERR PFX "qdev->tx_ring_count = %d.\n", qdev->tx_ring_count);
595 printk(KERN_ERR PFX "qdev->rx_ring_count = %d.\n", qdev->rx_ring_count);
596 printk(KERN_ERR PFX "qdev->ring_mem_size = %d.\n", qdev->ring_mem_size);
597 printk(KERN_ERR PFX "qdev->ring_mem = %p.\n", qdev->ring_mem);
598 printk(KERN_ERR PFX "qdev->intr_count = %d.\n", qdev->intr_count);
599 printk(KERN_ERR PFX "qdev->tx_ring = %p.\n",
600 qdev->tx_ring);
601 printk(KERN_ERR PFX "qdev->rss_ring_count = %d.\n",
602 qdev->rss_ring_count);
603 printk(KERN_ERR PFX "qdev->rx_ring = %p.\n", qdev->rx_ring);
604 printk(KERN_ERR PFX "qdev->default_rx_queue = %d.\n",
605 qdev->default_rx_queue);
606 printk(KERN_ERR PFX "qdev->xg_sem_mask = 0x%08x.\n",
607 qdev->xg_sem_mask);
608 printk(KERN_ERR PFX "qdev->port_link_up = 0x%08x.\n",
609 qdev->port_link_up);
610 printk(KERN_ERR PFX "qdev->port_init = 0x%08x.\n",
611 qdev->port_init);
614 #endif
616 #ifdef QL_CB_DUMP
617 void ql_dump_wqicb(struct wqicb *wqicb)
619 printk(KERN_ERR PFX "Dumping wqicb stuff...\n");
620 printk(KERN_ERR PFX "wqicb->len = 0x%x.\n", le16_to_cpu(wqicb->len));
621 printk(KERN_ERR PFX "wqicb->flags = %x.\n", le16_to_cpu(wqicb->flags));
622 printk(KERN_ERR PFX "wqicb->cq_id_rss = %d.\n",
623 le16_to_cpu(wqicb->cq_id_rss));
624 printk(KERN_ERR PFX "wqicb->rid = 0x%x.\n", le16_to_cpu(wqicb->rid));
625 printk(KERN_ERR PFX "wqicb->wq_addr = 0x%llx.\n",
626 (unsigned long long) le64_to_cpu(wqicb->addr));
627 printk(KERN_ERR PFX "wqicb->wq_cnsmr_idx_addr = 0x%llx.\n",
628 (unsigned long long) le64_to_cpu(wqicb->cnsmr_idx_addr));
631 void ql_dump_tx_ring(struct tx_ring *tx_ring)
633 if (tx_ring == NULL)
634 return;
635 printk(KERN_ERR PFX
636 "===================== Dumping tx_ring %d ===============.\n",
637 tx_ring->wq_id);
638 printk(KERN_ERR PFX "tx_ring->base = %p.\n", tx_ring->wq_base);
639 printk(KERN_ERR PFX "tx_ring->base_dma = 0x%llx.\n",
640 (unsigned long long) tx_ring->wq_base_dma);
641 printk(KERN_ERR PFX
642 "tx_ring->cnsmr_idx_sh_reg, addr = 0x%p, value = %d.\n",
643 tx_ring->cnsmr_idx_sh_reg,
644 tx_ring->cnsmr_idx_sh_reg
645 ? ql_read_sh_reg(tx_ring->cnsmr_idx_sh_reg) : 0);
646 printk(KERN_ERR PFX "tx_ring->size = %d.\n", tx_ring->wq_size);
647 printk(KERN_ERR PFX "tx_ring->len = %d.\n", tx_ring->wq_len);
648 printk(KERN_ERR PFX "tx_ring->prod_idx_db_reg = %p.\n",
649 tx_ring->prod_idx_db_reg);
650 printk(KERN_ERR PFX "tx_ring->valid_db_reg = %p.\n",
651 tx_ring->valid_db_reg);
652 printk(KERN_ERR PFX "tx_ring->prod_idx = %d.\n", tx_ring->prod_idx);
653 printk(KERN_ERR PFX "tx_ring->cq_id = %d.\n", tx_ring->cq_id);
654 printk(KERN_ERR PFX "tx_ring->wq_id = %d.\n", tx_ring->wq_id);
655 printk(KERN_ERR PFX "tx_ring->q = %p.\n", tx_ring->q);
656 printk(KERN_ERR PFX "tx_ring->tx_count = %d.\n",
657 atomic_read(&tx_ring->tx_count));
660 void ql_dump_ricb(struct ricb *ricb)
662 int i;
663 printk(KERN_ERR PFX
664 "===================== Dumping ricb ===============.\n");
665 printk(KERN_ERR PFX "Dumping ricb stuff...\n");
667 printk(KERN_ERR PFX "ricb->base_cq = %d.\n", ricb->base_cq & 0x1f);
668 printk(KERN_ERR PFX "ricb->flags = %s%s%s%s%s%s%s%s%s.\n",
669 ricb->base_cq & RSS_L4K ? "RSS_L4K " : "",
670 ricb->flags & RSS_L6K ? "RSS_L6K " : "",
671 ricb->flags & RSS_LI ? "RSS_LI " : "",
672 ricb->flags & RSS_LB ? "RSS_LB " : "",
673 ricb->flags & RSS_LM ? "RSS_LM " : "",
674 ricb->flags & RSS_RI4 ? "RSS_RI4 " : "",
675 ricb->flags & RSS_RT4 ? "RSS_RT4 " : "",
676 ricb->flags & RSS_RI6 ? "RSS_RI6 " : "",
677 ricb->flags & RSS_RT6 ? "RSS_RT6 " : "");
678 printk(KERN_ERR PFX "ricb->mask = 0x%.04x.\n", le16_to_cpu(ricb->mask));
679 for (i = 0; i < 16; i++)
680 printk(KERN_ERR PFX "ricb->hash_cq_id[%d] = 0x%.08x.\n", i,
681 le32_to_cpu(ricb->hash_cq_id[i]));
682 for (i = 0; i < 10; i++)
683 printk(KERN_ERR PFX "ricb->ipv6_hash_key[%d] = 0x%.08x.\n", i,
684 le32_to_cpu(ricb->ipv6_hash_key[i]));
685 for (i = 0; i < 4; i++)
686 printk(KERN_ERR PFX "ricb->ipv4_hash_key[%d] = 0x%.08x.\n", i,
687 le32_to_cpu(ricb->ipv4_hash_key[i]));
690 void ql_dump_cqicb(struct cqicb *cqicb)
692 printk(KERN_ERR PFX "Dumping cqicb stuff...\n");
694 printk(KERN_ERR PFX "cqicb->msix_vect = %d.\n", cqicb->msix_vect);
695 printk(KERN_ERR PFX "cqicb->flags = %x.\n", cqicb->flags);
696 printk(KERN_ERR PFX "cqicb->len = %d.\n", le16_to_cpu(cqicb->len));
697 printk(KERN_ERR PFX "cqicb->addr = 0x%llx.\n",
698 (unsigned long long) le64_to_cpu(cqicb->addr));
699 printk(KERN_ERR PFX "cqicb->prod_idx_addr = 0x%llx.\n",
700 (unsigned long long) le64_to_cpu(cqicb->prod_idx_addr));
701 printk(KERN_ERR PFX "cqicb->pkt_delay = 0x%.04x.\n",
702 le16_to_cpu(cqicb->pkt_delay));
703 printk(KERN_ERR PFX "cqicb->irq_delay = 0x%.04x.\n",
704 le16_to_cpu(cqicb->irq_delay));
705 printk(KERN_ERR PFX "cqicb->lbq_addr = 0x%llx.\n",
706 (unsigned long long) le64_to_cpu(cqicb->lbq_addr));
707 printk(KERN_ERR PFX "cqicb->lbq_buf_size = 0x%.04x.\n",
708 le16_to_cpu(cqicb->lbq_buf_size));
709 printk(KERN_ERR PFX "cqicb->lbq_len = 0x%.04x.\n",
710 le16_to_cpu(cqicb->lbq_len));
711 printk(KERN_ERR PFX "cqicb->sbq_addr = 0x%llx.\n",
712 (unsigned long long) le64_to_cpu(cqicb->sbq_addr));
713 printk(KERN_ERR PFX "cqicb->sbq_buf_size = 0x%.04x.\n",
714 le16_to_cpu(cqicb->sbq_buf_size));
715 printk(KERN_ERR PFX "cqicb->sbq_len = 0x%.04x.\n",
716 le16_to_cpu(cqicb->sbq_len));
719 void ql_dump_rx_ring(struct rx_ring *rx_ring)
721 if (rx_ring == NULL)
722 return;
723 printk(KERN_ERR PFX
724 "===================== Dumping rx_ring %d ===============.\n",
725 rx_ring->cq_id);
726 printk(KERN_ERR PFX "Dumping rx_ring %d, type = %s%s%s.\n",
727 rx_ring->cq_id, rx_ring->type == DEFAULT_Q ? "DEFAULT" : "",
728 rx_ring->type == TX_Q ? "OUTBOUND COMPLETIONS" : "",
729 rx_ring->type == RX_Q ? "INBOUND_COMPLETIONS" : "");
730 printk(KERN_ERR PFX "rx_ring->cqicb = %p.\n", &rx_ring->cqicb);
731 printk(KERN_ERR PFX "rx_ring->cq_base = %p.\n", rx_ring->cq_base);
732 printk(KERN_ERR PFX "rx_ring->cq_base_dma = %llx.\n",
733 (unsigned long long) rx_ring->cq_base_dma);
734 printk(KERN_ERR PFX "rx_ring->cq_size = %d.\n", rx_ring->cq_size);
735 printk(KERN_ERR PFX "rx_ring->cq_len = %d.\n", rx_ring->cq_len);
736 printk(KERN_ERR PFX
737 "rx_ring->prod_idx_sh_reg, addr = 0x%p, value = %d.\n",
738 rx_ring->prod_idx_sh_reg,
739 rx_ring->prod_idx_sh_reg
740 ? ql_read_sh_reg(rx_ring->prod_idx_sh_reg) : 0);
741 printk(KERN_ERR PFX "rx_ring->prod_idx_sh_reg_dma = %llx.\n",
742 (unsigned long long) rx_ring->prod_idx_sh_reg_dma);
743 printk(KERN_ERR PFX "rx_ring->cnsmr_idx_db_reg = %p.\n",
744 rx_ring->cnsmr_idx_db_reg);
745 printk(KERN_ERR PFX "rx_ring->cnsmr_idx = %d.\n", rx_ring->cnsmr_idx);
746 printk(KERN_ERR PFX "rx_ring->curr_entry = %p.\n", rx_ring->curr_entry);
747 printk(KERN_ERR PFX "rx_ring->valid_db_reg = %p.\n",
748 rx_ring->valid_db_reg);
750 printk(KERN_ERR PFX "rx_ring->lbq_base = %p.\n", rx_ring->lbq_base);
751 printk(KERN_ERR PFX "rx_ring->lbq_base_dma = %llx.\n",
752 (unsigned long long) rx_ring->lbq_base_dma);
753 printk(KERN_ERR PFX "rx_ring->lbq_base_indirect = %p.\n",
754 rx_ring->lbq_base_indirect);
755 printk(KERN_ERR PFX "rx_ring->lbq_base_indirect_dma = %llx.\n",
756 (unsigned long long) rx_ring->lbq_base_indirect_dma);
757 printk(KERN_ERR PFX "rx_ring->lbq = %p.\n", rx_ring->lbq);
758 printk(KERN_ERR PFX "rx_ring->lbq_len = %d.\n", rx_ring->lbq_len);
759 printk(KERN_ERR PFX "rx_ring->lbq_size = %d.\n", rx_ring->lbq_size);
760 printk(KERN_ERR PFX "rx_ring->lbq_prod_idx_db_reg = %p.\n",
761 rx_ring->lbq_prod_idx_db_reg);
762 printk(KERN_ERR PFX "rx_ring->lbq_prod_idx = %d.\n",
763 rx_ring->lbq_prod_idx);
764 printk(KERN_ERR PFX "rx_ring->lbq_curr_idx = %d.\n",
765 rx_ring->lbq_curr_idx);
766 printk(KERN_ERR PFX "rx_ring->lbq_clean_idx = %d.\n",
767 rx_ring->lbq_clean_idx);
768 printk(KERN_ERR PFX "rx_ring->lbq_free_cnt = %d.\n",
769 rx_ring->lbq_free_cnt);
770 printk(KERN_ERR PFX "rx_ring->lbq_buf_size = %d.\n",
771 rx_ring->lbq_buf_size);
773 printk(KERN_ERR PFX "rx_ring->sbq_base = %p.\n", rx_ring->sbq_base);
774 printk(KERN_ERR PFX "rx_ring->sbq_base_dma = %llx.\n",
775 (unsigned long long) rx_ring->sbq_base_dma);
776 printk(KERN_ERR PFX "rx_ring->sbq_base_indirect = %p.\n",
777 rx_ring->sbq_base_indirect);
778 printk(KERN_ERR PFX "rx_ring->sbq_base_indirect_dma = %llx.\n",
779 (unsigned long long) rx_ring->sbq_base_indirect_dma);
780 printk(KERN_ERR PFX "rx_ring->sbq = %p.\n", rx_ring->sbq);
781 printk(KERN_ERR PFX "rx_ring->sbq_len = %d.\n", rx_ring->sbq_len);
782 printk(KERN_ERR PFX "rx_ring->sbq_size = %d.\n", rx_ring->sbq_size);
783 printk(KERN_ERR PFX "rx_ring->sbq_prod_idx_db_reg addr = %p.\n",
784 rx_ring->sbq_prod_idx_db_reg);
785 printk(KERN_ERR PFX "rx_ring->sbq_prod_idx = %d.\n",
786 rx_ring->sbq_prod_idx);
787 printk(KERN_ERR PFX "rx_ring->sbq_curr_idx = %d.\n",
788 rx_ring->sbq_curr_idx);
789 printk(KERN_ERR PFX "rx_ring->sbq_clean_idx = %d.\n",
790 rx_ring->sbq_clean_idx);
791 printk(KERN_ERR PFX "rx_ring->sbq_free_cnt = %d.\n",
792 rx_ring->sbq_free_cnt);
793 printk(KERN_ERR PFX "rx_ring->sbq_buf_size = %d.\n",
794 rx_ring->sbq_buf_size);
795 printk(KERN_ERR PFX "rx_ring->cq_id = %d.\n", rx_ring->cq_id);
796 printk(KERN_ERR PFX "rx_ring->irq = %d.\n", rx_ring->irq);
797 printk(KERN_ERR PFX "rx_ring->cpu = %d.\n", rx_ring->cpu);
798 printk(KERN_ERR PFX "rx_ring->qdev = %p.\n", rx_ring->qdev);
801 void ql_dump_hw_cb(struct ql_adapter *qdev, int size, u32 bit, u16 q_id)
803 void *ptr;
805 printk(KERN_ERR PFX "%s: Enter.\n", __func__);
807 ptr = kmalloc(size, GFP_ATOMIC);
808 if (ptr == NULL) {
809 printk(KERN_ERR PFX "%s: Couldn't allocate a buffer.\n",
810 __func__);
811 return;
814 if (ql_write_cfg(qdev, ptr, size, bit, q_id)) {
815 printk(KERN_ERR "%s: Failed to upload control block!\n",
816 __func__);
817 goto fail_it;
819 switch (bit) {
820 case CFG_DRQ:
821 ql_dump_wqicb((struct wqicb *)ptr);
822 break;
823 case CFG_DCQ:
824 ql_dump_cqicb((struct cqicb *)ptr);
825 break;
826 case CFG_DR:
827 ql_dump_ricb((struct ricb *)ptr);
828 break;
829 default:
830 printk(KERN_ERR PFX "%s: Invalid bit value = %x.\n",
831 __func__, bit);
832 break;
834 fail_it:
835 kfree(ptr);
837 #endif
839 #ifdef QL_OB_DUMP
840 void ql_dump_tx_desc(struct tx_buf_desc *tbd)
842 printk(KERN_ERR PFX "tbd->addr = 0x%llx\n",
843 le64_to_cpu((u64) tbd->addr));
844 printk(KERN_ERR PFX "tbd->len = %d\n",
845 le32_to_cpu(tbd->len & TX_DESC_LEN_MASK));
846 printk(KERN_ERR PFX "tbd->flags = %s %s\n",
847 tbd->len & TX_DESC_C ? "C" : ".",
848 tbd->len & TX_DESC_E ? "E" : ".");
849 tbd++;
850 printk(KERN_ERR PFX "tbd->addr = 0x%llx\n",
851 le64_to_cpu((u64) tbd->addr));
852 printk(KERN_ERR PFX "tbd->len = %d\n",
853 le32_to_cpu(tbd->len & TX_DESC_LEN_MASK));
854 printk(KERN_ERR PFX "tbd->flags = %s %s\n",
855 tbd->len & TX_DESC_C ? "C" : ".",
856 tbd->len & TX_DESC_E ? "E" : ".");
857 tbd++;
858 printk(KERN_ERR PFX "tbd->addr = 0x%llx\n",
859 le64_to_cpu((u64) tbd->addr));
860 printk(KERN_ERR PFX "tbd->len = %d\n",
861 le32_to_cpu(tbd->len & TX_DESC_LEN_MASK));
862 printk(KERN_ERR PFX "tbd->flags = %s %s\n",
863 tbd->len & TX_DESC_C ? "C" : ".",
864 tbd->len & TX_DESC_E ? "E" : ".");
868 void ql_dump_ob_mac_iocb(struct ob_mac_iocb_req *ob_mac_iocb)
870 struct ob_mac_tso_iocb_req *ob_mac_tso_iocb =
871 (struct ob_mac_tso_iocb_req *)ob_mac_iocb;
872 struct tx_buf_desc *tbd;
873 u16 frame_len;
875 printk(KERN_ERR PFX "%s\n", __func__);
876 printk(KERN_ERR PFX "opcode = %s\n",
877 (ob_mac_iocb->opcode == OPCODE_OB_MAC_IOCB) ? "MAC" : "TSO");
878 printk(KERN_ERR PFX "flags1 = %s %s %s %s %s\n",
879 ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_OI ? "OI" : "",
880 ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_I ? "I" : "",
881 ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_D ? "D" : "",
882 ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_IP4 ? "IP4" : "",
883 ob_mac_tso_iocb->flags1 & OB_MAC_TSO_IOCB_IP6 ? "IP6" : "");
884 printk(KERN_ERR PFX "flags2 = %s %s %s\n",
885 ob_mac_tso_iocb->flags2 & OB_MAC_TSO_IOCB_LSO ? "LSO" : "",
886 ob_mac_tso_iocb->flags2 & OB_MAC_TSO_IOCB_UC ? "UC" : "",
887 ob_mac_tso_iocb->flags2 & OB_MAC_TSO_IOCB_TC ? "TC" : "");
888 printk(KERN_ERR PFX "flags3 = %s %s %s \n",
889 ob_mac_tso_iocb->flags3 & OB_MAC_TSO_IOCB_IC ? "IC" : "",
890 ob_mac_tso_iocb->flags3 & OB_MAC_TSO_IOCB_DFP ? "DFP" : "",
891 ob_mac_tso_iocb->flags3 & OB_MAC_TSO_IOCB_V ? "V" : "");
892 printk(KERN_ERR PFX "tid = %x\n", ob_mac_iocb->tid);
893 printk(KERN_ERR PFX "txq_idx = %d\n", ob_mac_iocb->txq_idx);
894 printk(KERN_ERR PFX "vlan_tci = %x\n", ob_mac_tso_iocb->vlan_tci);
895 if (ob_mac_iocb->opcode == OPCODE_OB_MAC_TSO_IOCB) {
896 printk(KERN_ERR PFX "frame_len = %d\n",
897 le32_to_cpu(ob_mac_tso_iocb->frame_len));
898 printk(KERN_ERR PFX "mss = %d\n",
899 le16_to_cpu(ob_mac_tso_iocb->mss));
900 printk(KERN_ERR PFX "prot_hdr_len = %d\n",
901 le16_to_cpu(ob_mac_tso_iocb->total_hdrs_len));
902 printk(KERN_ERR PFX "hdr_offset = 0x%.04x\n",
903 le16_to_cpu(ob_mac_tso_iocb->net_trans_offset));
904 frame_len = le32_to_cpu(ob_mac_tso_iocb->frame_len);
905 } else {
906 printk(KERN_ERR PFX "frame_len = %d\n",
907 le16_to_cpu(ob_mac_iocb->frame_len));
908 frame_len = le16_to_cpu(ob_mac_iocb->frame_len);
910 tbd = &ob_mac_iocb->tbd[0];
911 ql_dump_tx_desc(tbd);
914 void ql_dump_ob_mac_rsp(struct ob_mac_iocb_rsp *ob_mac_rsp)
916 printk(KERN_ERR PFX "%s\n", __func__);
917 printk(KERN_ERR PFX "opcode = %d\n", ob_mac_rsp->opcode);
918 printk(KERN_ERR PFX "flags = %s %s %s %s %s %s %s\n",
919 ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_OI ? "OI" : ".",
920 ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_I ? "I" : ".",
921 ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_E ? "E" : ".",
922 ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_S ? "S" : ".",
923 ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_L ? "L" : ".",
924 ob_mac_rsp->flags1 & OB_MAC_IOCB_RSP_P ? "P" : ".",
925 ob_mac_rsp->flags2 & OB_MAC_IOCB_RSP_B ? "B" : ".");
926 printk(KERN_ERR PFX "tid = %x\n", ob_mac_rsp->tid);
928 #endif
930 #ifdef QL_IB_DUMP
931 void ql_dump_ib_mac_rsp(struct ib_mac_iocb_rsp *ib_mac_rsp)
933 printk(KERN_ERR PFX "%s\n", __func__);
934 printk(KERN_ERR PFX "opcode = 0x%x\n", ib_mac_rsp->opcode);
935 printk(KERN_ERR PFX "flags1 = %s%s%s%s%s%s\n",
936 ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_OI ? "OI " : "",
937 ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_I ? "I " : "",
938 ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_TE ? "TE " : "",
939 ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_NU ? "NU " : "",
940 ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_IE ? "IE " : "",
941 ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_B ? "B " : "");
943 if (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK)
944 printk(KERN_ERR PFX "%s%s%s Multicast.\n",
945 (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK) ==
946 IB_MAC_IOCB_RSP_M_HASH ? "Hash" : "",
947 (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK) ==
948 IB_MAC_IOCB_RSP_M_REG ? "Registered" : "",
949 (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK) ==
950 IB_MAC_IOCB_RSP_M_PROM ? "Promiscuous" : "");
952 printk(KERN_ERR PFX "flags2 = %s%s%s%s%s\n",
953 (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_P) ? "P " : "",
954 (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) ? "V " : "",
955 (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_U) ? "U " : "",
956 (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_T) ? "T " : "",
957 (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_FO) ? "FO " : "");
959 if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK)
960 printk(KERN_ERR PFX "%s%s%s%s%s error.\n",
961 (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) ==
962 IB_MAC_IOCB_RSP_ERR_OVERSIZE ? "oversize" : "",
963 (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) ==
964 IB_MAC_IOCB_RSP_ERR_UNDERSIZE ? "undersize" : "",
965 (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) ==
966 IB_MAC_IOCB_RSP_ERR_PREAMBLE ? "preamble" : "",
967 (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) ==
968 IB_MAC_IOCB_RSP_ERR_FRAME_LEN ? "frame length" : "",
969 (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) ==
970 IB_MAC_IOCB_RSP_ERR_CRC ? "CRC" : "");
972 printk(KERN_ERR PFX "flags3 = %s%s.\n",
973 ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_DS ? "DS " : "",
974 ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_DL ? "DL " : "");
976 if (ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK)
977 printk(KERN_ERR PFX "RSS flags = %s%s%s%s.\n",
978 ((ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) ==
979 IB_MAC_IOCB_RSP_M_IPV4) ? "IPv4 RSS" : "",
980 ((ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) ==
981 IB_MAC_IOCB_RSP_M_IPV6) ? "IPv6 RSS " : "",
982 ((ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) ==
983 IB_MAC_IOCB_RSP_M_TCP_V4) ? "TCP/IPv4 RSS" : "",
984 ((ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) ==
985 IB_MAC_IOCB_RSP_M_TCP_V6) ? "TCP/IPv6 RSS" : "");
987 printk(KERN_ERR PFX "data_len = %d\n",
988 le32_to_cpu(ib_mac_rsp->data_len));
989 printk(KERN_ERR PFX "data_addr = 0x%llx\n",
990 (unsigned long long) le64_to_cpu(ib_mac_rsp->data_addr));
991 if (ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK)
992 printk(KERN_ERR PFX "rss = %x\n",
993 le32_to_cpu(ib_mac_rsp->rss));
994 if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V)
995 printk(KERN_ERR PFX "vlan_id = %x\n",
996 le16_to_cpu(ib_mac_rsp->vlan_id));
998 printk(KERN_ERR PFX "flags4 = %s%s%s.\n",
999 ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV ? "HV " : "",
1000 ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HS ? "HS " : "",
1001 ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HL ? "HL " : "");
1003 if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) {
1004 printk(KERN_ERR PFX "hdr length = %d.\n",
1005 le32_to_cpu(ib_mac_rsp->hdr_len));
1006 printk(KERN_ERR PFX "hdr addr = 0x%llx.\n",
1007 (unsigned long long) le64_to_cpu(ib_mac_rsp->hdr_addr));
1010 #endif
1012 #ifdef QL_ALL_DUMP
1013 void ql_dump_all(struct ql_adapter *qdev)
1015 int i;
1017 QL_DUMP_REGS(qdev);
1018 QL_DUMP_QDEV(qdev);
1019 for (i = 0; i < qdev->tx_ring_count; i++) {
1020 QL_DUMP_TX_RING(&qdev->tx_ring[i]);
1021 QL_DUMP_WQICB((struct wqicb *)&qdev->tx_ring[i]);
1023 for (i = 0; i < qdev->rx_ring_count; i++) {
1024 QL_DUMP_RX_RING(&qdev->rx_ring[i]);
1025 QL_DUMP_CQICB((struct cqicb *)&qdev->rx_ring[i]);
1028 #endif