aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2007-04-25 09:51:30 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-05-06 10:33:12 -0400
commit1dcb58e5680b6673bf984696d3d8b9033b6e41bf (patch)
tree7421ad398ef2ee04d2c7b22bb975219593885f01 /drivers/scsi/lpfc/lpfc_sli.c
parente555db930f7512491485cfc43df4306192835373 (diff)
[SCSI] lpfc 8.1.12 : Misc bug fixes and code cleanup
Misc bug fixes and code cleanup: - Fix system hang while running on systems with IOMMU - Fix use after free issues with rports - Don't free mailbox structure if it's still on the mboxq list - Decrement txq_cnt rather than txcmplq_cnt when parsing the txq list - Use msleep for long delays to prevent soft lockup bug check - Don't remove node during dev_loss_tmo if discovery is active - Fix memory leaks in get/reset statistics and link attention paths - Fixed lpfc_ns_rsp to handle entire GID_FT response. - mbox interface should use MAILBOX_CMD_SIZE rather than sizeof(MAILBOX_t) - Fixed bug check in add_timer. - Fixup messages 0116, 0117, and 0128 to report ELS I/O tag. - Remove unused parameter to lpfc_cleanup. - Change mailbox timeout handling. - Remove unused buflist. Code cleanup. 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_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c98
1 files changed, 29 insertions, 69 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 9fb6960a8ada..54a8f4d3db13 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -693,25 +693,8 @@ lpfc_sli_handle_mb_event(struct lpfc_hba * phba)
693 } else { 693 } else {
694 spin_unlock_irq(phba->host->host_lock); 694 spin_unlock_irq(phba->host->host_lock);
695 /* Turn on IOCB processing */ 695 /* Turn on IOCB processing */
696 for (i = 0; i < phba->sli.num_rings; i++) { 696 for (i = 0; i < phba->sli.num_rings; i++)
697 lpfc_sli_turn_on_ring(phba, i); 697 lpfc_sli_turn_on_ring(phba, i);
698 }
699
700 /* Free any lpfc_dmabuf's waiting for mbox cmd cmpls */
701 while (!list_empty(&phba->freebufList)) {
702 struct lpfc_dmabuf *mp;
703
704 mp = NULL;
705 list_remove_head((&phba->freebufList),
706 mp,
707 struct lpfc_dmabuf,
708 list);
709 if (mp) {
710 lpfc_mbuf_free(phba, mp->virt,
711 mp->phys);
712 kfree(mp);
713 }
714 }
715 } 698 }
716 699
717 } while (process_next); 700 } while (process_next);
@@ -1985,42 +1968,6 @@ lpfc_sli_hba_setup_exit:
1985 return rc; 1968 return rc;
1986} 1969}
1987 1970
1988static void
1989lpfc_mbox_abort(struct lpfc_hba * phba)
1990{
1991 LPFC_MBOXQ_t *pmbox;
1992 MAILBOX_t *mb;
1993
1994 if (phba->sli.mbox_active) {
1995 del_timer_sync(&phba->sli.mbox_tmo);
1996 phba->work_hba_events &= ~WORKER_MBOX_TMO;
1997 pmbox = phba->sli.mbox_active;
1998 mb = &pmbox->mb;
1999 phba->sli.mbox_active = NULL;
2000 if (pmbox->mbox_cmpl) {
2001 mb->mbxStatus = MBX_NOT_FINISHED;
2002 (pmbox->mbox_cmpl) (phba, pmbox);
2003 }
2004 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
2005 }
2006
2007 /* Abort all the non active mailbox commands. */
2008 spin_lock_irq(phba->host->host_lock);
2009 pmbox = lpfc_mbox_get(phba);
2010 while (pmbox) {
2011 mb = &pmbox->mb;
2012 if (pmbox->mbox_cmpl) {
2013 mb->mbxStatus = MBX_NOT_FINISHED;
2014 spin_unlock_irq(phba->host->host_lock);
2015 (pmbox->mbox_cmpl) (phba, pmbox);
2016 spin_lock_irq(phba->host->host_lock);
2017 }
2018 pmbox = lpfc_mbox_get(phba);
2019 }
2020 spin_unlock_irq(phba->host->host_lock);
2021 return;
2022}
2023
2024/*! lpfc_mbox_timeout 1971/*! lpfc_mbox_timeout
2025 * 1972 *
2026 * \pre 1973 * \pre
@@ -2055,6 +2002,8 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
2055{ 2002{
2056 LPFC_MBOXQ_t *pmbox; 2003 LPFC_MBOXQ_t *pmbox;
2057 MAILBOX_t *mb; 2004 MAILBOX_t *mb;
2005 struct lpfc_sli *psli = &phba->sli;
2006 struct lpfc_sli_ring *pring;
2058 2007
2059 spin_lock_irq(phba->host->host_lock); 2008 spin_lock_irq(phba->host->host_lock);
2060 if (!(phba->work_hba_events & WORKER_MBOX_TMO)) { 2009 if (!(phba->work_hba_events & WORKER_MBOX_TMO)) {
@@ -2062,8 +2011,6 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
2062 return; 2011 return;
2063 } 2012 }
2064 2013
2065 phba->work_hba_events &= ~WORKER_MBOX_TMO;
2066
2067 pmbox = phba->sli.mbox_active; 2014 pmbox = phba->sli.mbox_active;
2068 mb = &pmbox->mb; 2015 mb = &pmbox->mb;
2069 2016
@@ -2078,17 +2025,32 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
2078 phba->sli.sli_flag, 2025 phba->sli.sli_flag,
2079 phba->sli.mbox_active); 2026 phba->sli.mbox_active);
2080 2027
2081 phba->sli.mbox_active = NULL; 2028 /* Setting state unknown so lpfc_sli_abort_iocb_ring
2082 if (pmbox->mbox_cmpl) { 2029 * would get IOCB_ERROR from lpfc_sli_issue_iocb, allowing
2083 mb->mbxStatus = MBX_NOT_FINISHED; 2030 * it to fail all oustanding SCSI IO.
2084 spin_unlock_irq(phba->host->host_lock); 2031 */
2085 (pmbox->mbox_cmpl) (phba, pmbox); 2032 phba->hba_state = LPFC_STATE_UNKNOWN;
2086 spin_lock_irq(phba->host->host_lock); 2033 phba->work_hba_events &= ~WORKER_MBOX_TMO;
2087 } 2034 phba->fc_flag |= FC_ESTABLISH_LINK;
2088 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; 2035 psli->sli_flag &= ~LPFC_SLI2_ACTIVE;
2089
2090 spin_unlock_irq(phba->host->host_lock); 2036 spin_unlock_irq(phba->host->host_lock);
2091 lpfc_mbox_abort(phba); 2037
2038 pring = &psli->ring[psli->fcp_ring];
2039 lpfc_sli_abort_iocb_ring(phba, pring);
2040
2041 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
2042 "%d:0316 Resetting board due to mailbox timeout\n",
2043 phba->brd_no);
2044 /*
2045 * lpfc_offline calls lpfc_sli_hba_down which will clean up
2046 * on oustanding mailbox commands.
2047 */
2048 lpfc_offline_prep(phba);
2049 lpfc_offline(phba);
2050 lpfc_sli_brdrestart(phba);
2051 if (lpfc_online(phba) == 0) /* Initialize the HBA */
2052 mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60);
2053 lpfc_unblock_mgmt_io(phba);
2092 return; 2054 return;
2093} 2055}
2094 2056
@@ -2320,9 +2282,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag)
2320 spin_unlock_irqrestore(phba->host->host_lock, 2282 spin_unlock_irqrestore(phba->host->host_lock,
2321 drvr_flag); 2283 drvr_flag);
2322 2284
2323 /* Can be in interrupt context, do not sleep */ 2285 msleep(1);
2324 /* (or might be called with interrupts disabled) */
2325 mdelay(1);
2326 2286
2327 spin_lock_irqsave(phba->host->host_lock, drvr_flag); 2287 spin_lock_irqsave(phba->host->host_lock, drvr_flag);
2328 2288