aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2014-04-04 13:52:02 -0400
committerChristoph Hellwig <hch@lst.de>2014-06-02 12:28:47 -0400
commitdb55fba8dc26535d34c00a3b3256da0b48608071 (patch)
tree46253e73ba4f005889625d387c0a47d85b731e04
parentee62021a11320e972e0218ab73a5a5196b6aa499 (diff)
lpfc: Fix SLI4 s abort loop to process all FCP rings and under ring_lock
Fix SLI4 s abort loop to process all FCP rings and under ring_lock Signed-off-by: James Smart <james.smart@emulex.com> Reviewed-By: Dick Kennedy <dick.kennedy@emulex.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/scsi/lpfc/lpfc_crtn.h1
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c23
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c155
3 files changed, 99 insertions, 80 deletions
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index adda0bf7a244..429116a9cb7d 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -289,6 +289,7 @@ int lpfc_sli_issue_iocb(struct lpfc_hba *, uint32_t,
289void lpfc_sli_pcimem_bcopy(void *, void *, uint32_t); 289void lpfc_sli_pcimem_bcopy(void *, void *, uint32_t);
290void lpfc_sli_bemem_bcopy(void *, void *, uint32_t); 290void lpfc_sli_bemem_bcopy(void *, void *, uint32_t);
291void lpfc_sli_abort_iocb_ring(struct lpfc_hba *, struct lpfc_sli_ring *); 291void lpfc_sli_abort_iocb_ring(struct lpfc_hba *, struct lpfc_sli_ring *);
292void lpfc_sli_abort_fcp_rings(struct lpfc_hba *phba);
292void lpfc_sli_hba_iocb_abort(struct lpfc_hba *); 293void lpfc_sli_hba_iocb_abort(struct lpfc_hba *);
293void lpfc_sli_flush_fcp_rings(struct lpfc_hba *); 294void lpfc_sli_flush_fcp_rings(struct lpfc_hba *);
294int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *, 295int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *,
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 9f3efdb9e833..02d8731eb365 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -880,8 +880,6 @@ lpfc_hba_clean_txcmplq(struct lpfc_hba *phba)
880 LIST_HEAD(completions); 880 LIST_HEAD(completions);
881 int i; 881 int i;
882 882
883
884
885 for (i = 0; i < psli->num_rings; i++) { 883 for (i = 0; i < psli->num_rings; i++) {
886 pring = &psli->ring[i]; 884 pring = &psli->ring[i];
887 if (phba->sli_rev >= LPFC_SLI_REV4) 885 if (phba->sli_rev >= LPFC_SLI_REV4)
@@ -892,6 +890,7 @@ lpfc_hba_clean_txcmplq(struct lpfc_hba *phba)
892 * way, nothing should be on txcmplq as it will NEVER complete. 890 * way, nothing should be on txcmplq as it will NEVER complete.
893 */ 891 */
894 list_splice_init(&pring->txcmplq, &completions); 892 list_splice_init(&pring->txcmplq, &completions);
893 pring->txcmplq_cnt = 0;
895 894
896 if (phba->sli_rev >= LPFC_SLI_REV4) 895 if (phba->sli_rev >= LPFC_SLI_REV4)
897 spin_unlock_irq(&pring->ring_lock); 896 spin_unlock_irq(&pring->ring_lock);
@@ -1300,7 +1299,6 @@ static void
1300lpfc_handle_deferred_eratt(struct lpfc_hba *phba) 1299lpfc_handle_deferred_eratt(struct lpfc_hba *phba)
1301{ 1300{
1302 uint32_t old_host_status = phba->work_hs; 1301 uint32_t old_host_status = phba->work_hs;
1303 struct lpfc_sli_ring *pring;
1304 struct lpfc_sli *psli = &phba->sli; 1302 struct lpfc_sli *psli = &phba->sli;
1305 1303
1306 /* If the pci channel is offline, ignore possible errors, 1304 /* If the pci channel is offline, ignore possible errors,
@@ -1329,8 +1327,7 @@ lpfc_handle_deferred_eratt(struct lpfc_hba *phba)
1329 * dropped by the firmware. Error iocb (I/O) on txcmplq and let the 1327 * dropped by the firmware. Error iocb (I/O) on txcmplq and let the
1330 * SCSI layer retry it after re-establishing link. 1328 * SCSI layer retry it after re-establishing link.
1331 */ 1329 */
1332 pring = &psli->ring[psli->fcp_ring]; 1330 lpfc_sli_abort_fcp_rings(phba);
1333 lpfc_sli_abort_iocb_ring(phba, pring);
1334 1331
1335 /* 1332 /*
1336 * There was a firmware error. Take the hba offline and then 1333 * There was a firmware error. Take the hba offline and then
@@ -1398,7 +1395,6 @@ lpfc_handle_eratt_s3(struct lpfc_hba *phba)
1398{ 1395{
1399 struct lpfc_vport *vport = phba->pport; 1396 struct lpfc_vport *vport = phba->pport;
1400 struct lpfc_sli *psli = &phba->sli; 1397 struct lpfc_sli *psli = &phba->sli;
1401 struct lpfc_sli_ring *pring;
1402 uint32_t event_data; 1398 uint32_t event_data;
1403 unsigned long temperature; 1399 unsigned long temperature;
1404 struct temp_event temp_event_data; 1400 struct temp_event temp_event_data;
@@ -1450,8 +1446,7 @@ lpfc_handle_eratt_s3(struct lpfc_hba *phba)
1450 * Error iocb (I/O) on txcmplq and let the SCSI layer 1446 * Error iocb (I/O) on txcmplq and let the SCSI layer
1451 * retry it after re-establishing link. 1447 * retry it after re-establishing link.
1452 */ 1448 */
1453 pring = &psli->ring[psli->fcp_ring]; 1449 lpfc_sli_abort_fcp_rings(phba);
1454 lpfc_sli_abort_iocb_ring(phba, pring);
1455 1450
1456 /* 1451 /*
1457 * There was a firmware error. Take the hba offline and then 1452 * There was a firmware error. Take the hba offline and then
@@ -9716,9 +9711,6 @@ lpfc_pci_resume_one_s3(struct pci_dev *pdev)
9716static void 9711static void
9717lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) 9712lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba)
9718{ 9713{
9719 struct lpfc_sli *psli = &phba->sli;
9720 struct lpfc_sli_ring *pring;
9721
9722 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 9714 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
9723 "2723 PCI channel I/O abort preparing for recovery\n"); 9715 "2723 PCI channel I/O abort preparing for recovery\n");
9724 9716
@@ -9726,8 +9718,7 @@ lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba)
9726 * There may be errored I/Os through HBA, abort all I/Os on txcmplq 9718 * There may be errored I/Os through HBA, abort all I/Os on txcmplq
9727 * and let the SCSI mid-layer to retry them to recover. 9719 * and let the SCSI mid-layer to retry them to recover.
9728 */ 9720 */
9729 pring = &psli->ring[psli->fcp_ring]; 9721 lpfc_sli_abort_fcp_rings(phba);
9730 lpfc_sli_abort_iocb_ring(phba, pring);
9731} 9722}
9732 9723
9733/** 9724/**
@@ -10470,17 +10461,13 @@ lpfc_pci_resume_one_s4(struct pci_dev *pdev)
10470static void 10461static void
10471lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) 10462lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba)
10472{ 10463{
10473 struct lpfc_sli *psli = &phba->sli;
10474 struct lpfc_sli_ring *pring;
10475
10476 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 10464 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
10477 "2828 PCI channel I/O abort preparing for recovery\n"); 10465 "2828 PCI channel I/O abort preparing for recovery\n");
10478 /* 10466 /*
10479 * There may be errored I/Os through HBA, abort all I/Os on txcmplq 10467 * There may be errored I/Os through HBA, abort all I/Os on txcmplq
10480 * and let the SCSI mid-layer to retry them to recover. 10468 * and let the SCSI mid-layer to retry them to recover.
10481 */ 10469 */
10482 pring = &psli->ring[psli->fcp_ring]; 10470 lpfc_sli_abort_fcp_rings(phba);
10483 lpfc_sli_abort_iocb_ring(phba, pring);
10484} 10471}
10485 10472
10486/** 10473/**
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 393662c24df5..91e3c51f8265 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -3532,14 +3532,27 @@ lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
3532 /* Error everything on txq and txcmplq 3532 /* Error everything on txq and txcmplq
3533 * First do the txq. 3533 * First do the txq.
3534 */ 3534 */
3535 spin_lock_irq(&phba->hbalock); 3535 if (phba->sli_rev >= LPFC_SLI_REV4) {
3536 list_splice_init(&pring->txq, &completions); 3536 spin_lock_irq(&pring->ring_lock);
3537 list_splice_init(&pring->txq, &completions);
3538 pring->txq_cnt = 0;
3539 spin_unlock_irq(&pring->ring_lock);
3537 3540
3538 /* Next issue ABTS for everything on the txcmplq */ 3541 spin_lock_irq(&phba->hbalock);
3539 list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) 3542 /* Next issue ABTS for everything on the txcmplq */
3540 lpfc_sli_issue_abort_iotag(phba, pring, iocb); 3543 list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list)
3544 lpfc_sli_issue_abort_iotag(phba, pring, iocb);
3545 spin_unlock_irq(&phba->hbalock);
3546 } else {
3547 spin_lock_irq(&phba->hbalock);
3548 list_splice_init(&pring->txq, &completions);
3549 pring->txq_cnt = 0;
3541 3550
3542 spin_unlock_irq(&phba->hbalock); 3551 /* Next issue ABTS for everything on the txcmplq */
3552 list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list)
3553 lpfc_sli_issue_abort_iotag(phba, pring, iocb);
3554 spin_unlock_irq(&phba->hbalock);
3555 }
3543 3556
3544 /* Cancel all the IOCBs from the completions list */ 3557 /* Cancel all the IOCBs from the completions list */
3545 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, 3558 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
@@ -3547,6 +3560,36 @@ lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
3547} 3560}
3548 3561
3549/** 3562/**
3563 * lpfc_sli_abort_fcp_rings - Abort all iocbs in all FCP rings
3564 * @phba: Pointer to HBA context object.
3565 * @pring: Pointer to driver SLI ring object.
3566 *
3567 * This function aborts all iocbs in FCP rings and frees all the iocb
3568 * objects in txq. This function issues an abort iocb for all the iocb commands
3569 * in txcmplq. The iocbs in the txcmplq is not guaranteed to complete before
3570 * the return of this function. The caller is not required to hold any locks.
3571 **/
3572void
3573lpfc_sli_abort_fcp_rings(struct lpfc_hba *phba)
3574{
3575 struct lpfc_sli *psli = &phba->sli;
3576 struct lpfc_sli_ring *pring;
3577 uint32_t i;
3578
3579 /* Look on all the FCP Rings for the iotag */
3580 if (phba->sli_rev >= LPFC_SLI_REV4) {
3581 for (i = 0; i < phba->cfg_fcp_io_channel; i++) {
3582 pring = &psli->ring[i + MAX_SLI3_CONFIGURED_RINGS];
3583 lpfc_sli_abort_iocb_ring(phba, pring);
3584 }
3585 } else {
3586 pring = &psli->ring[psli->fcp_ring];
3587 lpfc_sli_abort_iocb_ring(phba, pring);
3588 }
3589}
3590
3591
3592/**
3550 * lpfc_sli_flush_fcp_rings - flush all iocbs in the fcp ring 3593 * lpfc_sli_flush_fcp_rings - flush all iocbs in the fcp ring
3551 * @phba: Pointer to HBA context object. 3594 * @phba: Pointer to HBA context object.
3552 * 3595 *
@@ -3563,28 +3606,55 @@ lpfc_sli_flush_fcp_rings(struct lpfc_hba *phba)
3563 LIST_HEAD(txcmplq); 3606 LIST_HEAD(txcmplq);
3564 struct lpfc_sli *psli = &phba->sli; 3607 struct lpfc_sli *psli = &phba->sli;
3565 struct lpfc_sli_ring *pring; 3608 struct lpfc_sli_ring *pring;
3566 3609 uint32_t i;
3567 /* Currently, only one fcp ring */
3568 pring = &psli->ring[psli->fcp_ring];
3569 3610
3570 spin_lock_irq(&phba->hbalock); 3611 spin_lock_irq(&phba->hbalock);
3571 /* Retrieve everything on txq */
3572 list_splice_init(&pring->txq, &txq);
3573
3574 /* Retrieve everything on the txcmplq */
3575 list_splice_init(&pring->txcmplq, &txcmplq);
3576
3577 /* Indicate the I/O queues are flushed */ 3612 /* Indicate the I/O queues are flushed */
3578 phba->hba_flag |= HBA_FCP_IOQ_FLUSH; 3613 phba->hba_flag |= HBA_FCP_IOQ_FLUSH;
3579 spin_unlock_irq(&phba->hbalock); 3614 spin_unlock_irq(&phba->hbalock);
3580 3615
3581 /* Flush the txq */ 3616 /* Look on all the FCP Rings for the iotag */
3582 lpfc_sli_cancel_iocbs(phba, &txq, IOSTAT_LOCAL_REJECT, 3617 if (phba->sli_rev >= LPFC_SLI_REV4) {
3583 IOERR_SLI_DOWN); 3618 for (i = 0; i < phba->cfg_fcp_io_channel; i++) {
3619 pring = &psli->ring[i + MAX_SLI3_CONFIGURED_RINGS];
3620
3621 spin_lock_irq(&pring->ring_lock);
3622 /* Retrieve everything on txq */
3623 list_splice_init(&pring->txq, &txq);
3624 /* Retrieve everything on the txcmplq */
3625 list_splice_init(&pring->txcmplq, &txcmplq);
3626 pring->txq_cnt = 0;
3627 pring->txcmplq_cnt = 0;
3628 spin_unlock_irq(&pring->ring_lock);
3629
3630 /* Flush the txq */
3631 lpfc_sli_cancel_iocbs(phba, &txq,
3632 IOSTAT_LOCAL_REJECT,
3633 IOERR_SLI_DOWN);
3634 /* Flush the txcmpq */
3635 lpfc_sli_cancel_iocbs(phba, &txcmplq,
3636 IOSTAT_LOCAL_REJECT,
3637 IOERR_SLI_DOWN);
3638 }
3639 } else {
3640 pring = &psli->ring[psli->fcp_ring];
3584 3641
3585 /* Flush the txcmpq */ 3642 spin_lock_irq(&phba->hbalock);
3586 lpfc_sli_cancel_iocbs(phba, &txcmplq, IOSTAT_LOCAL_REJECT, 3643 /* Retrieve everything on txq */
3587 IOERR_SLI_DOWN); 3644 list_splice_init(&pring->txq, &txq);
3645 /* Retrieve everything on the txcmplq */
3646 list_splice_init(&pring->txcmplq, &txcmplq);
3647 pring->txq_cnt = 0;
3648 pring->txcmplq_cnt = 0;
3649 spin_unlock_irq(&phba->hbalock);
3650
3651 /* Flush the txq */
3652 lpfc_sli_cancel_iocbs(phba, &txq, IOSTAT_LOCAL_REJECT,
3653 IOERR_SLI_DOWN);
3654 /* Flush the txcmpq */
3655 lpfc_sli_cancel_iocbs(phba, &txcmplq, IOSTAT_LOCAL_REJECT,
3656 IOERR_SLI_DOWN);
3657 }
3588} 3658}
3589 3659
3590/** 3660/**
@@ -6722,7 +6792,6 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
6722 LPFC_MBOXQ_t *pmbox = phba->sli.mbox_active; 6792 LPFC_MBOXQ_t *pmbox = phba->sli.mbox_active;
6723 MAILBOX_t *mb = &pmbox->u.mb; 6793 MAILBOX_t *mb = &pmbox->u.mb;
6724 struct lpfc_sli *psli = &phba->sli; 6794 struct lpfc_sli *psli = &phba->sli;
6725 struct lpfc_sli_ring *pring;
6726 6795
6727 /* If the mailbox completed, process the completion and return */ 6796 /* If the mailbox completed, process the completion and return */
6728 if (lpfc_sli4_process_missed_mbox_completions(phba)) 6797 if (lpfc_sli4_process_missed_mbox_completions(phba))
@@ -6764,8 +6833,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
6764 psli->sli_flag &= ~LPFC_SLI_ACTIVE; 6833 psli->sli_flag &= ~LPFC_SLI_ACTIVE;
6765 spin_unlock_irq(&phba->hbalock); 6834 spin_unlock_irq(&phba->hbalock);
6766 6835
6767 pring = &psli->ring[psli->fcp_ring]; 6836 lpfc_sli_abort_fcp_rings(phba);
6768 lpfc_sli_abort_iocb_ring(phba, pring);
6769 6837
6770 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, 6838 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
6771 "0345 Resetting board due to mailbox timeout\n"); 6839 "0345 Resetting board due to mailbox timeout\n");
@@ -9805,43 +9873,6 @@ abort_iotag_exit:
9805} 9873}
9806 9874
9807/** 9875/**
9808 * lpfc_sli_iocb_ring_abort - Unconditionally abort all iocbs on an iocb ring
9809 * @phba: Pointer to HBA context object.
9810 * @pring: Pointer to driver SLI ring object.
9811 *
9812 * This function aborts all iocbs in the given ring and frees all the iocb
9813 * objects in txq. This function issues abort iocbs unconditionally for all
9814 * the iocb commands in txcmplq. The iocbs in the txcmplq is not guaranteed
9815 * to complete before the return of this function. The caller is not required
9816 * to hold any locks.
9817 **/
9818static void
9819lpfc_sli_iocb_ring_abort(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
9820{
9821 LIST_HEAD(completions);
9822 struct lpfc_iocbq *iocb, *next_iocb;
9823
9824 if (pring->ringno == LPFC_ELS_RING)
9825 lpfc_fabric_abort_hba(phba);
9826
9827 spin_lock_irq(&phba->hbalock);
9828
9829 /* Take off all the iocbs on txq for cancelling */
9830 list_splice_init(&pring->txq, &completions);
9831 pring->txq_cnt = 0;
9832
9833 /* Next issue ABTS for everything on the txcmplq */
9834 list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list)
9835 lpfc_sli_abort_iotag_issue(phba, pring, iocb);
9836
9837 spin_unlock_irq(&phba->hbalock);
9838
9839 /* Cancel all the IOCBs from the completions list */
9840 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
9841 IOERR_SLI_ABORTED);
9842}
9843
9844/**
9845 * lpfc_sli_hba_iocb_abort - Abort all iocbs to an hba. 9876 * lpfc_sli_hba_iocb_abort - Abort all iocbs to an hba.
9846 * @phba: pointer to lpfc HBA data structure. 9877 * @phba: pointer to lpfc HBA data structure.
9847 * 9878 *
@@ -9856,7 +9887,7 @@ lpfc_sli_hba_iocb_abort(struct lpfc_hba *phba)
9856 9887
9857 for (i = 0; i < psli->num_rings; i++) { 9888 for (i = 0; i < psli->num_rings; i++) {
9858 pring = &psli->ring[i]; 9889 pring = &psli->ring[i];
9859 lpfc_sli_iocb_ring_abort(phba, pring); 9890 lpfc_sli_abort_iocb_ring(phba, pring);
9860 } 9891 }
9861} 9892}
9862 9893