diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 284 |
1 files changed, 146 insertions, 138 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 07bd0dcdf0d6..414350ab584e 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -53,8 +53,6 @@ static struct scsi_transport_template *lpfc_transport_template = NULL; | |||
53 | static struct scsi_transport_template *lpfc_vport_transport_template = NULL; | 53 | static struct scsi_transport_template *lpfc_vport_transport_template = NULL; |
54 | static DEFINE_IDR(lpfc_hba_index); | 54 | static DEFINE_IDR(lpfc_hba_index); |
55 | 55 | ||
56 | |||
57 | |||
58 | /************************************************************************/ | 56 | /************************************************************************/ |
59 | /* */ | 57 | /* */ |
60 | /* lpfc_config_port_prep */ | 58 | /* lpfc_config_port_prep */ |
@@ -107,10 +105,9 @@ lpfc_config_port_prep(struct lpfc_hba *phba) | |||
107 | 105 | ||
108 | if (rc != MBX_SUCCESS) { | 106 | if (rc != MBX_SUCCESS) { |
109 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | 107 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, |
110 | "%d:0324 Config Port initialization " | 108 | "0324 Config Port initialization " |
111 | "error, mbxCmd x%x READ_NVPARM, " | 109 | "error, mbxCmd x%x READ_NVPARM, " |
112 | "mbxStatus x%x\n", | 110 | "mbxStatus x%x\n", |
113 | phba->brd_no, | ||
114 | mb->mbxCommand, mb->mbxStatus); | 111 | mb->mbxCommand, mb->mbxStatus); |
115 | mempool_free(pmb, phba->mbox_mem_pool); | 112 | mempool_free(pmb, phba->mbox_mem_pool); |
116 | return -ERESTART; | 113 | return -ERESTART; |
@@ -128,9 +125,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba) | |||
128 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); | 125 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); |
129 | if (rc != MBX_SUCCESS) { | 126 | if (rc != MBX_SUCCESS) { |
130 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 127 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
131 | "%d:0439 Adapter failed to init, mbxCmd x%x " | 128 | "0439 Adapter failed to init, mbxCmd x%x " |
132 | "READ_REV, mbxStatus x%x\n", | 129 | "READ_REV, mbxStatus x%x\n", |
133 | phba->brd_no, | ||
134 | mb->mbxCommand, mb->mbxStatus); | 130 | mb->mbxCommand, mb->mbxStatus); |
135 | mempool_free( pmb, phba->mbox_mem_pool); | 131 | mempool_free( pmb, phba->mbox_mem_pool); |
136 | return -ERESTART; | 132 | return -ERESTART; |
@@ -144,9 +140,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba) | |||
144 | if (mb->un.varRdRev.rr == 0) { | 140 | if (mb->un.varRdRev.rr == 0) { |
145 | vp->rev.rBit = 0; | 141 | vp->rev.rBit = 0; |
146 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 142 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
147 | "%d:0440 Adapter failed to init, READ_REV has " | 143 | "0440 Adapter failed to init, READ_REV has " |
148 | "missing revision information.\n", | 144 | "missing revision information.\n"); |
149 | phba->brd_no); | ||
150 | mempool_free(pmb, phba->mbox_mem_pool); | 145 | mempool_free(pmb, phba->mbox_mem_pool); |
151 | return -ERESTART; | 146 | return -ERESTART; |
152 | } | 147 | } |
@@ -197,9 +192,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba) | |||
197 | 192 | ||
198 | if (rc != MBX_SUCCESS) { | 193 | if (rc != MBX_SUCCESS) { |
199 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 194 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
200 | "%d:0441 VPD not present on adapter, " | 195 | "0441 VPD not present on adapter, " |
201 | "mbxCmd x%x DUMP VPD, mbxStatus x%x\n", | 196 | "mbxCmd x%x DUMP VPD, mbxStatus x%x\n", |
202 | phba->brd_no, | ||
203 | mb->mbxCommand, mb->mbxStatus); | 197 | mb->mbxCommand, mb->mbxStatus); |
204 | mb->un.varDmp.word_cnt = 0; | 198 | mb->un.varDmp.word_cnt = 0; |
205 | } | 199 | } |
@@ -253,9 +247,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
253 | pmb->vport = vport; | 247 | pmb->vport = vport; |
254 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | 248 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { |
255 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 249 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
256 | "%d:0448 Adapter failed init, mbxCmd x%x " | 250 | "0448 Adapter failed init, mbxCmd x%x " |
257 | "READ_SPARM mbxStatus x%x\n", | 251 | "READ_SPARM mbxStatus x%x\n", |
258 | phba->brd_no, | ||
259 | mb->mbxCommand, mb->mbxStatus); | 252 | mb->mbxCommand, mb->mbxStatus); |
260 | phba->link_state = LPFC_HBA_ERROR; | 253 | phba->link_state = LPFC_HBA_ERROR; |
261 | mp = (struct lpfc_dmabuf *) pmb->context1; | 254 | mp = (struct lpfc_dmabuf *) pmb->context1; |
@@ -312,9 +305,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
312 | pmb->vport = vport; | 305 | pmb->vport = vport; |
313 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | 306 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { |
314 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 307 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
315 | "%d:0453 Adapter failed to init, mbxCmd x%x " | 308 | "0453 Adapter failed to init, mbxCmd x%x " |
316 | "READ_CONFIG, mbxStatus x%x\n", | 309 | "READ_CONFIG, mbxStatus x%x\n", |
317 | phba->brd_no, | ||
318 | mb->mbxCommand, mb->mbxStatus); | 310 | mb->mbxCommand, mb->mbxStatus); |
319 | phba->link_state = LPFC_HBA_ERROR; | 311 | phba->link_state = LPFC_HBA_ERROR; |
320 | mempool_free( pmb, phba->mbox_mem_pool); | 312 | mempool_free( pmb, phba->mbox_mem_pool); |
@@ -344,9 +336,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
344 | && !(phba->lmt & LMT_10Gb))) { | 336 | && !(phba->lmt & LMT_10Gb))) { |
345 | /* Reset link speed to auto */ | 337 | /* Reset link speed to auto */ |
346 | lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT, | 338 | lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT, |
347 | "%d:1302 Invalid speed for this board: " | 339 | "1302 Invalid speed for this board: " |
348 | "Reset link speed to auto: x%x\n", | 340 | "Reset link speed to auto: x%x\n", |
349 | phba->brd_no, | ||
350 | phba->cfg_link_speed); | 341 | phba->cfg_link_speed); |
351 | phba->cfg_link_speed = LINK_SPEED_AUTO; | 342 | phba->cfg_link_speed = LINK_SPEED_AUTO; |
352 | } | 343 | } |
@@ -402,9 +393,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
402 | lpfc_set_loopback_flag(phba); | 393 | lpfc_set_loopback_flag(phba); |
403 | if (rc != MBX_SUCCESS) { | 394 | if (rc != MBX_SUCCESS) { |
404 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 395 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
405 | "%d:0454 Adapter failed to init, mbxCmd x%x " | 396 | "0454 Adapter failed to init, mbxCmd x%x " |
406 | "INIT_LINK, mbxStatus x%x\n", | 397 | "INIT_LINK, mbxStatus x%x\n", |
407 | phba->brd_no, | ||
408 | mb->mbxCommand, mb->mbxStatus); | 398 | mb->mbxCommand, mb->mbxStatus); |
409 | 399 | ||
410 | /* Clear all interrupt enable conditions */ | 400 | /* Clear all interrupt enable conditions */ |
@@ -437,16 +427,11 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
437 | int | 427 | int |
438 | lpfc_hba_down_prep(struct lpfc_hba *phba) | 428 | lpfc_hba_down_prep(struct lpfc_hba *phba) |
439 | { | 429 | { |
440 | struct lpfc_vport *vport = phba->pport; | ||
441 | |||
442 | /* Disable interrupts */ | 430 | /* Disable interrupts */ |
443 | writel(0, phba->HCregaddr); | 431 | writel(0, phba->HCregaddr); |
444 | readl(phba->HCregaddr); /* flush */ | 432 | readl(phba->HCregaddr); /* flush */ |
445 | 433 | ||
446 | list_for_each_entry(vport, &phba->port_list, listentry) { | 434 | lpfc_cleanup_discovery_resources(phba->pport); |
447 | lpfc_cleanup_discovery_resources(vport); | ||
448 | } | ||
449 | |||
450 | return 0; | 435 | return 0; |
451 | } | 436 | } |
452 | 437 | ||
@@ -518,7 +503,7 @@ lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) | |||
518 | mempool_free(pmboxq, phba->mbox_mem_pool); | 503 | mempool_free(pmboxq, phba->mbox_mem_pool); |
519 | if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && | 504 | if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && |
520 | !(phba->link_state == LPFC_HBA_ERROR) && | 505 | !(phba->link_state == LPFC_HBA_ERROR) && |
521 | !(phba->pport->fc_flag & FC_UNLOADING)) | 506 | !(phba->pport->load_flag & FC_UNLOADING)) |
522 | mod_timer(&phba->hb_tmofunc, | 507 | mod_timer(&phba->hb_tmofunc, |
523 | jiffies + HZ * LPFC_HB_MBOX_INTERVAL); | 508 | jiffies + HZ * LPFC_HB_MBOX_INTERVAL); |
524 | return; | 509 | return; |
@@ -532,7 +517,7 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba) | |||
532 | struct lpfc_sli *psli = &phba->sli; | 517 | struct lpfc_sli *psli = &phba->sli; |
533 | 518 | ||
534 | if ((phba->link_state == LPFC_HBA_ERROR) || | 519 | if ((phba->link_state == LPFC_HBA_ERROR) || |
535 | (phba->pport->fc_flag & FC_UNLOADING) || | 520 | (phba->pport->load_flag & FC_UNLOADING) || |
536 | (phba->pport->fc_flag & FC_OFFLINE_MODE)) | 521 | (phba->pport->fc_flag & FC_OFFLINE_MODE)) |
537 | return; | 522 | return; |
538 | 523 | ||
@@ -586,8 +571,8 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba) | |||
586 | * need to take the HBA offline. | 571 | * need to take the HBA offline. |
587 | */ | 572 | */ |
588 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 573 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
589 | "%d:0459 Adapter heartbeat failure, taking " | 574 | "0459 Adapter heartbeat failure, taking " |
590 | "this port offline.\n", phba->brd_no); | 575 | "this port offline.\n"); |
591 | 576 | ||
592 | spin_lock_irq(&phba->hbalock); | 577 | spin_lock_irq(&phba->hbalock); |
593 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; | 578 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; |
@@ -615,9 +600,10 @@ lpfc_handle_eratt(struct lpfc_hba *phba) | |||
615 | struct lpfc_vport *vport = phba->pport; | 600 | struct lpfc_vport *vport = phba->pport; |
616 | struct lpfc_sli *psli = &phba->sli; | 601 | struct lpfc_sli *psli = &phba->sli; |
617 | struct lpfc_sli_ring *pring; | 602 | struct lpfc_sli_ring *pring; |
618 | struct lpfc_vport *port_iterator; | 603 | struct lpfc_vport **vports; |
619 | uint32_t event_data; | 604 | uint32_t event_data; |
620 | struct Scsi_Host *shost; | 605 | struct Scsi_Host *shost; |
606 | int i; | ||
621 | 607 | ||
622 | /* If the pci channel is offline, ignore possible errors, | 608 | /* If the pci channel is offline, ignore possible errors, |
623 | * since we cannot communicate with the pci card anyway. */ | 609 | * since we cannot communicate with the pci card anyway. */ |
@@ -628,18 +614,21 @@ lpfc_handle_eratt(struct lpfc_hba *phba) | |||
628 | phba->work_hs & HS_FFER5) { | 614 | phba->work_hs & HS_FFER5) { |
629 | /* Re-establishing Link */ | 615 | /* Re-establishing Link */ |
630 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, | 616 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, |
631 | "%d:1301 Re-establishing Link " | 617 | "1301 Re-establishing Link " |
632 | "Data: x%x x%x x%x\n", | 618 | "Data: x%x x%x x%x\n", |
633 | phba->brd_no, phba->work_hs, | 619 | phba->work_hs, |
634 | phba->work_status[0], phba->work_status[1]); | 620 | phba->work_status[0], phba->work_status[1]); |
635 | list_for_each_entry(port_iterator, &phba->port_list, | 621 | vports = lpfc_create_vport_work_array(phba); |
636 | listentry) { | 622 | if (vports != NULL) |
637 | shost = lpfc_shost_from_vport(port_iterator); | 623 | for(i = 0; |
638 | 624 | i < LPFC_MAX_VPORTS && vports[i] != NULL; | |
639 | spin_lock_irq(shost->host_lock); | 625 | i++){ |
640 | port_iterator->fc_flag |= FC_ESTABLISH_LINK; | 626 | shost = lpfc_shost_from_vport(vports[i]); |
641 | spin_unlock_irq(shost->host_lock); | 627 | spin_lock_irq(shost->host_lock); |
642 | } | 628 | vports[i]->fc_flag |= FC_ESTABLISH_LINK; |
629 | spin_unlock_irq(shost->host_lock); | ||
630 | } | ||
631 | lpfc_destroy_vport_work_array(vports); | ||
643 | spin_lock_irq(&phba->hbalock); | 632 | spin_lock_irq(&phba->hbalock); |
644 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; | 633 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; |
645 | spin_unlock_irq(&phba->hbalock); | 634 | spin_unlock_irq(&phba->hbalock); |
@@ -673,9 +662,9 @@ lpfc_handle_eratt(struct lpfc_hba *phba) | |||
673 | * twice. This is the adapter hardware error path. | 662 | * twice. This is the adapter hardware error path. |
674 | */ | 663 | */ |
675 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 664 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
676 | "%d:0457 Adapter Hardware Error " | 665 | "0457 Adapter Hardware Error " |
677 | "Data: x%x x%x x%x\n", | 666 | "Data: x%x x%x x%x\n", |
678 | phba->brd_no, phba->work_hs, | 667 | phba->work_hs, |
679 | phba->work_status[0], phba->work_status[1]); | 668 | phba->work_status[0], phba->work_status[1]); |
680 | 669 | ||
681 | event_data = FC_REG_DUMP_EVENT; | 670 | event_data = FC_REG_DUMP_EVENT; |
@@ -708,7 +697,6 @@ lpfc_handle_latt(struct lpfc_hba *phba) | |||
708 | { | 697 | { |
709 | struct lpfc_vport *vport = phba->pport; | 698 | struct lpfc_vport *vport = phba->pport; |
710 | struct lpfc_sli *psli = &phba->sli; | 699 | struct lpfc_sli *psli = &phba->sli; |
711 | struct lpfc_vport *port_iterator; | ||
712 | LPFC_MBOXQ_t *pmb; | 700 | LPFC_MBOXQ_t *pmb; |
713 | volatile uint32_t control; | 701 | volatile uint32_t control; |
714 | struct lpfc_dmabuf *mp; | 702 | struct lpfc_dmabuf *mp; |
@@ -729,8 +717,7 @@ lpfc_handle_latt(struct lpfc_hba *phba) | |||
729 | rc = -EIO; | 717 | rc = -EIO; |
730 | 718 | ||
731 | /* Cleanup any outstanding ELS commands */ | 719 | /* Cleanup any outstanding ELS commands */ |
732 | list_for_each_entry(port_iterator, &phba->port_list, listentry) | 720 | lpfc_els_flush_all_cmd(phba); |
733 | lpfc_els_flush_cmd(port_iterator); | ||
734 | 721 | ||
735 | psli->slistat.link_event++; | 722 | psli->slistat.link_event++; |
736 | lpfc_read_la(phba, pmb, mp); | 723 | lpfc_read_la(phba, pmb, mp); |
@@ -773,8 +760,7 @@ lpfc_handle_latt_err_exit: | |||
773 | /* The other case is an error from issue_mbox */ | 760 | /* The other case is an error from issue_mbox */ |
774 | if (rc == -ENOMEM) | 761 | if (rc == -ENOMEM) |
775 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, | 762 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, |
776 | "%d:0300 READ_LA: no buffers\n", | 763 | "0300 READ_LA: no buffers\n"); |
777 | phba->brd_no); | ||
778 | 764 | ||
779 | return; | 765 | return; |
780 | } | 766 | } |
@@ -799,8 +785,7 @@ lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) | |||
799 | 785 | ||
800 | /* Vital Product */ | 786 | /* Vital Product */ |
801 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 787 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
802 | "%d:0455 Vital Product Data: x%x x%x x%x x%x\n", | 788 | "0455 Vital Product Data: x%x x%x x%x x%x\n", |
803 | phba->brd_no, | ||
804 | (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2], | 789 | (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2], |
805 | (uint32_t) vpd[3]); | 790 | (uint32_t) vpd[3]); |
806 | while (!finished && (index < (len - 4))) { | 791 | while (!finished && (index < (len - 4))) { |
@@ -1313,22 +1298,25 @@ static void | |||
1313 | lpfc_establish_link_tmo(unsigned long ptr) | 1298 | lpfc_establish_link_tmo(unsigned long ptr) |
1314 | { | 1299 | { |
1315 | struct lpfc_hba *phba = (struct lpfc_hba *) ptr; | 1300 | struct lpfc_hba *phba = (struct lpfc_hba *) ptr; |
1316 | struct lpfc_vport *vport = phba->pport; | 1301 | struct lpfc_vport **vports; |
1317 | unsigned long iflag; | 1302 | unsigned long iflag; |
1303 | int i; | ||
1318 | 1304 | ||
1319 | /* Re-establishing Link, timer expired */ | 1305 | /* Re-establishing Link, timer expired */ |
1320 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, | 1306 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, |
1321 | "%d:1300 Re-establishing Link, timer expired " | 1307 | "1300 Re-establishing Link, timer expired " |
1322 | "Data: x%x x%x\n", | 1308 | "Data: x%x x%x\n", |
1323 | phba->brd_no, vport->fc_flag, | 1309 | phba->pport->fc_flag, phba->pport->port_state); |
1324 | vport->port_state); | 1310 | vports = lpfc_create_vport_work_array(phba); |
1325 | list_for_each_entry(vport, &phba->port_list, listentry) { | 1311 | if (vports != NULL) |
1326 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 1312 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { |
1327 | 1313 | struct Scsi_Host *shost; | |
1328 | spin_lock_irqsave(shost->host_lock, iflag); | 1314 | shost = lpfc_shost_from_vport(vports[i]); |
1329 | vport->fc_flag &= ~FC_ESTABLISH_LINK; | 1315 | spin_lock_irqsave(shost->host_lock, iflag); |
1330 | spin_unlock_irqrestore(shost->host_lock, iflag); | 1316 | vports[i]->fc_flag &= ~FC_ESTABLISH_LINK; |
1331 | } | 1317 | spin_unlock_irqrestore(shost->host_lock, iflag); |
1318 | } | ||
1319 | lpfc_destroy_vport_work_array(vports); | ||
1332 | } | 1320 | } |
1333 | 1321 | ||
1334 | void | 1322 | void |
@@ -1343,12 +1331,9 @@ lpfc_stop_vport_timers(struct lpfc_vport *vport) | |||
1343 | static void | 1331 | static void |
1344 | lpfc_stop_phba_timers(struct lpfc_hba *phba) | 1332 | lpfc_stop_phba_timers(struct lpfc_hba *phba) |
1345 | { | 1333 | { |
1346 | struct lpfc_vport *vport; | ||
1347 | |||
1348 | del_timer_sync(&phba->fcp_poll_timer); | 1334 | del_timer_sync(&phba->fcp_poll_timer); |
1349 | del_timer_sync(&phba->fc_estabtmo); | 1335 | del_timer_sync(&phba->fc_estabtmo); |
1350 | list_for_each_entry(vport, &phba->port_list, listentry) | 1336 | lpfc_stop_vport_timers(phba->pport); |
1351 | lpfc_stop_vport_timers(vport); | ||
1352 | del_timer_sync(&phba->sli.mbox_tmo); | 1337 | del_timer_sync(&phba->sli.mbox_tmo); |
1353 | del_timer_sync(&phba->fabric_block_timer); | 1338 | del_timer_sync(&phba->fabric_block_timer); |
1354 | phba->hb_outstanding = 0; | 1339 | phba->hb_outstanding = 0; |
@@ -1360,6 +1345,8 @@ int | |||
1360 | lpfc_online(struct lpfc_hba *phba) | 1345 | lpfc_online(struct lpfc_hba *phba) |
1361 | { | 1346 | { |
1362 | struct lpfc_vport *vport = phba->pport; | 1347 | struct lpfc_vport *vport = phba->pport; |
1348 | struct lpfc_vport **vports; | ||
1349 | int i; | ||
1363 | 1350 | ||
1364 | if (!phba) | 1351 | if (!phba) |
1365 | return 0; | 1352 | return 0; |
@@ -1368,8 +1355,7 @@ lpfc_online(struct lpfc_hba *phba) | |||
1368 | return 0; | 1355 | return 0; |
1369 | 1356 | ||
1370 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | 1357 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, |
1371 | "%d:0458 Bring Adapter online\n", | 1358 | "0458 Bring Adapter online\n"); |
1372 | phba->brd_no); | ||
1373 | 1359 | ||
1374 | lpfc_block_mgmt_io(phba); | 1360 | lpfc_block_mgmt_io(phba); |
1375 | 1361 | ||
@@ -1383,14 +1369,18 @@ lpfc_online(struct lpfc_hba *phba) | |||
1383 | return 1; | 1369 | return 1; |
1384 | } | 1370 | } |
1385 | 1371 | ||
1386 | list_for_each_entry(vport, &phba->port_list, listentry) { | 1372 | vports = lpfc_create_vport_work_array(phba); |
1387 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 1373 | if (vports != NULL) |
1388 | spin_lock_irq(shost->host_lock); | 1374 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { |
1389 | vport->fc_flag &= ~FC_OFFLINE_MODE; | 1375 | struct Scsi_Host *shost; |
1390 | if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) | 1376 | shost = lpfc_shost_from_vport(vports[i]); |
1391 | vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; | 1377 | spin_lock_irq(shost->host_lock); |
1392 | spin_unlock_irq(shost->host_lock); | 1378 | vports[i]->fc_flag &= ~FC_OFFLINE_MODE; |
1393 | } | 1379 | if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) |
1380 | vports[i]->fc_flag |= FC_VPORT_NEEDS_REG_VPI; | ||
1381 | spin_unlock_irq(shost->host_lock); | ||
1382 | } | ||
1383 | lpfc_destroy_vport_work_array(vports); | ||
1394 | 1384 | ||
1395 | lpfc_unblock_mgmt_io(phba); | 1385 | lpfc_unblock_mgmt_io(phba); |
1396 | return 0; | 1386 | return 0; |
@@ -1440,39 +1430,39 @@ lpfc_offline_prep(struct lpfc_hba * phba) | |||
1440 | void | 1430 | void |
1441 | lpfc_offline(struct lpfc_hba *phba) | 1431 | lpfc_offline(struct lpfc_hba *phba) |
1442 | { | 1432 | { |
1443 | struct lpfc_vport *vport = phba->pport; | 1433 | struct Scsi_Host *shost; |
1444 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 1434 | struct lpfc_vport **vports; |
1445 | struct lpfc_vport *port_iterator; | 1435 | int i; |
1446 | 1436 | ||
1447 | if (vport->fc_flag & FC_OFFLINE_MODE) | 1437 | if (phba->pport->fc_flag & FC_OFFLINE_MODE) |
1448 | return; | 1438 | return; |
1449 | 1439 | ||
1450 | /* stop all timers associated with this hba */ | 1440 | /* stop all timers associated with this hba */ |
1451 | lpfc_stop_phba_timers(phba); | 1441 | lpfc_stop_phba_timers(phba); |
1452 | list_for_each_entry(port_iterator, &phba->port_list, listentry) { | 1442 | vports = lpfc_create_vport_work_array(phba); |
1453 | port_iterator->work_port_events = 0; | 1443 | if (vports != NULL) |
1454 | } | 1444 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) |
1455 | 1445 | lpfc_stop_vport_timers(vports[i]); | |
1446 | lpfc_destroy_vport_work_array(vports); | ||
1456 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | 1447 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, |
1457 | "%d:0460 Bring Adapter offline\n", | 1448 | "0460 Bring Adapter offline\n"); |
1458 | phba->brd_no); | ||
1459 | |||
1460 | /* Bring down the SLI Layer and cleanup. The HBA is offline | 1449 | /* Bring down the SLI Layer and cleanup. The HBA is offline |
1461 | now. */ | 1450 | now. */ |
1462 | lpfc_sli_hba_down(phba); | 1451 | lpfc_sli_hba_down(phba); |
1463 | spin_lock_irq(&phba->hbalock); | 1452 | spin_lock_irq(&phba->hbalock); |
1464 | phba->work_ha = 0; | 1453 | phba->work_ha = 0; |
1465 | vport->fc_flag |= FC_OFFLINE_MODE; | ||
1466 | spin_unlock_irq(&phba->hbalock); | 1454 | spin_unlock_irq(&phba->hbalock); |
1467 | list_for_each_entry(port_iterator, &phba->port_list, listentry) { | 1455 | vports = lpfc_create_vport_work_array(phba); |
1468 | shost = lpfc_shost_from_vport(port_iterator); | 1456 | if (vports != NULL) |
1469 | 1457 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { | |
1470 | lpfc_cleanup(port_iterator); | 1458 | shost = lpfc_shost_from_vport(vports[i]); |
1471 | spin_lock_irq(shost->host_lock); | 1459 | lpfc_cleanup(vports[i]); |
1472 | vport->work_port_events = 0; | 1460 | spin_lock_irq(shost->host_lock); |
1473 | vport->fc_flag |= FC_OFFLINE_MODE; | 1461 | vports[i]->work_port_events = 0; |
1474 | spin_unlock_irq(shost->host_lock); | 1462 | vports[i]->fc_flag |= FC_OFFLINE_MODE; |
1475 | } | 1463 | spin_unlock_irq(shost->host_lock); |
1464 | } | ||
1465 | lpfc_destroy_vport_work_array(vports); | ||
1476 | } | 1466 | } |
1477 | 1467 | ||
1478 | /****************************************************************************** | 1468 | /****************************************************************************** |
@@ -1509,15 +1499,19 @@ lpfc_scsi_free(struct lpfc_hba *phba) | |||
1509 | return 0; | 1499 | return 0; |
1510 | } | 1500 | } |
1511 | 1501 | ||
1512 | |||
1513 | struct lpfc_vport * | 1502 | struct lpfc_vport * |
1514 | lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) | 1503 | lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) |
1515 | { | 1504 | { |
1516 | struct lpfc_vport *vport; | 1505 | struct lpfc_vport *vport; |
1517 | struct Scsi_Host *shost; | 1506 | struct Scsi_Host *shost; |
1518 | int error = 0; | 1507 | int error = 0; |
1519 | 1508 | ||
1520 | shost = scsi_host_alloc(&lpfc_template, sizeof(struct lpfc_vport)); | 1509 | if (dev != &phba->pcidev->dev) |
1510 | shost = scsi_host_alloc(&lpfc_vport_template, | ||
1511 | sizeof(struct lpfc_vport)); | ||
1512 | else | ||
1513 | shost = scsi_host_alloc(&lpfc_template, | ||
1514 | sizeof(struct lpfc_vport)); | ||
1521 | if (!shost) | 1515 | if (!shost) |
1522 | goto out; | 1516 | goto out; |
1523 | 1517 | ||
@@ -1527,9 +1521,10 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) | |||
1527 | vport->load_flag |= FC_LOADING; | 1521 | vport->load_flag |= FC_LOADING; |
1528 | vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; | 1522 | vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; |
1529 | 1523 | ||
1524 | lpfc_get_vport_cfgparam(vport); | ||
1530 | shost->unique_id = instance; | 1525 | shost->unique_id = instance; |
1531 | shost->max_id = LPFC_MAX_TARGET; | 1526 | shost->max_id = LPFC_MAX_TARGET; |
1532 | shost->max_lun = phba->cfg_max_luns; | 1527 | shost->max_lun = vport->cfg_max_luns; |
1533 | shost->this_id = -1; | 1528 | shost->this_id = -1; |
1534 | shost->max_cmd_len = 16; | 1529 | shost->max_cmd_len = 16; |
1535 | /* | 1530 | /* |
@@ -1538,7 +1533,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) | |||
1538 | * max xri value determined in hba setup. | 1533 | * max xri value determined in hba setup. |
1539 | */ | 1534 | */ |
1540 | shost->can_queue = phba->cfg_hba_queue_depth - 10; | 1535 | shost->can_queue = phba->cfg_hba_queue_depth - 10; |
1541 | if (fc_vport != NULL) { | 1536 | if (dev != &phba->pcidev->dev) { |
1542 | shost->transportt = lpfc_vport_transport_template; | 1537 | shost->transportt = lpfc_vport_transport_template; |
1543 | vport->port_type = LPFC_NPIV_PORT; | 1538 | vport->port_type = LPFC_NPIV_PORT; |
1544 | } else { | 1539 | } else { |
@@ -1562,15 +1557,13 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) | |||
1562 | vport->els_tmofunc.function = lpfc_els_timeout; | 1557 | vport->els_tmofunc.function = lpfc_els_timeout; |
1563 | vport->els_tmofunc.data = (unsigned long)vport; | 1558 | vport->els_tmofunc.data = (unsigned long)vport; |
1564 | 1559 | ||
1565 | if (fc_vport != NULL) { | 1560 | error = scsi_add_host(shost, dev); |
1566 | error = scsi_add_host(shost, &fc_vport->dev); | ||
1567 | } else { | ||
1568 | error = scsi_add_host(shost, &phba->pcidev->dev); | ||
1569 | } | ||
1570 | if (error) | 1561 | if (error) |
1571 | goto out_put_shost; | 1562 | goto out_put_shost; |
1572 | 1563 | ||
1564 | spin_lock_irq(&phba->hbalock); | ||
1573 | list_add_tail(&vport->listentry, &phba->port_list); | 1565 | list_add_tail(&vport->listentry, &phba->port_list); |
1566 | spin_unlock_irq(&phba->hbalock); | ||
1574 | return vport; | 1567 | return vport; |
1575 | 1568 | ||
1576 | out_put_shost: | 1569 | out_put_shost: |
@@ -1625,23 +1618,21 @@ int lpfc_scan_finished(struct Scsi_Host *shost, unsigned long time) | |||
1625 | 1618 | ||
1626 | spin_lock_irq(shost->host_lock); | 1619 | spin_lock_irq(shost->host_lock); |
1627 | 1620 | ||
1628 | if (vport->fc_flag & FC_UNLOADING) { | 1621 | if (vport->load_flag & FC_UNLOADING) { |
1629 | stat = 1; | 1622 | stat = 1; |
1630 | goto finished; | 1623 | goto finished; |
1631 | } | 1624 | } |
1632 | if (time >= 30 * HZ) { | 1625 | if (time >= 30 * HZ) { |
1633 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 1626 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
1634 | "%d:0461 Scanning longer than 30 " | 1627 | "0461 Scanning longer than 30 " |
1635 | "seconds. Continuing initialization\n", | 1628 | "seconds. Continuing initialization\n"); |
1636 | phba->brd_no); | ||
1637 | stat = 1; | 1629 | stat = 1; |
1638 | goto finished; | 1630 | goto finished; |
1639 | } | 1631 | } |
1640 | if (time >= 15 * HZ && phba->link_state <= LPFC_LINK_DOWN) { | 1632 | if (time >= 15 * HZ && phba->link_state <= LPFC_LINK_DOWN) { |
1641 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 1633 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
1642 | "%d:0465 Link down longer than 15 " | 1634 | "0465 Link down longer than 15 " |
1643 | "seconds. Continuing initialization\n", | 1635 | "seconds. Continuing initialization\n"); |
1644 | phba->brd_no); | ||
1645 | stat = 1; | 1636 | stat = 1; |
1646 | goto finished; | 1637 | goto finished; |
1647 | } | 1638 | } |
@@ -1704,7 +1695,7 @@ void lpfc_host_attrib_init(struct Scsi_Host *shost) | |||
1704 | 1695 | ||
1705 | fc_host_max_npiv_vports(shost) = phba->max_vpi; | 1696 | fc_host_max_npiv_vports(shost) = phba->max_vpi; |
1706 | spin_lock_irq(shost->host_lock); | 1697 | spin_lock_irq(shost->host_lock); |
1707 | vport->fc_flag &= ~FC_LOADING; | 1698 | vport->load_flag &= ~FC_LOADING; |
1708 | spin_unlock_irq(shost->host_lock); | 1699 | spin_unlock_irq(shost->host_lock); |
1709 | } | 1700 | } |
1710 | 1701 | ||
@@ -1716,9 +1707,10 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1716 | struct lpfc_sli *psli; | 1707 | struct lpfc_sli *psli; |
1717 | struct lpfc_iocbq *iocbq_entry = NULL, *iocbq_next = NULL; | 1708 | struct lpfc_iocbq *iocbq_entry = NULL, *iocbq_next = NULL; |
1718 | struct Scsi_Host *shost = NULL; | 1709 | struct Scsi_Host *shost = NULL; |
1710 | void *ptr; | ||
1719 | unsigned long bar0map_len, bar2map_len; | 1711 | unsigned long bar0map_len, bar2map_len; |
1720 | int error = -ENODEV; | 1712 | int error = -ENODEV; |
1721 | int i; | 1713 | int i, hbq_count; |
1722 | uint16_t iotag; | 1714 | uint16_t iotag; |
1723 | 1715 | ||
1724 | if (pci_enable_device(pdev)) | 1716 | if (pci_enable_device(pdev)) |
@@ -1739,7 +1731,6 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1739 | goto out_free_phba; | 1731 | goto out_free_phba; |
1740 | 1732 | ||
1741 | INIT_LIST_HEAD(&phba->port_list); | 1733 | INIT_LIST_HEAD(&phba->port_list); |
1742 | INIT_LIST_HEAD(&phba->hbq_buffer_list); | ||
1743 | /* | 1734 | /* |
1744 | * Get all the module params for configuring this host and then | 1735 | * Get all the module params for configuring this host and then |
1745 | * establish the host. | 1736 | * establish the host. |
@@ -1817,6 +1808,17 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1817 | if (!phba->hbqslimp.virt) | 1808 | if (!phba->hbqslimp.virt) |
1818 | goto out_free_slim; | 1809 | goto out_free_slim; |
1819 | 1810 | ||
1811 | hbq_count = lpfc_sli_hbq_count(); | ||
1812 | ptr = phba->hbqslimp.virt; | ||
1813 | for (i = 0; i < hbq_count; ++i) { | ||
1814 | phba->hbqs[i].hbq_virt = ptr; | ||
1815 | INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); | ||
1816 | ptr += (lpfc_hbq_defs[i]->entry_count * | ||
1817 | sizeof(struct lpfc_hbq_entry)); | ||
1818 | } | ||
1819 | phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; | ||
1820 | phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; | ||
1821 | |||
1820 | memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); | 1822 | memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); |
1821 | 1823 | ||
1822 | /* Initialize the SLI Layer to run with lpfc HBAs. */ | 1824 | /* Initialize the SLI Layer to run with lpfc HBAs. */ |
@@ -1880,7 +1882,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1880 | /* Initialize list of fabric iocbs */ | 1882 | /* Initialize list of fabric iocbs */ |
1881 | INIT_LIST_HEAD(&phba->fabric_iocb_list); | 1883 | INIT_LIST_HEAD(&phba->fabric_iocb_list); |
1882 | 1884 | ||
1883 | vport = lpfc_create_port(phba, phba->brd_no, NULL); | 1885 | vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); |
1884 | if (!vport) | 1886 | if (!vport) |
1885 | goto out_kthread_stop; | 1887 | goto out_kthread_stop; |
1886 | 1888 | ||
@@ -1892,18 +1894,19 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1892 | 1894 | ||
1893 | if (phba->cfg_use_msi) { | 1895 | if (phba->cfg_use_msi) { |
1894 | error = pci_enable_msi(phba->pcidev); | 1896 | error = pci_enable_msi(phba->pcidev); |
1895 | if (error) | 1897 | if (!error) |
1896 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "%d:0452 " | 1898 | phba->using_msi = 1; |
1897 | "Enable MSI failed, continuing with " | 1899 | else |
1898 | "IRQ\n", phba->brd_no); | 1900 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
1901 | "0452 Enable MSI failed, continuing " | ||
1902 | "with IRQ\n"); | ||
1899 | } | 1903 | } |
1900 | 1904 | ||
1901 | error = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED, | 1905 | error = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED, |
1902 | LPFC_DRIVER_NAME, phba); | 1906 | LPFC_DRIVER_NAME, phba); |
1903 | if (error) { | 1907 | if (error) { |
1904 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1908 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
1905 | "%d:0451 Enable interrupt handler failed\n", | 1909 | "0451 Enable interrupt handler failed\n"); |
1906 | phba->brd_no); | ||
1907 | goto out_disable_msi; | 1910 | goto out_disable_msi; |
1908 | } | 1911 | } |
1909 | 1912 | ||
@@ -1940,14 +1943,15 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1940 | out_remove_device: | 1943 | out_remove_device: |
1941 | lpfc_free_sysfs_attr(vport); | 1944 | lpfc_free_sysfs_attr(vport); |
1942 | spin_lock_irq(shost->host_lock); | 1945 | spin_lock_irq(shost->host_lock); |
1943 | vport->fc_flag |= FC_UNLOADING; | 1946 | vport->load_flag |= FC_UNLOADING; |
1944 | spin_unlock_irq(shost->host_lock); | 1947 | spin_unlock_irq(shost->host_lock); |
1945 | out_free_irq: | 1948 | out_free_irq: |
1946 | lpfc_stop_phba_timers(phba); | 1949 | lpfc_stop_phba_timers(phba); |
1947 | phba->pport->work_port_events = 0; | 1950 | phba->pport->work_port_events = 0; |
1948 | free_irq(phba->pcidev->irq, phba); | 1951 | free_irq(phba->pcidev->irq, phba); |
1949 | out_disable_msi: | 1952 | out_disable_msi: |
1950 | pci_disable_msi(phba->pcidev); | 1953 | if (phba->using_msi) |
1954 | pci_disable_msi(phba->pcidev); | ||
1951 | destroy_port(vport); | 1955 | destroy_port(vport); |
1952 | out_kthread_stop: | 1956 | out_kthread_stop: |
1953 | kthread_stop(phba->worker_thread); | 1957 | kthread_stop(phba->worker_thread); |
@@ -1989,16 +1993,15 @@ lpfc_pci_remove_one(struct pci_dev *pdev) | |||
1989 | struct Scsi_Host *shost = pci_get_drvdata(pdev); | 1993 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
1990 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 1994 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1991 | struct lpfc_hba *phba = vport->phba; | 1995 | struct lpfc_hba *phba = vport->phba; |
1992 | struct lpfc_vport *port_iterator; | 1996 | spin_lock_irq(&phba->hbalock); |
1993 | list_for_each_entry(port_iterator, &phba->port_list, listentry) | 1997 | vport->load_flag |= FC_UNLOADING; |
1994 | port_iterator->load_flag |= FC_UNLOADING; | 1998 | spin_unlock_irq(&phba->hbalock); |
1995 | 1999 | ||
1996 | kfree(vport->vname); | 2000 | kfree(vport->vname); |
1997 | lpfc_free_sysfs_attr(vport); | 2001 | lpfc_free_sysfs_attr(vport); |
1998 | 2002 | ||
1999 | fc_remove_host(shost); | 2003 | fc_remove_host(shost); |
2000 | scsi_remove_host(shost); | 2004 | scsi_remove_host(shost); |
2001 | |||
2002 | /* | 2005 | /* |
2003 | * Bring down the SLI Layer. This step disable all interrupts, | 2006 | * Bring down the SLI Layer. This step disable all interrupts, |
2004 | * clears the rings, discards all mailbox commands, and resets | 2007 | * clears the rings, discards all mailbox commands, and resets |
@@ -2012,7 +2015,6 @@ lpfc_pci_remove_one(struct pci_dev *pdev) | |||
2012 | list_del_init(&vport->listentry); | 2015 | list_del_init(&vport->listentry); |
2013 | spin_unlock_irq(&phba->hbalock); | 2016 | spin_unlock_irq(&phba->hbalock); |
2014 | 2017 | ||
2015 | |||
2016 | lpfc_debugfs_terminate(vport); | 2018 | lpfc_debugfs_terminate(vport); |
2017 | lpfc_cleanup(vport); | 2019 | lpfc_cleanup(vport); |
2018 | 2020 | ||
@@ -2020,7 +2022,8 @@ lpfc_pci_remove_one(struct pci_dev *pdev) | |||
2020 | 2022 | ||
2021 | /* Release the irq reservation */ | 2023 | /* Release the irq reservation */ |
2022 | free_irq(phba->pcidev->irq, phba); | 2024 | free_irq(phba->pcidev->irq, phba); |
2023 | pci_disable_msi(phba->pcidev); | 2025 | if (phba->using_msi) |
2026 | pci_disable_msi(phba->pcidev); | ||
2024 | 2027 | ||
2025 | pci_set_drvdata(pdev, NULL); | 2028 | pci_set_drvdata(pdev, NULL); |
2026 | scsi_host_put(shost); | 2029 | scsi_host_put(shost); |
@@ -2062,8 +2065,8 @@ lpfc_pci_remove_one(struct pci_dev *pdev) | |||
2062 | static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, | 2065 | static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, |
2063 | pci_channel_state_t state) | 2066 | pci_channel_state_t state) |
2064 | { | 2067 | { |
2065 | struct Scsi_Host *host = pci_get_drvdata(pdev); | 2068 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
2066 | struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; | 2069 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
2067 | struct lpfc_sli *psli = &phba->sli; | 2070 | struct lpfc_sli *psli = &phba->sli; |
2068 | struct lpfc_sli_ring *pring; | 2071 | struct lpfc_sli_ring *pring; |
2069 | 2072 | ||
@@ -2079,6 +2082,11 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, | |||
2079 | pring = &psli->ring[psli->fcp_ring]; | 2082 | pring = &psli->ring[psli->fcp_ring]; |
2080 | lpfc_sli_abort_iocb_ring(phba, pring); | 2083 | lpfc_sli_abort_iocb_ring(phba, pring); |
2081 | 2084 | ||
2085 | /* Release the irq reservation */ | ||
2086 | free_irq(phba->pcidev->irq, phba); | ||
2087 | if (phba->using_msi) | ||
2088 | pci_disable_msi(phba->pcidev); | ||
2089 | |||
2082 | /* Request a slot reset. */ | 2090 | /* Request a slot reset. */ |
2083 | return PCI_ERS_RESULT_NEED_RESET; | 2091 | return PCI_ERS_RESULT_NEED_RESET; |
2084 | } | 2092 | } |
@@ -2091,8 +2099,8 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, | |||
2091 | */ | 2099 | */ |
2092 | static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) | 2100 | static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) |
2093 | { | 2101 | { |
2094 | struct Scsi_Host *host = pci_get_drvdata(pdev); | 2102 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
2095 | struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; | 2103 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
2096 | struct lpfc_sli *psli = &phba->sli; | 2104 | struct lpfc_sli *psli = &phba->sli; |
2097 | int bars = pci_select_bars(pdev, IORESOURCE_MEM); | 2105 | int bars = pci_select_bars(pdev, IORESOURCE_MEM); |
2098 | 2106 | ||
@@ -2106,9 +2114,9 @@ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) | |||
2106 | pci_set_master(pdev); | 2114 | pci_set_master(pdev); |
2107 | 2115 | ||
2108 | /* Re-establishing Link */ | 2116 | /* Re-establishing Link */ |
2109 | spin_lock_irq(host->host_lock); | 2117 | spin_lock_irq(shost->host_lock); |
2110 | phba->pport->fc_flag |= FC_ESTABLISH_LINK; | 2118 | phba->pport->fc_flag |= FC_ESTABLISH_LINK; |
2111 | spin_unlock_irq(host->host_lock); | 2119 | spin_unlock_irq(shost->host_lock); |
2112 | 2120 | ||
2113 | spin_lock_irq(&phba->hbalock); | 2121 | spin_lock_irq(&phba->hbalock); |
2114 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; | 2122 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; |
@@ -2131,8 +2139,8 @@ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) | |||
2131 | */ | 2139 | */ |
2132 | static void lpfc_io_resume(struct pci_dev *pdev) | 2140 | static void lpfc_io_resume(struct pci_dev *pdev) |
2133 | { | 2141 | { |
2134 | struct Scsi_Host *host = pci_get_drvdata(pdev); | 2142 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
2135 | struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; | 2143 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
2136 | 2144 | ||
2137 | if (lpfc_online(phba) == 0) { | 2145 | if (lpfc_online(phba) == 0) { |
2138 | mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60); | 2146 | mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60); |