diff options
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r-- | drivers/scsi/lpfc/lpfc.h | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 8 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 1 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_els.c | 7 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 11 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hw4.h | 20 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 256 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 39 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 96 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli4.h | 8 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_version.h | 2 |
11 files changed, 326 insertions, 124 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index a184c2443a64..69b59935b53f 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | struct lpfc_sli2_slim; | 28 | struct lpfc_sli2_slim; |
29 | 29 | ||
30 | #define ELX_MODEL_NAME_SIZE 80 | ||
31 | |||
30 | #define LPFC_PCI_DEV_LP 0x1 | 32 | #define LPFC_PCI_DEV_LP 0x1 |
31 | #define LPFC_PCI_DEV_OC 0x2 | 33 | #define LPFC_PCI_DEV_OC 0x2 |
32 | 34 | ||
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index b032562aa0d9..ad16e54ac383 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -3935,6 +3935,12 @@ MODULE_PARM_DESC(lpfc_fcp_look_ahead, "Look ahead for completions"); | |||
3935 | # - Only meaningful if BG is turned on (lpfc_enable_bg=1). | 3935 | # - Only meaningful if BG is turned on (lpfc_enable_bg=1). |
3936 | # - Allows you to ultimately specify which profiles to use | 3936 | # - Allows you to ultimately specify which profiles to use |
3937 | # - Default will result in registering capabilities for all profiles. | 3937 | # - Default will result in registering capabilities for all profiles. |
3938 | # - SHOST_DIF_TYPE1_PROTECTION 1 | ||
3939 | # HBA supports T10 DIF Type 1: HBA to Target Type 1 Protection | ||
3940 | # - SHOST_DIX_TYPE0_PROTECTION 8 | ||
3941 | # HBA supports DIX Type 0: Host to HBA protection only | ||
3942 | # - SHOST_DIX_TYPE1_PROTECTION 16 | ||
3943 | # HBA supports DIX Type 1: Host to HBA Type 1 protection | ||
3938 | # | 3944 | # |
3939 | */ | 3945 | */ |
3940 | unsigned int lpfc_prot_mask = SHOST_DIF_TYPE1_PROTECTION | | 3946 | unsigned int lpfc_prot_mask = SHOST_DIF_TYPE1_PROTECTION | |
@@ -3947,7 +3953,7 @@ MODULE_PARM_DESC(lpfc_prot_mask, "host protection mask"); | |||
3947 | /* | 3953 | /* |
3948 | # lpfc_prot_guard: i | 3954 | # lpfc_prot_guard: i |
3949 | # - Bit mask of protection guard types to register with the SCSI mid-layer | 3955 | # - Bit mask of protection guard types to register with the SCSI mid-layer |
3950 | # - Guard types are currently either 1) IP checksum 2) T10-DIF CRC | 3956 | # - Guard types are currently either 1) T10-DIF CRC 2) IP checksum |
3951 | # - Allows you to ultimately specify which profiles to use | 3957 | # - Allows you to ultimately specify which profiles to use |
3952 | # - Default will result in registering capabilities for all guard types | 3958 | # - Default will result in registering capabilities for all guard types |
3953 | # | 3959 | # |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index e470c489de07..4380a44000bc 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -467,3 +467,4 @@ int lpfc_sli4_read_config(struct lpfc_hba *); | |||
467 | void lpfc_sli4_node_prep(struct lpfc_hba *); | 467 | void lpfc_sli4_node_prep(struct lpfc_hba *); |
468 | int lpfc_sli4_xri_sgl_update(struct lpfc_hba *); | 468 | int lpfc_sli4_xri_sgl_update(struct lpfc_hba *); |
469 | void lpfc_free_sgl_list(struct lpfc_hba *, struct list_head *); | 469 | void lpfc_free_sgl_list(struct lpfc_hba *, struct list_head *); |
470 | uint32_t lpfc_sli_port_speed_get(struct lpfc_hba *); | ||
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index cfe533bc9790..f19e9b6f9f13 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -809,6 +809,8 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
809 | phba->fc_ratov = FF_DEF_RATOV; | 809 | phba->fc_ratov = FF_DEF_RATOV; |
810 | rc = memcmp(&vport->fc_portname, &sp->portName, | 810 | rc = memcmp(&vport->fc_portname, &sp->portName, |
811 | sizeof(vport->fc_portname)); | 811 | sizeof(vport->fc_portname)); |
812 | memcpy(&phba->fc_fabparam, sp, sizeof(struct serv_parm)); | ||
813 | |||
812 | if (rc >= 0) { | 814 | if (rc >= 0) { |
813 | /* This side will initiate the PLOGI */ | 815 | /* This side will initiate the PLOGI */ |
814 | spin_lock_irq(shost->host_lock); | 816 | spin_lock_irq(shost->host_lock); |
@@ -3160,7 +3162,8 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
3160 | retry = 1; | 3162 | retry = 1; |
3161 | break; | 3163 | break; |
3162 | } | 3164 | } |
3163 | if (cmd == ELS_CMD_PLOGI) { | 3165 | if ((cmd == ELS_CMD_PLOGI) || |
3166 | (cmd == ELS_CMD_PRLI)) { | ||
3164 | delay = 1000; | 3167 | delay = 1000; |
3165 | maxretry = lpfc_max_els_tries + 1; | 3168 | maxretry = lpfc_max_els_tries + 1; |
3166 | retry = 1; | 3169 | retry = 1; |
@@ -3305,7 +3308,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
3305 | ndlp->nlp_prev_state = ndlp->nlp_state; | 3308 | ndlp->nlp_prev_state = ndlp->nlp_state; |
3306 | if (cmd == ELS_CMD_PRLI) | 3309 | if (cmd == ELS_CMD_PRLI) |
3307 | lpfc_nlp_set_state(vport, ndlp, | 3310 | lpfc_nlp_set_state(vport, ndlp, |
3308 | NLP_STE_REG_LOGIN_ISSUE); | 3311 | NLP_STE_PRLI_ISSUE); |
3309 | else | 3312 | else |
3310 | lpfc_nlp_set_state(vport, ndlp, | 3313 | lpfc_nlp_set_state(vport, ndlp, |
3311 | NLP_STE_NPR_NODE); | 3314 | NLP_STE_NPR_NODE); |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index e9845d2ecf10..d7096ad94d3f 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -1506,9 +1506,10 @@ lpfc_match_fcf_conn_list(struct lpfc_hba *phba, | |||
1506 | } | 1506 | } |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | /* If FCF not available return 0 */ | 1509 | /* FCF not valid/available or solicitation in progress */ |
1510 | if (!bf_get(lpfc_fcf_record_fcf_avail, new_fcf_record) || | 1510 | if (!bf_get(lpfc_fcf_record_fcf_avail, new_fcf_record) || |
1511 | !bf_get(lpfc_fcf_record_fcf_valid, new_fcf_record)) | 1511 | !bf_get(lpfc_fcf_record_fcf_valid, new_fcf_record) || |
1512 | bf_get(lpfc_fcf_record_fcf_sol, new_fcf_record)) | ||
1512 | return 0; | 1513 | return 0; |
1513 | 1514 | ||
1514 | if (!(phba->hba_flag & HBA_FIP_SUPPORT)) { | 1515 | if (!(phba->hba_flag & HBA_FIP_SUPPORT)) { |
@@ -1842,6 +1843,7 @@ lpfc_sli4_log_fcf_record_info(struct lpfc_hba *phba, | |||
1842 | "\tFCF_Index : x%x\n" | 1843 | "\tFCF_Index : x%x\n" |
1843 | "\tFCF_Avail : x%x\n" | 1844 | "\tFCF_Avail : x%x\n" |
1844 | "\tFCF_Valid : x%x\n" | 1845 | "\tFCF_Valid : x%x\n" |
1846 | "\tFCF_SOL : x%x\n" | ||
1845 | "\tFIP_Priority : x%x\n" | 1847 | "\tFIP_Priority : x%x\n" |
1846 | "\tMAC_Provider : x%x\n" | 1848 | "\tMAC_Provider : x%x\n" |
1847 | "\tLowest VLANID : x%x\n" | 1849 | "\tLowest VLANID : x%x\n" |
@@ -1852,6 +1854,7 @@ lpfc_sli4_log_fcf_record_info(struct lpfc_hba *phba, | |||
1852 | bf_get(lpfc_fcf_record_fcf_index, fcf_record), | 1854 | bf_get(lpfc_fcf_record_fcf_index, fcf_record), |
1853 | bf_get(lpfc_fcf_record_fcf_avail, fcf_record), | 1855 | bf_get(lpfc_fcf_record_fcf_avail, fcf_record), |
1854 | bf_get(lpfc_fcf_record_fcf_valid, fcf_record), | 1856 | bf_get(lpfc_fcf_record_fcf_valid, fcf_record), |
1857 | bf_get(lpfc_fcf_record_fcf_sol, fcf_record), | ||
1855 | fcf_record->fip_priority, | 1858 | fcf_record->fip_priority, |
1856 | bf_get(lpfc_fcf_record_mac_addr_prov, fcf_record), | 1859 | bf_get(lpfc_fcf_record_mac_addr_prov, fcf_record), |
1857 | vlan_id, | 1860 | vlan_id, |
@@ -2185,12 +2188,14 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
2185 | new_fcf_record)); | 2188 | new_fcf_record)); |
2186 | lpfc_printf_log(phba, KERN_WARNING, LOG_FIP, | 2189 | lpfc_printf_log(phba, KERN_WARNING, LOG_FIP, |
2187 | "2781 FCF (x%x) failed connection " | 2190 | "2781 FCF (x%x) failed connection " |
2188 | "list check: (x%x/x%x)\n", | 2191 | "list check: (x%x/x%x/%x)\n", |
2189 | bf_get(lpfc_fcf_record_fcf_index, | 2192 | bf_get(lpfc_fcf_record_fcf_index, |
2190 | new_fcf_record), | 2193 | new_fcf_record), |
2191 | bf_get(lpfc_fcf_record_fcf_avail, | 2194 | bf_get(lpfc_fcf_record_fcf_avail, |
2192 | new_fcf_record), | 2195 | new_fcf_record), |
2193 | bf_get(lpfc_fcf_record_fcf_valid, | 2196 | bf_get(lpfc_fcf_record_fcf_valid, |
2197 | new_fcf_record), | ||
2198 | bf_get(lpfc_fcf_record_fcf_sol, | ||
2194 | new_fcf_record)); | 2199 | new_fcf_record)); |
2195 | if ((phba->fcf.fcf_flag & FCF_IN_USE) && | 2200 | if ((phba->fcf.fcf_flag & FCF_IN_USE) && |
2196 | lpfc_sli4_fcf_record_match(phba, &phba->fcf.current_rec, | 2201 | lpfc_sli4_fcf_record_match(phba, &phba->fcf.current_rec, |
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 834b699cac76..2cdeb5434fb7 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h | |||
@@ -1305,6 +1305,11 @@ struct lpfc_mbx_mq_create_ext { | |||
1305 | #define lpfc_mbx_mq_create_ext_async_evt_link_SHIFT LPFC_TRAILER_CODE_LINK | 1305 | #define lpfc_mbx_mq_create_ext_async_evt_link_SHIFT LPFC_TRAILER_CODE_LINK |
1306 | #define lpfc_mbx_mq_create_ext_async_evt_link_MASK 0x00000001 | 1306 | #define lpfc_mbx_mq_create_ext_async_evt_link_MASK 0x00000001 |
1307 | #define lpfc_mbx_mq_create_ext_async_evt_link_WORD async_evt_bmap | 1307 | #define lpfc_mbx_mq_create_ext_async_evt_link_WORD async_evt_bmap |
1308 | #define LPFC_EVT_CODE_LINK_NO_LINK 0x0 | ||
1309 | #define LPFC_EVT_CODE_LINK_10_MBIT 0x1 | ||
1310 | #define LPFC_EVT_CODE_LINK_100_MBIT 0x2 | ||
1311 | #define LPFC_EVT_CODE_LINK_1_GBIT 0x3 | ||
1312 | #define LPFC_EVT_CODE_LINK_10_GBIT 0x4 | ||
1308 | #define lpfc_mbx_mq_create_ext_async_evt_fip_SHIFT LPFC_TRAILER_CODE_FCOE | 1313 | #define lpfc_mbx_mq_create_ext_async_evt_fip_SHIFT LPFC_TRAILER_CODE_FCOE |
1309 | #define lpfc_mbx_mq_create_ext_async_evt_fip_MASK 0x00000001 | 1314 | #define lpfc_mbx_mq_create_ext_async_evt_fip_MASK 0x00000001 |
1310 | #define lpfc_mbx_mq_create_ext_async_evt_fip_WORD async_evt_bmap | 1315 | #define lpfc_mbx_mq_create_ext_async_evt_fip_WORD async_evt_bmap |
@@ -1314,6 +1319,13 @@ struct lpfc_mbx_mq_create_ext { | |||
1314 | #define lpfc_mbx_mq_create_ext_async_evt_fc_SHIFT LPFC_TRAILER_CODE_FC | 1319 | #define lpfc_mbx_mq_create_ext_async_evt_fc_SHIFT LPFC_TRAILER_CODE_FC |
1315 | #define lpfc_mbx_mq_create_ext_async_evt_fc_MASK 0x00000001 | 1320 | #define lpfc_mbx_mq_create_ext_async_evt_fc_MASK 0x00000001 |
1316 | #define lpfc_mbx_mq_create_ext_async_evt_fc_WORD async_evt_bmap | 1321 | #define lpfc_mbx_mq_create_ext_async_evt_fc_WORD async_evt_bmap |
1322 | #define LPFC_EVT_CODE_FC_NO_LINK 0x0 | ||
1323 | #define LPFC_EVT_CODE_FC_1_GBAUD 0x1 | ||
1324 | #define LPFC_EVT_CODE_FC_2_GBAUD 0x2 | ||
1325 | #define LPFC_EVT_CODE_FC_4_GBAUD 0x4 | ||
1326 | #define LPFC_EVT_CODE_FC_8_GBAUD 0x8 | ||
1327 | #define LPFC_EVT_CODE_FC_10_GBAUD 0xA | ||
1328 | #define LPFC_EVT_CODE_FC_16_GBAUD 0x10 | ||
1317 | #define lpfc_mbx_mq_create_ext_async_evt_sli_SHIFT LPFC_TRAILER_CODE_SLI | 1329 | #define lpfc_mbx_mq_create_ext_async_evt_sli_SHIFT LPFC_TRAILER_CODE_SLI |
1318 | #define lpfc_mbx_mq_create_ext_async_evt_sli_MASK 0x00000001 | 1330 | #define lpfc_mbx_mq_create_ext_async_evt_sli_MASK 0x00000001 |
1319 | #define lpfc_mbx_mq_create_ext_async_evt_sli_WORD async_evt_bmap | 1331 | #define lpfc_mbx_mq_create_ext_async_evt_sli_WORD async_evt_bmap |
@@ -1695,8 +1707,14 @@ struct fcf_record { | |||
1695 | #define lpfc_fcf_record_fc_map_2_MASK 0x000000FF | 1707 | #define lpfc_fcf_record_fc_map_2_MASK 0x000000FF |
1696 | #define lpfc_fcf_record_fc_map_2_WORD word7 | 1708 | #define lpfc_fcf_record_fc_map_2_WORD word7 |
1697 | #define lpfc_fcf_record_fcf_valid_SHIFT 24 | 1709 | #define lpfc_fcf_record_fcf_valid_SHIFT 24 |
1698 | #define lpfc_fcf_record_fcf_valid_MASK 0x000000FF | 1710 | #define lpfc_fcf_record_fcf_valid_MASK 0x00000001 |
1699 | #define lpfc_fcf_record_fcf_valid_WORD word7 | 1711 | #define lpfc_fcf_record_fcf_valid_WORD word7 |
1712 | #define lpfc_fcf_record_fcf_fc_SHIFT 25 | ||
1713 | #define lpfc_fcf_record_fcf_fc_MASK 0x00000001 | ||
1714 | #define lpfc_fcf_record_fcf_fc_WORD word7 | ||
1715 | #define lpfc_fcf_record_fcf_sol_SHIFT 31 | ||
1716 | #define lpfc_fcf_record_fcf_sol_MASK 0x00000001 | ||
1717 | #define lpfc_fcf_record_fcf_sol_WORD word7 | ||
1700 | uint32_t word8; | 1718 | uint32_t word8; |
1701 | #define lpfc_fcf_record_fcf_index_SHIFT 0 | 1719 | #define lpfc_fcf_record_fcf_index_SHIFT 0 |
1702 | #define lpfc_fcf_record_fcf_index_MASK 0x0000FFFF | 1720 | #define lpfc_fcf_record_fcf_index_MASK 0x0000FFFF |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 8a55a586dd65..7dc4218d9c4c 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -1892,8 +1892,10 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) | |||
1892 | max_speed = 4; | 1892 | max_speed = 4; |
1893 | else if (phba->lmt & LMT_2Gb) | 1893 | else if (phba->lmt & LMT_2Gb) |
1894 | max_speed = 2; | 1894 | max_speed = 2; |
1895 | else | 1895 | else if (phba->lmt & LMT_1Gb) |
1896 | max_speed = 1; | 1896 | max_speed = 1; |
1897 | else | ||
1898 | max_speed = 0; | ||
1897 | 1899 | ||
1898 | vp = &phba->vpd; | 1900 | vp = &phba->vpd; |
1899 | 1901 | ||
@@ -2078,9 +2080,13 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) | |||
2078 | if (descp && descp[0] == '\0') { | 2080 | if (descp && descp[0] == '\0') { |
2079 | if (oneConnect) | 2081 | if (oneConnect) |
2080 | snprintf(descp, 255, | 2082 | snprintf(descp, 255, |
2081 | "Emulex OneConnect %s, %s Initiator, Port %s", | 2083 | "Emulex OneConnect %s, %s Initiator %s", |
2082 | m.name, m.function, | 2084 | m.name, m.function, |
2083 | phba->Port); | 2085 | phba->Port); |
2086 | else if (max_speed == 0) | ||
2087 | snprintf(descp, 255, | ||
2088 | "Emulex %s %s %s ", | ||
2089 | m.name, m.bus, m.function); | ||
2084 | else | 2090 | else |
2085 | snprintf(descp, 255, | 2091 | snprintf(descp, 255, |
2086 | "Emulex %s %d%s %s %s", | 2092 | "Emulex %s %d%s %s %s", |
@@ -3502,6 +3508,119 @@ lpfc_sli4_parse_latt_link_speed(struct lpfc_hba *phba, | |||
3502 | } | 3508 | } |
3503 | 3509 | ||
3504 | /** | 3510 | /** |
3511 | * lpfc_sli_port_speed_get - Get sli3 link speed code to link speed | ||
3512 | * @phba: pointer to lpfc hba data structure. | ||
3513 | * | ||
3514 | * This routine is to get an SLI3 FC port's link speed in Mbps. | ||
3515 | * | ||
3516 | * Return: link speed in terms of Mbps. | ||
3517 | **/ | ||
3518 | uint32_t | ||
3519 | lpfc_sli_port_speed_get(struct lpfc_hba *phba) | ||
3520 | { | ||
3521 | uint32_t link_speed; | ||
3522 | |||
3523 | if (!lpfc_is_link_up(phba)) | ||
3524 | return 0; | ||
3525 | |||
3526 | switch (phba->fc_linkspeed) { | ||
3527 | case LPFC_LINK_SPEED_1GHZ: | ||
3528 | link_speed = 1000; | ||
3529 | break; | ||
3530 | case LPFC_LINK_SPEED_2GHZ: | ||
3531 | link_speed = 2000; | ||
3532 | break; | ||
3533 | case LPFC_LINK_SPEED_4GHZ: | ||
3534 | link_speed = 4000; | ||
3535 | break; | ||
3536 | case LPFC_LINK_SPEED_8GHZ: | ||
3537 | link_speed = 8000; | ||
3538 | break; | ||
3539 | case LPFC_LINK_SPEED_10GHZ: | ||
3540 | link_speed = 10000; | ||
3541 | break; | ||
3542 | case LPFC_LINK_SPEED_16GHZ: | ||
3543 | link_speed = 16000; | ||
3544 | break; | ||
3545 | default: | ||
3546 | link_speed = 0; | ||
3547 | } | ||
3548 | return link_speed; | ||
3549 | } | ||
3550 | |||
3551 | /** | ||
3552 | * lpfc_sli4_port_speed_parse - Parse async evt link speed code to link speed | ||
3553 | * @phba: pointer to lpfc hba data structure. | ||
3554 | * @evt_code: asynchronous event code. | ||
3555 | * @speed_code: asynchronous event link speed code. | ||
3556 | * | ||
3557 | * This routine is to parse the giving SLI4 async event link speed code into | ||
3558 | * value of Mbps for the link speed. | ||
3559 | * | ||
3560 | * Return: link speed in terms of Mbps. | ||
3561 | **/ | ||
3562 | static uint32_t | ||
3563 | lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, | ||
3564 | uint8_t speed_code) | ||
3565 | { | ||
3566 | uint32_t port_speed; | ||
3567 | |||
3568 | switch (evt_code) { | ||
3569 | case LPFC_TRAILER_CODE_LINK: | ||
3570 | switch (speed_code) { | ||
3571 | case LPFC_EVT_CODE_LINK_NO_LINK: | ||
3572 | port_speed = 0; | ||
3573 | break; | ||
3574 | case LPFC_EVT_CODE_LINK_10_MBIT: | ||
3575 | port_speed = 10; | ||
3576 | break; | ||
3577 | case LPFC_EVT_CODE_LINK_100_MBIT: | ||
3578 | port_speed = 100; | ||
3579 | break; | ||
3580 | case LPFC_EVT_CODE_LINK_1_GBIT: | ||
3581 | port_speed = 1000; | ||
3582 | break; | ||
3583 | case LPFC_EVT_CODE_LINK_10_GBIT: | ||
3584 | port_speed = 10000; | ||
3585 | break; | ||
3586 | default: | ||
3587 | port_speed = 0; | ||
3588 | } | ||
3589 | break; | ||
3590 | case LPFC_TRAILER_CODE_FC: | ||
3591 | switch (speed_code) { | ||
3592 | case LPFC_EVT_CODE_FC_NO_LINK: | ||
3593 | port_speed = 0; | ||
3594 | break; | ||
3595 | case LPFC_EVT_CODE_FC_1_GBAUD: | ||
3596 | port_speed = 1000; | ||
3597 | break; | ||
3598 | case LPFC_EVT_CODE_FC_2_GBAUD: | ||
3599 | port_speed = 2000; | ||
3600 | break; | ||
3601 | case LPFC_EVT_CODE_FC_4_GBAUD: | ||
3602 | port_speed = 4000; | ||
3603 | break; | ||
3604 | case LPFC_EVT_CODE_FC_8_GBAUD: | ||
3605 | port_speed = 8000; | ||
3606 | break; | ||
3607 | case LPFC_EVT_CODE_FC_10_GBAUD: | ||
3608 | port_speed = 10000; | ||
3609 | break; | ||
3610 | case LPFC_EVT_CODE_FC_16_GBAUD: | ||
3611 | port_speed = 16000; | ||
3612 | break; | ||
3613 | default: | ||
3614 | port_speed = 0; | ||
3615 | } | ||
3616 | break; | ||
3617 | default: | ||
3618 | port_speed = 0; | ||
3619 | } | ||
3620 | return port_speed; | ||
3621 | } | ||
3622 | |||
3623 | /** | ||
3505 | * lpfc_sli4_async_link_evt - Process the asynchronous FCoE link event | 3624 | * lpfc_sli4_async_link_evt - Process the asynchronous FCoE link event |
3506 | * @phba: pointer to lpfc hba data structure. | 3625 | * @phba: pointer to lpfc hba data structure. |
3507 | * @acqe_link: pointer to the async link completion queue entry. | 3626 | * @acqe_link: pointer to the async link completion queue entry. |
@@ -3558,7 +3677,8 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, | |||
3558 | 3677 | ||
3559 | /* Keep the link status for extra SLI4 state machine reference */ | 3678 | /* Keep the link status for extra SLI4 state machine reference */ |
3560 | phba->sli4_hba.link_state.speed = | 3679 | phba->sli4_hba.link_state.speed = |
3561 | bf_get(lpfc_acqe_link_speed, acqe_link); | 3680 | lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_LINK, |
3681 | bf_get(lpfc_acqe_link_speed, acqe_link)); | ||
3562 | phba->sli4_hba.link_state.duplex = | 3682 | phba->sli4_hba.link_state.duplex = |
3563 | bf_get(lpfc_acqe_link_duplex, acqe_link); | 3683 | bf_get(lpfc_acqe_link_duplex, acqe_link); |
3564 | phba->sli4_hba.link_state.status = | 3684 | phba->sli4_hba.link_state.status = |
@@ -3570,7 +3690,8 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, | |||
3570 | phba->sli4_hba.link_state.fault = | 3690 | phba->sli4_hba.link_state.fault = |
3571 | bf_get(lpfc_acqe_link_fault, acqe_link); | 3691 | bf_get(lpfc_acqe_link_fault, acqe_link); |
3572 | phba->sli4_hba.link_state.logical_speed = | 3692 | phba->sli4_hba.link_state.logical_speed = |
3573 | bf_get(lpfc_acqe_logical_link_speed, acqe_link); | 3693 | bf_get(lpfc_acqe_logical_link_speed, acqe_link) * 10; |
3694 | |||
3574 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 3695 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
3575 | "2900 Async FC/FCoE Link event - Speed:%dGBit " | 3696 | "2900 Async FC/FCoE Link event - Speed:%dGBit " |
3576 | "duplex:x%x LA Type:x%x Port Type:%d Port Number:%d " | 3697 | "duplex:x%x LA Type:x%x Port Type:%d Port Number:%d " |
@@ -3580,7 +3701,7 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, | |||
3580 | phba->sli4_hba.link_state.status, | 3701 | phba->sli4_hba.link_state.status, |
3581 | phba->sli4_hba.link_state.type, | 3702 | phba->sli4_hba.link_state.type, |
3582 | phba->sli4_hba.link_state.number, | 3703 | phba->sli4_hba.link_state.number, |
3583 | phba->sli4_hba.link_state.logical_speed * 10, | 3704 | phba->sli4_hba.link_state.logical_speed, |
3584 | phba->sli4_hba.link_state.fault); | 3705 | phba->sli4_hba.link_state.fault); |
3585 | /* | 3706 | /* |
3586 | * For FC Mode: issue the READ_TOPOLOGY mailbox command to fetch | 3707 | * For FC Mode: issue the READ_TOPOLOGY mailbox command to fetch |
@@ -3652,7 +3773,8 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) | |||
3652 | } | 3773 | } |
3653 | /* Keep the link status for extra SLI4 state machine reference */ | 3774 | /* Keep the link status for extra SLI4 state machine reference */ |
3654 | phba->sli4_hba.link_state.speed = | 3775 | phba->sli4_hba.link_state.speed = |
3655 | bf_get(lpfc_acqe_fc_la_speed, acqe_fc); | 3776 | lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, |
3777 | bf_get(lpfc_acqe_fc_la_speed, acqe_fc)); | ||
3656 | phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; | 3778 | phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; |
3657 | phba->sli4_hba.link_state.topology = | 3779 | phba->sli4_hba.link_state.topology = |
3658 | bf_get(lpfc_acqe_fc_la_topology, acqe_fc); | 3780 | bf_get(lpfc_acqe_fc_la_topology, acqe_fc); |
@@ -3665,7 +3787,7 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) | |||
3665 | phba->sli4_hba.link_state.fault = | 3787 | phba->sli4_hba.link_state.fault = |
3666 | bf_get(lpfc_acqe_link_fault, acqe_fc); | 3788 | bf_get(lpfc_acqe_link_fault, acqe_fc); |
3667 | phba->sli4_hba.link_state.logical_speed = | 3789 | phba->sli4_hba.link_state.logical_speed = |
3668 | bf_get(lpfc_acqe_fc_la_llink_spd, acqe_fc); | 3790 | bf_get(lpfc_acqe_fc_la_llink_spd, acqe_fc) * 10; |
3669 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 3791 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
3670 | "2896 Async FC event - Speed:%dGBaud Topology:x%x " | 3792 | "2896 Async FC event - Speed:%dGBaud Topology:x%x " |
3671 | "LA Type:x%x Port Type:%d Port Number:%d Logical speed:" | 3793 | "LA Type:x%x Port Type:%d Port Number:%d Logical speed:" |
@@ -3675,7 +3797,7 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) | |||
3675 | phba->sli4_hba.link_state.status, | 3797 | phba->sli4_hba.link_state.status, |
3676 | phba->sli4_hba.link_state.type, | 3798 | phba->sli4_hba.link_state.type, |
3677 | phba->sli4_hba.link_state.number, | 3799 | phba->sli4_hba.link_state.number, |
3678 | phba->sli4_hba.link_state.logical_speed * 10, | 3800 | phba->sli4_hba.link_state.logical_speed, |
3679 | phba->sli4_hba.link_state.fault); | 3801 | phba->sli4_hba.link_state.fault); |
3680 | pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 3802 | pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
3681 | if (!pmb) { | 3803 | if (!pmb) { |
@@ -3783,14 +3905,18 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli) | |||
3783 | case LPFC_SLI_EVENT_STATUS_VALID: | 3905 | case LPFC_SLI_EVENT_STATUS_VALID: |
3784 | return; /* no message if the sfp is okay */ | 3906 | return; /* no message if the sfp is okay */ |
3785 | case LPFC_SLI_EVENT_STATUS_NOT_PRESENT: | 3907 | case LPFC_SLI_EVENT_STATUS_NOT_PRESENT: |
3786 | sprintf(message, "Not installed"); | 3908 | sprintf(message, "Optics faulted/incorrectly installed/not " \ |
3909 | "installed - Reseat optics, if issue not " | ||
3910 | "resolved, replace."); | ||
3787 | break; | 3911 | break; |
3788 | case LPFC_SLI_EVENT_STATUS_WRONG_TYPE: | 3912 | case LPFC_SLI_EVENT_STATUS_WRONG_TYPE: |
3789 | sprintf(message, | 3913 | sprintf(message, |
3790 | "Optics of two types installed"); | 3914 | "Optics of two types installed - Remove one optic or " \ |
3915 | "install matching pair of optics."); | ||
3791 | break; | 3916 | break; |
3792 | case LPFC_SLI_EVENT_STATUS_UNSUPPORTED: | 3917 | case LPFC_SLI_EVENT_STATUS_UNSUPPORTED: |
3793 | sprintf(message, "Incompatible optics"); | 3918 | sprintf(message, "Incompatible optics - Replace with " \ |
3919 | "compatible optics for card to function."); | ||
3794 | break; | 3920 | break; |
3795 | default: | 3921 | default: |
3796 | /* firmware is reporting a status we don't know about */ | 3922 | /* firmware is reporting a status we don't know about */ |
@@ -4161,11 +4287,11 @@ lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, | |||
4161 | phba->fcoe_eventtag = acqe_grp5->event_tag; | 4287 | phba->fcoe_eventtag = acqe_grp5->event_tag; |
4162 | prev_ll_spd = phba->sli4_hba.link_state.logical_speed; | 4288 | prev_ll_spd = phba->sli4_hba.link_state.logical_speed; |
4163 | phba->sli4_hba.link_state.logical_speed = | 4289 | phba->sli4_hba.link_state.logical_speed = |
4164 | (bf_get(lpfc_acqe_grp5_llink_spd, acqe_grp5)); | 4290 | (bf_get(lpfc_acqe_grp5_llink_spd, acqe_grp5)) * 10; |
4165 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 4291 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
4166 | "2789 GRP5 Async Event: Updating logical link speed " | 4292 | "2789 GRP5 Async Event: Updating logical link speed " |
4167 | "from %dMbps to %dMbps\n", (prev_ll_spd * 10), | 4293 | "from %dMbps to %dMbps\n", prev_ll_spd, |
4168 | (phba->sli4_hba.link_state.logical_speed*10)); | 4294 | phba->sli4_hba.link_state.logical_speed); |
4169 | } | 4295 | } |
4170 | 4296 | ||
4171 | /** | 4297 | /** |
@@ -4947,7 +5073,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) | |||
4947 | } | 5073 | } |
4948 | 5074 | ||
4949 | phba->sli4_hba.msix_entries = kzalloc((sizeof(struct msix_entry) * | 5075 | phba->sli4_hba.msix_entries = kzalloc((sizeof(struct msix_entry) * |
4950 | phba->sli4_hba.cfg_eqn), GFP_KERNEL); | 5076 | phba->cfg_fcp_io_channel), GFP_KERNEL); |
4951 | if (!phba->sli4_hba.msix_entries) { | 5077 | if (!phba->sli4_hba.msix_entries) { |
4952 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 5078 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
4953 | "2573 Failed allocate memory for msi-x " | 5079 | "2573 Failed allocate memory for msi-x " |
@@ -6559,7 +6685,8 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba) | |||
6559 | i++; | 6685 | i++; |
6560 | } | 6686 | } |
6561 | if (i < cfg_fcp_io_channel) { | 6687 | if (i < cfg_fcp_io_channel) { |
6562 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | 6688 | lpfc_printf_log(phba, |
6689 | KERN_ERR, LOG_INIT, | ||
6563 | "3188 Reducing IO channels to match number of " | 6690 | "3188 Reducing IO channels to match number of " |
6564 | "CPUs: from %d to %d\n", cfg_fcp_io_channel, i); | 6691 | "CPUs: from %d to %d\n", cfg_fcp_io_channel, i); |
6565 | cfg_fcp_io_channel = i; | 6692 | cfg_fcp_io_channel = i; |
@@ -6567,8 +6694,8 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba) | |||
6567 | 6694 | ||
6568 | if (cfg_fcp_io_channel > | 6695 | if (cfg_fcp_io_channel > |
6569 | phba->sli4_hba.max_cfg_param.max_eq) { | 6696 | phba->sli4_hba.max_cfg_param.max_eq) { |
6570 | cfg_fcp_io_channel = phba->sli4_hba.max_cfg_param.max_eq; | 6697 | if (phba->sli4_hba.max_cfg_param.max_eq < |
6571 | if (cfg_fcp_io_channel < LPFC_FCP_IO_CHAN_MIN) { | 6698 | LPFC_FCP_IO_CHAN_MIN) { |
6572 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 6699 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
6573 | "2574 Not enough EQs (%d) from the " | 6700 | "2574 Not enough EQs (%d) from the " |
6574 | "pci function for supporting FCP " | 6701 | "pci function for supporting FCP " |
@@ -6577,13 +6704,12 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba) | |||
6577 | phba->cfg_fcp_io_channel); | 6704 | phba->cfg_fcp_io_channel); |
6578 | goto out_error; | 6705 | goto out_error; |
6579 | } | 6706 | } |
6580 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | 6707 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
6581 | "2575 Not enough EQs (%d) from the pci " | 6708 | "2575 Reducing IO channels to match number of " |
6582 | "function for supporting the requested " | 6709 | "available EQs: from %d to %d\n", |
6583 | "FCP EQs (%d), the actual FCP EQs can " | 6710 | cfg_fcp_io_channel, |
6584 | "be supported: %d\n", | 6711 | phba->sli4_hba.max_cfg_param.max_eq); |
6585 | phba->sli4_hba.max_cfg_param.max_eq, | 6712 | cfg_fcp_io_channel = phba->sli4_hba.max_cfg_param.max_eq; |
6586 | phba->cfg_fcp_io_channel, cfg_fcp_io_channel); | ||
6587 | } | 6713 | } |
6588 | 6714 | ||
6589 | /* Eventually cfg_fcp_eq_count / cfg_fcp_wq_count will be depricated */ | 6715 | /* Eventually cfg_fcp_eq_count / cfg_fcp_wq_count will be depricated */ |
@@ -6592,7 +6718,6 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba) | |||
6592 | phba->cfg_fcp_eq_count = cfg_fcp_io_channel; | 6718 | phba->cfg_fcp_eq_count = cfg_fcp_io_channel; |
6593 | phba->cfg_fcp_wq_count = cfg_fcp_io_channel; | 6719 | phba->cfg_fcp_wq_count = cfg_fcp_io_channel; |
6594 | phba->cfg_fcp_io_channel = cfg_fcp_io_channel; | 6720 | phba->cfg_fcp_io_channel = cfg_fcp_io_channel; |
6595 | phba->sli4_hba.cfg_eqn = cfg_fcp_io_channel; | ||
6596 | 6721 | ||
6597 | /* Get EQ depth from module parameter, fake the default for now */ | 6722 | /* Get EQ depth from module parameter, fake the default for now */ |
6598 | phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; | 6723 | phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; |
@@ -8095,11 +8220,11 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba) | |||
8095 | int vectors, rc, index; | 8220 | int vectors, rc, index; |
8096 | 8221 | ||
8097 | /* Set up MSI-X multi-message vectors */ | 8222 | /* Set up MSI-X multi-message vectors */ |
8098 | for (index = 0; index < phba->sli4_hba.cfg_eqn; index++) | 8223 | for (index = 0; index < phba->cfg_fcp_io_channel; index++) |
8099 | phba->sli4_hba.msix_entries[index].entry = index; | 8224 | phba->sli4_hba.msix_entries[index].entry = index; |
8100 | 8225 | ||
8101 | /* Configure MSI-X capability structure */ | 8226 | /* Configure MSI-X capability structure */ |
8102 | vectors = phba->sli4_hba.cfg_eqn; | 8227 | vectors = phba->cfg_fcp_io_channel; |
8103 | enable_msix_vectors: | 8228 | enable_msix_vectors: |
8104 | rc = pci_enable_msix(phba->pcidev, phba->sli4_hba.msix_entries, | 8229 | rc = pci_enable_msix(phba->pcidev, phba->sli4_hba.msix_entries, |
8105 | vectors); | 8230 | vectors); |
@@ -8142,8 +8267,14 @@ enable_msix_vectors: | |||
8142 | goto cfg_fail_out; | 8267 | goto cfg_fail_out; |
8143 | } | 8268 | } |
8144 | } | 8269 | } |
8145 | phba->sli4_hba.msix_vec_nr = vectors; | ||
8146 | 8270 | ||
8271 | if (vectors != phba->cfg_fcp_io_channel) { | ||
8272 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
8273 | "3238 Reducing IO channels to match number of " | ||
8274 | "MSI-X vectors, requested %d got %d\n", | ||
8275 | phba->cfg_fcp_io_channel, vectors); | ||
8276 | phba->cfg_fcp_io_channel = vectors; | ||
8277 | } | ||
8147 | return rc; | 8278 | return rc; |
8148 | 8279 | ||
8149 | cfg_fail_out: | 8280 | cfg_fail_out: |
@@ -8171,7 +8302,7 @@ lpfc_sli4_disable_msix(struct lpfc_hba *phba) | |||
8171 | int index; | 8302 | int index; |
8172 | 8303 | ||
8173 | /* Free up MSI-X multi-message vectors */ | 8304 | /* Free up MSI-X multi-message vectors */ |
8174 | for (index = 0; index < phba->sli4_hba.msix_vec_nr; index++) | 8305 | for (index = 0; index < phba->cfg_fcp_io_channel; index++) |
8175 | free_irq(phba->sli4_hba.msix_entries[index].vector, | 8306 | free_irq(phba->sli4_hba.msix_entries[index].vector, |
8176 | &phba->sli4_hba.fcp_eq_hdl[index]); | 8307 | &phba->sli4_hba.fcp_eq_hdl[index]); |
8177 | 8308 | ||
@@ -9304,23 +9435,28 @@ lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) | |||
9304 | 9435 | ||
9305 | /** | 9436 | /** |
9306 | * lpfc_write_firmware - attempt to write a firmware image to the port | 9437 | * lpfc_write_firmware - attempt to write a firmware image to the port |
9307 | * @phba: pointer to lpfc hba data structure. | ||
9308 | * @fw: pointer to firmware image returned from request_firmware. | 9438 | * @fw: pointer to firmware image returned from request_firmware. |
9439 | * @phba: pointer to lpfc hba data structure. | ||
9309 | * | 9440 | * |
9310 | * returns the number of bytes written if write is successful. | ||
9311 | * returns a negative error value if there were errors. | ||
9312 | * returns 0 if firmware matches currently active firmware on port. | ||
9313 | **/ | 9441 | **/ |
9314 | int | 9442 | static void |
9315 | lpfc_write_firmware(struct lpfc_hba *phba, const struct firmware *fw) | 9443 | lpfc_write_firmware(const struct firmware *fw, void *context) |
9316 | { | 9444 | { |
9445 | struct lpfc_hba *phba = (struct lpfc_hba *)context; | ||
9317 | char fwrev[FW_REV_STR_SIZE]; | 9446 | char fwrev[FW_REV_STR_SIZE]; |
9318 | struct lpfc_grp_hdr *image = (struct lpfc_grp_hdr *)fw->data; | 9447 | struct lpfc_grp_hdr *image; |
9319 | struct list_head dma_buffer_list; | 9448 | struct list_head dma_buffer_list; |
9320 | int i, rc = 0; | 9449 | int i, rc = 0; |
9321 | struct lpfc_dmabuf *dmabuf, *next; | 9450 | struct lpfc_dmabuf *dmabuf, *next; |
9322 | uint32_t offset = 0, temp_offset = 0; | 9451 | uint32_t offset = 0, temp_offset = 0; |
9323 | 9452 | ||
9453 | /* It can be null, sanity check */ | ||
9454 | if (!fw) { | ||
9455 | rc = -ENXIO; | ||
9456 | goto out; | ||
9457 | } | ||
9458 | image = (struct lpfc_grp_hdr *)fw->data; | ||
9459 | |||
9324 | INIT_LIST_HEAD(&dma_buffer_list); | 9460 | INIT_LIST_HEAD(&dma_buffer_list); |
9325 | if ((be32_to_cpu(image->magic_number) != LPFC_GROUP_OJECT_MAGIC_NUM) || | 9461 | if ((be32_to_cpu(image->magic_number) != LPFC_GROUP_OJECT_MAGIC_NUM) || |
9326 | (bf_get_be32(lpfc_grp_hdr_file_type, image) != | 9462 | (bf_get_be32(lpfc_grp_hdr_file_type, image) != |
@@ -9333,12 +9469,13 @@ lpfc_write_firmware(struct lpfc_hba *phba, const struct firmware *fw) | |||
9333 | be32_to_cpu(image->magic_number), | 9469 | be32_to_cpu(image->magic_number), |
9334 | bf_get_be32(lpfc_grp_hdr_file_type, image), | 9470 | bf_get_be32(lpfc_grp_hdr_file_type, image), |
9335 | bf_get_be32(lpfc_grp_hdr_id, image)); | 9471 | bf_get_be32(lpfc_grp_hdr_id, image)); |
9336 | return -EINVAL; | 9472 | rc = -EINVAL; |
9473 | goto release_out; | ||
9337 | } | 9474 | } |
9338 | lpfc_decode_firmware_rev(phba, fwrev, 1); | 9475 | lpfc_decode_firmware_rev(phba, fwrev, 1); |
9339 | if (strncmp(fwrev, image->revision, strnlen(image->revision, 16))) { | 9476 | if (strncmp(fwrev, image->revision, strnlen(image->revision, 16))) { |
9340 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 9477 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
9341 | "3023 Updating Firmware. Current Version:%s " | 9478 | "3023 Updating Firmware, Current Version:%s " |
9342 | "New Version:%s\n", | 9479 | "New Version:%s\n", |
9343 | fwrev, image->revision); | 9480 | fwrev, image->revision); |
9344 | for (i = 0; i < LPFC_MBX_WR_CONFIG_MAX_BDE; i++) { | 9481 | for (i = 0; i < LPFC_MBX_WR_CONFIG_MAX_BDE; i++) { |
@@ -9346,7 +9483,7 @@ lpfc_write_firmware(struct lpfc_hba *phba, const struct firmware *fw) | |||
9346 | GFP_KERNEL); | 9483 | GFP_KERNEL); |
9347 | if (!dmabuf) { | 9484 | if (!dmabuf) { |
9348 | rc = -ENOMEM; | 9485 | rc = -ENOMEM; |
9349 | goto out; | 9486 | goto release_out; |
9350 | } | 9487 | } |
9351 | dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, | 9488 | dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, |
9352 | SLI4_PAGE_SIZE, | 9489 | SLI4_PAGE_SIZE, |
@@ -9355,7 +9492,7 @@ lpfc_write_firmware(struct lpfc_hba *phba, const struct firmware *fw) | |||
9355 | if (!dmabuf->virt) { | 9492 | if (!dmabuf->virt) { |
9356 | kfree(dmabuf); | 9493 | kfree(dmabuf); |
9357 | rc = -ENOMEM; | 9494 | rc = -ENOMEM; |
9358 | goto out; | 9495 | goto release_out; |
9359 | } | 9496 | } |
9360 | list_add_tail(&dmabuf->list, &dma_buffer_list); | 9497 | list_add_tail(&dmabuf->list, &dma_buffer_list); |
9361 | } | 9498 | } |
@@ -9375,23 +9512,24 @@ lpfc_write_firmware(struct lpfc_hba *phba, const struct firmware *fw) | |||
9375 | } | 9512 | } |
9376 | rc = lpfc_wr_object(phba, &dma_buffer_list, | 9513 | rc = lpfc_wr_object(phba, &dma_buffer_list, |
9377 | (fw->size - offset), &offset); | 9514 | (fw->size - offset), &offset); |
9378 | if (rc) { | 9515 | if (rc) |
9379 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 9516 | goto release_out; |
9380 | "3024 Firmware update failed. " | ||
9381 | "%d\n", rc); | ||
9382 | goto out; | ||
9383 | } | ||
9384 | } | 9517 | } |
9385 | rc = offset; | 9518 | rc = offset; |
9386 | } | 9519 | } |
9387 | out: | 9520 | |
9521 | release_out: | ||
9388 | list_for_each_entry_safe(dmabuf, next, &dma_buffer_list, list) { | 9522 | list_for_each_entry_safe(dmabuf, next, &dma_buffer_list, list) { |
9389 | list_del(&dmabuf->list); | 9523 | list_del(&dmabuf->list); |
9390 | dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, | 9524 | dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, |
9391 | dmabuf->virt, dmabuf->phys); | 9525 | dmabuf->virt, dmabuf->phys); |
9392 | kfree(dmabuf); | 9526 | kfree(dmabuf); |
9393 | } | 9527 | } |
9394 | return rc; | 9528 | release_firmware(fw); |
9529 | out: | ||
9530 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
9531 | "3024 Firmware update done: %d.", rc); | ||
9532 | return; | ||
9395 | } | 9533 | } |
9396 | 9534 | ||
9397 | /** | 9535 | /** |
@@ -9418,12 +9556,11 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
9418 | struct lpfc_hba *phba; | 9556 | struct lpfc_hba *phba; |
9419 | struct lpfc_vport *vport = NULL; | 9557 | struct lpfc_vport *vport = NULL; |
9420 | struct Scsi_Host *shost = NULL; | 9558 | struct Scsi_Host *shost = NULL; |
9421 | int error; | 9559 | int error, ret; |
9422 | uint32_t cfg_mode, intr_mode; | 9560 | uint32_t cfg_mode, intr_mode; |
9423 | int mcnt; | 9561 | int mcnt; |
9424 | int adjusted_fcp_io_channel; | 9562 | int adjusted_fcp_io_channel; |
9425 | const struct firmware *fw; | 9563 | uint8_t file_name[ELX_MODEL_NAME_SIZE]; |
9426 | uint8_t file_name[16]; | ||
9427 | 9564 | ||
9428 | /* Allocate memory for HBA structure */ | 9565 | /* Allocate memory for HBA structure */ |
9429 | phba = lpfc_hba_alloc(pdev); | 9566 | phba = lpfc_hba_alloc(pdev); |
@@ -9525,9 +9662,6 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
9525 | /* Default to single EQ for non-MSI-X */ | 9662 | /* Default to single EQ for non-MSI-X */ |
9526 | if (phba->intr_type != MSIX) | 9663 | if (phba->intr_type != MSIX) |
9527 | adjusted_fcp_io_channel = 1; | 9664 | adjusted_fcp_io_channel = 1; |
9528 | else if (phba->sli4_hba.msix_vec_nr < | ||
9529 | phba->cfg_fcp_io_channel) | ||
9530 | adjusted_fcp_io_channel = phba->sli4_hba.msix_vec_nr; | ||
9531 | else | 9665 | else |
9532 | adjusted_fcp_io_channel = phba->cfg_fcp_io_channel; | 9666 | adjusted_fcp_io_channel = phba->cfg_fcp_io_channel; |
9533 | phba->cfg_fcp_io_channel = adjusted_fcp_io_channel; | 9667 | phba->cfg_fcp_io_channel = adjusted_fcp_io_channel; |
@@ -9572,12 +9706,12 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
9572 | /* check for firmware upgrade or downgrade (if_type 2 only) */ | 9706 | /* check for firmware upgrade or downgrade (if_type 2 only) */ |
9573 | if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == | 9707 | if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == |
9574 | LPFC_SLI_INTF_IF_TYPE_2) { | 9708 | LPFC_SLI_INTF_IF_TYPE_2) { |
9575 | snprintf(file_name, 16, "%s.grp", phba->ModelName); | 9709 | snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", |
9576 | error = request_firmware(&fw, file_name, &phba->pcidev->dev); | 9710 | phba->ModelName); |
9577 | if (!error) { | 9711 | ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG, |
9578 | lpfc_write_firmware(phba, fw); | 9712 | file_name, &phba->pcidev->dev, |
9579 | release_firmware(fw); | 9713 | GFP_KERNEL, (void *)phba, |
9580 | } | 9714 | lpfc_write_firmware); |
9581 | } | 9715 | } |
9582 | 9716 | ||
9583 | /* Check if there are static vports to be created. */ | 9717 | /* Check if there are static vports to be created. */ |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 64013f3097ad..7f45ac9964a9 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -3829,9 +3829,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
3829 | cmd->scsi_done(cmd); | 3829 | cmd->scsi_done(cmd); |
3830 | 3830 | ||
3831 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { | 3831 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { |
3832 | spin_lock_irq(&phba->hbalock); | 3832 | spin_lock_irqsave(&phba->hbalock, flags); |
3833 | lpfc_cmd->pCmd = NULL; | 3833 | lpfc_cmd->pCmd = NULL; |
3834 | spin_unlock_irq(&phba->hbalock); | 3834 | spin_unlock_irqrestore(&phba->hbalock, flags); |
3835 | 3835 | ||
3836 | /* | 3836 | /* |
3837 | * If there is a thread waiting for command completion | 3837 | * If there is a thread waiting for command completion |
@@ -3871,9 +3871,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
3871 | } | 3871 | } |
3872 | } | 3872 | } |
3873 | 3873 | ||
3874 | spin_lock_irq(&phba->hbalock); | 3874 | spin_lock_irqsave(&phba->hbalock, flags); |
3875 | lpfc_cmd->pCmd = NULL; | 3875 | lpfc_cmd->pCmd = NULL; |
3876 | spin_unlock_irq(&phba->hbalock); | 3876 | spin_unlock_irqrestore(&phba->hbalock, flags); |
3877 | 3877 | ||
3878 | /* | 3878 | /* |
3879 | * If there is a thread waiting for command completion | 3879 | * If there is a thread waiting for command completion |
@@ -4163,7 +4163,7 @@ lpfc_info(struct Scsi_Host *host) | |||
4163 | { | 4163 | { |
4164 | struct lpfc_vport *vport = (struct lpfc_vport *) host->hostdata; | 4164 | struct lpfc_vport *vport = (struct lpfc_vport *) host->hostdata; |
4165 | struct lpfc_hba *phba = vport->phba; | 4165 | struct lpfc_hba *phba = vport->phba; |
4166 | int len; | 4166 | int len, link_speed = 0; |
4167 | static char lpfcinfobuf[384]; | 4167 | static char lpfcinfobuf[384]; |
4168 | 4168 | ||
4169 | memset(lpfcinfobuf,0,384); | 4169 | memset(lpfcinfobuf,0,384); |
@@ -4184,12 +4184,18 @@ lpfc_info(struct Scsi_Host *host) | |||
4184 | phba->Port); | 4184 | phba->Port); |
4185 | } | 4185 | } |
4186 | len = strlen(lpfcinfobuf); | 4186 | len = strlen(lpfcinfobuf); |
4187 | if (phba->sli4_hba.link_state.logical_speed) { | 4187 | if (phba->sli_rev <= LPFC_SLI_REV3) { |
4188 | snprintf(lpfcinfobuf + len, | 4188 | link_speed = lpfc_sli_port_speed_get(phba); |
4189 | 384-len, | 4189 | } else { |
4190 | " Logical Link Speed: %d Mbps", | 4190 | if (phba->sli4_hba.link_state.logical_speed) |
4191 | phba->sli4_hba.link_state.logical_speed * 10); | 4191 | link_speed = |
4192 | phba->sli4_hba.link_state.logical_speed; | ||
4193 | else | ||
4194 | link_speed = phba->sli4_hba.link_state.speed; | ||
4192 | } | 4195 | } |
4196 | if (link_speed != 0) | ||
4197 | snprintf(lpfcinfobuf + len, 384-len, | ||
4198 | " Logical Link Speed: %d Mbps", link_speed); | ||
4193 | } | 4199 | } |
4194 | return lpfcinfobuf; | 4200 | return lpfcinfobuf; |
4195 | } | 4201 | } |
@@ -4398,16 +4404,17 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
4398 | struct lpfc_scsi_buf *lpfc_cmd; | 4404 | struct lpfc_scsi_buf *lpfc_cmd; |
4399 | IOCB_t *cmd, *icmd; | 4405 | IOCB_t *cmd, *icmd; |
4400 | int ret = SUCCESS, status = 0; | 4406 | int ret = SUCCESS, status = 0; |
4407 | unsigned long flags; | ||
4401 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq); | 4408 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq); |
4402 | 4409 | ||
4403 | status = fc_block_scsi_eh(cmnd); | 4410 | status = fc_block_scsi_eh(cmnd); |
4404 | if (status != 0 && status != SUCCESS) | 4411 | if (status != 0 && status != SUCCESS) |
4405 | return status; | 4412 | return status; |
4406 | 4413 | ||
4407 | spin_lock_irq(&phba->hbalock); | 4414 | spin_lock_irqsave(&phba->hbalock, flags); |
4408 | /* driver queued commands are in process of being flushed */ | 4415 | /* driver queued commands are in process of being flushed */ |
4409 | if (phba->hba_flag & HBA_FCP_IOQ_FLUSH) { | 4416 | if (phba->hba_flag & HBA_FCP_IOQ_FLUSH) { |
4410 | spin_unlock_irq(&phba->hbalock); | 4417 | spin_unlock_irqrestore(&phba->hbalock, flags); |
4411 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, | 4418 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, |
4412 | "3168 SCSI Layer abort requested I/O has been " | 4419 | "3168 SCSI Layer abort requested I/O has been " |
4413 | "flushed by LLD.\n"); | 4420 | "flushed by LLD.\n"); |
@@ -4416,7 +4423,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
4416 | 4423 | ||
4417 | lpfc_cmd = (struct lpfc_scsi_buf *)cmnd->host_scribble; | 4424 | lpfc_cmd = (struct lpfc_scsi_buf *)cmnd->host_scribble; |
4418 | if (!lpfc_cmd || !lpfc_cmd->pCmd) { | 4425 | if (!lpfc_cmd || !lpfc_cmd->pCmd) { |
4419 | spin_unlock_irq(&phba->hbalock); | 4426 | spin_unlock_irqrestore(&phba->hbalock, flags); |
4420 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, | 4427 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, |
4421 | "2873 SCSI Layer I/O Abort Request IO CMPL Status " | 4428 | "2873 SCSI Layer I/O Abort Request IO CMPL Status " |
4422 | "x%x ID %d LUN %d\n", | 4429 | "x%x ID %d LUN %d\n", |
@@ -4427,7 +4434,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
4427 | iocb = &lpfc_cmd->cur_iocbq; | 4434 | iocb = &lpfc_cmd->cur_iocbq; |
4428 | /* the command is in process of being cancelled */ | 4435 | /* the command is in process of being cancelled */ |
4429 | if (!(iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ)) { | 4436 | if (!(iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ)) { |
4430 | spin_unlock_irq(&phba->hbalock); | 4437 | spin_unlock_irqrestore(&phba->hbalock, flags); |
4431 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, | 4438 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, |
4432 | "3169 SCSI Layer abort requested I/O has been " | 4439 | "3169 SCSI Layer abort requested I/O has been " |
4433 | "cancelled by LLD.\n"); | 4440 | "cancelled by LLD.\n"); |
@@ -4484,7 +4491,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
4484 | abtsiocb->iocb_cmpl = lpfc_sli_abort_fcp_cmpl; | 4491 | abtsiocb->iocb_cmpl = lpfc_sli_abort_fcp_cmpl; |
4485 | abtsiocb->vport = vport; | 4492 | abtsiocb->vport = vport; |
4486 | /* no longer need the lock after this point */ | 4493 | /* no longer need the lock after this point */ |
4487 | spin_unlock_irq(&phba->hbalock); | 4494 | spin_unlock_irqrestore(&phba->hbalock, flags); |
4488 | 4495 | ||
4489 | if (lpfc_sli_issue_iocb(phba, LPFC_FCP_RING, abtsiocb, 0) == | 4496 | if (lpfc_sli_issue_iocb(phba, LPFC_FCP_RING, abtsiocb, 0) == |
4490 | IOCB_ERROR) { | 4497 | IOCB_ERROR) { |
@@ -4516,7 +4523,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
4516 | goto out; | 4523 | goto out; |
4517 | 4524 | ||
4518 | out_unlock: | 4525 | out_unlock: |
4519 | spin_unlock_irq(&phba->hbalock); | 4526 | spin_unlock_irqrestore(&phba->hbalock, flags); |
4520 | out: | 4527 | out: |
4521 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, | 4528 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, |
4522 | "0749 SCSI Layer I/O Abort Request Status x%x ID %d " | 4529 | "0749 SCSI Layer I/O Abort Request Status x%x ID %d " |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 219bf534ef99..d7f3313ef886 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -3964,9 +3964,9 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba) | |||
3964 | pci_write_config_word(phba->pcidev, PCI_COMMAND, (cfg_value & | 3964 | pci_write_config_word(phba->pcidev, PCI_COMMAND, (cfg_value & |
3965 | ~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR))); | 3965 | ~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR))); |
3966 | 3966 | ||
3967 | /* Perform FCoE PCI function reset */ | 3967 | /* Perform FCoE PCI function reset before freeing queue memory */ |
3968 | lpfc_sli4_queue_destroy(phba); | ||
3969 | rc = lpfc_pci_function_reset(phba); | 3968 | rc = lpfc_pci_function_reset(phba); |
3969 | lpfc_sli4_queue_destroy(phba); | ||
3970 | 3970 | ||
3971 | /* Restore PCI cmd register */ | 3971 | /* Restore PCI cmd register */ |
3972 | pci_write_config_word(phba->pcidev, PCI_COMMAND, cfg_value); | 3972 | pci_write_config_word(phba->pcidev, PCI_COMMAND, cfg_value); |
@@ -7072,6 +7072,40 @@ lpfc_sli4_async_mbox_unblock(struct lpfc_hba *phba) | |||
7072 | } | 7072 | } |
7073 | 7073 | ||
7074 | /** | 7074 | /** |
7075 | * lpfc_sli4_wait_bmbx_ready - Wait for bootstrap mailbox register ready | ||
7076 | * @phba: Pointer to HBA context object. | ||
7077 | * @mboxq: Pointer to mailbox object. | ||
7078 | * | ||
7079 | * The function waits for the bootstrap mailbox register ready bit from | ||
7080 | * port for twice the regular mailbox command timeout value. | ||
7081 | * | ||
7082 | * 0 - no timeout on waiting for bootstrap mailbox register ready. | ||
7083 | * MBXERR_ERROR - wait for bootstrap mailbox register timed out. | ||
7084 | **/ | ||
7085 | static int | ||
7086 | lpfc_sli4_wait_bmbx_ready(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | ||
7087 | { | ||
7088 | uint32_t db_ready; | ||
7089 | unsigned long timeout; | ||
7090 | struct lpfc_register bmbx_reg; | ||
7091 | |||
7092 | timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq) | ||
7093 | * 1000) + jiffies; | ||
7094 | |||
7095 | do { | ||
7096 | bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr); | ||
7097 | db_ready = bf_get(lpfc_bmbx_rdy, &bmbx_reg); | ||
7098 | if (!db_ready) | ||
7099 | msleep(2); | ||
7100 | |||
7101 | if (time_after(jiffies, timeout)) | ||
7102 | return MBXERR_ERROR; | ||
7103 | } while (!db_ready); | ||
7104 | |||
7105 | return 0; | ||
7106 | } | ||
7107 | |||
7108 | /** | ||
7075 | * lpfc_sli4_post_sync_mbox - Post an SLI4 mailbox to the bootstrap mailbox | 7109 | * lpfc_sli4_post_sync_mbox - Post an SLI4 mailbox to the bootstrap mailbox |
7076 | * @phba: Pointer to HBA context object. | 7110 | * @phba: Pointer to HBA context object. |
7077 | * @mboxq: Pointer to mailbox object. | 7111 | * @mboxq: Pointer to mailbox object. |
@@ -7092,15 +7126,12 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
7092 | { | 7126 | { |
7093 | int rc = MBX_SUCCESS; | 7127 | int rc = MBX_SUCCESS; |
7094 | unsigned long iflag; | 7128 | unsigned long iflag; |
7095 | uint32_t db_ready; | ||
7096 | uint32_t mcqe_status; | 7129 | uint32_t mcqe_status; |
7097 | uint32_t mbx_cmnd; | 7130 | uint32_t mbx_cmnd; |
7098 | unsigned long timeout; | ||
7099 | struct lpfc_sli *psli = &phba->sli; | 7131 | struct lpfc_sli *psli = &phba->sli; |
7100 | struct lpfc_mqe *mb = &mboxq->u.mqe; | 7132 | struct lpfc_mqe *mb = &mboxq->u.mqe; |
7101 | struct lpfc_bmbx_create *mbox_rgn; | 7133 | struct lpfc_bmbx_create *mbox_rgn; |
7102 | struct dma_address *dma_address; | 7134 | struct dma_address *dma_address; |
7103 | struct lpfc_register bmbx_reg; | ||
7104 | 7135 | ||
7105 | /* | 7136 | /* |
7106 | * Only one mailbox can be active to the bootstrap mailbox region | 7137 | * Only one mailbox can be active to the bootstrap mailbox region |
@@ -7124,6 +7155,11 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
7124 | phba->sli.mbox_active = mboxq; | 7155 | phba->sli.mbox_active = mboxq; |
7125 | spin_unlock_irqrestore(&phba->hbalock, iflag); | 7156 | spin_unlock_irqrestore(&phba->hbalock, iflag); |
7126 | 7157 | ||
7158 | /* wait for bootstrap mbox register for readyness */ | ||
7159 | rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq); | ||
7160 | if (rc) | ||
7161 | goto exit; | ||
7162 | |||
7127 | /* | 7163 | /* |
7128 | * Initialize the bootstrap memory region to avoid stale data areas | 7164 | * Initialize the bootstrap memory region to avoid stale data areas |
7129 | * in the mailbox post. Then copy the caller's mailbox contents to | 7165 | * in the mailbox post. Then copy the caller's mailbox contents to |
@@ -7138,35 +7174,18 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
7138 | dma_address = &phba->sli4_hba.bmbx.dma_address; | 7174 | dma_address = &phba->sli4_hba.bmbx.dma_address; |
7139 | writel(dma_address->addr_hi, phba->sli4_hba.BMBXregaddr); | 7175 | writel(dma_address->addr_hi, phba->sli4_hba.BMBXregaddr); |
7140 | 7176 | ||
7141 | timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq) | 7177 | /* wait for bootstrap mbox register for hi-address write done */ |
7142 | * 1000) + jiffies; | 7178 | rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq); |
7143 | do { | 7179 | if (rc) |
7144 | bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr); | 7180 | goto exit; |
7145 | db_ready = bf_get(lpfc_bmbx_rdy, &bmbx_reg); | ||
7146 | if (!db_ready) | ||
7147 | msleep(2); | ||
7148 | |||
7149 | if (time_after(jiffies, timeout)) { | ||
7150 | rc = MBXERR_ERROR; | ||
7151 | goto exit; | ||
7152 | } | ||
7153 | } while (!db_ready); | ||
7154 | 7181 | ||
7155 | /* Post the low mailbox dma address to the port. */ | 7182 | /* Post the low mailbox dma address to the port. */ |
7156 | writel(dma_address->addr_lo, phba->sli4_hba.BMBXregaddr); | 7183 | writel(dma_address->addr_lo, phba->sli4_hba.BMBXregaddr); |
7157 | timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq) | ||
7158 | * 1000) + jiffies; | ||
7159 | do { | ||
7160 | bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr); | ||
7161 | db_ready = bf_get(lpfc_bmbx_rdy, &bmbx_reg); | ||
7162 | if (!db_ready) | ||
7163 | msleep(2); | ||
7164 | 7184 | ||
7165 | if (time_after(jiffies, timeout)) { | 7185 | /* wait for bootstrap mbox register for low address write done */ |
7166 | rc = MBXERR_ERROR; | 7186 | rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq); |
7167 | goto exit; | 7187 | if (rc) |
7168 | } | 7188 | goto exit; |
7169 | } while (!db_ready); | ||
7170 | 7189 | ||
7171 | /* | 7190 | /* |
7172 | * Read the CQ to ensure the mailbox has completed. | 7191 | * Read the CQ to ensure the mailbox has completed. |
@@ -8090,6 +8109,8 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq, | |||
8090 | bf_set(wqe_lenloc, &wqe->fcp_icmd.wqe_com, | 8109 | bf_set(wqe_lenloc, &wqe->fcp_icmd.wqe_com, |
8091 | LPFC_WQE_LENLOC_NONE); | 8110 | LPFC_WQE_LENLOC_NONE); |
8092 | bf_set(wqe_ebde_cnt, &wqe->fcp_icmd.wqe_com, 0); | 8111 | bf_set(wqe_ebde_cnt, &wqe->fcp_icmd.wqe_com, 0); |
8112 | bf_set(wqe_erp, &wqe->fcp_icmd.wqe_com, | ||
8113 | iocbq->iocb.ulpFCP2Rcvy); | ||
8093 | break; | 8114 | break; |
8094 | case CMD_GEN_REQUEST64_CR: | 8115 | case CMD_GEN_REQUEST64_CR: |
8095 | /* For this command calculate the xmit length of the | 8116 | /* For this command calculate the xmit length of the |
@@ -12099,6 +12120,7 @@ lpfc_modify_fcp_eq_delay(struct lpfc_hba *phba, uint16_t startq) | |||
12099 | struct lpfc_queue *eq; | 12120 | struct lpfc_queue *eq; |
12100 | int cnt, rc, length, status = 0; | 12121 | int cnt, rc, length, status = 0; |
12101 | uint32_t shdr_status, shdr_add_status; | 12122 | uint32_t shdr_status, shdr_add_status; |
12123 | uint32_t result; | ||
12102 | int fcp_eqidx; | 12124 | int fcp_eqidx; |
12103 | union lpfc_sli4_cfg_shdr *shdr; | 12125 | union lpfc_sli4_cfg_shdr *shdr; |
12104 | uint16_t dmult; | 12126 | uint16_t dmult; |
@@ -12117,8 +12139,11 @@ lpfc_modify_fcp_eq_delay(struct lpfc_hba *phba, uint16_t startq) | |||
12117 | eq_delay = &mbox->u.mqe.un.eq_delay; | 12139 | eq_delay = &mbox->u.mqe.un.eq_delay; |
12118 | 12140 | ||
12119 | /* Calculate delay multiper from maximum interrupt per second */ | 12141 | /* Calculate delay multiper from maximum interrupt per second */ |
12120 | dmult = phba->cfg_fcp_imax / phba->cfg_fcp_io_channel; | 12142 | result = phba->cfg_fcp_imax / phba->cfg_fcp_io_channel; |
12121 | dmult = LPFC_DMULT_CONST/dmult - 1; | 12143 | if (result > LPFC_DMULT_CONST) |
12144 | dmult = 0; | ||
12145 | else | ||
12146 | dmult = LPFC_DMULT_CONST/result - 1; | ||
12122 | 12147 | ||
12123 | cnt = 0; | 12148 | cnt = 0; |
12124 | for (fcp_eqidx = startq; fcp_eqidx < phba->cfg_fcp_io_channel; | 12149 | for (fcp_eqidx = startq; fcp_eqidx < phba->cfg_fcp_io_channel; |
@@ -12174,7 +12199,7 @@ lpfc_modify_fcp_eq_delay(struct lpfc_hba *phba, uint16_t startq) | |||
12174 | * fails this function will return -ENXIO. | 12199 | * fails this function will return -ENXIO. |
12175 | **/ | 12200 | **/ |
12176 | uint32_t | 12201 | uint32_t |
12177 | lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint16_t imax) | 12202 | lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax) |
12178 | { | 12203 | { |
12179 | struct lpfc_mbx_eq_create *eq_create; | 12204 | struct lpfc_mbx_eq_create *eq_create; |
12180 | LPFC_MBOXQ_t *mbox; | 12205 | LPFC_MBOXQ_t *mbox; |
@@ -12206,7 +12231,10 @@ lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint16_t imax) | |||
12206 | LPFC_EQE_SIZE); | 12231 | LPFC_EQE_SIZE); |
12207 | bf_set(lpfc_eq_context_valid, &eq_create->u.request.context, 1); | 12232 | bf_set(lpfc_eq_context_valid, &eq_create->u.request.context, 1); |
12208 | /* Calculate delay multiper from maximum interrupt per second */ | 12233 | /* Calculate delay multiper from maximum interrupt per second */ |
12209 | dmult = LPFC_DMULT_CONST/imax - 1; | 12234 | if (imax > LPFC_DMULT_CONST) |
12235 | dmult = 0; | ||
12236 | else | ||
12237 | dmult = LPFC_DMULT_CONST/imax - 1; | ||
12210 | bf_set(lpfc_eq_context_delay_multi, &eq_create->u.request.context, | 12238 | bf_set(lpfc_eq_context_delay_multi, &eq_create->u.request.context, |
12211 | dmult); | 12239 | dmult); |
12212 | switch (eq->entry_count) { | 12240 | switch (eq->entry_count) { |
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index bd4bc4342ae2..f44a06a4c6e7 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h | |||
@@ -37,7 +37,7 @@ | |||
37 | /* Multi-queue arrangement for FCP EQ/CQ/WQ tuples */ | 37 | /* Multi-queue arrangement for FCP EQ/CQ/WQ tuples */ |
38 | #define LPFC_FCP_IO_CHAN_DEF 4 | 38 | #define LPFC_FCP_IO_CHAN_DEF 4 |
39 | #define LPFC_FCP_IO_CHAN_MIN 1 | 39 | #define LPFC_FCP_IO_CHAN_MIN 1 |
40 | #define LPFC_FCP_IO_CHAN_MAX 8 | 40 | #define LPFC_FCP_IO_CHAN_MAX 16 |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * Provide the default FCF Record attributes used by the driver | 43 | * Provide the default FCF Record attributes used by the driver |
@@ -168,7 +168,7 @@ struct lpfc_queue { | |||
168 | }; | 168 | }; |
169 | 169 | ||
170 | struct lpfc_sli4_link { | 170 | struct lpfc_sli4_link { |
171 | uint8_t speed; | 171 | uint16_t speed; |
172 | uint8_t duplex; | 172 | uint8_t duplex; |
173 | uint8_t status; | 173 | uint8_t status; |
174 | uint8_t type; | 174 | uint8_t type; |
@@ -490,8 +490,6 @@ struct lpfc_sli4_hba { | |||
490 | struct lpfc_pc_sli4_params pc_sli4_params; | 490 | struct lpfc_pc_sli4_params pc_sli4_params; |
491 | struct msix_entry *msix_entries; | 491 | struct msix_entry *msix_entries; |
492 | uint8_t handler_name[LPFC_FCP_IO_CHAN_MAX][LPFC_SLI4_HANDLER_NAME_SZ]; | 492 | uint8_t handler_name[LPFC_FCP_IO_CHAN_MAX][LPFC_SLI4_HANDLER_NAME_SZ]; |
493 | uint32_t cfg_eqn; | ||
494 | uint32_t msix_vec_nr; | ||
495 | struct lpfc_fcp_eq_hdl *fcp_eq_hdl; /* FCP per-WQ handle */ | 493 | struct lpfc_fcp_eq_hdl *fcp_eq_hdl; /* FCP per-WQ handle */ |
496 | 494 | ||
497 | /* Pointers to the constructed SLI4 queues */ | 495 | /* Pointers to the constructed SLI4 queues */ |
@@ -626,7 +624,7 @@ void lpfc_sli4_hba_reset(struct lpfc_hba *); | |||
626 | struct lpfc_queue *lpfc_sli4_queue_alloc(struct lpfc_hba *, uint32_t, | 624 | struct lpfc_queue *lpfc_sli4_queue_alloc(struct lpfc_hba *, uint32_t, |
627 | uint32_t); | 625 | uint32_t); |
628 | void lpfc_sli4_queue_free(struct lpfc_queue *); | 626 | void lpfc_sli4_queue_free(struct lpfc_queue *); |
629 | uint32_t lpfc_eq_create(struct lpfc_hba *, struct lpfc_queue *, uint16_t); | 627 | uint32_t lpfc_eq_create(struct lpfc_hba *, struct lpfc_queue *, uint32_t); |
630 | uint32_t lpfc_modify_fcp_eq_delay(struct lpfc_hba *, uint16_t); | 628 | uint32_t lpfc_modify_fcp_eq_delay(struct lpfc_hba *, uint16_t); |
631 | uint32_t lpfc_cq_create(struct lpfc_hba *, struct lpfc_queue *, | 629 | uint32_t lpfc_cq_create(struct lpfc_hba *, struct lpfc_queue *, |
632 | struct lpfc_queue *, uint32_t, uint32_t); | 630 | struct lpfc_queue *, uint32_t, uint32_t); |
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index 04265a1c4e52..0c2149189dda 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.3.34" | 21 | #define LPFC_DRIVER_VERSION "8.3.35" |
22 | #define LPFC_DRIVER_NAME "lpfc" | 22 | #define LPFC_DRIVER_NAME "lpfc" |
23 | 23 | ||
24 | /* Used for SLI 2/3 */ | 24 | /* Used for SLI 2/3 */ |