aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2009-07-19 10:01:03 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-08-22 18:51:56 -0400
commit8fa38513ddc1076f3e26c651f3567b084c273ba2 (patch)
treea13d51bd2b2deced5b2209f52118b53ad1f59bbc
parent66d6faec2f874cf6bf9bd4900966584ea9feae3d (diff)
[SCSI] lpfc 8.3.4: Various SLI4 fixes
Various SLI4 fixes - Fix switch name not used in the FCF record for FCoE HBAs - Enabled HBA UE error polling error-condition action code - Rewrite lpfc_sli4_scmd_to_wqidx_distr() to handle counter rollover cleanly - Modify resume_rpi mailbox data structure to match current SLI4 spec - Do not issue mailbox command in MBX_POLL mode when LPFC_HBA_ERROR is set - Wait for HBA POST completion before checking Online and UE registers - Fix accumulated total length not being filled in on unsolicited IOCBs - Use PCI config space register to determine SLI rev of HBA - Turn on starting ELS tmo function timer during device initialization Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/scsi/lpfc/lpfc.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c66
-rw-r--r--drivers/scsi/lpfc/lpfc_hw4.h74
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c48
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c8
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c90
-rw-r--r--drivers/scsi/lpfc/lpfc_sli4.h1
7 files changed, 190 insertions, 99 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 1877d9811831..8917bb2c5fc2 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -616,6 +616,8 @@ struct lpfc_hba {
616 uint32_t hbq_count; /* Count of configured HBQs */ 616 uint32_t hbq_count; /* Count of configured HBQs */
617 struct hbq_s hbqs[LPFC_MAX_HBQS]; /* local copy of hbq indicies */ 617 struct hbq_s hbqs[LPFC_MAX_HBQS]; /* local copy of hbq indicies */
618 618
619 uint32_t fcp_qidx; /* next work queue to post work to */
620
619 unsigned long pci_bar0_map; /* Physical address for PCI BAR0 */ 621 unsigned long pci_bar0_map; /* Physical address for PCI BAR0 */
620 unsigned long pci_bar1_map; /* Physical address for PCI BAR1 */ 622 unsigned long pci_bar1_map; /* Physical address for PCI BAR1 */
621 unsigned long pci_bar2_map; /* Physical address for PCI BAR2 */ 623 unsigned long pci_bar2_map; /* Physical address for PCI BAR2 */
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index ed46b24a3380..625b2ef3050f 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1054,6 +1054,39 @@ lpfc_fab_name_match(uint8_t *fab_name, struct fcf_record *new_fcf_record)
1054} 1054}
1055 1055
1056/** 1056/**
1057 * lpfc_sw_name_match - Check if the fcf switch name match.
1058 * @fab_name: pointer to fabric name.
1059 * @new_fcf_record: pointer to fcf record.
1060 *
1061 * This routine compare the fcf record's switch name with provided
1062 * switch name. If the switch name are identical this function
1063 * returns 1 else return 0.
1064 **/
1065static uint32_t
1066lpfc_sw_name_match(uint8_t *sw_name, struct fcf_record *new_fcf_record)
1067{
1068 if ((sw_name[0] ==
1069 bf_get(lpfc_fcf_record_switch_name_0, new_fcf_record)) &&
1070 (sw_name[1] ==
1071 bf_get(lpfc_fcf_record_switch_name_1, new_fcf_record)) &&
1072 (sw_name[2] ==
1073 bf_get(lpfc_fcf_record_switch_name_2, new_fcf_record)) &&
1074 (sw_name[3] ==
1075 bf_get(lpfc_fcf_record_switch_name_3, new_fcf_record)) &&
1076 (sw_name[4] ==
1077 bf_get(lpfc_fcf_record_switch_name_4, new_fcf_record)) &&
1078 (sw_name[5] ==
1079 bf_get(lpfc_fcf_record_switch_name_5, new_fcf_record)) &&
1080 (sw_name[6] ==
1081 bf_get(lpfc_fcf_record_switch_name_6, new_fcf_record)) &&
1082 (sw_name[7] ==
1083 bf_get(lpfc_fcf_record_switch_name_7, new_fcf_record)))
1084 return 1;
1085 else
1086 return 0;
1087}
1088
1089/**
1057 * lpfc_mac_addr_match - Check if the fcf mac address match. 1090 * lpfc_mac_addr_match - Check if the fcf mac address match.
1058 * @phba: pointer to lpfc hba data structure. 1091 * @phba: pointer to lpfc hba data structure.
1059 * @new_fcf_record: pointer to fcf record. 1092 * @new_fcf_record: pointer to fcf record.
@@ -1123,6 +1156,22 @@ lpfc_copy_fcf_record(struct lpfc_hba *phba, struct fcf_record *new_fcf_record)
1123 bf_get(lpfc_fcf_record_mac_5, new_fcf_record); 1156 bf_get(lpfc_fcf_record_mac_5, new_fcf_record);
1124 phba->fcf.fcf_indx = bf_get(lpfc_fcf_record_fcf_index, new_fcf_record); 1157 phba->fcf.fcf_indx = bf_get(lpfc_fcf_record_fcf_index, new_fcf_record);
1125 phba->fcf.priority = new_fcf_record->fip_priority; 1158 phba->fcf.priority = new_fcf_record->fip_priority;
1159 phba->fcf.switch_name[0] =
1160 bf_get(lpfc_fcf_record_switch_name_0, new_fcf_record);
1161 phba->fcf.switch_name[1] =
1162 bf_get(lpfc_fcf_record_switch_name_1, new_fcf_record);
1163 phba->fcf.switch_name[2] =
1164 bf_get(lpfc_fcf_record_switch_name_2, new_fcf_record);
1165 phba->fcf.switch_name[3] =
1166 bf_get(lpfc_fcf_record_switch_name_3, new_fcf_record);
1167 phba->fcf.switch_name[4] =
1168 bf_get(lpfc_fcf_record_switch_name_4, new_fcf_record);
1169 phba->fcf.switch_name[5] =
1170 bf_get(lpfc_fcf_record_switch_name_5, new_fcf_record);
1171 phba->fcf.switch_name[6] =
1172 bf_get(lpfc_fcf_record_switch_name_6, new_fcf_record);
1173 phba->fcf.switch_name[7] =
1174 bf_get(lpfc_fcf_record_switch_name_7, new_fcf_record);
1126} 1175}
1127 1176
1128/** 1177/**
@@ -1239,9 +1288,12 @@ lpfc_match_fcf_conn_list(struct lpfc_hba *phba,
1239 1288
1240 if ((conn_entry->conn_rec.flags & FCFCNCT_FBNM_VALID) && 1289 if ((conn_entry->conn_rec.flags & FCFCNCT_FBNM_VALID) &&
1241 !lpfc_fab_name_match(conn_entry->conn_rec.fabric_name, 1290 !lpfc_fab_name_match(conn_entry->conn_rec.fabric_name,
1242 new_fcf_record)) 1291 new_fcf_record))
1292 continue;
1293 if ((conn_entry->conn_rec.flags & FCFCNCT_SWNM_VALID) &&
1294 !lpfc_sw_name_match(conn_entry->conn_rec.switch_name,
1295 new_fcf_record))
1243 continue; 1296 continue;
1244
1245 if (conn_entry->conn_rec.flags & FCFCNCT_VLAN_VALID) { 1297 if (conn_entry->conn_rec.flags & FCFCNCT_VLAN_VALID) {
1246 /* 1298 /*
1247 * If the vlan bit map does not have the bit set for the 1299 * If the vlan bit map does not have the bit set for the
@@ -1424,7 +1476,9 @@ lpfc_mbx_cmpl_read_fcf_record(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1424 spin_lock_irqsave(&phba->hbalock, flags); 1476 spin_lock_irqsave(&phba->hbalock, flags);
1425 if (phba->fcf.fcf_flag & FCF_IN_USE) { 1477 if (phba->fcf.fcf_flag & FCF_IN_USE) {
1426 if (lpfc_fab_name_match(phba->fcf.fabric_name, 1478 if (lpfc_fab_name_match(phba->fcf.fabric_name,
1427 new_fcf_record) && 1479 new_fcf_record) &&
1480 lpfc_sw_name_match(phba->fcf.switch_name,
1481 new_fcf_record) &&
1428 lpfc_mac_addr_match(phba, new_fcf_record)) { 1482 lpfc_mac_addr_match(phba, new_fcf_record)) {
1429 phba->fcf.fcf_flag |= FCF_AVAILABLE; 1483 phba->fcf.fcf_flag |= FCF_AVAILABLE;
1430 spin_unlock_irqrestore(&phba->hbalock, flags); 1484 spin_unlock_irqrestore(&phba->hbalock, flags);
@@ -1464,9 +1518,9 @@ lpfc_mbx_cmpl_read_fcf_record(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1464 * If there is a record with lower priority value for 1518 * If there is a record with lower priority value for
1465 * the current FCF, use that record. 1519 * the current FCF, use that record.
1466 */ 1520 */
1467 if (lpfc_fab_name_match(phba->fcf.fabric_name, new_fcf_record) 1521 if (lpfc_fab_name_match(phba->fcf.fabric_name,
1468 && (new_fcf_record->fip_priority < 1522 new_fcf_record) &&
1469 phba->fcf.priority)) { 1523 (new_fcf_record->fip_priority < phba->fcf.priority)) {
1470 /* Use this FCF record */ 1524 /* Use this FCF record */
1471 lpfc_copy_fcf_record(phba, new_fcf_record); 1525 lpfc_copy_fcf_record(phba, new_fcf_record);
1472 phba->fcf.addr_mode = addr_mode; 1526 phba->fcf.addr_mode = addr_mode;
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 2995d128f07f..3689eee04535 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -52,6 +52,31 @@ struct dma_address {
52 uint32_t addr_hi; 52 uint32_t addr_hi;
53}; 53};
54 54
55#define LPFC_SLIREV_CONF_WORD 0x58
56struct lpfc_sli_intf {
57 uint32_t word0;
58#define lpfc_sli_intf_iftype_MASK 0x00000007
59#define lpfc_sli_intf_iftype_SHIFT 0
60#define lpfc_sli_intf_iftype_WORD word0
61#define lpfc_sli_intf_rev_MASK 0x0000000f
62#define lpfc_sli_intf_rev_SHIFT 4
63#define lpfc_sli_intf_rev_WORD word0
64#define LPFC_SLIREV_CONF_SLI4 4
65#define lpfc_sli_intf_family_MASK 0x000000ff
66#define lpfc_sli_intf_family_SHIFT 8
67#define lpfc_sli_intf_family_WORD word0
68#define lpfc_sli_intf_feat1_MASK 0x000000ff
69#define lpfc_sli_intf_feat1_SHIFT 16
70#define lpfc_sli_intf_feat1_WORD word0
71#define lpfc_sli_intf_feat2_MASK 0x0000001f
72#define lpfc_sli_intf_feat2_SHIFT 24
73#define lpfc_sli_intf_feat2_WORD word0
74#define lpfc_sli_intf_valid_MASK 0x00000007
75#define lpfc_sli_intf_valid_SHIFT 29
76#define lpfc_sli_intf_valid_WORD word0
77#define LPFC_SLI_INTF_VALID 6
78};
79
55#define LPFC_SLI4_BAR0 1 80#define LPFC_SLI4_BAR0 1
56#define LPFC_SLI4_BAR1 2 81#define LPFC_SLI4_BAR1 2
57#define LPFC_SLI4_BAR2 4 82#define LPFC_SLI4_BAR2 4
@@ -1181,6 +1206,32 @@ struct fcf_record {
1181#define lpfc_fcf_record_fcf_state_MASK 0x0000FFFF 1206#define lpfc_fcf_record_fcf_state_MASK 0x0000FFFF
1182#define lpfc_fcf_record_fcf_state_WORD word8 1207#define lpfc_fcf_record_fcf_state_WORD word8
1183 uint8_t vlan_bitmap[512]; 1208 uint8_t vlan_bitmap[512];
1209 uint32_t word137;
1210#define lpfc_fcf_record_switch_name_0_SHIFT 0
1211#define lpfc_fcf_record_switch_name_0_MASK 0x000000FF
1212#define lpfc_fcf_record_switch_name_0_WORD word137
1213#define lpfc_fcf_record_switch_name_1_SHIFT 8
1214#define lpfc_fcf_record_switch_name_1_MASK 0x000000FF
1215#define lpfc_fcf_record_switch_name_1_WORD word137
1216#define lpfc_fcf_record_switch_name_2_SHIFT 16
1217#define lpfc_fcf_record_switch_name_2_MASK 0x000000FF
1218#define lpfc_fcf_record_switch_name_2_WORD word137
1219#define lpfc_fcf_record_switch_name_3_SHIFT 24
1220#define lpfc_fcf_record_switch_name_3_MASK 0x000000FF
1221#define lpfc_fcf_record_switch_name_3_WORD word137
1222 uint32_t word138;
1223#define lpfc_fcf_record_switch_name_4_SHIFT 0
1224#define lpfc_fcf_record_switch_name_4_MASK 0x000000FF
1225#define lpfc_fcf_record_switch_name_4_WORD word138
1226#define lpfc_fcf_record_switch_name_5_SHIFT 8
1227#define lpfc_fcf_record_switch_name_5_MASK 0x000000FF
1228#define lpfc_fcf_record_switch_name_5_WORD word138
1229#define lpfc_fcf_record_switch_name_6_SHIFT 16
1230#define lpfc_fcf_record_switch_name_6_MASK 0x000000FF
1231#define lpfc_fcf_record_switch_name_6_WORD word138
1232#define lpfc_fcf_record_switch_name_7_SHIFT 24
1233#define lpfc_fcf_record_switch_name_7_MASK 0x000000FF
1234#define lpfc_fcf_record_switch_name_7_WORD word138
1184}; 1235};
1185 1236
1186struct lpfc_mbx_read_fcf_tbl { 1237struct lpfc_mbx_read_fcf_tbl {
@@ -1385,20 +1436,17 @@ struct lpfc_mbx_unreg_vfi {
1385 1436
1386struct lpfc_mbx_resume_rpi { 1437struct lpfc_mbx_resume_rpi {
1387 uint32_t word1; 1438 uint32_t word1;
1388#define lpfc_resume_rpi_rpi_SHIFT 0 1439#define lpfc_resume_rpi_index_SHIFT 0
1389#define lpfc_resume_rpi_rpi_MASK 0x0000FFFF 1440#define lpfc_resume_rpi_index_MASK 0x0000FFFF
1390#define lpfc_resume_rpi_rpi_WORD word1 1441#define lpfc_resume_rpi_index_WORD word1
1442#define lpfc_resume_rpi_ii_SHIFT 30
1443#define lpfc_resume_rpi_ii_MASK 0x00000003
1444#define lpfc_resume_rpi_ii_WORD word1
1445#define RESUME_INDEX_RPI 0
1446#define RESUME_INDEX_VPI 1
1447#define RESUME_INDEX_VFI 2
1448#define RESUME_INDEX_FCFI 3
1391 uint32_t event_tag; 1449 uint32_t event_tag;
1392 uint32_t word3_rsvd;
1393 uint32_t word4_rsvd;
1394 uint32_t word5_rsvd;
1395 uint32_t word6;
1396#define lpfc_resume_rpi_vpi_SHIFT 0
1397#define lpfc_resume_rpi_vpi_MASK 0x0000FFFF
1398#define lpfc_resume_rpi_vpi_WORD word6
1399#define lpfc_resume_rpi_vfi_SHIFT 16
1400#define lpfc_resume_rpi_vfi_MASK 0x0000FFFF
1401#define lpfc_resume_rpi_vfi_WORD word6
1402}; 1450};
1403 1451
1404#define REG_FCF_INVALID_QID 0xFFFF 1452#define REG_FCF_INVALID_QID 0xFFFF
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 2452dc9c9014..f8271a587aab 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -4488,23 +4488,6 @@ lpfc_sli4_post_status_check(struct lpfc_hba *phba)
4488 if (!phba->sli4_hba.STAregaddr) 4488 if (!phba->sli4_hba.STAregaddr)
4489 return -ENODEV; 4489 return -ENODEV;
4490 4490
4491 /* With uncoverable error, log the error message and return error */
4492 onlnreg0 = readl(phba->sli4_hba.ONLINE0regaddr);
4493 onlnreg1 = readl(phba->sli4_hba.ONLINE1regaddr);
4494 if ((onlnreg0 != LPFC_ONLINE_NERR) || (onlnreg1 != LPFC_ONLINE_NERR)) {
4495 uerrlo_reg.word0 = readl(phba->sli4_hba.UERRLOregaddr);
4496 uerrhi_reg.word0 = readl(phba->sli4_hba.UERRHIregaddr);
4497 if (uerrlo_reg.word0 || uerrhi_reg.word0) {
4498 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
4499 "1422 HBA Unrecoverable error: "
4500 "uerr_lo_reg=0x%x, uerr_hi_reg=0x%x, "
4501 "online0_reg=0x%x, online1_reg=0x%x\n",
4502 uerrlo_reg.word0, uerrhi_reg.word0,
4503 onlnreg0, onlnreg1);
4504 }
4505 return -ENODEV;
4506 }
4507
4508 /* Wait up to 30 seconds for the SLI Port POST done and ready */ 4491 /* Wait up to 30 seconds for the SLI Port POST done and ready */
4509 for (i = 0; i < 3000; i++) { 4492 for (i = 0; i < 3000; i++) {
4510 sta_reg.word0 = readl(phba->sli4_hba.STAregaddr); 4493 sta_reg.word0 = readl(phba->sli4_hba.STAregaddr);
@@ -4544,6 +4527,23 @@ lpfc_sli4_post_status_check(struct lpfc_hba *phba)
4544 bf_get(lpfc_scratchpad_featurelevel1, &scratchpad), 4527 bf_get(lpfc_scratchpad_featurelevel1, &scratchpad),
4545 bf_get(lpfc_scratchpad_featurelevel2, &scratchpad)); 4528 bf_get(lpfc_scratchpad_featurelevel2, &scratchpad));
4546 4529
4530 /* With uncoverable error, log the error message and return error */
4531 onlnreg0 = readl(phba->sli4_hba.ONLINE0regaddr);
4532 onlnreg1 = readl(phba->sli4_hba.ONLINE1regaddr);
4533 if ((onlnreg0 != LPFC_ONLINE_NERR) || (onlnreg1 != LPFC_ONLINE_NERR)) {
4534 uerrlo_reg.word0 = readl(phba->sli4_hba.UERRLOregaddr);
4535 uerrhi_reg.word0 = readl(phba->sli4_hba.UERRHIregaddr);
4536 if (uerrlo_reg.word0 || uerrhi_reg.word0) {
4537 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
4538 "1422 HBA Unrecoverable error: "
4539 "uerr_lo_reg=0x%x, uerr_hi_reg=0x%x, "
4540 "online0_reg=0x%x, online1_reg=0x%x\n",
4541 uerrlo_reg.word0, uerrhi_reg.word0,
4542 onlnreg0, onlnreg1);
4543 }
4544 return -ENODEV;
4545 }
4546
4547 return port_error; 4547 return port_error;
4548} 4548}
4549 4549
@@ -7635,19 +7635,17 @@ static int __devinit
7635lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) 7635lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
7636{ 7636{
7637 int rc; 7637 int rc;
7638 uint16_t dev_id; 7638 struct lpfc_sli_intf intf;
7639 7639
7640 if (pci_read_config_word(pdev, PCI_DEVICE_ID, &dev_id)) 7640 if (pci_read_config_dword(pdev, LPFC_SLIREV_CONF_WORD, &intf.word0))
7641 return -ENODEV; 7641 return -ENODEV;
7642 7642
7643 switch (dev_id) { 7643 if ((bf_get(lpfc_sli_intf_valid, &intf) == LPFC_SLI_INTF_VALID) &&
7644 case PCI_DEVICE_ID_TIGERSHARK: 7644 (bf_get(lpfc_sli_intf_rev, &intf) == LPFC_SLIREV_CONF_SLI4))
7645 rc = lpfc_pci_probe_one_s4(pdev, pid); 7645 rc = lpfc_pci_probe_one_s4(pdev, pid);
7646 break; 7646 else
7647 default:
7648 rc = lpfc_pci_probe_one_s3(pdev, pid); 7647 rc = lpfc_pci_probe_one_s3(pdev, pid);
7649 break; 7648
7650 }
7651 return rc; 7649 return rc;
7652} 7650}
7653 7651
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 3423571dd1b3..42b4f3841697 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -1938,9 +1938,7 @@ lpfc_resume_rpi(struct lpfcMboxq *mbox, struct lpfc_nodelist *ndlp)
1938 memset(mbox, 0, sizeof(*mbox)); 1938 memset(mbox, 0, sizeof(*mbox));
1939 resume_rpi = &mbox->u.mqe.un.resume_rpi; 1939 resume_rpi = &mbox->u.mqe.un.resume_rpi;
1940 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_RESUME_RPI); 1940 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_RESUME_RPI);
1941 bf_set(lpfc_resume_rpi_rpi, resume_rpi, ndlp->nlp_rpi); 1941 bf_set(lpfc_resume_rpi_index, resume_rpi, ndlp->nlp_rpi);
1942 bf_set(lpfc_resume_rpi_vpi, resume_rpi, 1942 bf_set(lpfc_resume_rpi_ii, resume_rpi, RESUME_INDEX_RPI);
1943 ndlp->vport->vpi + ndlp->vport->phba->vpi_base); 1943 resume_rpi->event_tag = ndlp->phba->fc_eventTag;
1944 bf_set(lpfc_resume_rpi_vfi, resume_rpi,
1945 ndlp->vport->vfi + ndlp->vport->phba->vfi_base);
1946} 1944}
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index acc43b061ba1..04f527ca8f5f 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -4522,12 +4522,8 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4522 lpfc_sli4_rb_setup(phba); 4522 lpfc_sli4_rb_setup(phba);
4523 4523
4524 /* Start the ELS watchdog timer */ 4524 /* Start the ELS watchdog timer */
4525 /* 4525 mod_timer(&vport->els_tmofunc,
4526 * The driver for SLI4 is not yet ready to process timeouts 4526 jiffies + HZ * (phba->fc_ratov * 2));
4527 * or interrupts. Once it is, the comment bars can be removed.
4528 */
4529 /* mod_timer(&vport->els_tmofunc,
4530 * jiffies + HZ * (phba->fc_ratov*2)); */
4531 4527
4532 /* Start heart beat timer */ 4528 /* Start heart beat timer */
4533 mod_timer(&phba->hb_tmofunc, 4529 mod_timer(&phba->hb_tmofunc,
@@ -5279,6 +5275,18 @@ lpfc_sli_issue_mbox_s4(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq,
5279 unsigned long iflags; 5275 unsigned long iflags;
5280 int rc; 5276 int rc;
5281 5277
5278 rc = lpfc_mbox_dev_check(phba);
5279 if (unlikely(rc)) {
5280 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
5281 "(%d):2544 Mailbox command x%x (x%x) "
5282 "cannot issue Data: x%x x%x\n",
5283 mboxq->vport ? mboxq->vport->vpi : 0,
5284 mboxq->u.mb.mbxCommand,
5285 lpfc_sli4_mbox_opcode_get(phba, mboxq),
5286 psli->sli_flag, flag);
5287 goto out_not_finished;
5288 }
5289
5282 /* Detect polling mode and jump to a handler */ 5290 /* Detect polling mode and jump to a handler */
5283 if (!phba->sli4_hba.intr_enable) { 5291 if (!phba->sli4_hba.intr_enable) {
5284 if (flag == MBX_POLL) 5292 if (flag == MBX_POLL)
@@ -5338,17 +5346,6 @@ lpfc_sli_issue_mbox_s4(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq,
5338 psli->sli_flag, flag); 5346 psli->sli_flag, flag);
5339 goto out_not_finished; 5347 goto out_not_finished;
5340 } 5348 }
5341 rc = lpfc_mbox_dev_check(phba);
5342 if (unlikely(rc)) {
5343 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
5344 "(%d):2544 Mailbox command x%x (x%x) "
5345 "cannot issue Data: x%x x%x\n",
5346 mboxq->vport ? mboxq->vport->vpi : 0,
5347 mboxq->u.mb.mbxCommand,
5348 lpfc_sli4_mbox_opcode_get(phba, mboxq),
5349 psli->sli_flag, flag);
5350 goto out_not_finished;
5351 }
5352 5349
5353 /* Put the mailbox command to the driver internal FIFO */ 5350 /* Put the mailbox command to the driver internal FIFO */
5354 psli->slistat.mbox_busy++; 5351 psli->slistat.mbox_busy++;
@@ -5817,19 +5814,21 @@ lpfc_sli4_bpl2sgl(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq,
5817/** 5814/**
5818 * lpfc_sli4_scmd_to_wqidx_distr - scsi command to SLI4 WQ index distribution 5815 * lpfc_sli4_scmd_to_wqidx_distr - scsi command to SLI4 WQ index distribution
5819 * @phba: Pointer to HBA context object. 5816 * @phba: Pointer to HBA context object.
5820 * @piocb: Pointer to command iocb.
5821 * 5817 *
5822 * This routine performs a round robin SCSI command to SLI4 FCP WQ index 5818 * This routine performs a round robin SCSI command to SLI4 FCP WQ index
5823 * distribution. 5819 * distribution. This is called by __lpfc_sli_issue_iocb_s4() with the hbalock
5820 * held.
5824 * 5821 *
5825 * Return: index into SLI4 fast-path FCP queue index. 5822 * Return: index into SLI4 fast-path FCP queue index.
5826 **/ 5823 **/
5827static uint32_t 5824static uint32_t
5828lpfc_sli4_scmd_to_wqidx_distr(struct lpfc_hba *phba, struct lpfc_iocbq *piocb) 5825lpfc_sli4_scmd_to_wqidx_distr(struct lpfc_hba *phba)
5829{ 5826{
5830 static uint32_t fcp_qidx; 5827 ++phba->fcp_qidx;
5828 if (phba->fcp_qidx >= phba->cfg_fcp_wq_count)
5829 phba->fcp_qidx = 0;
5831 5830
5832 return fcp_qidx++ % phba->cfg_fcp_wq_count; 5831 return phba->fcp_qidx;
5833} 5832}
5834 5833
5835/** 5834/**
@@ -6156,7 +6155,7 @@ __lpfc_sli_issue_iocb_s4(struct lpfc_hba *phba, uint32_t ring_number,
6156 return IOCB_ERROR; 6155 return IOCB_ERROR;
6157 6156
6158 if (piocb->iocb_flag & LPFC_IO_FCP) { 6157 if (piocb->iocb_flag & LPFC_IO_FCP) {
6159 fcp_wqidx = lpfc_sli4_scmd_to_wqidx_distr(phba, piocb); 6158 fcp_wqidx = lpfc_sli4_scmd_to_wqidx_distr(phba);
6160 if (lpfc_sli4_wq_put(phba->sli4_hba.fcp_wq[fcp_wqidx], &wqe)) 6159 if (lpfc_sli4_wq_put(phba->sli4_hba.fcp_wq[fcp_wqidx], &wqe))
6161 return IOCB_ERROR; 6160 return IOCB_ERROR;
6162 } else { 6161 } else {
@@ -7678,12 +7677,6 @@ lpfc_sli4_eratt_read(struct lpfc_hba *phba)
7678 "online0_reg=0x%x, online1_reg=0x%x\n", 7677 "online0_reg=0x%x, online1_reg=0x%x\n",
7679 uerr_sta_lo, uerr_sta_hi, 7678 uerr_sta_lo, uerr_sta_hi,
7680 onlnreg0, onlnreg1); 7679 onlnreg0, onlnreg1);
7681 /* TEMP: as the driver error recover logic is not
7682 * fully developed, we just log the error message
7683 * and the device error attention action is now
7684 * temporarily disabled.
7685 */
7686 return 0;
7687 phba->work_status[0] = uerr_sta_lo; 7680 phba->work_status[0] = uerr_sta_lo;
7688 phba->work_status[1] = uerr_sta_hi; 7681 phba->work_status[1] = uerr_sta_hi;
7689 /* Set the driver HA work bitmap */ 7682 /* Set the driver HA work bitmap */
@@ -9499,8 +9492,7 @@ lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint16_t imax)
9499 eq->host_index = 0; 9492 eq->host_index = 0;
9500 eq->hba_index = 0; 9493 eq->hba_index = 0;
9501 9494
9502 if (rc != MBX_TIMEOUT) 9495 mempool_free(mbox, phba->mbox_mem_pool);
9503 mempool_free(mbox, phba->mbox_mem_pool);
9504 return status; 9496 return status;
9505} 9497}
9506 9498
@@ -9604,10 +9596,9 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq,
9604 cq->queue_id = bf_get(lpfc_mbx_cq_create_q_id, &cq_create->u.response); 9596 cq->queue_id = bf_get(lpfc_mbx_cq_create_q_id, &cq_create->u.response);
9605 cq->host_index = 0; 9597 cq->host_index = 0;
9606 cq->hba_index = 0; 9598 cq->hba_index = 0;
9607out:
9608 9599
9609 if (rc != MBX_TIMEOUT) 9600out:
9610 mempool_free(mbox, phba->mbox_mem_pool); 9601 mempool_free(mbox, phba->mbox_mem_pool);
9611 return status; 9602 return status;
9612} 9603}
9613 9604
@@ -9712,8 +9703,7 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq,
9712 /* link the mq onto the parent cq child list */ 9703 /* link the mq onto the parent cq child list */
9713 list_add_tail(&mq->list, &cq->child_list); 9704 list_add_tail(&mq->list, &cq->child_list);
9714out: 9705out:
9715 if (rc != MBX_TIMEOUT) 9706 mempool_free(mbox, phba->mbox_mem_pool);
9716 mempool_free(mbox, phba->mbox_mem_pool);
9717 return status; 9707 return status;
9718} 9708}
9719 9709
@@ -9795,8 +9785,7 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq,
9795 /* link the wq onto the parent cq child list */ 9785 /* link the wq onto the parent cq child list */
9796 list_add_tail(&wq->list, &cq->child_list); 9786 list_add_tail(&wq->list, &cq->child_list);
9797out: 9787out:
9798 if (rc != MBX_TIMEOUT) 9788 mempool_free(mbox, phba->mbox_mem_pool);
9799 mempool_free(mbox, phba->mbox_mem_pool);
9800 return status; 9789 return status;
9801} 9790}
9802 9791
@@ -9970,8 +9959,7 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
9970 list_add_tail(&drq->list, &cq->child_list); 9959 list_add_tail(&drq->list, &cq->child_list);
9971 9960
9972out: 9961out:
9973 if (rc != MBX_TIMEOUT) 9962 mempool_free(mbox, phba->mbox_mem_pool);
9974 mempool_free(mbox, phba->mbox_mem_pool);
9975 return status; 9963 return status;
9976} 9964}
9977 9965
@@ -10026,8 +10014,7 @@ lpfc_eq_destroy(struct lpfc_hba *phba, struct lpfc_queue *eq)
10026 10014
10027 /* Remove eq from any list */ 10015 /* Remove eq from any list */
10028 list_del_init(&eq->list); 10016 list_del_init(&eq->list);
10029 if (rc != MBX_TIMEOUT) 10017 mempool_free(mbox, eq->phba->mbox_mem_pool);
10030 mempool_free(mbox, eq->phba->mbox_mem_pool);
10031 return status; 10018 return status;
10032} 10019}
10033 10020
@@ -10080,8 +10067,7 @@ lpfc_cq_destroy(struct lpfc_hba *phba, struct lpfc_queue *cq)
10080 } 10067 }
10081 /* Remove cq from any list */ 10068 /* Remove cq from any list */
10082 list_del_init(&cq->list); 10069 list_del_init(&cq->list);
10083 if (rc != MBX_TIMEOUT) 10070 mempool_free(mbox, cq->phba->mbox_mem_pool);
10084 mempool_free(mbox, cq->phba->mbox_mem_pool);
10085 return status; 10071 return status;
10086} 10072}
10087 10073
@@ -10134,8 +10120,7 @@ lpfc_mq_destroy(struct lpfc_hba *phba, struct lpfc_queue *mq)
10134 } 10120 }
10135 /* Remove mq from any list */ 10121 /* Remove mq from any list */
10136 list_del_init(&mq->list); 10122 list_del_init(&mq->list);
10137 if (rc != MBX_TIMEOUT) 10123 mempool_free(mbox, mq->phba->mbox_mem_pool);
10138 mempool_free(mbox, mq->phba->mbox_mem_pool);
10139 return status; 10124 return status;
10140} 10125}
10141 10126
@@ -10187,8 +10172,7 @@ lpfc_wq_destroy(struct lpfc_hba *phba, struct lpfc_queue *wq)
10187 } 10172 }
10188 /* Remove wq from any list */ 10173 /* Remove wq from any list */
10189 list_del_init(&wq->list); 10174 list_del_init(&wq->list);
10190 if (rc != MBX_TIMEOUT) 10175 mempool_free(mbox, wq->phba->mbox_mem_pool);
10191 mempool_free(mbox, wq->phba->mbox_mem_pool);
10192 return status; 10176 return status;
10193} 10177}
10194 10178
@@ -10258,8 +10242,7 @@ lpfc_rq_destroy(struct lpfc_hba *phba, struct lpfc_queue *hrq,
10258 } 10242 }
10259 list_del_init(&hrq->list); 10243 list_del_init(&hrq->list);
10260 list_del_init(&drq->list); 10244 list_del_init(&drq->list);
10261 if (rc != MBX_TIMEOUT) 10245 mempool_free(mbox, hrq->phba->mbox_mem_pool);
10262 mempool_free(mbox, hrq->phba->mbox_mem_pool);
10263 return status; 10246 return status;
10264} 10247}
10265 10248
@@ -10933,6 +10916,7 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)
10933 first_iocbq = lpfc_sli_get_iocbq(vport->phba); 10916 first_iocbq = lpfc_sli_get_iocbq(vport->phba);
10934 if (first_iocbq) { 10917 if (first_iocbq) {
10935 /* Initialize the first IOCB. */ 10918 /* Initialize the first IOCB. */
10919 first_iocbq->iocb.unsli3.rcvsli3.acc_len = 0;
10936 first_iocbq->iocb.ulpStatus = IOSTAT_SUCCESS; 10920 first_iocbq->iocb.ulpStatus = IOSTAT_SUCCESS;
10937 first_iocbq->iocb.ulpCommand = CMD_IOCB_RCV_SEQ64_CX; 10921 first_iocbq->iocb.ulpCommand = CMD_IOCB_RCV_SEQ64_CX;
10938 first_iocbq->iocb.ulpContext = be16_to_cpu(fc_hdr->fh_ox_id); 10922 first_iocbq->iocb.ulpContext = be16_to_cpu(fc_hdr->fh_ox_id);
@@ -10945,6 +10929,8 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)
10945 first_iocbq->iocb.un.cont64[0].tus.f.bdeSize = 10929 first_iocbq->iocb.un.cont64[0].tus.f.bdeSize =
10946 LPFC_DATA_BUF_SIZE; 10930 LPFC_DATA_BUF_SIZE;
10947 first_iocbq->iocb.un.rcvels.remoteID = sid; 10931 first_iocbq->iocb.un.rcvels.remoteID = sid;
10932 first_iocbq->iocb.unsli3.rcvsli3.acc_len +=
10933 bf_get(lpfc_rcqe_length, &seq_dmabuf->rcqe);
10948 } 10934 }
10949 iocbq = first_iocbq; 10935 iocbq = first_iocbq;
10950 /* 10936 /*
@@ -10961,6 +10947,8 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)
10961 iocbq->iocb.ulpBdeCount++; 10947 iocbq->iocb.ulpBdeCount++;
10962 iocbq->iocb.unsli3.rcvsli3.bde2.tus.f.bdeSize = 10948 iocbq->iocb.unsli3.rcvsli3.bde2.tus.f.bdeSize =
10963 LPFC_DATA_BUF_SIZE; 10949 LPFC_DATA_BUF_SIZE;
10950 first_iocbq->iocb.unsli3.rcvsli3.acc_len +=
10951 bf_get(lpfc_rcqe_length, &seq_dmabuf->rcqe);
10964 } else { 10952 } else {
10965 iocbq = lpfc_sli_get_iocbq(vport->phba); 10953 iocbq = lpfc_sli_get_iocbq(vport->phba);
10966 if (!iocbq) { 10954 if (!iocbq) {
@@ -10978,6 +10966,8 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)
10978 iocbq->iocb.ulpBdeCount = 1; 10966 iocbq->iocb.ulpBdeCount = 1;
10979 iocbq->iocb.un.cont64[0].tus.f.bdeSize = 10967 iocbq->iocb.un.cont64[0].tus.f.bdeSize =
10980 LPFC_DATA_BUF_SIZE; 10968 LPFC_DATA_BUF_SIZE;
10969 first_iocbq->iocb.unsli3.rcvsli3.acc_len +=
10970 bf_get(lpfc_rcqe_length, &seq_dmabuf->rcqe);
10981 iocbq->iocb.un.rcvels.remoteID = sid; 10971 iocbq->iocb.un.rcvels.remoteID = sid;
10982 list_add_tail(&iocbq->list, &first_iocbq->list); 10972 list_add_tail(&iocbq->list, &first_iocbq->list);
10983 } 10973 }
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index 3b276b47d18f..b6f3e04f3848 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.h
@@ -132,6 +132,7 @@ struct lpfc_sli4_link {
132 132
133struct lpfc_fcf { 133struct lpfc_fcf {
134 uint8_t fabric_name[8]; 134 uint8_t fabric_name[8];
135 uint8_t switch_name[8];
135 uint8_t mac_addr[6]; 136 uint8_t mac_addr[6];
136 uint16_t fcf_indx; 137 uint16_t fcf_indx;
137 uint16_t fcfi; 138 uint16_t fcfi;