diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 350a625fa224..70f4d5a1348e 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -320,7 +320,8 @@ lpfc_sli_next_iotag(struct lpfc_hba * phba, struct lpfc_iocbq * iocbq) | |||
320 | kfree(old_arr); | 320 | kfree(old_arr); |
321 | return iotag; | 321 | return iotag; |
322 | } | 322 | } |
323 | } | 323 | } else |
324 | spin_unlock_irq(phba->host->host_lock); | ||
324 | 325 | ||
325 | lpfc_printf_log(phba, KERN_ERR,LOG_SLI, | 326 | lpfc_printf_log(phba, KERN_ERR,LOG_SLI, |
326 | "%d:0318 Failed to allocate IOTAG.last IOTAG is %d\n", | 327 | "%d:0318 Failed to allocate IOTAG.last IOTAG is %d\n", |
@@ -969,9 +970,11 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba * phba) | |||
969 | * resources need to be recovered. | 970 | * resources need to be recovered. |
970 | */ | 971 | */ |
971 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { | 972 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { |
972 | printk(KERN_INFO "%s: IOCB cmd 0x%x processed." | 973 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
973 | " Skipping completion\n", __FUNCTION__, | 974 | "%d:0314 IOCB cmd 0x%x" |
974 | irsp->ulpCommand); | 975 | " processed. Skipping" |
976 | " completion", phba->brd_no, | ||
977 | irsp->ulpCommand); | ||
975 | break; | 978 | break; |
976 | } | 979 | } |
977 | 980 | ||
@@ -1104,7 +1107,7 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba * phba, | |||
1104 | if (unlikely(irsp->ulpStatus)) { | 1107 | if (unlikely(irsp->ulpStatus)) { |
1105 | /* Rsp ring <ringno> error: IOCB */ | 1108 | /* Rsp ring <ringno> error: IOCB */ |
1106 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 1109 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
1107 | "%d:0326 Rsp Ring %d error: IOCB Data: " | 1110 | "%d:0336 Rsp Ring %d error: IOCB Data: " |
1108 | "x%x x%x x%x x%x x%x x%x x%x x%x\n", | 1111 | "x%x x%x x%x x%x x%x x%x x%x x%x\n", |
1109 | phba->brd_no, pring->ringno, | 1112 | phba->brd_no, pring->ringno, |
1110 | irsp->un.ulpWord[0], irsp->un.ulpWord[1], | 1113 | irsp->un.ulpWord[0], irsp->un.ulpWord[1], |
@@ -1122,9 +1125,11 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba * phba, | |||
1122 | * resources need to be recovered. | 1125 | * resources need to be recovered. |
1123 | */ | 1126 | */ |
1124 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { | 1127 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { |
1125 | printk(KERN_INFO "%s: IOCB cmd 0x%x processed. " | 1128 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
1126 | "Skipping completion\n", __FUNCTION__, | 1129 | "%d:0333 IOCB cmd 0x%x" |
1127 | irsp->ulpCommand); | 1130 | " processed. Skipping" |
1131 | " completion\n", phba->brd_no, | ||
1132 | irsp->ulpCommand); | ||
1128 | break; | 1133 | break; |
1129 | } | 1134 | } |
1130 | 1135 | ||
@@ -1155,7 +1160,7 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba * phba, | |||
1155 | } else { | 1160 | } else { |
1156 | /* Unknown IOCB command */ | 1161 | /* Unknown IOCB command */ |
1157 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1162 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1158 | "%d:0321 Unknown IOCB command " | 1163 | "%d:0334 Unknown IOCB command " |
1159 | "Data: x%x, x%x x%x x%x x%x\n", | 1164 | "Data: x%x, x%x x%x x%x x%x\n", |
1160 | phba->brd_no, type, irsp->ulpCommand, | 1165 | phba->brd_no, type, irsp->ulpCommand, |
1161 | irsp->ulpStatus, irsp->ulpIoTag, | 1166 | irsp->ulpStatus, irsp->ulpIoTag, |
@@ -1238,7 +1243,7 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba * phba, | |||
1238 | lpfc_printf_log(phba, | 1243 | lpfc_printf_log(phba, |
1239 | KERN_ERR, | 1244 | KERN_ERR, |
1240 | LOG_SLI, | 1245 | LOG_SLI, |
1241 | "%d:0312 Ring %d handler: portRspPut %d " | 1246 | "%d:0303 Ring %d handler: portRspPut %d " |
1242 | "is bigger then rsp ring %d\n", | 1247 | "is bigger then rsp ring %d\n", |
1243 | phba->brd_no, | 1248 | phba->brd_no, |
1244 | pring->ringno, portRspPut, portRspMax); | 1249 | pring->ringno, portRspPut, portRspMax); |
@@ -1383,7 +1388,7 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba * phba, | |||
1383 | lpfc_printf_log(phba, | 1388 | lpfc_printf_log(phba, |
1384 | KERN_ERR, | 1389 | KERN_ERR, |
1385 | LOG_SLI, | 1390 | LOG_SLI, |
1386 | "%d:0321 Unknown IOCB command " | 1391 | "%d:0335 Unknown IOCB command " |
1387 | "Data: x%x x%x x%x x%x\n", | 1392 | "Data: x%x x%x x%x x%x\n", |
1388 | phba->brd_no, | 1393 | phba->brd_no, |
1389 | irsp->ulpCommand, | 1394 | irsp->ulpCommand, |
@@ -1399,11 +1404,11 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba * phba, | |||
1399 | next_iocb, | 1404 | next_iocb, |
1400 | &saveq->list, | 1405 | &saveq->list, |
1401 | list) { | 1406 | list) { |
1407 | list_del(&rspiocbp->list); | ||
1402 | lpfc_sli_release_iocbq(phba, | 1408 | lpfc_sli_release_iocbq(phba, |
1403 | rspiocbp); | 1409 | rspiocbp); |
1404 | } | 1410 | } |
1405 | } | 1411 | } |
1406 | |||
1407 | lpfc_sli_release_iocbq(phba, saveq); | 1412 | lpfc_sli_release_iocbq(phba, saveq); |
1408 | } | 1413 | } |
1409 | } | 1414 | } |
@@ -1711,15 +1716,13 @@ lpfc_sli_brdreset(struct lpfc_hba * phba) | |||
1711 | phba->fc_myDID = 0; | 1716 | phba->fc_myDID = 0; |
1712 | phba->fc_prevDID = 0; | 1717 | phba->fc_prevDID = 0; |
1713 | 1718 | ||
1714 | psli->sli_flag = 0; | ||
1715 | |||
1716 | /* Turn off parity checking and serr during the physical reset */ | 1719 | /* Turn off parity checking and serr during the physical reset */ |
1717 | pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value); | 1720 | pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value); |
1718 | pci_write_config_word(phba->pcidev, PCI_COMMAND, | 1721 | pci_write_config_word(phba->pcidev, PCI_COMMAND, |
1719 | (cfg_value & | 1722 | (cfg_value & |
1720 | ~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR))); | 1723 | ~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR))); |
1721 | 1724 | ||
1722 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; | 1725 | psli->sli_flag &= ~(LPFC_SLI2_ACTIVE | LPFC_PROCESS_LA); |
1723 | /* Now toggle INITFF bit in the Host Control Register */ | 1726 | /* Now toggle INITFF bit in the Host Control Register */ |
1724 | writel(HC_INITFF, phba->HCregaddr); | 1727 | writel(HC_INITFF, phba->HCregaddr); |
1725 | mdelay(1); | 1728 | mdelay(1); |
@@ -1760,7 +1763,7 @@ lpfc_sli_brdrestart(struct lpfc_hba * phba) | |||
1760 | 1763 | ||
1761 | /* Restart HBA */ | 1764 | /* Restart HBA */ |
1762 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 1765 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
1763 | "%d:0328 Restart HBA Data: x%x x%x\n", phba->brd_no, | 1766 | "%d:0337 Restart HBA Data: x%x x%x\n", phba->brd_no, |
1764 | phba->hba_state, psli->sli_flag); | 1767 | phba->hba_state, psli->sli_flag); |
1765 | 1768 | ||
1766 | word0 = 0; | 1769 | word0 = 0; |
@@ -1792,6 +1795,9 @@ lpfc_sli_brdrestart(struct lpfc_hba * phba) | |||
1792 | 1795 | ||
1793 | spin_unlock_irq(phba->host->host_lock); | 1796 | spin_unlock_irq(phba->host->host_lock); |
1794 | 1797 | ||
1798 | memset(&psli->lnk_stat_offsets, 0, sizeof(psli->lnk_stat_offsets)); | ||
1799 | psli->stats_start = get_seconds(); | ||
1800 | |||
1795 | if (skip_post) | 1801 | if (skip_post) |
1796 | mdelay(100); | 1802 | mdelay(100); |
1797 | else | 1803 | else |
@@ -1902,6 +1908,9 @@ lpfc_sli_hba_setup(struct lpfc_hba * phba) | |||
1902 | } | 1908 | } |
1903 | 1909 | ||
1904 | while (resetcount < 2 && !done) { | 1910 | while (resetcount < 2 && !done) { |
1911 | spin_lock_irq(phba->host->host_lock); | ||
1912 | phba->sli.sli_flag |= LPFC_SLI_MBOX_ACTIVE; | ||
1913 | spin_unlock_irq(phba->host->host_lock); | ||
1905 | phba->hba_state = LPFC_STATE_UNKNOWN; | 1914 | phba->hba_state = LPFC_STATE_UNKNOWN; |
1906 | lpfc_sli_brdrestart(phba); | 1915 | lpfc_sli_brdrestart(phba); |
1907 | msleep(2500); | 1916 | msleep(2500); |
@@ -1909,6 +1918,9 @@ lpfc_sli_hba_setup(struct lpfc_hba * phba) | |||
1909 | if (rc) | 1918 | if (rc) |
1910 | break; | 1919 | break; |
1911 | 1920 | ||
1921 | spin_lock_irq(phba->host->host_lock); | ||
1922 | phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; | ||
1923 | spin_unlock_irq(phba->host->host_lock); | ||
1912 | resetcount++; | 1924 | resetcount++; |
1913 | 1925 | ||
1914 | /* Call pre CONFIG_PORT mailbox command initialization. A value of 0 | 1926 | /* Call pre CONFIG_PORT mailbox command initialization. A value of 0 |
@@ -2194,7 +2206,8 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag) | |||
2194 | return (MBX_NOT_FINISHED); | 2206 | return (MBX_NOT_FINISHED); |
2195 | } | 2207 | } |
2196 | /* timeout active mbox command */ | 2208 | /* timeout active mbox command */ |
2197 | mod_timer(&psli->mbox_tmo, jiffies + HZ * LPFC_MBOX_TMO); | 2209 | mod_timer(&psli->mbox_tmo, (jiffies + |
2210 | (HZ * lpfc_mbox_tmo_val(phba, mb->mbxCommand)))); | ||
2198 | } | 2211 | } |
2199 | 2212 | ||
2200 | /* Mailbox cmd <cmd> issue */ | 2213 | /* Mailbox cmd <cmd> issue */ |
@@ -2254,7 +2267,6 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag) | |||
2254 | break; | 2267 | break; |
2255 | 2268 | ||
2256 | case MBX_POLL: | 2269 | case MBX_POLL: |
2257 | i = 0; | ||
2258 | psli->mbox_active = NULL; | 2270 | psli->mbox_active = NULL; |
2259 | if (psli->sli_flag & LPFC_SLI2_ACTIVE) { | 2271 | if (psli->sli_flag & LPFC_SLI2_ACTIVE) { |
2260 | /* First read mbox status word */ | 2272 | /* First read mbox status word */ |
@@ -2268,11 +2280,14 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag) | |||
2268 | /* Read the HBA Host Attention Register */ | 2280 | /* Read the HBA Host Attention Register */ |
2269 | ha_copy = readl(phba->HAregaddr); | 2281 | ha_copy = readl(phba->HAregaddr); |
2270 | 2282 | ||
2283 | i = lpfc_mbox_tmo_val(phba, mb->mbxCommand); | ||
2284 | i *= 1000; /* Convert to ms */ | ||
2285 | |||
2271 | /* Wait for command to complete */ | 2286 | /* Wait for command to complete */ |
2272 | while (((word0 & OWN_CHIP) == OWN_CHIP) || | 2287 | while (((word0 & OWN_CHIP) == OWN_CHIP) || |
2273 | (!(ha_copy & HA_MBATT) && | 2288 | (!(ha_copy & HA_MBATT) && |
2274 | (phba->hba_state > LPFC_WARM_START))) { | 2289 | (phba->hba_state > LPFC_WARM_START))) { |
2275 | if (i++ >= 100) { | 2290 | if (i-- <= 0) { |
2276 | psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; | 2291 | psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; |
2277 | spin_unlock_irqrestore(phba->host->host_lock, | 2292 | spin_unlock_irqrestore(phba->host->host_lock, |
2278 | drvr_flag); | 2293 | drvr_flag); |
@@ -2290,7 +2305,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag) | |||
2290 | 2305 | ||
2291 | /* Can be in interrupt context, do not sleep */ | 2306 | /* Can be in interrupt context, do not sleep */ |
2292 | /* (or might be called with interrupts disabled) */ | 2307 | /* (or might be called with interrupts disabled) */ |
2293 | mdelay(i); | 2308 | mdelay(1); |
2294 | 2309 | ||
2295 | spin_lock_irqsave(phba->host->host_lock, drvr_flag); | 2310 | spin_lock_irqsave(phba->host->host_lock, drvr_flag); |
2296 | 2311 | ||
@@ -3005,7 +3020,7 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba * phba, | |||
3005 | 3020 | ||
3006 | if (timeleft == 0) { | 3021 | if (timeleft == 0) { |
3007 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 3022 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
3008 | "%d:0329 IOCB wait timeout error - no " | 3023 | "%d:0338 IOCB wait timeout error - no " |
3009 | "wake response Data x%x\n", | 3024 | "wake response Data x%x\n", |
3010 | phba->brd_no, timeout); | 3025 | phba->brd_no, timeout); |
3011 | retval = IOCB_TIMEDOUT; | 3026 | retval = IOCB_TIMEDOUT; |