aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c101
-rw-r--r--drivers/scsi/lpfc/lpfc_crtn.h1
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c13
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c21
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c15
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c13
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c16
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c24
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c21
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c57
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.h20
-rw-r--r--drivers/scsi/lpfc/lpfc_version.h2
12 files changed, 249 insertions, 55 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 5c68cdd8736f..d384c16f4a87 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -222,7 +222,7 @@ lpfc_issue_lip(struct Scsi_Host *host)
222 pmboxq->mb.mbxCommand = MBX_DOWN_LINK; 222 pmboxq->mb.mbxCommand = MBX_DOWN_LINK;
223 pmboxq->mb.mbxOwner = OWN_HOST; 223 pmboxq->mb.mbxOwner = OWN_HOST;
224 224
225 mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); 225 mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, LPFC_MBOX_TMO * 2);
226 226
227 if ((mbxstatus == MBX_SUCCESS) && (pmboxq->mb.mbxStatus == 0)) { 227 if ((mbxstatus == MBX_SUCCESS) && (pmboxq->mb.mbxStatus == 0)) {
228 memset((void *)pmboxq, 0, sizeof (LPFC_MBOXQ_t)); 228 memset((void *)pmboxq, 0, sizeof (LPFC_MBOXQ_t));
@@ -884,7 +884,7 @@ sysfs_mbox_write(struct kobject *kobj, char *buf, loff_t off, size_t count)
884 phba->sysfs_mbox.mbox == NULL ) { 884 phba->sysfs_mbox.mbox == NULL ) {
885 sysfs_mbox_idle(phba); 885 sysfs_mbox_idle(phba);
886 spin_unlock_irq(host->host_lock); 886 spin_unlock_irq(host->host_lock);
887 return -EINVAL; 887 return -EAGAIN;
888 } 888 }
889 } 889 }
890 890
@@ -1000,14 +1000,15 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count)
1000 spin_unlock_irq(phba->host->host_lock); 1000 spin_unlock_irq(phba->host->host_lock);
1001 rc = lpfc_sli_issue_mbox_wait (phba, 1001 rc = lpfc_sli_issue_mbox_wait (phba,
1002 phba->sysfs_mbox.mbox, 1002 phba->sysfs_mbox.mbox,
1003 phba->fc_ratov * 2); 1003 lpfc_mbox_tmo_val(phba,
1004 phba->sysfs_mbox.mbox->mb.mbxCommand) * HZ);
1004 spin_lock_irq(phba->host->host_lock); 1005 spin_lock_irq(phba->host->host_lock);
1005 } 1006 }
1006 1007
1007 if (rc != MBX_SUCCESS) { 1008 if (rc != MBX_SUCCESS) {
1008 sysfs_mbox_idle(phba); 1009 sysfs_mbox_idle(phba);
1009 spin_unlock_irq(host->host_lock); 1010 spin_unlock_irq(host->host_lock);
1010 return -ENODEV; 1011 return (rc == MBX_TIMEOUT) ? -ETIME : -ENODEV;
1011 } 1012 }
1012 phba->sysfs_mbox.state = SMBOX_READING; 1013 phba->sysfs_mbox.state = SMBOX_READING;
1013 } 1014 }
@@ -1016,7 +1017,7 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count)
1016 printk(KERN_WARNING "mbox_read: Bad State\n"); 1017 printk(KERN_WARNING "mbox_read: Bad State\n");
1017 sysfs_mbox_idle(phba); 1018 sysfs_mbox_idle(phba);
1018 spin_unlock_irq(host->host_lock); 1019 spin_unlock_irq(host->host_lock);
1019 return -EINVAL; 1020 return -EAGAIN;
1020 } 1021 }
1021 1022
1022 memcpy(buf, (uint8_t *) & phba->sysfs_mbox.mbox->mb + off, count); 1023 memcpy(buf, (uint8_t *) & phba->sysfs_mbox.mbox->mb + off, count);
@@ -1210,8 +1211,10 @@ lpfc_get_stats(struct Scsi_Host *shost)
1210 struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata; 1211 struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata;
1211 struct lpfc_sli *psli = &phba->sli; 1212 struct lpfc_sli *psli = &phba->sli;
1212 struct fc_host_statistics *hs = &phba->link_stats; 1213 struct fc_host_statistics *hs = &phba->link_stats;
1214 struct lpfc_lnk_stat * lso = &psli->lnk_stat_offsets;
1213 LPFC_MBOXQ_t *pmboxq; 1215 LPFC_MBOXQ_t *pmboxq;
1214 MAILBOX_t *pmb; 1216 MAILBOX_t *pmb;
1217 unsigned long seconds;
1215 int rc = 0; 1218 int rc = 0;
1216 1219
1217 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 1220 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
@@ -1272,22 +1275,103 @@ lpfc_get_stats(struct Scsi_Host *shost)
1272 hs->invalid_crc_count = pmb->un.varRdLnk.crcCnt; 1275 hs->invalid_crc_count = pmb->un.varRdLnk.crcCnt;
1273 hs->error_frames = pmb->un.varRdLnk.crcCnt; 1276 hs->error_frames = pmb->un.varRdLnk.crcCnt;
1274 1277
1278 hs->link_failure_count -= lso->link_failure_count;
1279 hs->loss_of_sync_count -= lso->loss_of_sync_count;
1280 hs->loss_of_signal_count -= lso->loss_of_signal_count;
1281 hs->prim_seq_protocol_err_count -= lso->prim_seq_protocol_err_count;
1282 hs->invalid_tx_word_count -= lso->invalid_tx_word_count;
1283 hs->invalid_crc_count -= lso->invalid_crc_count;
1284 hs->error_frames -= lso->error_frames;
1285
1275 if (phba->fc_topology == TOPOLOGY_LOOP) { 1286 if (phba->fc_topology == TOPOLOGY_LOOP) {
1276 hs->lip_count = (phba->fc_eventTag >> 1); 1287 hs->lip_count = (phba->fc_eventTag >> 1);
1288 hs->lip_count -= lso->link_events;
1277 hs->nos_count = -1; 1289 hs->nos_count = -1;
1278 } else { 1290 } else {
1279 hs->lip_count = -1; 1291 hs->lip_count = -1;
1280 hs->nos_count = (phba->fc_eventTag >> 1); 1292 hs->nos_count = (phba->fc_eventTag >> 1);
1293 hs->nos_count -= lso->link_events;
1281 } 1294 }
1282 1295
1283 hs->dumped_frames = -1; 1296 hs->dumped_frames = -1;
1284 1297
1285/* FIX ME */ 1298 seconds = get_seconds();
1286 /*hs->SecondsSinceLastReset = (jiffies - lpfc_loadtime) / HZ;*/ 1299 if (seconds < psli->stats_start)
1300 hs->seconds_since_last_reset = seconds +
1301 ((unsigned long)-1 - psli->stats_start);
1302 else
1303 hs->seconds_since_last_reset = seconds - psli->stats_start;
1287 1304
1288 return hs; 1305 return hs;
1289} 1306}
1290 1307
1308static void
1309lpfc_reset_stats(struct Scsi_Host *shost)
1310{
1311 struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata;
1312 struct lpfc_sli *psli = &phba->sli;
1313 struct lpfc_lnk_stat * lso = &psli->lnk_stat_offsets;
1314 LPFC_MBOXQ_t *pmboxq;
1315 MAILBOX_t *pmb;
1316 int rc = 0;
1317
1318 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
1319 if (!pmboxq)
1320 return;
1321 memset(pmboxq, 0, sizeof(LPFC_MBOXQ_t));
1322
1323 pmb = &pmboxq->mb;
1324 pmb->mbxCommand = MBX_READ_STATUS;
1325 pmb->mbxOwner = OWN_HOST;
1326 pmb->un.varWords[0] = 0x1; /* reset request */
1327 pmboxq->context1 = NULL;
1328
1329 if ((phba->fc_flag & FC_OFFLINE_MODE) ||
1330 (!(psli->sli_flag & LPFC_SLI2_ACTIVE)))
1331 rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL);
1332 else
1333 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2);
1334
1335 if (rc != MBX_SUCCESS) {
1336 if (rc == MBX_TIMEOUT)
1337 pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
1338 else
1339 mempool_free(pmboxq, phba->mbox_mem_pool);
1340 return;
1341 }
1342
1343 memset(pmboxq, 0, sizeof(LPFC_MBOXQ_t));
1344 pmb->mbxCommand = MBX_READ_LNK_STAT;
1345 pmb->mbxOwner = OWN_HOST;
1346 pmboxq->context1 = NULL;
1347
1348 if ((phba->fc_flag & FC_OFFLINE_MODE) ||
1349 (!(psli->sli_flag & LPFC_SLI2_ACTIVE)))
1350 rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL);
1351 else
1352 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2);
1353
1354 if (rc != MBX_SUCCESS) {
1355 if (rc == MBX_TIMEOUT)
1356 pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
1357 else
1358 mempool_free( pmboxq, phba->mbox_mem_pool);
1359 return;
1360 }
1361
1362 lso->link_failure_count = pmb->un.varRdLnk.linkFailureCnt;
1363 lso->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt;
1364 lso->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt;
1365 lso->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt;
1366 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord;
1367 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt;
1368 lso->error_frames = pmb->un.varRdLnk.crcCnt;
1369 lso->link_events = (phba->fc_eventTag >> 1);
1370
1371 psli->stats_start = get_seconds();
1372
1373 return;
1374}
1291 1375
1292/* 1376/*
1293 * The LPFC driver treats linkdown handling as target loss events so there 1377 * The LPFC driver treats linkdown handling as target loss events so there
@@ -1431,8 +1515,7 @@ struct fc_function_template lpfc_transport_functions = {
1431 */ 1515 */
1432 1516
1433 .get_fc_host_stats = lpfc_get_stats, 1517 .get_fc_host_stats = lpfc_get_stats,
1434 1518 .reset_fc_host_stats = lpfc_reset_stats,
1435 /* the LPFC driver doesn't support resetting stats yet */
1436 1519
1437 .dd_fcrport_size = sizeof(struct lpfc_rport_data), 1520 .dd_fcrport_size = sizeof(struct lpfc_rport_data),
1438 .show_rport_maxframe_size = 1, 1521 .show_rport_maxframe_size = 1,
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index 517e9e4dd461..2a176467f71b 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -127,6 +127,7 @@ void lpfc_config_port(struct lpfc_hba *, LPFC_MBOXQ_t *);
127void lpfc_kill_board(struct lpfc_hba *, LPFC_MBOXQ_t *); 127void lpfc_kill_board(struct lpfc_hba *, LPFC_MBOXQ_t *);
128void lpfc_mbox_put(struct lpfc_hba *, LPFC_MBOXQ_t *); 128void lpfc_mbox_put(struct lpfc_hba *, LPFC_MBOXQ_t *);
129LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *); 129LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *);
130int lpfc_mbox_tmo_val(struct lpfc_hba *, int);
130 131
131int lpfc_mem_alloc(struct lpfc_hba *); 132int lpfc_mem_alloc(struct lpfc_hba *);
132void lpfc_mem_free(struct lpfc_hba *); 133void lpfc_mem_free(struct lpfc_hba *);
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index b65ee57af53e..bbb7310210b0 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -131,6 +131,7 @@ lpfc_ct_unsol_event(struct lpfc_hba * phba,
131 } 131 }
132 132
133ct_unsol_event_exit_piocbq: 133ct_unsol_event_exit_piocbq:
134 list_del(&head);
134 if (pmbuf) { 135 if (pmbuf) {
135 list_for_each_entry_safe(matp, next_matp, &pmbuf->list, list) { 136 list_for_each_entry_safe(matp, next_matp, &pmbuf->list, list) {
136 lpfc_mbuf_free(phba, matp->virt, matp->phys); 137 lpfc_mbuf_free(phba, matp->virt, matp->phys);
@@ -481,7 +482,7 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
481 if (CTrsp->CommandResponse.bits.CmdRsp == 482 if (CTrsp->CommandResponse.bits.CmdRsp ==
482 be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { 483 be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) {
483 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 484 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
484 "%d:0239 NameServer Rsp " 485 "%d:0208 NameServer Rsp "
485 "Data: x%x\n", 486 "Data: x%x\n",
486 phba->brd_no, 487 phba->brd_no,
487 phba->fc_flag); 488 phba->fc_flag);
@@ -588,13 +589,9 @@ lpfc_get_hba_sym_node_name(struct lpfc_hba * phba, uint8_t * symbp)
588 589
589 lpfc_decode_firmware_rev(phba, fwrev, 0); 590 lpfc_decode_firmware_rev(phba, fwrev, 0);
590 591
591 if (phba->Port[0]) { 592 sprintf(symbp, "Emulex %s FV%s DV%s", phba->ModelName,
592 sprintf(symbp, "Emulex %s Port %s FV%s DV%s", phba->ModelName, 593 fwrev, lpfc_release_version);
593 phba->Port, fwrev, lpfc_release_version); 594 return;
594 } else {
595 sprintf(symbp, "Emulex %s FV%s DV%s", phba->ModelName,
596 fwrev, lpfc_release_version);
597 }
598} 595}
599 596
600/* 597/*
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index b89f6cb641e6..3567de613162 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -1848,9 +1848,12 @@ static void
1848lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, 1848lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1849 struct lpfc_iocbq * rspiocb) 1849 struct lpfc_iocbq * rspiocb)
1850{ 1850{
1851 IOCB_t *irsp;
1851 struct lpfc_nodelist *ndlp; 1852 struct lpfc_nodelist *ndlp;
1852 LPFC_MBOXQ_t *mbox = NULL; 1853 LPFC_MBOXQ_t *mbox = NULL;
1853 1854
1855 irsp = &rspiocb->iocb;
1856
1854 ndlp = (struct lpfc_nodelist *) cmdiocb->context1; 1857 ndlp = (struct lpfc_nodelist *) cmdiocb->context1;
1855 if (cmdiocb->context_un.mbox) 1858 if (cmdiocb->context_un.mbox)
1856 mbox = cmdiocb->context_un.mbox; 1859 mbox = cmdiocb->context_un.mbox;
@@ -1893,9 +1896,15 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1893 mempool_free( mbox, phba->mbox_mem_pool); 1896 mempool_free( mbox, phba->mbox_mem_pool);
1894 } else { 1897 } else {
1895 mempool_free( mbox, phba->mbox_mem_pool); 1898 mempool_free( mbox, phba->mbox_mem_pool);
1896 if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) { 1899 /* Do not call NO_LIST for lpfc_els_abort'ed ELS cmds */
1897 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1900 if (!((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
1898 ndlp = NULL; 1901 ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) ||
1902 (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) ||
1903 (irsp->un.ulpWord[4] == IOERR_SLI_DOWN)))) {
1904 if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) {
1905 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
1906 ndlp = NULL;
1907 }
1899 } 1908 }
1900 } 1909 }
1901 } 1910 }
@@ -2839,7 +2848,7 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
2839 2848
2840 /* Xmit ELS RPS ACC response tag <ulpIoTag> */ 2849 /* Xmit ELS RPS ACC response tag <ulpIoTag> */
2841 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 2850 lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
2842 "%d:0128 Xmit ELS RPS ACC response tag x%x " 2851 "%d:0118 Xmit ELS RPS ACC response tag x%x "
2843 "Data: x%x x%x x%x x%x x%x\n", 2852 "Data: x%x x%x x%x x%x x%x\n",
2844 phba->brd_no, 2853 phba->brd_no,
2845 elsiocb->iocb.ulpIoTag, 2854 elsiocb->iocb.ulpIoTag,
@@ -2948,7 +2957,7 @@ lpfc_els_rsp_rpl_acc(struct lpfc_hba * phba, uint16_t cmdsize,
2948 2957
2949 /* Xmit ELS RPL ACC response tag <ulpIoTag> */ 2958 /* Xmit ELS RPL ACC response tag <ulpIoTag> */
2950 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 2959 lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
2951 "%d:0128 Xmit ELS RPL ACC response tag x%x " 2960 "%d:0120 Xmit ELS RPL ACC response tag x%x "
2952 "Data: x%x x%x x%x x%x x%x\n", 2961 "Data: x%x x%x x%x x%x x%x\n",
2953 phba->brd_no, 2962 phba->brd_no,
2954 elsiocb->iocb.ulpIoTag, 2963 elsiocb->iocb.ulpIoTag,
@@ -3109,7 +3118,7 @@ lpfc_els_rcv_fan(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
3109 struct lpfc_nodelist *ndlp, *next_ndlp; 3118 struct lpfc_nodelist *ndlp, *next_ndlp;
3110 3119
3111 /* FAN received */ 3120 /* FAN received */
3112 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, "%d:265 FAN received\n", 3121 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, "%d:0265 FAN received\n",
3113 phba->brd_no); 3122 phba->brd_no);
3114 3123
3115 icmd = &cmdiocb->iocb; 3124 icmd = &cmdiocb->iocb;
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 4d6cf990c4fc..b2f1552f1848 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1557,6 +1557,8 @@ lpfc_freenode(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
1557 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 1557 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
1558 } 1558 }
1559 } 1559 }
1560
1561 spin_lock_irq(phba->host->host_lock);
1560 list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { 1562 list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) {
1561 if ((mb->mb.mbxCommand == MBX_REG_LOGIN64) && 1563 if ((mb->mb.mbxCommand == MBX_REG_LOGIN64) &&
1562 (ndlp == (struct lpfc_nodelist *) mb->context2)) { 1564 (ndlp == (struct lpfc_nodelist *) mb->context2)) {
@@ -1569,6 +1571,7 @@ lpfc_freenode(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
1569 mempool_free(mb, phba->mbox_mem_pool); 1571 mempool_free(mb, phba->mbox_mem_pool);
1570 } 1572 }
1571 } 1573 }
1574 spin_unlock_irq(phba->host->host_lock);
1572 1575
1573 lpfc_els_abort(phba,ndlp,0); 1576 lpfc_els_abort(phba,ndlp,0);
1574 spin_lock_irq(phba->host->host_lock); 1577 spin_lock_irq(phba->host->host_lock);
@@ -1782,7 +1785,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1782 /* LOG change to REGLOGIN */ 1785 /* LOG change to REGLOGIN */
1783 /* FIND node DID reglogin */ 1786 /* FIND node DID reglogin */
1784 lpfc_printf_log(phba, KERN_INFO, LOG_NODE, 1787 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1785 "%d:0931 FIND node DID reglogin" 1788 "%d:0901 FIND node DID reglogin"
1786 " Data: x%p x%x x%x x%x\n", 1789 " Data: x%p x%x x%x x%x\n",
1787 phba->brd_no, 1790 phba->brd_no,
1788 ndlp, ndlp->nlp_DID, 1791 ndlp, ndlp->nlp_DID,
@@ -1805,7 +1808,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1805 /* LOG change to PRLI */ 1808 /* LOG change to PRLI */
1806 /* FIND node DID prli */ 1809 /* FIND node DID prli */
1807 lpfc_printf_log(phba, KERN_INFO, LOG_NODE, 1810 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1808 "%d:0931 FIND node DID prli " 1811 "%d:0902 FIND node DID prli "
1809 "Data: x%p x%x x%x x%x\n", 1812 "Data: x%p x%x x%x x%x\n",
1810 phba->brd_no, 1813 phba->brd_no,
1811 ndlp, ndlp->nlp_DID, 1814 ndlp, ndlp->nlp_DID,
@@ -1828,7 +1831,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1828 /* LOG change to NPR */ 1831 /* LOG change to NPR */
1829 /* FIND node DID npr */ 1832 /* FIND node DID npr */
1830 lpfc_printf_log(phba, KERN_INFO, LOG_NODE, 1833 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1831 "%d:0931 FIND node DID npr " 1834 "%d:0903 FIND node DID npr "
1832 "Data: x%p x%x x%x x%x\n", 1835 "Data: x%p x%x x%x x%x\n",
1833 phba->brd_no, 1836 phba->brd_no,
1834 ndlp, ndlp->nlp_DID, 1837 ndlp, ndlp->nlp_DID,
@@ -1851,7 +1854,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1851 /* LOG change to UNUSED */ 1854 /* LOG change to UNUSED */
1852 /* FIND node DID unused */ 1855 /* FIND node DID unused */
1853 lpfc_printf_log(phba, KERN_INFO, LOG_NODE, 1856 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1854 "%d:0931 FIND node DID unused " 1857 "%d:0905 FIND node DID unused "
1855 "Data: x%p x%x x%x x%x\n", 1858 "Data: x%p x%x x%x x%x\n",
1856 phba->brd_no, 1859 phba->brd_no,
1857 ndlp, ndlp->nlp_DID, 1860 ndlp, ndlp->nlp_DID,
@@ -2335,7 +2338,7 @@ lpfc_disc_timeout_handler(struct lpfc_hba *phba)
2335 initlinkmbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 2338 initlinkmbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
2336 if (!initlinkmbox) { 2339 if (!initlinkmbox) {
2337 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2340 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
2338 "%d:0226 Device Discovery " 2341 "%d:0206 Device Discovery "
2339 "completion error\n", 2342 "completion error\n",
2340 phba->brd_no); 2343 phba->brd_no);
2341 phba->hba_state = LPFC_HBA_ERROR; 2344 phba->hba_state = LPFC_HBA_ERROR;
@@ -2365,7 +2368,7 @@ lpfc_disc_timeout_handler(struct lpfc_hba *phba)
2365 if (!clearlambox) { 2368 if (!clearlambox) {
2366 clrlaerr = 1; 2369 clrlaerr = 1;
2367 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2370 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
2368 "%d:0226 Device Discovery " 2371 "%d:0207 Device Discovery "
2369 "completion error\n", 2372 "completion error\n",
2370 phba->brd_no); 2373 phba->brd_no);
2371 phba->hba_state = LPFC_HBA_ERROR; 2374 phba->hba_state = LPFC_HBA_ERROR;
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index ef47b824cbed..f6948ffe689a 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1379,6 +1379,7 @@ lpfc_offline(struct lpfc_hba * phba)
1379 /* stop all timers associated with this hba */ 1379 /* stop all timers associated with this hba */
1380 lpfc_stop_timer(phba); 1380 lpfc_stop_timer(phba);
1381 phba->work_hba_events = 0; 1381 phba->work_hba_events = 0;
1382 phba->work_ha = 0;
1382 1383
1383 lpfc_printf_log(phba, 1384 lpfc_printf_log(phba,
1384 KERN_WARNING, 1385 KERN_WARNING,
@@ -1616,7 +1617,11 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1616 goto out_free_iocbq; 1617 goto out_free_iocbq;
1617 } 1618 }
1618 1619
1619 /* We can rely on a queue depth attribute only after SLI HBA setup */ 1620 /*
1621 * Set initial can_queue value since 0 is no longer supported and
1622 * scsi_add_host will fail. This will be adjusted later based on the
1623 * max xri value determined in hba setup.
1624 */
1620 host->can_queue = phba->cfg_hba_queue_depth - 10; 1625 host->can_queue = phba->cfg_hba_queue_depth - 10;
1621 1626
1622 /* Tell the midlayer we support 16 byte commands */ 1627 /* Tell the midlayer we support 16 byte commands */
@@ -1656,6 +1661,12 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1656 goto out_free_irq; 1661 goto out_free_irq;
1657 } 1662 }
1658 1663
1664 /*
1665 * hba setup may have changed the hba_queue_depth so we need to adjust
1666 * the value of can_queue.
1667 */
1668 host->can_queue = phba->cfg_hba_queue_depth - 10;
1669
1659 lpfc_discovery_wait(phba); 1670 lpfc_discovery_wait(phba);
1660 1671
1661 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { 1672 if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index e42f22aaf71b..4d016c2a1b26 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -651,3 +651,19 @@ lpfc_mbox_get(struct lpfc_hba * phba)
651 651
652 return mbq; 652 return mbq;
653} 653}
654
655int
656lpfc_mbox_tmo_val(struct lpfc_hba *phba, int cmd)
657{
658 switch (cmd) {
659 case MBX_WRITE_NV: /* 0x03 */
660 case MBX_UPDATE_CFG: /* 0x1B */
661 case MBX_DOWN_LOAD: /* 0x1C */
662 case MBX_DEL_LD_ENTRY: /* 0x1D */
663 case MBX_LOAD_AREA: /* 0x81 */
664 case MBX_FLASH_WR_ULA: /* 0x98 */
665 case MBX_LOAD_EXP_ROM: /* 0x9C */
666 return LPFC_MBOX_TMO_FLASH_CMD;
667 }
668 return LPFC_MBOX_TMO;
669}
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index bd0b0e293d63..20449a8dd53d 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -179,7 +179,7 @@ lpfc_els_abort(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
179 179
180 /* Abort outstanding I/O on NPort <nlp_DID> */ 180 /* Abort outstanding I/O on NPort <nlp_DID> */
181 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 181 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
182 "%d:0201 Abort outstanding I/O on NPort x%x " 182 "%d:0205 Abort outstanding I/O on NPort x%x "
183 "Data: x%x x%x x%x\n", 183 "Data: x%x x%x x%x\n",
184 phba->brd_no, ndlp->nlp_DID, ndlp->nlp_flag, 184 phba->brd_no, ndlp->nlp_DID, ndlp->nlp_flag,
185 ndlp->nlp_state, ndlp->nlp_rpi); 185 ndlp->nlp_state, ndlp->nlp_rpi);
@@ -393,6 +393,20 @@ lpfc_rcv_plogi(struct lpfc_hba * phba,
393 mbox->context2 = ndlp; 393 mbox->context2 = ndlp;
394 ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI); 394 ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI);
395 395
396 /*
397 * If there is an outstanding PLOGI issued, abort it before
398 * sending ACC rsp for received PLOGI. If pending plogi
399 * is not canceled here, the plogi will be rejected by
400 * remote port and will be retried. On a configuration with
401 * single discovery thread, this will cause a huge delay in
402 * discovery. Also this will cause multiple state machines
403 * running in parallel for this node.
404 */
405 if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE) {
406 /* software abort outstanding PLOGI */
407 lpfc_els_abort(phba, ndlp, 1);
408 }
409
396 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0); 410 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0);
397 return 1; 411 return 1;
398 412
@@ -1601,7 +1615,13 @@ lpfc_rcv_padisc_npr_node(struct lpfc_hba * phba,
1601 1615
1602 lpfc_rcv_padisc(phba, ndlp, cmdiocb); 1616 lpfc_rcv_padisc(phba, ndlp, cmdiocb);
1603 1617
1604 if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) { 1618 /*
1619 * Do not start discovery if discovery is about to start
1620 * or discovery in progress for this node. Starting discovery
1621 * here will affect the counting of discovery threads.
1622 */
1623 if ((!(ndlp->nlp_flag & NLP_DELAY_TMO)) &&
1624 (ndlp->nlp_flag & NLP_NPR_2B_DISC)){
1605 if (ndlp->nlp_flag & NLP_NPR_ADISC) { 1625 if (ndlp->nlp_flag & NLP_NPR_ADISC) {
1606 ndlp->nlp_prev_state = NLP_STE_NPR_NODE; 1626 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
1607 ndlp->nlp_state = NLP_STE_ADISC_ISSUE; 1627 ndlp->nlp_state = NLP_STE_ADISC_ISSUE;
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index a760a44173df..a8816a8738f8 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -21,6 +21,7 @@
21 21
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/delay.h>
24 25
25#include <scsi/scsi.h> 26#include <scsi/scsi.h>
26#include <scsi/scsi_device.h> 27#include <scsi/scsi_device.h>
@@ -841,6 +842,21 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
841 return 0; 842 return 0;
842} 843}
843 844
845static void
846lpfc_block_error_handler(struct scsi_cmnd *cmnd)
847{
848 struct Scsi_Host *shost = cmnd->device->host;
849 struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
850
851 spin_lock_irq(shost->host_lock);
852 while (rport->port_state == FC_PORTSTATE_BLOCKED) {
853 spin_unlock_irq(shost->host_lock);
854 msleep(1000);
855 spin_lock_irq(shost->host_lock);
856 }
857 spin_unlock_irq(shost->host_lock);
858 return;
859}
844 860
845static int 861static int
846lpfc_abort_handler(struct scsi_cmnd *cmnd) 862lpfc_abort_handler(struct scsi_cmnd *cmnd)
@@ -855,6 +871,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
855 unsigned int loop_count = 0; 871 unsigned int loop_count = 0;
856 int ret = SUCCESS; 872 int ret = SUCCESS;
857 873
874 lpfc_block_error_handler(cmnd);
858 spin_lock_irq(shost->host_lock); 875 spin_lock_irq(shost->host_lock);
859 876
860 lpfc_cmd = (struct lpfc_scsi_buf *)cmnd->host_scribble; 877 lpfc_cmd = (struct lpfc_scsi_buf *)cmnd->host_scribble;
@@ -957,6 +974,7 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
957 int ret = FAILED; 974 int ret = FAILED;
958 int cnt, loopcnt; 975 int cnt, loopcnt;
959 976
977 lpfc_block_error_handler(cmnd);
960 spin_lock_irq(shost->host_lock); 978 spin_lock_irq(shost->host_lock);
961 /* 979 /*
962 * If target is not in a MAPPED state, delay the reset until 980 * If target is not in a MAPPED state, delay the reset until
@@ -1073,6 +1091,7 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
1073 int cnt, loopcnt; 1091 int cnt, loopcnt;
1074 struct lpfc_scsi_buf * lpfc_cmd; 1092 struct lpfc_scsi_buf * lpfc_cmd;
1075 1093
1094 lpfc_block_error_handler(cmnd);
1076 spin_lock_irq(shost->host_lock); 1095 spin_lock_irq(shost->host_lock);
1077 1096
1078 lpfc_cmd = lpfc_get_scsi_buf(phba); 1097 lpfc_cmd = lpfc_get_scsi_buf(phba);
@@ -1104,7 +1123,7 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
1104 ndlp->rport->dd_data); 1123 ndlp->rport->dd_data);
1105 if (ret != SUCCESS) { 1124 if (ret != SUCCESS) {
1106 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 1125 lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
1107 "%d:0713 Bus Reset on target %d failed\n", 1126 "%d:0700 Bus Reset on target %d failed\n",
1108 phba->brd_no, i); 1127 phba->brd_no, i);
1109 err_count++; 1128 err_count++;
1110 } 1129 }
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;
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h
index d8ef0d2894d4..e26de6809358 100644
--- a/drivers/scsi/lpfc/lpfc_sli.h
+++ b/drivers/scsi/lpfc/lpfc_sli.h
@@ -172,6 +172,18 @@ struct lpfc_sli_stat {
172 uint32_t mbox_busy; /* Mailbox cmd busy */ 172 uint32_t mbox_busy; /* Mailbox cmd busy */
173}; 173};
174 174
175/* Structure to store link status values when port stats are reset */
176struct lpfc_lnk_stat {
177 uint32_t link_failure_count;
178 uint32_t loss_of_sync_count;
179 uint32_t loss_of_signal_count;
180 uint32_t prim_seq_protocol_err_count;
181 uint32_t invalid_tx_word_count;
182 uint32_t invalid_crc_count;
183 uint32_t error_frames;
184 uint32_t link_events;
185};
186
175/* Structure used to hold SLI information */ 187/* Structure used to hold SLI information */
176struct lpfc_sli { 188struct lpfc_sli {
177 uint32_t num_rings; 189 uint32_t num_rings;
@@ -201,6 +213,8 @@ struct lpfc_sli {
201 struct lpfc_iocbq ** iocbq_lookup; /* array to lookup IOCB by IOTAG */ 213 struct lpfc_iocbq ** iocbq_lookup; /* array to lookup IOCB by IOTAG */
202 size_t iocbq_lookup_len; /* current lengs of the array */ 214 size_t iocbq_lookup_len; /* current lengs of the array */
203 uint16_t last_iotag; /* last allocated IOTAG */ 215 uint16_t last_iotag; /* last allocated IOTAG */
216 unsigned long stats_start; /* in seconds */
217 struct lpfc_lnk_stat lnk_stat_offsets;
204}; 218};
205 219
206/* Given a pointer to the start of the ring, and the slot number of 220/* Given a pointer to the start of the ring, and the slot number of
@@ -211,3 +225,9 @@ struct lpfc_sli {
211 225
212#define LPFC_MBOX_TMO 30 /* Sec tmo for outstanding mbox 226#define LPFC_MBOX_TMO 30 /* Sec tmo for outstanding mbox
213 command */ 227 command */
228#define LPFC_MBOX_TMO_FLASH_CMD 300 /* Sec tmo for outstanding FLASH write
229 * or erase cmds. This is especially
230 * long because of the potential of
231 * multiple flash erases that can be
232 * spawned.
233 */
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index 10e89c6ae823..c7091ea29f3f 100644
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.h
@@ -18,7 +18,7 @@
18 * included with this package. * 18 * included with this package. *
19 *******************************************************************/ 19 *******************************************************************/
20 20
21#define LPFC_DRIVER_VERSION "8.1.7" 21#define LPFC_DRIVER_VERSION "8.1.9"
22 22
23#define LPFC_DRIVER_NAME "lpfc" 23#define LPFC_DRIVER_NAME "lpfc"
24 24