diff options
author | James Smart <James.Smart@Emulex.Com> | 2007-08-02 11:09:43 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-08-01 13:17:30 -0400 |
commit | a58cbd5212fff2d4bba0bf58e778f02069597294 (patch) | |
tree | a2f773026934e3c2dad7642089b96ea48ea00db3 /drivers/scsi/lpfc | |
parent | c000c43cf12090972fad0fbb621d78c2100d0373 (diff) |
[SCSI] lpfc 8.2.2 : Error messages and debugfs updates
Error messages and debugfs updates:
- Fix up GID_FT error messages
- Enhance debugfs with slow_ring_trace, dumpslim and nodelist information
- Add log type (and messages) for vport state changes
- Enhance log messages when retries ELS fail
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r-- | drivers/scsi/lpfc/lpfc.h | 6 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_ct.c | 26 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_debugfs.c | 443 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_debugfs.h | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_els.c | 11 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 9 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 37 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_vport.c | 10 |
9 files changed, 488 insertions, 58 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index f8f64d6485cd..3f64c4b81b0c 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -335,7 +335,7 @@ struct lpfc_vport { | |||
335 | struct dentry *debug_disc_trc; | 335 | struct dentry *debug_disc_trc; |
336 | struct dentry *debug_nodelist; | 336 | struct dentry *debug_nodelist; |
337 | struct dentry *vport_debugfs_root; | 337 | struct dentry *vport_debugfs_root; |
338 | struct lpfc_disc_trc *disc_trc; | 338 | struct lpfc_debugfs_trc *disc_trc; |
339 | atomic_t disc_trc_cnt; | 339 | atomic_t disc_trc_cnt; |
340 | #endif | 340 | #endif |
341 | }; | 341 | }; |
@@ -547,6 +547,10 @@ struct lpfc_hba { | |||
547 | #ifdef CONFIG_LPFC_DEBUG_FS | 547 | #ifdef CONFIG_LPFC_DEBUG_FS |
548 | struct dentry *hba_debugfs_root; | 548 | struct dentry *hba_debugfs_root; |
549 | atomic_t debugfs_vport_count; | 549 | atomic_t debugfs_vport_count; |
550 | struct dentry *debug_dumpslim; | ||
551 | struct dentry *debug_slow_ring_trc; | ||
552 | struct lpfc_debugfs_trc *slow_ring_trc; | ||
553 | atomic_t slow_ring_trc_cnt; | ||
550 | #endif | 554 | #endif |
551 | 555 | ||
552 | /* Fields used for heart beat. */ | 556 | /* Fields used for heart beat. */ |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index e19d1a746586..f9fdc862028a 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -271,6 +271,8 @@ extern void lpfc_debugfs_initialize(struct lpfc_vport *); | |||
271 | extern void lpfc_debugfs_terminate(struct lpfc_vport *); | 271 | extern void lpfc_debugfs_terminate(struct lpfc_vport *); |
272 | extern void lpfc_debugfs_disc_trc(struct lpfc_vport *, int, char *, uint32_t, | 272 | extern void lpfc_debugfs_disc_trc(struct lpfc_vport *, int, char *, uint32_t, |
273 | uint32_t, uint32_t); | 273 | uint32_t, uint32_t); |
274 | extern void lpfc_debugfs_slow_ring_trc(struct lpfc_hba *, char *, uint32_t, | ||
275 | uint32_t, uint32_t); | ||
274 | 276 | ||
275 | /* Interface exported by fabric iocb scheduler */ | 277 | /* Interface exported by fabric iocb scheduler */ |
276 | int lpfc_issue_fabric_iocb(struct lpfc_hba *, struct lpfc_iocbq *); | 278 | int lpfc_issue_fabric_iocb(struct lpfc_hba *, struct lpfc_iocbq *); |
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index ae9d6f385a6c..edbebffa26cf 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c | |||
@@ -607,7 +607,25 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
607 | } else if (CTrsp->CommandResponse.bits.CmdRsp == | 607 | } else if (CTrsp->CommandResponse.bits.CmdRsp == |
608 | be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { | 608 | be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { |
609 | /* NameServer Rsp Error */ | 609 | /* NameServer Rsp Error */ |
610 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 610 | if ((CTrsp->ReasonCode == SLI_CT_UNABLE_TO_PERFORM_REQ) |
611 | && (CTrsp->Explanation == SLI_CT_NO_FC4_TYPES)) { | ||
612 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | ||
613 | "%d (%d):0269 No NameServer Entries " | ||
614 | "Data: x%x x%x x%x x%x\n", | ||
615 | phba->brd_no, vport->vpi, | ||
616 | CTrsp->CommandResponse.bits.CmdRsp, | ||
617 | (uint32_t) CTrsp->ReasonCode, | ||
618 | (uint32_t) CTrsp->Explanation, | ||
619 | vport->fc_flag); | ||
620 | |||
621 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | ||
622 | "GID_FT no entry cmd:x%x rsn:x%x exp:x%x", | ||
623 | (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, | ||
624 | (uint32_t) CTrsp->ReasonCode, | ||
625 | (uint32_t) CTrsp->Explanation); | ||
626 | } | ||
627 | else { | ||
628 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | ||
611 | "%d (%d):0240 NameServer Rsp Error " | 629 | "%d (%d):0240 NameServer Rsp Error " |
612 | "Data: x%x x%x x%x x%x\n", | 630 | "Data: x%x x%x x%x x%x\n", |
613 | phba->brd_no, vport->vpi, | 631 | phba->brd_no, vport->vpi, |
@@ -616,11 +634,13 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
616 | (uint32_t) CTrsp->Explanation, | 634 | (uint32_t) CTrsp->Explanation, |
617 | vport->fc_flag); | 635 | vport->fc_flag); |
618 | 636 | ||
619 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | 637 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, |
620 | "GID_FT rsp err1 cmd:x%x rsn:x%x exp:x%x", | 638 | "GID_FT rsp err1 cmd:x%x rsn:x%x exp:x%x", |
621 | (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, | 639 | (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, |
622 | (uint32_t) CTrsp->ReasonCode, | 640 | (uint32_t) CTrsp->ReasonCode, |
623 | (uint32_t) CTrsp->Explanation); | 641 | (uint32_t) CTrsp->Explanation); |
642 | } | ||
643 | |||
624 | 644 | ||
625 | } else { | 645 | } else { |
626 | /* NameServer Rsp Error */ | 646 | /* NameServer Rsp Error */ |
@@ -696,7 +716,7 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
696 | if ((fbits & FC4_FEATURE_INIT) && | 716 | if ((fbits & FC4_FEATURE_INIT) && |
697 | !(fbits & FC4_FEATURE_TARGET)) { | 717 | !(fbits & FC4_FEATURE_TARGET)) { |
698 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 718 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
699 | "%d (%d):0245 Skip x%x GFF " | 719 | "%d (%d):0270 Skip x%x GFF " |
700 | "NameServer Rsp Data: (init) " | 720 | "NameServer Rsp Data: (init) " |
701 | "x%x x%x\n", phba->brd_no, | 721 | "x%x x%x\n", phba->brd_no, |
702 | vport->vpi, did, fbits, | 722 | vport->vpi, did, fbits, |
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 673cfe11cc2b..2310a2d1d8ce 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | |||
@@ -75,11 +75,18 @@ static int lpfc_debugfs_enable = 0; | |||
75 | module_param(lpfc_debugfs_enable, int, 0); | 75 | module_param(lpfc_debugfs_enable, int, 0); |
76 | MODULE_PARM_DESC(lpfc_debugfs_enable, "Enable debugfs services"); | 76 | MODULE_PARM_DESC(lpfc_debugfs_enable, "Enable debugfs services"); |
77 | 77 | ||
78 | static int lpfc_debugfs_max_disc_trc = 0; /* This MUST be a power of 2 */ | 78 | /* This MUST be a power of 2 */ |
79 | static int lpfc_debugfs_max_disc_trc = 0; | ||
79 | module_param(lpfc_debugfs_max_disc_trc, int, 0); | 80 | module_param(lpfc_debugfs_max_disc_trc, int, 0); |
80 | MODULE_PARM_DESC(lpfc_debugfs_max_disc_trc, | 81 | MODULE_PARM_DESC(lpfc_debugfs_max_disc_trc, |
81 | "Set debugfs discovery trace depth"); | 82 | "Set debugfs discovery trace depth"); |
82 | 83 | ||
84 | /* This MUST be a power of 2 */ | ||
85 | static int lpfc_debugfs_max_slow_ring_trc = 0; | ||
86 | module_param(lpfc_debugfs_max_slow_ring_trc, int, 0); | ||
87 | MODULE_PARM_DESC(lpfc_debugfs_max_slow_ring_trc, | ||
88 | "Set debugfs slow ring trace depth"); | ||
89 | |||
83 | static int lpfc_debugfs_mask_disc_trc = 0; | 90 | static int lpfc_debugfs_mask_disc_trc = 0; |
84 | module_param(lpfc_debugfs_mask_disc_trc, int, 0); | 91 | module_param(lpfc_debugfs_mask_disc_trc, int, 0); |
85 | MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc, | 92 | MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc, |
@@ -87,19 +94,22 @@ MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc, | |||
87 | 94 | ||
88 | #include <linux/debugfs.h> | 95 | #include <linux/debugfs.h> |
89 | 96 | ||
90 | /* size of discovery_trace output line */ | 97 | /* size of output line, for discovery_trace and slow_ring_trace */ |
91 | #define LPFC_DISC_TRC_ENTRY_SIZE 80 | 98 | #define LPFC_DEBUG_TRC_ENTRY_SIZE 100 |
92 | 99 | ||
93 | /* nodelist output buffer size */ | 100 | /* nodelist output buffer size */ |
94 | #define LPFC_NODELIST_SIZE 8192 | 101 | #define LPFC_NODELIST_SIZE 8192 |
95 | #define LPFC_NODELIST_ENTRY_SIZE 120 | 102 | #define LPFC_NODELIST_ENTRY_SIZE 120 |
96 | 103 | ||
104 | /* dump_slim output buffer size */ | ||
105 | #define LPFC_DUMPSLIM_SIZE 4096 | ||
106 | |||
97 | struct lpfc_debug { | 107 | struct lpfc_debug { |
98 | char *buffer; | 108 | char *buffer; |
99 | int len; | 109 | int len; |
100 | }; | 110 | }; |
101 | 111 | ||
102 | atomic_t lpfc_debugfs_disc_trc_cnt = ATOMIC_INIT(0); | 112 | atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0); |
103 | unsigned long lpfc_debugfs_start_time = 0L; | 113 | unsigned long lpfc_debugfs_start_time = 0L; |
104 | 114 | ||
105 | static int | 115 | static int |
@@ -107,8 +117,8 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) | |||
107 | { | 117 | { |
108 | int i, index, len, enable; | 118 | int i, index, len, enable; |
109 | uint32_t ms; | 119 | uint32_t ms; |
110 | struct lpfc_disc_trc *dtp; | 120 | struct lpfc_debugfs_trc *dtp; |
111 | char buffer[80]; | 121 | char buffer[LPFC_DEBUG_TRC_ENTRY_SIZE]; |
112 | 122 | ||
113 | 123 | ||
114 | enable = lpfc_debugfs_enable; | 124 | enable = lpfc_debugfs_enable; |
@@ -122,7 +132,8 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) | |||
122 | if (!dtp->fmt) | 132 | if (!dtp->fmt) |
123 | continue; | 133 | continue; |
124 | ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); | 134 | ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); |
125 | snprintf(buffer, 80, "%010d:%010d ms:%s\n", | 135 | snprintf(buffer, |
136 | LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n", | ||
126 | dtp->seq_cnt, ms, dtp->fmt); | 137 | dtp->seq_cnt, ms, dtp->fmt); |
127 | len += snprintf(buf+len, size-len, buffer, | 138 | len += snprintf(buf+len, size-len, buffer, |
128 | dtp->data1, dtp->data2, dtp->data3); | 139 | dtp->data1, dtp->data2, dtp->data3); |
@@ -132,7 +143,50 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) | |||
132 | if (!dtp->fmt) | 143 | if (!dtp->fmt) |
133 | continue; | 144 | continue; |
134 | ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); | 145 | ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); |
135 | snprintf(buffer, 80, "%010d:%010d ms:%s\n", | 146 | snprintf(buffer, |
147 | LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n", | ||
148 | dtp->seq_cnt, ms, dtp->fmt); | ||
149 | len += snprintf(buf+len, size-len, buffer, | ||
150 | dtp->data1, dtp->data2, dtp->data3); | ||
151 | } | ||
152 | |||
153 | lpfc_debugfs_enable = enable; | ||
154 | return len; | ||
155 | } | ||
156 | |||
157 | static int | ||
158 | lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size) | ||
159 | { | ||
160 | int i, index, len, enable; | ||
161 | uint32_t ms; | ||
162 | struct lpfc_debugfs_trc *dtp; | ||
163 | char buffer[LPFC_DEBUG_TRC_ENTRY_SIZE]; | ||
164 | |||
165 | |||
166 | enable = lpfc_debugfs_enable; | ||
167 | lpfc_debugfs_enable = 0; | ||
168 | |||
169 | len = 0; | ||
170 | index = (atomic_read(&phba->slow_ring_trc_cnt) + 1) & | ||
171 | (lpfc_debugfs_max_slow_ring_trc - 1); | ||
172 | for (i = index; i < lpfc_debugfs_max_slow_ring_trc; i++) { | ||
173 | dtp = phba->slow_ring_trc + i; | ||
174 | if (!dtp->fmt) | ||
175 | continue; | ||
176 | ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); | ||
177 | snprintf(buffer, | ||
178 | LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n", | ||
179 | dtp->seq_cnt, ms, dtp->fmt); | ||
180 | len += snprintf(buf+len, size-len, buffer, | ||
181 | dtp->data1, dtp->data2, dtp->data3); | ||
182 | } | ||
183 | for (i = 0; i < index; i++) { | ||
184 | dtp = phba->slow_ring_trc + i; | ||
185 | if (!dtp->fmt) | ||
186 | continue; | ||
187 | ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); | ||
188 | snprintf(buffer, | ||
189 | LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n", | ||
136 | dtp->seq_cnt, ms, dtp->fmt); | 190 | dtp->seq_cnt, ms, dtp->fmt); |
137 | len += snprintf(buf+len, size-len, buffer, | 191 | len += snprintf(buf+len, size-len, buffer, |
138 | dtp->data1, dtp->data2, dtp->data3); | 192 | dtp->data1, dtp->data2, dtp->data3); |
@@ -143,6 +197,95 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) | |||
143 | } | 197 | } |
144 | 198 | ||
145 | static int | 199 | static int |
200 | lpfc_debugfs_dumpslim_data(struct lpfc_hba *phba, char *buf, int size) | ||
201 | { | ||
202 | int len = 0; | ||
203 | int cnt, i, off; | ||
204 | uint32_t word0, word1, word2, word3; | ||
205 | uint32_t *ptr; | ||
206 | struct lpfc_pgp *pgpp; | ||
207 | struct lpfc_sli *psli = &phba->sli; | ||
208 | struct lpfc_sli_ring *pring; | ||
209 | |||
210 | cnt = LPFC_DUMPSLIM_SIZE; | ||
211 | off = 0; | ||
212 | spin_lock_irq(&phba->hbalock); | ||
213 | |||
214 | len += snprintf(buf+len, size-len, "SLIM Mailbox\n"); | ||
215 | ptr = (uint32_t *)phba->slim2p; | ||
216 | i = sizeof(MAILBOX_t); | ||
217 | while (i > 0) { | ||
218 | len += snprintf(buf+len, size-len, | ||
219 | "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n", | ||
220 | off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), | ||
221 | *(ptr+5), *(ptr+6), *(ptr+7)); | ||
222 | ptr += 8; | ||
223 | i -= (8 * sizeof(uint32_t)); | ||
224 | off += (8 * sizeof(uint32_t)); | ||
225 | } | ||
226 | |||
227 | len += snprintf(buf+len, size-len, "SLIM PCB\n"); | ||
228 | ptr = (uint32_t *)&phba->slim2p->pcb; | ||
229 | i = sizeof(PCB_t); | ||
230 | while (i > 0) { | ||
231 | len += snprintf(buf+len, size-len, | ||
232 | "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n", | ||
233 | off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), | ||
234 | *(ptr+5), *(ptr+6), *(ptr+7)); | ||
235 | ptr += 8; | ||
236 | i -= (8 * sizeof(uint32_t)); | ||
237 | off += (8 * sizeof(uint32_t)); | ||
238 | } | ||
239 | |||
240 | pgpp = (struct lpfc_pgp *)&phba->slim2p->mbx.us.s3_pgp.port; | ||
241 | pring = &psli->ring[0]; | ||
242 | len += snprintf(buf+len, size-len, | ||
243 | "Ring 0: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) " | ||
244 | "RSP PutInx:%d Max:%d\n", | ||
245 | pgpp->cmdGetInx, pring->numCiocb, | ||
246 | pring->next_cmdidx, pring->local_getidx, pring->flag, | ||
247 | pgpp->rspPutInx, pring->numRiocb); | ||
248 | pgpp++; | ||
249 | |||
250 | pring = &psli->ring[1]; | ||
251 | len += snprintf(buf+len, size-len, | ||
252 | "Ring 1: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) " | ||
253 | "RSP PutInx:%d Max:%d\n", | ||
254 | pgpp->cmdGetInx, pring->numCiocb, | ||
255 | pring->next_cmdidx, pring->local_getidx, pring->flag, | ||
256 | pgpp->rspPutInx, pring->numRiocb); | ||
257 | pgpp++; | ||
258 | |||
259 | pring = &psli->ring[2]; | ||
260 | len += snprintf(buf+len, size-len, | ||
261 | "Ring 2: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) " | ||
262 | "RSP PutInx:%d Max:%d\n", | ||
263 | pgpp->cmdGetInx, pring->numCiocb, | ||
264 | pring->next_cmdidx, pring->local_getidx, pring->flag, | ||
265 | pgpp->rspPutInx, pring->numRiocb); | ||
266 | pgpp++; | ||
267 | |||
268 | pring = &psli->ring[3]; | ||
269 | len += snprintf(buf+len, size-len, | ||
270 | "Ring 3: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) " | ||
271 | "RSP PutInx:%d Max:%d\n", | ||
272 | pgpp->cmdGetInx, pring->numCiocb, | ||
273 | pring->next_cmdidx, pring->local_getidx, pring->flag, | ||
274 | pgpp->rspPutInx, pring->numRiocb); | ||
275 | |||
276 | |||
277 | ptr = (uint32_t *)&phba->slim2p->mbx.us.s3_pgp.hbq_get; | ||
278 | word0 = readl(phba->HAregaddr); | ||
279 | word1 = readl(phba->CAregaddr); | ||
280 | word2 = readl(phba->HSregaddr); | ||
281 | word3 = readl(phba->HCregaddr); | ||
282 | len += snprintf(buf+len, size-len, "HA:%08x CA:%08x HS:%08x HC:%08x\n", | ||
283 | word0, word1, word2, word3); | ||
284 | spin_unlock_irq(&phba->hbalock); | ||
285 | return len; | ||
286 | } | ||
287 | |||
288 | static int | ||
146 | lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) | 289 | lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) |
147 | { | 290 | { |
148 | int len = 0; | 291 | int len = 0; |
@@ -204,7 +347,7 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) | |||
204 | len += snprintf(buf+len, size-len, "RPI:%03d flag:x%08x ", | 347 | len += snprintf(buf+len, size-len, "RPI:%03d flag:x%08x ", |
205 | ndlp->nlp_rpi, ndlp->nlp_flag); | 348 | ndlp->nlp_rpi, ndlp->nlp_flag); |
206 | if (!ndlp->nlp_type) | 349 | if (!ndlp->nlp_type) |
207 | len += snprintf(buf+len, size-len, "UNKNOWN_TYPE"); | 350 | len += snprintf(buf+len, size-len, "UNKNOWN_TYPE "); |
208 | if (ndlp->nlp_type & NLP_FC_NODE) | 351 | if (ndlp->nlp_type & NLP_FC_NODE) |
209 | len += snprintf(buf+len, size-len, "FC_NODE "); | 352 | len += snprintf(buf+len, size-len, "FC_NODE "); |
210 | if (ndlp->nlp_type & NLP_FABRIC) | 353 | if (ndlp->nlp_type & NLP_FABRIC) |
@@ -213,7 +356,9 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) | |||
213 | len += snprintf(buf+len, size-len, "FCP_TGT sid:%d ", | 356 | len += snprintf(buf+len, size-len, "FCP_TGT sid:%d ", |
214 | ndlp->nlp_sid); | 357 | ndlp->nlp_sid); |
215 | if (ndlp->nlp_type & NLP_FCP_INITIATOR) | 358 | if (ndlp->nlp_type & NLP_FCP_INITIATOR) |
216 | len += snprintf(buf+len, size-len, "FCP_INITIATOR"); | 359 | len += snprintf(buf+len, size-len, "FCP_INITIATOR "); |
360 | len += snprintf(buf+len, size-len, "refcnt:%x", | ||
361 | atomic_read(&ndlp->kref.refcount)); | ||
217 | len += snprintf(buf+len, size-len, "\n"); | 362 | len += snprintf(buf+len, size-len, "\n"); |
218 | } | 363 | } |
219 | spin_unlock_irq(shost->host_lock); | 364 | spin_unlock_irq(shost->host_lock); |
@@ -227,7 +372,7 @@ lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt, | |||
227 | uint32_t data1, uint32_t data2, uint32_t data3) | 372 | uint32_t data1, uint32_t data2, uint32_t data3) |
228 | { | 373 | { |
229 | #ifdef CONFIG_LPFC_DEBUG_FS | 374 | #ifdef CONFIG_LPFC_DEBUG_FS |
230 | struct lpfc_disc_trc *dtp; | 375 | struct lpfc_debugfs_trc *dtp; |
231 | int index; | 376 | int index; |
232 | 377 | ||
233 | if (!(lpfc_debugfs_mask_disc_trc & mask)) | 378 | if (!(lpfc_debugfs_mask_disc_trc & mask)) |
@@ -244,7 +389,32 @@ lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt, | |||
244 | dtp->data1 = data1; | 389 | dtp->data1 = data1; |
245 | dtp->data2 = data2; | 390 | dtp->data2 = data2; |
246 | dtp->data3 = data3; | 391 | dtp->data3 = data3; |
247 | dtp->seq_cnt = atomic_inc_return(&lpfc_debugfs_disc_trc_cnt); | 392 | dtp->seq_cnt = atomic_inc_return(&lpfc_debugfs_seq_trc_cnt); |
393 | dtp->jif = jiffies; | ||
394 | #endif | ||
395 | return; | ||
396 | } | ||
397 | |||
398 | inline void | ||
399 | lpfc_debugfs_slow_ring_trc(struct lpfc_hba *phba, char *fmt, | ||
400 | uint32_t data1, uint32_t data2, uint32_t data3) | ||
401 | { | ||
402 | #ifdef CONFIG_LPFC_DEBUG_FS | ||
403 | struct lpfc_debugfs_trc *dtp; | ||
404 | int index; | ||
405 | |||
406 | if (!lpfc_debugfs_enable || !lpfc_debugfs_max_slow_ring_trc || | ||
407 | !phba || !phba->slow_ring_trc) | ||
408 | return; | ||
409 | |||
410 | index = atomic_inc_return(&phba->slow_ring_trc_cnt) & | ||
411 | (lpfc_debugfs_max_slow_ring_trc - 1); | ||
412 | dtp = phba->slow_ring_trc + index; | ||
413 | dtp->fmt = fmt; | ||
414 | dtp->data1 = data1; | ||
415 | dtp->data2 = data2; | ||
416 | dtp->data3 = data3; | ||
417 | dtp->seq_cnt = atomic_inc_return(&lpfc_debugfs_seq_trc_cnt); | ||
248 | dtp->jif = jiffies; | 418 | dtp->jif = jiffies; |
249 | #endif | 419 | #endif |
250 | return; | 420 | return; |
@@ -269,7 +439,7 @@ lpfc_debugfs_disc_trc_open(struct inode *inode, struct file *file) | |||
269 | goto out; | 439 | goto out; |
270 | 440 | ||
271 | /* Round to page boundry */ | 441 | /* Round to page boundry */ |
272 | size = (lpfc_debugfs_max_disc_trc * LPFC_DISC_TRC_ENTRY_SIZE); | 442 | size = (lpfc_debugfs_max_disc_trc * LPFC_DEBUG_TRC_ENTRY_SIZE); |
273 | size = PAGE_ALIGN(size); | 443 | size = PAGE_ALIGN(size); |
274 | 444 | ||
275 | debug->buffer = kmalloc(size, GFP_KERNEL); | 445 | debug->buffer = kmalloc(size, GFP_KERNEL); |
@@ -287,6 +457,68 @@ out: | |||
287 | } | 457 | } |
288 | 458 | ||
289 | static int | 459 | static int |
460 | lpfc_debugfs_slow_ring_trc_open(struct inode *inode, struct file *file) | ||
461 | { | ||
462 | struct lpfc_hba *phba = inode->i_private; | ||
463 | struct lpfc_debug *debug; | ||
464 | int size; | ||
465 | int rc = -ENOMEM; | ||
466 | |||
467 | if (!lpfc_debugfs_max_slow_ring_trc) { | ||
468 | rc = -ENOSPC; | ||
469 | goto out; | ||
470 | } | ||
471 | |||
472 | debug = kmalloc(sizeof(*debug), GFP_KERNEL); | ||
473 | if (!debug) | ||
474 | goto out; | ||
475 | |||
476 | /* Round to page boundry */ | ||
477 | size = (lpfc_debugfs_max_slow_ring_trc * LPFC_DEBUG_TRC_ENTRY_SIZE); | ||
478 | size = PAGE_ALIGN(size); | ||
479 | |||
480 | debug->buffer = kmalloc(size, GFP_KERNEL); | ||
481 | if (!debug->buffer) { | ||
482 | kfree(debug); | ||
483 | goto out; | ||
484 | } | ||
485 | |||
486 | debug->len = lpfc_debugfs_slow_ring_trc_data(phba, debug->buffer, size); | ||
487 | file->private_data = debug; | ||
488 | |||
489 | rc = 0; | ||
490 | out: | ||
491 | return rc; | ||
492 | } | ||
493 | |||
494 | static int | ||
495 | lpfc_debugfs_dumpslim_open(struct inode *inode, struct file *file) | ||
496 | { | ||
497 | struct lpfc_hba *phba = inode->i_private; | ||
498 | struct lpfc_debug *debug; | ||
499 | int rc = -ENOMEM; | ||
500 | |||
501 | debug = kmalloc(sizeof(*debug), GFP_KERNEL); | ||
502 | if (!debug) | ||
503 | goto out; | ||
504 | |||
505 | /* Round to page boundry */ | ||
506 | debug->buffer = kmalloc(LPFC_DUMPSLIM_SIZE, GFP_KERNEL); | ||
507 | if (!debug->buffer) { | ||
508 | kfree(debug); | ||
509 | goto out; | ||
510 | } | ||
511 | |||
512 | debug->len = lpfc_debugfs_dumpslim_data(phba, debug->buffer, | ||
513 | LPFC_DUMPSLIM_SIZE); | ||
514 | file->private_data = debug; | ||
515 | |||
516 | rc = 0; | ||
517 | out: | ||
518 | return rc; | ||
519 | } | ||
520 | |||
521 | static int | ||
290 | lpfc_debugfs_nodelist_open(struct inode *inode, struct file *file) | 522 | lpfc_debugfs_nodelist_open(struct inode *inode, struct file *file) |
291 | { | 523 | { |
292 | struct lpfc_vport *vport = inode->i_private; | 524 | struct lpfc_vport *vport = inode->i_private; |
@@ -372,6 +604,24 @@ static struct file_operations lpfc_debugfs_op_nodelist = { | |||
372 | .release = lpfc_debugfs_release, | 604 | .release = lpfc_debugfs_release, |
373 | }; | 605 | }; |
374 | 606 | ||
607 | #undef lpfc_debugfs_op_dumpslim | ||
608 | static struct file_operations lpfc_debugfs_op_dumpslim = { | ||
609 | .owner = THIS_MODULE, | ||
610 | .open = lpfc_debugfs_dumpslim_open, | ||
611 | .llseek = lpfc_debugfs_lseek, | ||
612 | .read = lpfc_debugfs_read, | ||
613 | .release = lpfc_debugfs_release, | ||
614 | }; | ||
615 | |||
616 | #undef lpfc_debugfs_op_slow_ring_trc | ||
617 | static struct file_operations lpfc_debugfs_op_slow_ring_trc = { | ||
618 | .owner = THIS_MODULE, | ||
619 | .open = lpfc_debugfs_slow_ring_trc_open, | ||
620 | .llseek = lpfc_debugfs_lseek, | ||
621 | .read = lpfc_debugfs_read, | ||
622 | .release = lpfc_debugfs_release, | ||
623 | }; | ||
624 | |||
375 | static struct dentry *lpfc_debugfs_root = NULL; | 625 | static struct dentry *lpfc_debugfs_root = NULL; |
376 | static atomic_t lpfc_debugfs_hba_count; | 626 | static atomic_t lpfc_debugfs_hba_count; |
377 | #endif | 627 | #endif |
@@ -387,60 +637,142 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) | |||
387 | if (!lpfc_debugfs_enable) | 637 | if (!lpfc_debugfs_enable) |
388 | return; | 638 | return; |
389 | 639 | ||
390 | if (lpfc_debugfs_max_disc_trc) { | 640 | /* Setup lpfc root directory */ |
391 | num = lpfc_debugfs_max_disc_trc - 1; | ||
392 | if (num & lpfc_debugfs_max_disc_trc) { | ||
393 | /* Change to be a power of 2 */ | ||
394 | num = lpfc_debugfs_max_disc_trc; | ||
395 | i = 0; | ||
396 | while (num > 1) { | ||
397 | num = num >> 1; | ||
398 | i++; | ||
399 | } | ||
400 | lpfc_debugfs_max_disc_trc = (1 << i); | ||
401 | printk(KERN_ERR | ||
402 | "lpfc_debugfs_max_disc_trc changed to %d\n", | ||
403 | lpfc_debugfs_max_disc_trc); | ||
404 | } | ||
405 | } | ||
406 | |||
407 | if (!lpfc_debugfs_root) { | 641 | if (!lpfc_debugfs_root) { |
408 | lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL); | 642 | lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL); |
409 | atomic_set(&lpfc_debugfs_hba_count, 0); | 643 | atomic_set(&lpfc_debugfs_hba_count, 0); |
410 | if (!lpfc_debugfs_root) | 644 | if (!lpfc_debugfs_root) { |
645 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
646 | "%d:0409 Cannot create debugfs root (lpfc)", | ||
647 | phba->brd_no); | ||
411 | goto debug_failed; | 648 | goto debug_failed; |
649 | } | ||
412 | } | 650 | } |
413 | 651 | ||
652 | if (!lpfc_debugfs_start_time) | ||
653 | lpfc_debugfs_start_time = jiffies; | ||
654 | |||
655 | /* Setup lpfcX directory for specific HBA */ | ||
414 | snprintf(name, sizeof(name), "lpfc%d", phba->brd_no); | 656 | snprintf(name, sizeof(name), "lpfc%d", phba->brd_no); |
415 | if (!phba->hba_debugfs_root) { | 657 | if (!phba->hba_debugfs_root) { |
416 | phba->hba_debugfs_root = | 658 | phba->hba_debugfs_root = |
417 | debugfs_create_dir(name, lpfc_debugfs_root); | 659 | debugfs_create_dir(name, lpfc_debugfs_root); |
418 | if (!phba->hba_debugfs_root) | 660 | if (!phba->hba_debugfs_root) { |
661 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
662 | "%d:0409 Cannot create debugfs hba (lpfc%d)", | ||
663 | phba->brd_no, phba->brd_no); | ||
419 | goto debug_failed; | 664 | goto debug_failed; |
665 | } | ||
420 | atomic_inc(&lpfc_debugfs_hba_count); | 666 | atomic_inc(&lpfc_debugfs_hba_count); |
421 | atomic_set(&phba->debugfs_vport_count, 0); | 667 | atomic_set(&phba->debugfs_vport_count, 0); |
668 | |||
669 | /* Setup dumpslim */ | ||
670 | snprintf(name, sizeof(name), "dumpslim"); | ||
671 | phba->debug_dumpslim = | ||
672 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | ||
673 | phba->hba_debugfs_root, | ||
674 | phba, &lpfc_debugfs_op_dumpslim); | ||
675 | if (!phba->debug_dumpslim) { | ||
676 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
677 | "%d:0409 Cannot create debugfs dumpslim (lpfc%d)", | ||
678 | phba->brd_no, phba->brd_no); | ||
679 | goto debug_failed; | ||
680 | } | ||
681 | |||
682 | /* Setup slow ring trace */ | ||
683 | if (lpfc_debugfs_max_slow_ring_trc) { | ||
684 | num = lpfc_debugfs_max_slow_ring_trc - 1; | ||
685 | if (num & lpfc_debugfs_max_slow_ring_trc) { | ||
686 | /* Change to be a power of 2 */ | ||
687 | num = lpfc_debugfs_max_slow_ring_trc; | ||
688 | i = 0; | ||
689 | while (num > 1) { | ||
690 | num = num >> 1; | ||
691 | i++; | ||
692 | } | ||
693 | lpfc_debugfs_max_slow_ring_trc = (1 << i); | ||
694 | printk(KERN_ERR | ||
695 | "lpfc_debugfs_max_slow_ring_trc change to %d\n", | ||
696 | lpfc_debugfs_max_slow_ring_trc); | ||
697 | } | ||
698 | } | ||
699 | |||
700 | |||
701 | snprintf(name, sizeof(name), "slow_ring_trace"); | ||
702 | phba->debug_slow_ring_trc = | ||
703 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | ||
704 | phba->hba_debugfs_root, | ||
705 | phba, &lpfc_debugfs_op_slow_ring_trc); | ||
706 | if (!phba->debug_slow_ring_trc) { | ||
707 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
708 | "%d:0409 Cannot create debugfs " | ||
709 | "slow_ring_trace (lpfc%d)", | ||
710 | phba->brd_no, phba->brd_no); | ||
711 | goto debug_failed; | ||
712 | } | ||
713 | if (!phba->slow_ring_trc) { | ||
714 | phba->slow_ring_trc = kmalloc( | ||
715 | (sizeof(struct lpfc_debugfs_trc) * | ||
716 | lpfc_debugfs_max_slow_ring_trc), | ||
717 | GFP_KERNEL); | ||
718 | if (!phba->slow_ring_trc) { | ||
719 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
720 | "%d:0409 Cannot create debugfs " | ||
721 | "slow_ring buffer (lpfc%d)", | ||
722 | phba->brd_no, phba->brd_no); | ||
723 | goto debug_failed; | ||
724 | } | ||
725 | atomic_set(&phba->slow_ring_trc_cnt, 0); | ||
726 | memset(phba->slow_ring_trc, 0, | ||
727 | (sizeof(struct lpfc_debugfs_trc) * | ||
728 | lpfc_debugfs_max_slow_ring_trc)); | ||
729 | } | ||
422 | } | 730 | } |
423 | 731 | ||
424 | snprintf(name, sizeof(name), "vport%d", vport->vpi); | 732 | snprintf(name, sizeof(name), "vport%d", vport->vpi); |
425 | if (!vport->vport_debugfs_root) { | 733 | if (!vport->vport_debugfs_root) { |
426 | vport->vport_debugfs_root = | 734 | vport->vport_debugfs_root = |
427 | debugfs_create_dir(name, phba->hba_debugfs_root); | 735 | debugfs_create_dir(name, phba->hba_debugfs_root); |
428 | if (!vport->vport_debugfs_root) | 736 | if (!vport->vport_debugfs_root) { |
737 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
738 | "%d:0409 Cant create debugfs vport%d (lpfc%d)", | ||
739 | phba->brd_no, vport->vpi, phba->brd_no); | ||
429 | goto debug_failed; | 740 | goto debug_failed; |
741 | } | ||
430 | atomic_inc(&phba->debugfs_vport_count); | 742 | atomic_inc(&phba->debugfs_vport_count); |
431 | } | 743 | } |
432 | 744 | ||
433 | if (!lpfc_debugfs_start_time) | 745 | if (lpfc_debugfs_max_disc_trc) { |
434 | lpfc_debugfs_start_time = jiffies; | 746 | num = lpfc_debugfs_max_disc_trc - 1; |
747 | if (num & lpfc_debugfs_max_disc_trc) { | ||
748 | /* Change to be a power of 2 */ | ||
749 | num = lpfc_debugfs_max_disc_trc; | ||
750 | i = 0; | ||
751 | while (num > 1) { | ||
752 | num = num >> 1; | ||
753 | i++; | ||
754 | } | ||
755 | lpfc_debugfs_max_disc_trc = (1 << i); | ||
756 | printk(KERN_ERR | ||
757 | "lpfc_debugfs_max_disc_trc changed to %d\n", | ||
758 | lpfc_debugfs_max_disc_trc); | ||
759 | } | ||
760 | } | ||
435 | 761 | ||
436 | vport->disc_trc = kmalloc( | 762 | vport->disc_trc = kmalloc( |
437 | (sizeof(struct lpfc_disc_trc) * lpfc_debugfs_max_disc_trc), | 763 | (sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_disc_trc), |
438 | GFP_KERNEL); | 764 | GFP_KERNEL); |
439 | 765 | ||
440 | if (!vport->disc_trc) | 766 | if (!vport->disc_trc) { |
767 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
768 | "%d:0409 Cannot create debugfs " | ||
769 | "vport%d disc trace buffer (lpfc%d)", | ||
770 | phba->brd_no, vport->vpi, phba->brd_no); | ||
441 | goto debug_failed; | 771 | goto debug_failed; |
772 | } | ||
773 | atomic_set(&vport->disc_trc_cnt, 0); | ||
442 | memset(vport->disc_trc, 0, | 774 | memset(vport->disc_trc, 0, |
443 | (sizeof(struct lpfc_disc_trc) * lpfc_debugfs_max_disc_trc)); | 775 | (sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_disc_trc)); |
444 | 776 | ||
445 | snprintf(name, sizeof(name), "discovery_trace"); | 777 | snprintf(name, sizeof(name), "discovery_trace"); |
446 | vport->debug_disc_trc = | 778 | vport->debug_disc_trc = |
@@ -449,8 +781,9 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) | |||
449 | vport, &lpfc_debugfs_op_disc_trc); | 781 | vport, &lpfc_debugfs_op_disc_trc); |
450 | if (!vport->debug_disc_trc) { | 782 | if (!vport->debug_disc_trc) { |
451 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 783 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
452 | "%d:0409 Cannot create debugfs", | 784 | "%d:0409 Cannot create debugfs " |
453 | phba->brd_no); | 785 | "vport%d discovery_trace (lpfc%d)", |
786 | phba->brd_no, vport->vpi, phba->brd_no); | ||
454 | goto debug_failed; | 787 | goto debug_failed; |
455 | } | 788 | } |
456 | snprintf(name, sizeof(name), "nodelist"); | 789 | snprintf(name, sizeof(name), "nodelist"); |
@@ -460,8 +793,8 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) | |||
460 | vport, &lpfc_debugfs_op_nodelist); | 793 | vport, &lpfc_debugfs_op_nodelist); |
461 | if (!vport->debug_nodelist) { | 794 | if (!vport->debug_nodelist) { |
462 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 795 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
463 | "%d:0409 Cannot create debugfs", | 796 | "%d:0409 Cant create debugfs vport%d nodelist (lpfc%d)", |
464 | phba->brd_no); | 797 | phba->brd_no, vport->vpi, phba->brd_no); |
465 | goto debug_failed; | 798 | goto debug_failed; |
466 | } | 799 | } |
467 | debug_failed: | 800 | debug_failed: |
@@ -488,21 +821,41 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport) | |||
488 | debugfs_remove(vport->debug_nodelist); /* nodelist */ | 821 | debugfs_remove(vport->debug_nodelist); /* nodelist */ |
489 | vport->debug_nodelist = NULL; | 822 | vport->debug_nodelist = NULL; |
490 | } | 823 | } |
824 | |||
491 | if (vport->vport_debugfs_root) { | 825 | if (vport->vport_debugfs_root) { |
492 | debugfs_remove(vport->vport_debugfs_root); /* vportX */ | 826 | debugfs_remove(vport->vport_debugfs_root); /* vportX */ |
493 | vport->vport_debugfs_root = NULL; | 827 | vport->vport_debugfs_root = NULL; |
494 | atomic_dec(&phba->debugfs_vport_count); | 828 | atomic_dec(&phba->debugfs_vport_count); |
495 | } | 829 | } |
496 | if (atomic_read(&phba->debugfs_vport_count) == 0) { | 830 | if (atomic_read(&phba->debugfs_vport_count) == 0) { |
497 | debugfs_remove(vport->phba->hba_debugfs_root); /* lpfcX */ | 831 | |
498 | vport->phba->hba_debugfs_root = NULL; | 832 | if (phba->debug_dumpslim) { |
499 | atomic_dec(&lpfc_debugfs_hba_count); | 833 | debugfs_remove(phba->debug_dumpslim); /* dumpslim */ |
834 | phba->debug_dumpslim = NULL; | ||
835 | } | ||
836 | if (phba->slow_ring_trc) { | ||
837 | kfree(phba->slow_ring_trc); | ||
838 | phba->slow_ring_trc = NULL; | ||
839 | } | ||
840 | if (phba->debug_slow_ring_trc) { | ||
841 | /* slow_ring_trace */ | ||
842 | debugfs_remove(phba->debug_slow_ring_trc); | ||
843 | phba->debug_slow_ring_trc = NULL; | ||
844 | } | ||
845 | |||
846 | if (phba->hba_debugfs_root) { | ||
847 | debugfs_remove(phba->hba_debugfs_root); /* lpfcX */ | ||
848 | phba->hba_debugfs_root = NULL; | ||
849 | atomic_dec(&lpfc_debugfs_hba_count); | ||
850 | } | ||
851 | |||
500 | if (atomic_read(&lpfc_debugfs_hba_count) == 0) { | 852 | if (atomic_read(&lpfc_debugfs_hba_count) == 0) { |
501 | debugfs_remove(lpfc_debugfs_root); /* lpfc */ | 853 | debugfs_remove(lpfc_debugfs_root); /* lpfc */ |
502 | lpfc_debugfs_root = NULL; | 854 | lpfc_debugfs_root = NULL; |
503 | } | 855 | } |
504 | } | 856 | } |
505 | #endif | 857 | #endif |
858 | return; | ||
506 | } | 859 | } |
507 | 860 | ||
508 | 861 | ||
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.h b/drivers/scsi/lpfc/lpfc_debugfs.h index fffb678426a4..31e86a55391d 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.h +++ b/drivers/scsi/lpfc/lpfc_debugfs.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #define _H_LPFC_DEBUG_FS | 22 | #define _H_LPFC_DEBUG_FS |
23 | 23 | ||
24 | #ifdef CONFIG_LPFC_DEBUG_FS | 24 | #ifdef CONFIG_LPFC_DEBUG_FS |
25 | struct lpfc_disc_trc { | 25 | struct lpfc_debugfs_trc { |
26 | char *fmt; | 26 | char *fmt; |
27 | uint32_t data1; | 27 | uint32_t data1; |
28 | uint32_t data2; | 28 | uint32_t data2; |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 33fbc1666946..68fc975d4e52 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -2033,12 +2033,11 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
2033 | } | 2033 | } |
2034 | 2034 | ||
2035 | /* No retry ELS command <elsCmd> to remote NPORT <did> */ | 2035 | /* No retry ELS command <elsCmd> to remote NPORT <did> */ |
2036 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2036 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
2037 | "%d (%d):0108 No retry ELS command x%x to remote " | 2037 | "0108 No retry ELS command x%x to remote " |
2038 | "NPORT x%x Data: x%x\n", | 2038 | "NPORT x%x Retried:%d Error:x%x/%x\n", |
2039 | phba->brd_no, vport->vpi, | 2039 | cmd, did, cmdiocb->retry, irsp->ulpStatus, |
2040 | cmd, did, cmdiocb->retry); | 2040 | irsp->un.ulpWord[4]); |
2041 | |||
2042 | return 0; | 2041 | return 0; |
2043 | } | 2042 | } |
2044 | 2043 | ||
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index f2f4639eab59..ea27bbb81552 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -426,10 +426,19 @@ lpfc_work_done(struct lpfc_hba *phba) | |||
426 | spin_lock_irq(&phba->hbalock); | 426 | spin_lock_irq(&phba->hbalock); |
427 | control = readl(phba->HCregaddr); | 427 | control = readl(phba->HCregaddr); |
428 | if (!(control & (HC_R0INT_ENA << LPFC_ELS_RING))) { | 428 | if (!(control & (HC_R0INT_ENA << LPFC_ELS_RING))) { |
429 | lpfc_debugfs_slow_ring_trc(phba, | ||
430 | "WRK Enable ring: cntl:x%x hacopy:x%x", | ||
431 | control, ha_copy, 0); | ||
432 | |||
429 | control |= (HC_R0INT_ENA << LPFC_ELS_RING); | 433 | control |= (HC_R0INT_ENA << LPFC_ELS_RING); |
430 | writel(control, phba->HCregaddr); | 434 | writel(control, phba->HCregaddr); |
431 | readl(phba->HCregaddr); /* flush */ | 435 | readl(phba->HCregaddr); /* flush */ |
432 | } | 436 | } |
437 | else { | ||
438 | lpfc_debugfs_slow_ring_trc(phba, | ||
439 | "WRK Ring ok: cntl:x%x hacopy:x%x", | ||
440 | control, ha_copy, 0); | ||
441 | } | ||
433 | spin_unlock_irq(&phba->hbalock); | 442 | spin_unlock_irq(&phba->hbalock); |
434 | } | 443 | } |
435 | lpfc_work_list_done(phba); | 444 | lpfc_work_list_done(phba); |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index f4d5a6b00fde..14fe6b000b59 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -395,6 +395,14 @@ lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
395 | */ | 395 | */ |
396 | nextiocb->iocb.ulpIoTag = (nextiocb->iocb_cmpl) ? nextiocb->iotag : 0; | 396 | nextiocb->iocb.ulpIoTag = (nextiocb->iocb_cmpl) ? nextiocb->iotag : 0; |
397 | 397 | ||
398 | if (pring->ringno == LPFC_ELS_RING) { | ||
399 | lpfc_debugfs_slow_ring_trc(phba, | ||
400 | "IOCB cmd ring: wd4:x%08x wd6:x%08x wd7:x%08x", | ||
401 | *(((uint32_t *) &nextiocb->iocb) + 4), | ||
402 | *(((uint32_t *) &nextiocb->iocb) + 6), | ||
403 | *(((uint32_t *) &nextiocb->iocb) + 7)); | ||
404 | } | ||
405 | |||
398 | /* | 406 | /* |
399 | * Issue iocb command to adapter | 407 | * Issue iocb command to adapter |
400 | */ | 408 | */ |
@@ -1542,6 +1550,14 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1542 | if (++pring->rspidx >= portRspMax) | 1550 | if (++pring->rspidx >= portRspMax) |
1543 | pring->rspidx = 0; | 1551 | pring->rspidx = 0; |
1544 | 1552 | ||
1553 | if (pring->ringno == LPFC_ELS_RING) { | ||
1554 | lpfc_debugfs_slow_ring_trc(phba, | ||
1555 | "IOCB rsp ring: wd4:x%08x wd6:x%08x wd7:x%08x", | ||
1556 | *(((uint32_t *) irsp) + 4), | ||
1557 | *(((uint32_t *) irsp) + 6), | ||
1558 | *(((uint32_t *) irsp) + 7)); | ||
1559 | } | ||
1560 | |||
1545 | writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx); | 1561 | writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx); |
1546 | 1562 | ||
1547 | if (list_empty(&(pring->iocb_continueq))) { | 1563 | if (list_empty(&(pring->iocb_continueq))) { |
@@ -3850,12 +3866,33 @@ lpfc_intr_handler(int irq, void *dev_id) | |||
3850 | if (status & HA_RXMASK) { | 3866 | if (status & HA_RXMASK) { |
3851 | spin_lock(&phba->hbalock); | 3867 | spin_lock(&phba->hbalock); |
3852 | control = readl(phba->HCregaddr); | 3868 | control = readl(phba->HCregaddr); |
3869 | |||
3870 | lpfc_debugfs_slow_ring_trc(phba, | ||
3871 | "ISR slow ring: ctl:x%x stat:x%x isrcnt:x%x", | ||
3872 | control, status, | ||
3873 | (uint32_t)phba->sli.slistat.sli_intr); | ||
3874 | |||
3853 | if (control & (HC_R0INT_ENA << LPFC_ELS_RING)) { | 3875 | if (control & (HC_R0INT_ENA << LPFC_ELS_RING)) { |
3876 | lpfc_debugfs_slow_ring_trc(phba, | ||
3877 | "ISR Disable ring:" | ||
3878 | "pwork:x%x hawork:x%x wait:x%x", | ||
3879 | phba->work_ha, work_ha_copy, | ||
3880 | (uint32_t)((unsigned long) | ||
3881 | phba->work_wait)); | ||
3882 | |||
3854 | control &= | 3883 | control &= |
3855 | ~(HC_R0INT_ENA << LPFC_ELS_RING); | 3884 | ~(HC_R0INT_ENA << LPFC_ELS_RING); |
3856 | writel(control, phba->HCregaddr); | 3885 | writel(control, phba->HCregaddr); |
3857 | readl(phba->HCregaddr); /* flush */ | 3886 | readl(phba->HCregaddr); /* flush */ |
3858 | } | 3887 | } |
3888 | else { | ||
3889 | lpfc_debugfs_slow_ring_trc(phba, | ||
3890 | "ISR slow ring: pwork:" | ||
3891 | "x%x hawork:x%x wait:x%x", | ||
3892 | phba->work_ha, work_ha_copy, | ||
3893 | (uint32_t)((unsigned long) | ||
3894 | phba->work_wait)); | ||
3895 | } | ||
3859 | spin_unlock(&phba->hbalock); | 3896 | spin_unlock(&phba->hbalock); |
3860 | } | 3897 | } |
3861 | } | 3898 | } |
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index 85797dbf5478..c5918a643014 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c | |||
@@ -326,6 +326,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
326 | rc = VPORT_OK; | 326 | rc = VPORT_OK; |
327 | 327 | ||
328 | out: | 328 | out: |
329 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | ||
330 | "1825 Vport Created.\n"); | ||
329 | lpfc_host_attrib_init(lpfc_shost_from_vport(vport)); | 331 | lpfc_host_attrib_init(lpfc_shost_from_vport(vport)); |
330 | error_out: | 332 | error_out: |
331 | return rc; | 333 | return rc; |
@@ -371,6 +373,8 @@ disable_vport(struct fc_vport *fc_vport) | |||
371 | lpfc_mbx_unreg_vpi(vport); | 373 | lpfc_mbx_unreg_vpi(vport); |
372 | 374 | ||
373 | lpfc_vport_set_state(vport, FC_VPORT_DISABLED); | 375 | lpfc_vport_set_state(vport, FC_VPORT_DISABLED); |
376 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | ||
377 | "1826 Vport Disabled.\n"); | ||
374 | return VPORT_OK; | 378 | return VPORT_OK; |
375 | } | 379 | } |
376 | 380 | ||
@@ -408,7 +412,8 @@ enable_vport(struct fc_vport *fc_vport) | |||
408 | } else { | 412 | } else { |
409 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 413 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
410 | } | 414 | } |
411 | 415 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | |
416 | "1827 Vport Enabled.\n"); | ||
412 | return VPORT_OK; | 417 | return VPORT_OK; |
413 | } | 418 | } |
414 | 419 | ||
@@ -511,7 +516,8 @@ skip_logo: | |||
511 | spin_lock_irq(&phba->hbalock); | 516 | spin_lock_irq(&phba->hbalock); |
512 | list_del_init(&vport->listentry); | 517 | list_del_init(&vport->listentry); |
513 | spin_unlock_irq(&phba->hbalock); | 518 | spin_unlock_irq(&phba->hbalock); |
514 | 519 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | |
520 | "1828 Vport Deleted.\n"); | ||
515 | rc = VPORT_OK; | 521 | rc = VPORT_OK; |
516 | out: | 522 | out: |
517 | scsi_host_put(shost); | 523 | scsi_host_put(shost); |