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