diff options
author | James Smart <James.Smart@Emulex.Com> | 2007-08-02 11:10:09 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-08-01 13:21:26 -0400 |
commit | e8b62011d88d6fdba585fb2bb77c9274a63cadab (patch) | |
tree | 838c3abee73ec571456ae3ae83e51ecbed8e4a64 /drivers/scsi/lpfc/lpfc_vport.c | |
parent | 3de2a653a127c468284c48e233719dc39769e354 (diff) |
[SCSI] lpfc 8.2.2 : Rework the lpfc_printf_log() macro
Rework the lpfc_printf_log() macro so that logging is enabled on a
per-vport basis. Used to be on a physical-port basis, thus logging
with large numbers of vports became a mess. Required redefinition of
the macro, and an update of every use.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_vport.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_vport.c | 73 |
1 files changed, 34 insertions, 39 deletions
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index 70e1bc34fd48..77067d17c39d 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c | |||
@@ -125,11 +125,10 @@ lpfc_vport_sparm(struct lpfc_hba *phba, struct lpfc_vport *vport) | |||
125 | pmb->vport = vport; | 125 | pmb->vport = vport; |
126 | rc = lpfc_sli_issue_mbox_wait(phba, pmb, phba->fc_ratov * 2); | 126 | rc = lpfc_sli_issue_mbox_wait(phba, pmb, phba->fc_ratov * 2); |
127 | if (rc != MBX_SUCCESS) { | 127 | if (rc != MBX_SUCCESS) { |
128 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, | 128 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT | LOG_VPORT, |
129 | "%d (%d):1818 VPort failed init, mbxCmd x%x " | 129 | "1818 VPort failed init, mbxCmd x%x " |
130 | "READ_SPARM mbxStatus x%x, rc = x%x\n", | 130 | "READ_SPARM mbxStatus x%x, rc = x%x\n", |
131 | phba->brd_no, vport->vpi, | 131 | mb->mbxCommand, mb->mbxStatus, rc); |
132 | mb->mbxCommand, mb->mbxStatus, rc); | ||
133 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 132 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
134 | kfree(mp); | 133 | kfree(mp); |
135 | if (rc != MBX_TIMEOUT) | 134 | if (rc != MBX_TIMEOUT) |
@@ -162,9 +161,9 @@ lpfc_valid_wwn_format(struct lpfc_hba *phba, struct lpfc_name *wwn, | |||
162 | return 1; | 161 | return 1; |
163 | 162 | ||
164 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 163 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
165 | "%d:1822 Invalid %s: %02x:%02x:%02x:%02x:" | 164 | "1822 Invalid %s: %02x:%02x:%02x:%02x:" |
166 | "%02x:%02x:%02x:%02x\n", | 165 | "%02x:%02x:%02x:%02x\n", |
167 | phba->brd_no, name_type, | 166 | name_type, |
168 | wwn->u.wwn[0], wwn->u.wwn[1], | 167 | wwn->u.wwn[0], wwn->u.wwn[1], |
169 | wwn->u.wwn[2], wwn->u.wwn[3], | 168 | wwn->u.wwn[2], wwn->u.wwn[3], |
170 | wwn->u.wwn[4], wwn->u.wwn[5], | 169 | wwn->u.wwn[4], wwn->u.wwn[5], |
@@ -209,9 +208,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
209 | if ((phba->sli_rev < 3) || | 208 | if ((phba->sli_rev < 3) || |
210 | !(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) { | 209 | !(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) { |
211 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 210 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
212 | "%d:1808 Create VPORT failed: " | 211 | "1808 Create VPORT failed: " |
213 | "NPIV is not enabled: SLImode:%d\n", | 212 | "NPIV is not enabled: SLImode:%d\n", |
214 | phba->brd_no, phba->sli_rev); | 213 | phba->sli_rev); |
215 | rc = VPORT_INVAL; | 214 | rc = VPORT_INVAL; |
216 | goto error_out; | 215 | goto error_out; |
217 | } | 216 | } |
@@ -219,9 +218,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
219 | vpi = lpfc_alloc_vpi(phba); | 218 | vpi = lpfc_alloc_vpi(phba); |
220 | if (vpi == 0) { | 219 | if (vpi == 0) { |
221 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 220 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
222 | "%d:1809 Create VPORT failed: " | 221 | "1809 Create VPORT failed: " |
223 | "Max VPORTs (%d) exceeded\n", | 222 | "Max VPORTs (%d) exceeded\n", |
224 | phba->brd_no, phba->max_vpi); | 223 | phba->max_vpi); |
225 | rc = VPORT_NORESOURCES; | 224 | rc = VPORT_NORESOURCES; |
226 | goto error_out; | 225 | goto error_out; |
227 | } | 226 | } |
@@ -230,8 +229,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
230 | /* Assign an unused board number */ | 229 | /* Assign an unused board number */ |
231 | if ((instance = lpfc_get_instance()) < 0) { | 230 | if ((instance = lpfc_get_instance()) < 0) { |
232 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 231 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
233 | "%d:1810 Create VPORT failed: Cannot get " | 232 | "1810 Create VPORT failed: Cannot get " |
234 | "instance number\n", phba->brd_no); | 233 | "instance number\n"); |
235 | lpfc_free_vpi(phba, vpi); | 234 | lpfc_free_vpi(phba, vpi); |
236 | rc = VPORT_NORESOURCES; | 235 | rc = VPORT_NORESOURCES; |
237 | goto error_out; | 236 | goto error_out; |
@@ -240,8 +239,7 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
240 | vport = lpfc_create_port(phba, instance, &fc_vport->dev); | 239 | vport = lpfc_create_port(phba, instance, &fc_vport->dev); |
241 | if (!vport) { | 240 | if (!vport) { |
242 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 241 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
243 | "%d:1811 Create VPORT failed: vpi x%x\n", | 242 | "1811 Create VPORT failed: vpi x%x\n", vpi); |
244 | phba->brd_no, vpi); | ||
245 | lpfc_free_vpi(phba, vpi); | 243 | lpfc_free_vpi(phba, vpi); |
246 | rc = VPORT_NORESOURCES; | 244 | rc = VPORT_NORESOURCES; |
247 | goto error_out; | 245 | goto error_out; |
@@ -251,10 +249,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
251 | lpfc_debugfs_initialize(vport); | 249 | lpfc_debugfs_initialize(vport); |
252 | 250 | ||
253 | if (lpfc_vport_sparm(phba, vport)) { | 251 | if (lpfc_vport_sparm(phba, vport)) { |
254 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 252 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
255 | "%d:1813 Create VPORT failed: vpi:%d " | 253 | "1813 Create VPORT failed. " |
256 | "Cannot get sparam\n", | 254 | "Cannot get sparam\n"); |
257 | phba->brd_no, vpi); | ||
258 | lpfc_free_vpi(phba, vpi); | 255 | lpfc_free_vpi(phba, vpi); |
259 | destroy_port(vport); | 256 | destroy_port(vport); |
260 | rc = VPORT_NORESOURCES; | 257 | rc = VPORT_NORESOURCES; |
@@ -274,10 +271,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
274 | 271 | ||
275 | if (!lpfc_valid_wwn_format(phba, &vport->fc_sparam.nodeName, "WWNN") || | 272 | if (!lpfc_valid_wwn_format(phba, &vport->fc_sparam.nodeName, "WWNN") || |
276 | !lpfc_valid_wwn_format(phba, &vport->fc_sparam.portName, "WWPN")) { | 273 | !lpfc_valid_wwn_format(phba, &vport->fc_sparam.portName, "WWPN")) { |
277 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 274 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
278 | "%d:1821 Create VPORT failed: vpi:%d " | 275 | "1821 Create VPORT failed. " |
279 | "Invalid WWN format\n", | 276 | "Invalid WWN format\n"); |
280 | phba->brd_no, vpi); | ||
281 | lpfc_free_vpi(phba, vpi); | 277 | lpfc_free_vpi(phba, vpi); |
282 | destroy_port(vport); | 278 | destroy_port(vport); |
283 | rc = VPORT_INVAL; | 279 | rc = VPORT_INVAL; |
@@ -285,10 +281,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
285 | } | 281 | } |
286 | 282 | ||
287 | if (!lpfc_unique_wwpn(phba, vport)) { | 283 | if (!lpfc_unique_wwpn(phba, vport)) { |
288 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 284 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
289 | "%d:1823 Create VPORT failed: vpi:%d " | 285 | "1823 Create VPORT failed. " |
290 | "Duplicate WWN on HBA\n", | 286 | "Duplicate WWN on HBA\n"); |
291 | phba->brd_no, vpi); | ||
292 | lpfc_free_vpi(phba, vpi); | 287 | lpfc_free_vpi(phba, vpi); |
293 | destroy_port(vport); | 288 | destroy_port(vport); |
294 | rc = VPORT_INVAL; | 289 | rc = VPORT_INVAL; |
@@ -320,10 +315,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
320 | lpfc_initial_fdisc(vport); | 315 | lpfc_initial_fdisc(vport); |
321 | } else { | 316 | } else { |
322 | lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); | 317 | lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); |
323 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 318 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
324 | "%d (%d):0262 No NPIV Fabric " | 319 | "0262 No NPIV Fabric support\n"); |
325 | "support\n", | ||
326 | phba->brd_no, vport->vpi); | ||
327 | } | 320 | } |
328 | } else { | 321 | } else { |
329 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 322 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
@@ -409,10 +402,8 @@ enable_vport(struct fc_vport *fc_vport) | |||
409 | lpfc_initial_fdisc(vport); | 402 | lpfc_initial_fdisc(vport); |
410 | } else { | 403 | } else { |
411 | lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); | 404 | lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); |
412 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 405 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
413 | "%d (%d):0264 No NPIV Fabric " | 406 | "0264 No NPIV Fabric support\n"); |
414 | "support\n", | ||
415 | phba->brd_no, vport->vpi); | ||
416 | } | 407 | } |
417 | } else { | 408 | } else { |
418 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 409 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
@@ -462,9 +453,9 @@ lpfc_vport_delete(struct fc_vport *fc_vport) | |||
462 | return VPORT_INVAL; | 453 | return VPORT_INVAL; |
463 | 454 | ||
464 | if (vport->port_type == LPFC_PHYSICAL_PORT) { | 455 | if (vport->port_type == LPFC_PHYSICAL_PORT) { |
465 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 456 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
466 | "%d:1812 vport_delete failed: Cannot delete " | 457 | "1812 vport_delete failed: Cannot delete " |
467 | "physical host\n", phba->brd_no); | 458 | "physical host\n"); |
468 | goto out; | 459 | goto out; |
469 | } | 460 | } |
470 | 461 | ||
@@ -544,8 +535,12 @@ lpfc_create_vport_work_array(struct lpfc_hba *phba) | |||
544 | return NULL; | 535 | return NULL; |
545 | spin_lock_irq(&phba->hbalock); | 536 | spin_lock_irq(&phba->hbalock); |
546 | list_for_each_entry(port_iterator, &phba->port_list, listentry) { | 537 | list_for_each_entry(port_iterator, &phba->port_list, listentry) { |
547 | if (!scsi_host_get(lpfc_shost_from_vport(port_iterator))) | 538 | if (!scsi_host_get(lpfc_shost_from_vport(port_iterator))) { |
539 | lpfc_printf_vlog(port_iterator, KERN_ERR, LOG_VPORT, | ||
540 | "1801 Create vport work array FAILED: " | ||
541 | "cannot do scsi_host_get\n"); | ||
548 | continue; | 542 | continue; |
543 | } | ||
549 | vports[index++] = port_iterator; | 544 | vports[index++] = port_iterator; |
550 | } | 545 | } |
551 | spin_unlock_irq(&phba->hbalock); | 546 | spin_unlock_irq(&phba->hbalock); |