aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-14 15:34:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-14 15:34:34 -0400
commitc29c08b59875fe053471cf9eb66f8cfef39bc509 (patch)
tree00c9b1794483666eddccdd7302611e0cffb4c184 /drivers/scsi/lpfc
parentbbbfb910d14988963fbc0b3fc5fc460daf21bf24 (diff)
parent3c3e210877e89aa3bfbda22551876986c035c433 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (28 commits) [SCSI] qla4xxx: fix compilation warning [SCSI] make error handling more robust in the face of reservations [SCSI] tgt: fix warning [SCSI] drivers/message/fusion: Adjust confusing if indentation [SCSI] Return NEEDS_RETRY for eh commands with status BUSY [SCSI] ibmvfc: Driver version 1.0.9 [SCSI] ibmvfc: Fix terminate_rport_io [SCSI] ibmvfc: Fix rport add/delete race resulting in oops [SCSI] lpfc 8.3.16: Change LPFC driver version to 8.3.16 [SCSI] lpfc 8.3.16: FCoE Discovery and Failover Fixes [SCSI] lpfc 8.3.16: SLI Additions, updates, and code cleanup [SCSI] pm8001: introduce missing kfree [SCSI] qla4xxx: Update driver version to 5.02.00-k3 [SCSI] qla4xxx: Added AER support for ISP82xx [SCSI] qla4xxx: Handle outstanding mbx cmds on hung f/w scenarios [SCSI] qla4xxx: updated mbx_sys_info struct to sync with FW 4.6.x [SCSI] qla4xxx: clear AF_DPC_SCHEDULED flage when exit from do_dpc [SCSI] qla4xxx: Stop firmware before doing init firmware. [SCSI] qla4xxx: Use the correct request queue. [SCSI] qla4xxx: set correct value in sess->recovery_tmo ...
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc.h3
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c46
-rw-r--r--drivers/scsi/lpfc/lpfc_bsg.c9
-rw-r--r--drivers/scsi/lpfc/lpfc_compat.h3
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c76
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c17
-rw-r--r--drivers/scsi/lpfc/lpfc_hw.h32
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c132
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c8
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c8
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c36
-rw-r--r--drivers/scsi/lpfc/lpfc_version.h2
12 files changed, 273 insertions, 99 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 3482d5a5aed..a50aa03b8ac 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -775,6 +775,7 @@ struct lpfc_hba {
775 uint8_t temp_sensor_support; 775 uint8_t temp_sensor_support;
776 /* Fields used for heart beat. */ 776 /* Fields used for heart beat. */
777 unsigned long last_completion_time; 777 unsigned long last_completion_time;
778 unsigned long skipped_hb;
778 struct timer_list hb_tmofunc; 779 struct timer_list hb_tmofunc;
779 uint8_t hb_outstanding; 780 uint8_t hb_outstanding;
780 enum hba_temp_state over_temp_state; 781 enum hba_temp_state over_temp_state;
@@ -817,6 +818,8 @@ struct lpfc_hba {
817 uint32_t iocb_cnt; 818 uint32_t iocb_cnt;
818 uint32_t iocb_max; 819 uint32_t iocb_max;
819 atomic_t sdev_cnt; 820 atomic_t sdev_cnt;
821 uint8_t fips_spec_rev;
822 uint8_t fips_level;
820}; 823};
821 824
822static inline struct Scsi_Host * 825static inline struct Scsi_Host *
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index ad05b266e95..23ce4570833 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -1240,6 +1240,44 @@ lpfc_poll_store(struct device *dev, struct device_attribute *attr,
1240} 1240}
1241 1241
1242/** 1242/**
1243 * lpfc_fips_level_show - Return the current FIPS level for the HBA
1244 * @dev: class unused variable.
1245 * @attr: device attribute, not used.
1246 * @buf: on return contains the module description text.
1247 *
1248 * Returns: size of formatted string.
1249 **/
1250static ssize_t
1251lpfc_fips_level_show(struct device *dev, struct device_attribute *attr,
1252 char *buf)
1253{
1254 struct Scsi_Host *shost = class_to_shost(dev);
1255 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
1256 struct lpfc_hba *phba = vport->phba;
1257
1258 return snprintf(buf, PAGE_SIZE, "%d\n", phba->fips_level);
1259}
1260
1261/**
1262 * lpfc_fips_rev_show - Return the FIPS Spec revision for the HBA
1263 * @dev: class unused variable.
1264 * @attr: device attribute, not used.
1265 * @buf: on return contains the module description text.
1266 *
1267 * Returns: size of formatted string.
1268 **/
1269static ssize_t
1270lpfc_fips_rev_show(struct device *dev, struct device_attribute *attr,
1271 char *buf)
1272{
1273 struct Scsi_Host *shost = class_to_shost(dev);
1274 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
1275 struct lpfc_hba *phba = vport->phba;
1276
1277 return snprintf(buf, PAGE_SIZE, "%d\n", phba->fips_spec_rev);
1278}
1279
1280/**
1243 * lpfc_param_show - Return a cfg attribute value in decimal 1281 * lpfc_param_show - Return a cfg attribute value in decimal
1244 * 1282 *
1245 * Description: 1283 * Description:
@@ -1677,6 +1715,8 @@ static DEVICE_ATTR(max_xri, S_IRUGO, lpfc_max_xri_show, NULL);
1677static DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL); 1715static DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL);
1678static DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL); 1716static DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL);
1679static DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show, NULL); 1717static DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show, NULL);
1718static DEVICE_ATTR(lpfc_fips_level, S_IRUGO, lpfc_fips_level_show, NULL);
1719static DEVICE_ATTR(lpfc_fips_rev, S_IRUGO, lpfc_fips_rev_show, NULL);
1680 1720
1681 1721
1682static char *lpfc_soft_wwn_key = "C99G71SL8032A"; 1722static char *lpfc_soft_wwn_key = "C99G71SL8032A";
@@ -3278,7 +3318,7 @@ LPFC_ATTR_R(enable_bg, 0, 0, 1, "Enable BlockGuard Support");
3278# - Default will result in registering capabilities for all profiles. 3318# - Default will result in registering capabilities for all profiles.
3279# 3319#
3280*/ 3320*/
3281unsigned int lpfc_prot_mask = SHOST_DIX_TYPE0_PROTECTION; 3321unsigned int lpfc_prot_mask = SHOST_DIF_TYPE1_PROTECTION;
3282 3322
3283module_param(lpfc_prot_mask, uint, 0); 3323module_param(lpfc_prot_mask, uint, 0);
3284MODULE_PARM_DESC(lpfc_prot_mask, "host protection mask"); 3324MODULE_PARM_DESC(lpfc_prot_mask, "host protection mask");
@@ -3383,6 +3423,8 @@ struct device_attribute *lpfc_hba_attrs[] = {
3383 &dev_attr_iocb_hw, 3423 &dev_attr_iocb_hw,
3384 &dev_attr_txq_hw, 3424 &dev_attr_txq_hw,
3385 &dev_attr_txcmplq_hw, 3425 &dev_attr_txcmplq_hw,
3426 &dev_attr_lpfc_fips_level,
3427 &dev_attr_lpfc_fips_rev,
3386 NULL, 3428 NULL,
3387}; 3429};
3388 3430
@@ -3409,6 +3451,8 @@ struct device_attribute *lpfc_vport_attrs[] = {
3409 &dev_attr_lpfc_max_scsicmpl_time, 3451 &dev_attr_lpfc_max_scsicmpl_time,
3410 &dev_attr_lpfc_stat_data_ctrl, 3452 &dev_attr_lpfc_stat_data_ctrl,
3411 &dev_attr_lpfc_static_vport, 3453 &dev_attr_lpfc_static_vport,
3454 &dev_attr_lpfc_fips_level,
3455 &dev_attr_lpfc_fips_rev,
3412 NULL, 3456 NULL,
3413}; 3457};
3414 3458
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index d521569e662..49d0cf99c24 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -2724,15 +2724,6 @@ lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct fc_bsg_job *job,
2724 2724
2725 pmboxq->context2 = ext; 2725 pmboxq->context2 = ext;
2726 pmboxq->in_ext_byte_len = 2726 pmboxq->in_ext_byte_len =
2727 mbox_req->inExtWLen *
2728 sizeof(uint32_t);
2729 pmboxq->out_ext_byte_len =
2730 mbox_req->outExtWLen *
2731 sizeof(uint32_t);
2732 pmboxq->mbox_offset_word =
2733 mbox_req->mbOffset;
2734 pmboxq->context2 = ext;
2735 pmboxq->in_ext_byte_len =
2736 mbox_req->inExtWLen * sizeof(uint32_t); 2727 mbox_req->inExtWLen * sizeof(uint32_t);
2737 pmboxq->out_ext_byte_len = 2728 pmboxq->out_ext_byte_len =
2738 mbox_req->outExtWLen * sizeof(uint32_t); 2729 mbox_req->outExtWLen * sizeof(uint32_t);
diff --git a/drivers/scsi/lpfc/lpfc_compat.h b/drivers/scsi/lpfc/lpfc_compat.h
index a11f1ae7b98..75e2e569ded 100644
--- a/drivers/scsi/lpfc/lpfc_compat.h
+++ b/drivers/scsi/lpfc/lpfc_compat.h
@@ -82,8 +82,7 @@ lpfc_memcpy_from_slim( void *dest, void __iomem *src, unsigned int bytes)
82static inline void 82static inline void
83lpfc_memcpy_to_slim( void __iomem *dest, void *src, unsigned int bytes) 83lpfc_memcpy_to_slim( void __iomem *dest, void *src, unsigned int bytes)
84{ 84{
85 /* actually returns 1 byte past dest */ 85 __iowrite32_copy(dest, src, bytes);
86 memcpy_toio( dest, src, bytes);
87} 86}
88 87
89static inline void 88static inline void
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index afbed6bc31f..8d09191c327 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -600,6 +600,14 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
600 vport->fc_flag |= FC_VPORT_NEEDS_INIT_VPI; 600 vport->fc_flag |= FC_VPORT_NEEDS_INIT_VPI;
601 spin_unlock_irq(shost->host_lock); 601 spin_unlock_irq(shost->host_lock);
602 } 602 }
603 } else if ((phba->sli_rev == LPFC_SLI_REV4) &&
604 !(vport->fc_flag & FC_VPORT_NEEDS_REG_VPI)) {
605 /*
606 * Driver needs to re-reg VPI in order for f/w
607 * to update the MAC address.
608 */
609 lpfc_register_new_vport(phba, vport, ndlp);
610 return 0;
603 } 611 }
604 612
605 if (phba->sli_rev < LPFC_SLI_REV4) { 613 if (phba->sli_rev < LPFC_SLI_REV4) {
@@ -801,9 +809,12 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
801 (irsp->un.ulpWord[4] != IOERR_SLI_ABORTED)) { 809 (irsp->un.ulpWord[4] != IOERR_SLI_ABORTED)) {
802 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | LOG_ELS, 810 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | LOG_ELS,
803 "2611 FLOGI failed on registered " 811 "2611 FLOGI failed on registered "
804 "FCF record fcf_index:%d, trying " 812 "FCF record fcf_index(%d), status: "
805 "to perform round robin failover\n", 813 "x%x/x%x, tmo:x%x, trying to perform "
806 phba->fcf.current_rec.fcf_indx); 814 "round robin failover\n",
815 phba->fcf.current_rec.fcf_indx,
816 irsp->ulpStatus, irsp->un.ulpWord[4],
817 irsp->ulpTimeout);
807 fcf_index = lpfc_sli4_fcf_rr_next_index_get(phba); 818 fcf_index = lpfc_sli4_fcf_rr_next_index_get(phba);
808 if (fcf_index == LPFC_FCOE_FCF_NEXT_NONE) { 819 if (fcf_index == LPFC_FCOE_FCF_NEXT_NONE) {
809 /* 820 /*
@@ -841,6 +852,12 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
841 } 852 }
842 } 853 }
843 854
855 /* FLOGI failure */
856 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
857 "2858 FLOGI failure Status:x%x/x%x TMO:x%x\n",
858 irsp->ulpStatus, irsp->un.ulpWord[4],
859 irsp->ulpTimeout);
860
844 /* Check for retry */ 861 /* Check for retry */
845 if (lpfc_els_retry(phba, cmdiocb, rspiocb)) 862 if (lpfc_els_retry(phba, cmdiocb, rspiocb))
846 goto out; 863 goto out;
@@ -1291,6 +1308,8 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
1291 struct serv_parm *sp; 1308 struct serv_parm *sp;
1292 uint8_t name[sizeof(struct lpfc_name)]; 1309 uint8_t name[sizeof(struct lpfc_name)];
1293 uint32_t rc, keepDID = 0; 1310 uint32_t rc, keepDID = 0;
1311 int put_node;
1312 int put_rport;
1294 1313
1295 /* Fabric nodes can have the same WWPN so we don't bother searching 1314 /* Fabric nodes can have the same WWPN so we don't bother searching
1296 * by WWPN. Just return the ndlp that was given to us. 1315 * by WWPN. Just return the ndlp that was given to us.
@@ -1379,6 +1398,28 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
1379 /* Two ndlps cannot have the same did */ 1398 /* Two ndlps cannot have the same did */
1380 ndlp->nlp_DID = keepDID; 1399 ndlp->nlp_DID = keepDID;
1381 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 1400 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
1401 /* Since we are swapping the ndlp passed in with the new one
1402 * and the did has already been swapped, copy over the
1403 * state and names.
1404 */
1405 memcpy(&new_ndlp->nlp_portname, &ndlp->nlp_portname,
1406 sizeof(struct lpfc_name));
1407 memcpy(&new_ndlp->nlp_nodename, &ndlp->nlp_nodename,
1408 sizeof(struct lpfc_name));
1409 new_ndlp->nlp_state = ndlp->nlp_state;
1410 /* Fix up the rport accordingly */
1411 rport = ndlp->rport;
1412 if (rport) {
1413 rdata = rport->dd_data;
1414 put_node = rdata->pnode != NULL;
1415 put_rport = ndlp->rport != NULL;
1416 rdata->pnode = NULL;
1417 ndlp->rport = NULL;
1418 if (put_node)
1419 lpfc_nlp_put(ndlp);
1420 if (put_rport)
1421 put_device(&rport->dev);
1422 }
1382 } 1423 }
1383 return new_ndlp; 1424 return new_ndlp;
1384} 1425}
@@ -2880,6 +2921,17 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
2880 retry = 0; 2921 retry = 0;
2881 2922
2882 if (retry) { 2923 if (retry) {
2924 if ((cmd == ELS_CMD_PLOGI) || (cmd == ELS_CMD_FDISC)) {
2925 /* Stop retrying PLOGI and FDISC if in FCF discovery */
2926 if (phba->fcf.fcf_flag & FCF_DISCOVERY) {
2927 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
2928 "2849 Stop retry ELS command "
2929 "x%x to remote NPORT x%x, "
2930 "Data: x%x x%x\n", cmd, did,
2931 cmdiocb->retry, delay);
2932 return 0;
2933 }
2934 }
2883 2935
2884 /* Retry ELS command <elsCmd> to remote NPORT <did> */ 2936 /* Retry ELS command <elsCmd> to remote NPORT <did> */
2885 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 2937 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
@@ -6076,8 +6128,12 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
6076 6128
6077 if (mb->mbxStatus) { 6129 if (mb->mbxStatus) {
6078 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, 6130 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
6079 "0915 Register VPI failed: 0x%x\n", 6131 "0915 Register VPI failed : Status: x%x"
6080 mb->mbxStatus); 6132 " upd bit: x%x \n", mb->mbxStatus,
6133 mb->un.varRegVpi.upd);
6134 if (phba->sli_rev == LPFC_SLI_REV4 &&
6135 mb->un.varRegVpi.upd)
6136 goto mbox_err_exit ;
6081 6137
6082 switch (mb->mbxStatus) { 6138 switch (mb->mbxStatus) {
6083 case 0x11: /* unsupported feature */ 6139 case 0x11: /* unsupported feature */
@@ -6142,7 +6198,7 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
6142 } else 6198 } else
6143 lpfc_do_scr_ns_plogi(phba, vport); 6199 lpfc_do_scr_ns_plogi(phba, vport);
6144 } 6200 }
6145 6201mbox_err_exit:
6146 /* Now, we decrement the ndlp reference count held for this 6202 /* Now, we decrement the ndlp reference count held for this
6147 * callback function 6203 * callback function
6148 */ 6204 */
@@ -6387,6 +6443,14 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
6387 else 6443 else
6388 vport->fc_flag |= FC_LOGO_RCVD_DID_CHNG; 6444 vport->fc_flag |= FC_LOGO_RCVD_DID_CHNG;
6389 spin_unlock_irq(shost->host_lock); 6445 spin_unlock_irq(shost->host_lock);
6446 } else if ((phba->sli_rev == LPFC_SLI_REV4) &&
6447 !(vport->fc_flag & FC_VPORT_NEEDS_REG_VPI)) {
6448 /*
6449 * Driver needs to re-reg VPI in order for f/w
6450 * to update the MAC address.
6451 */
6452 lpfc_register_new_vport(phba, vport, ndlp);
6453 return ;
6390 } 6454 }
6391 6455
6392 if (vport->fc_flag & FC_VPORT_NEEDS_INIT_VPI) 6456 if (vport->fc_flag & FC_VPORT_NEEDS_INIT_VPI)
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 0639c994349..1f62ea8c165 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -588,7 +588,7 @@ lpfc_work_done(struct lpfc_hba *phba)
588 (status & 588 (status &
589 HA_RXMASK)); 589 HA_RXMASK));
590 } 590 }
591 if (pring->txq_cnt) 591 if ((phba->sli_rev == LPFC_SLI_REV4) && pring->txq_cnt)
592 lpfc_drain_txq(phba); 592 lpfc_drain_txq(phba);
593 /* 593 /*
594 * Turn on Ring interrupts 594 * Turn on Ring interrupts
@@ -1852,8 +1852,7 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1852 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba); 1852 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba);
1853 else if (phba->fcf.fcf_flag & FCF_REDISC_FOV) 1853 else if (phba->fcf.fcf_flag & FCF_REDISC_FOV)
1854 /* If in fast failover, mark it's completed */ 1854 /* If in fast failover, mark it's completed */
1855 phba->fcf.fcf_flag &= ~(FCF_REDISC_FOV | 1855 phba->fcf.fcf_flag &= ~FCF_REDISC_FOV;
1856 FCF_DISCOVERY);
1857 spin_unlock_irq(&phba->hbalock); 1856 spin_unlock_irq(&phba->hbalock);
1858 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 1857 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
1859 "2836 The new FCF record (x%x) " 1858 "2836 The new FCF record (x%x) "
@@ -2651,7 +2650,6 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
2651 spin_unlock_irq(&phba->hbalock); 2650 spin_unlock_irq(&phba->hbalock);
2652 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, 2651 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
2653 "2778 Start FCF table scan at linkup\n"); 2652 "2778 Start FCF table scan at linkup\n");
2654
2655 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, 2653 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba,
2656 LPFC_FCOE_FCF_GET_FIRST); 2654 LPFC_FCOE_FCF_GET_FIRST);
2657 if (rc) { 2655 if (rc) {
@@ -2660,6 +2658,9 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
2660 spin_unlock_irq(&phba->hbalock); 2658 spin_unlock_irq(&phba->hbalock);
2661 goto out; 2659 goto out;
2662 } 2660 }
2661 /* Reset FCF roundrobin bmask for new discovery */
2662 memset(phba->fcf.fcf_rr_bmask, 0,
2663 sizeof(*phba->fcf.fcf_rr_bmask));
2663 } 2664 }
2664 2665
2665 return; 2666 return;
@@ -5097,6 +5098,7 @@ static void
5097lpfc_unregister_vfi_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) 5098lpfc_unregister_vfi_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
5098{ 5099{
5099 struct lpfc_vport *vport = mboxq->vport; 5100 struct lpfc_vport *vport = mboxq->vport;
5101 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
5100 5102
5101 if (mboxq->u.mb.mbxStatus) { 5103 if (mboxq->u.mb.mbxStatus) {
5102 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY|LOG_MBOX, 5104 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY|LOG_MBOX,
@@ -5104,6 +5106,9 @@ lpfc_unregister_vfi_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
5104 "HBA state x%x\n", 5106 "HBA state x%x\n",
5105 mboxq->u.mb.mbxStatus, vport->port_state); 5107 mboxq->u.mb.mbxStatus, vport->port_state);
5106 } 5108 }
5109 spin_lock_irq(shost->host_lock);
5110 phba->pport->fc_flag &= ~FC_VFI_REGISTERED;
5111 spin_unlock_irq(shost->host_lock);
5107 mempool_free(mboxq, phba->mbox_mem_pool); 5112 mempool_free(mboxq, phba->mbox_mem_pool);
5108 return; 5113 return;
5109} 5114}
@@ -5285,6 +5290,10 @@ lpfc_unregister_fcf_rescan(struct lpfc_hba *phba)
5285 spin_lock_irq(&phba->hbalock); 5290 spin_lock_irq(&phba->hbalock);
5286 phba->fcf.fcf_flag |= FCF_INIT_DISC; 5291 phba->fcf.fcf_flag |= FCF_INIT_DISC;
5287 spin_unlock_irq(&phba->hbalock); 5292 spin_unlock_irq(&phba->hbalock);
5293
5294 /* Reset FCF roundrobin bmask for new discovery */
5295 memset(phba->fcf.fcf_rr_bmask, 0, sizeof(*phba->fcf.fcf_rr_bmask));
5296
5288 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); 5297 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST);
5289 5298
5290 if (rc) { 5299 if (rc) {
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index f5dbf2be3ea..1676f61291e 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -2291,7 +2291,8 @@ typedef struct {
2291typedef struct { 2291typedef struct {
2292#ifdef __BIG_ENDIAN_BITFIELD 2292#ifdef __BIG_ENDIAN_BITFIELD
2293 uint32_t rsvd1; 2293 uint32_t rsvd1;
2294 uint32_t rsvd2:8; 2294 uint32_t rsvd2:7;
2295 uint32_t upd:1;
2295 uint32_t sid:24; 2296 uint32_t sid:24;
2296 uint32_t wwn[2]; 2297 uint32_t wwn[2];
2297 uint32_t rsvd5; 2298 uint32_t rsvd5;
@@ -2300,7 +2301,8 @@ typedef struct {
2300#else /* __LITTLE_ENDIAN */ 2301#else /* __LITTLE_ENDIAN */
2301 uint32_t rsvd1; 2302 uint32_t rsvd1;
2302 uint32_t sid:24; 2303 uint32_t sid:24;
2303 uint32_t rsvd2:8; 2304 uint32_t upd:1;
2305 uint32_t rsvd2:7;
2304 uint32_t wwn[2]; 2306 uint32_t wwn[2];
2305 uint32_t rsvd5; 2307 uint32_t rsvd5;
2306 uint16_t vpi; 2308 uint16_t vpi;
@@ -2806,11 +2808,15 @@ typedef struct {
2806 uint32_t rsvd6; /* Reserved */ 2808 uint32_t rsvd6; /* Reserved */
2807 2809
2808#ifdef __BIG_ENDIAN_BITFIELD 2810#ifdef __BIG_ENDIAN_BITFIELD
2809 uint32_t rsvd7 : 16; /* Reserved */ 2811 uint32_t fips_rev : 3; /* FIPS Spec Revision */
2812 uint32_t fips_level : 4; /* FIPS Level */
2813 uint32_t sec_err : 9; /* security crypto error */
2810 uint32_t max_vpi : 16; /* Max number of virt N-Ports */ 2814 uint32_t max_vpi : 16; /* Max number of virt N-Ports */
2811#else /* __LITTLE_ENDIAN */ 2815#else /* __LITTLE_ENDIAN */
2812 uint32_t max_vpi : 16; /* Max number of virt N-Ports */ 2816 uint32_t max_vpi : 16; /* Max number of virt N-Ports */
2813 uint32_t rsvd7 : 16; /* Reserved */ 2817 uint32_t sec_err : 9; /* security crypto error */
2818 uint32_t fips_level : 4; /* FIPS Level */
2819 uint32_t fips_rev : 3; /* FIPS Spec Revision */
2814#endif 2820#endif
2815 2821
2816} CONFIG_PORT_VAR; 2822} CONFIG_PORT_VAR;
@@ -3441,63 +3447,63 @@ struct sli3_bg_fields {
3441static inline uint32_t 3447static inline uint32_t
3442lpfc_bgs_get_bidir_bg_prof(uint32_t bgstat) 3448lpfc_bgs_get_bidir_bg_prof(uint32_t bgstat)
3443{ 3449{
3444 return (le32_to_cpu(bgstat) & BGS_BIDIR_BG_PROF_MASK) >> 3450 return (bgstat & BGS_BIDIR_BG_PROF_MASK) >>
3445 BGS_BIDIR_BG_PROF_SHIFT; 3451 BGS_BIDIR_BG_PROF_SHIFT;
3446} 3452}
3447 3453
3448static inline uint32_t 3454static inline uint32_t
3449lpfc_bgs_get_bidir_err_cond(uint32_t bgstat) 3455lpfc_bgs_get_bidir_err_cond(uint32_t bgstat)
3450{ 3456{
3451 return (le32_to_cpu(bgstat) & BGS_BIDIR_ERR_COND_FLAGS_MASK) >> 3457 return (bgstat & BGS_BIDIR_ERR_COND_FLAGS_MASK) >>
3452 BGS_BIDIR_ERR_COND_SHIFT; 3458 BGS_BIDIR_ERR_COND_SHIFT;
3453} 3459}
3454 3460
3455static inline uint32_t 3461static inline uint32_t
3456lpfc_bgs_get_bg_prof(uint32_t bgstat) 3462lpfc_bgs_get_bg_prof(uint32_t bgstat)
3457{ 3463{
3458 return (le32_to_cpu(bgstat) & BGS_BG_PROFILE_MASK) >> 3464 return (bgstat & BGS_BG_PROFILE_MASK) >>
3459 BGS_BG_PROFILE_SHIFT; 3465 BGS_BG_PROFILE_SHIFT;
3460} 3466}
3461 3467
3462static inline uint32_t 3468static inline uint32_t
3463lpfc_bgs_get_invalid_prof(uint32_t bgstat) 3469lpfc_bgs_get_invalid_prof(uint32_t bgstat)
3464{ 3470{
3465 return (le32_to_cpu(bgstat) & BGS_INVALID_PROF_MASK) >> 3471 return (bgstat & BGS_INVALID_PROF_MASK) >>
3466 BGS_INVALID_PROF_SHIFT; 3472 BGS_INVALID_PROF_SHIFT;
3467} 3473}
3468 3474
3469static inline uint32_t 3475static inline uint32_t
3470lpfc_bgs_get_uninit_dif_block(uint32_t bgstat) 3476lpfc_bgs_get_uninit_dif_block(uint32_t bgstat)
3471{ 3477{
3472 return (le32_to_cpu(bgstat) & BGS_UNINIT_DIF_BLOCK_MASK) >> 3478 return (bgstat & BGS_UNINIT_DIF_BLOCK_MASK) >>
3473 BGS_UNINIT_DIF_BLOCK_SHIFT; 3479 BGS_UNINIT_DIF_BLOCK_SHIFT;
3474} 3480}
3475 3481
3476static inline uint32_t 3482static inline uint32_t
3477lpfc_bgs_get_hi_water_mark_present(uint32_t bgstat) 3483lpfc_bgs_get_hi_water_mark_present(uint32_t bgstat)
3478{ 3484{
3479 return (le32_to_cpu(bgstat) & BGS_HI_WATER_MARK_PRESENT_MASK) >> 3485 return (bgstat & BGS_HI_WATER_MARK_PRESENT_MASK) >>
3480 BGS_HI_WATER_MARK_PRESENT_SHIFT; 3486 BGS_HI_WATER_MARK_PRESENT_SHIFT;
3481} 3487}
3482 3488
3483static inline uint32_t 3489static inline uint32_t
3484lpfc_bgs_get_reftag_err(uint32_t bgstat) 3490lpfc_bgs_get_reftag_err(uint32_t bgstat)
3485{ 3491{
3486 return (le32_to_cpu(bgstat) & BGS_REFTAG_ERR_MASK) >> 3492 return (bgstat & BGS_REFTAG_ERR_MASK) >>
3487 BGS_REFTAG_ERR_SHIFT; 3493 BGS_REFTAG_ERR_SHIFT;
3488} 3494}
3489 3495
3490static inline uint32_t 3496static inline uint32_t
3491lpfc_bgs_get_apptag_err(uint32_t bgstat) 3497lpfc_bgs_get_apptag_err(uint32_t bgstat)
3492{ 3498{
3493 return (le32_to_cpu(bgstat) & BGS_APPTAG_ERR_MASK) >> 3499 return (bgstat & BGS_APPTAG_ERR_MASK) >>
3494 BGS_APPTAG_ERR_SHIFT; 3500 BGS_APPTAG_ERR_SHIFT;
3495} 3501}
3496 3502
3497static inline uint32_t 3503static inline uint32_t
3498lpfc_bgs_get_guard_err(uint32_t bgstat) 3504lpfc_bgs_get_guard_err(uint32_t bgstat)
3499{ 3505{
3500 return (le32_to_cpu(bgstat) & BGS_GUARD_ERR_MASK) >> 3506 return (bgstat & BGS_GUARD_ERR_MASK) >>
3501 BGS_GUARD_ERR_SHIFT; 3507 BGS_GUARD_ERR_SHIFT;
3502} 3508}
3503 3509
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 2786ee3b605..da9ba06ad58 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1032,27 +1032,46 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba)
1032 /* If there is no heart beat outstanding, issue a heartbeat command */ 1032 /* If there is no heart beat outstanding, issue a heartbeat command */
1033 if (phba->cfg_enable_hba_heartbeat) { 1033 if (phba->cfg_enable_hba_heartbeat) {
1034 if (!phba->hb_outstanding) { 1034 if (!phba->hb_outstanding) {
1035 pmboxq = mempool_alloc(phba->mbox_mem_pool,GFP_KERNEL); 1035 if ((!(psli->sli_flag & LPFC_SLI_MBOX_ACTIVE)) &&
1036 if (!pmboxq) { 1036 (list_empty(&psli->mboxq))) {
1037 mod_timer(&phba->hb_tmofunc, 1037 pmboxq = mempool_alloc(phba->mbox_mem_pool,
1038 jiffies + HZ * LPFC_HB_MBOX_INTERVAL); 1038 GFP_KERNEL);
1039 return; 1039 if (!pmboxq) {
1040 } 1040 mod_timer(&phba->hb_tmofunc,
1041 jiffies +
1042 HZ * LPFC_HB_MBOX_INTERVAL);
1043 return;
1044 }
1041 1045
1042 lpfc_heart_beat(phba, pmboxq); 1046 lpfc_heart_beat(phba, pmboxq);
1043 pmboxq->mbox_cmpl = lpfc_hb_mbox_cmpl; 1047 pmboxq->mbox_cmpl = lpfc_hb_mbox_cmpl;
1044 pmboxq->vport = phba->pport; 1048 pmboxq->vport = phba->pport;
1045 retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); 1049 retval = lpfc_sli_issue_mbox(phba, pmboxq,
1050 MBX_NOWAIT);
1051
1052 if (retval != MBX_BUSY &&
1053 retval != MBX_SUCCESS) {
1054 mempool_free(pmboxq,
1055 phba->mbox_mem_pool);
1056 mod_timer(&phba->hb_tmofunc,
1057 jiffies +
1058 HZ * LPFC_HB_MBOX_INTERVAL);
1059 return;
1060 }
1061 phba->skipped_hb = 0;
1062 phba->hb_outstanding = 1;
1063 } else if (time_before_eq(phba->last_completion_time,
1064 phba->skipped_hb)) {
1065 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
1066 "2857 Last completion time not "
1067 " updated in %d ms\n",
1068 jiffies_to_msecs(jiffies
1069 - phba->last_completion_time));
1070 } else
1071 phba->skipped_hb = jiffies;
1046 1072
1047 if (retval != MBX_BUSY && retval != MBX_SUCCESS) {
1048 mempool_free(pmboxq, phba->mbox_mem_pool);
1049 mod_timer(&phba->hb_tmofunc,
1050 jiffies + HZ * LPFC_HB_MBOX_INTERVAL);
1051 return;
1052 }
1053 mod_timer(&phba->hb_tmofunc, 1073 mod_timer(&phba->hb_tmofunc,
1054 jiffies + HZ * LPFC_HB_MBOX_TIMEOUT); 1074 jiffies + HZ * LPFC_HB_MBOX_TIMEOUT);
1055 phba->hb_outstanding = 1;
1056 return; 1075 return;
1057 } else { 1076 } else {
1058 /* 1077 /*
@@ -3281,10 +3300,10 @@ lpfc_sli4_perform_vport_cvl(struct lpfc_vport *vport)
3281 if (!ndlp) 3300 if (!ndlp)
3282 return 0; 3301 return 0;
3283 } 3302 }
3284 if (phba->pport->port_state <= LPFC_FLOGI) 3303 if (phba->pport->port_state < LPFC_FLOGI)
3285 return NULL; 3304 return NULL;
3286 /* If virtual link is not yet instantiated ignore CVL */ 3305 /* If virtual link is not yet instantiated ignore CVL */
3287 if (vport->port_state <= LPFC_FDISC) 3306 if ((vport != phba->pport) && (vport->port_state < LPFC_FDISC))
3288 return NULL; 3307 return NULL;
3289 shost = lpfc_shost_from_vport(vport); 3308 shost = lpfc_shost_from_vport(vport);
3290 if (!shost) 3309 if (!shost)
@@ -3357,21 +3376,7 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3357 "evt_tag:x%x, fcf_index:x%x\n", 3376 "evt_tag:x%x, fcf_index:x%x\n",
3358 acqe_fcoe->event_tag, 3377 acqe_fcoe->event_tag,
3359 acqe_fcoe->index); 3378 acqe_fcoe->index);
3360 /* If the FCF discovery is in progress, do nothing. */ 3379 if (phba->fcf.fcf_flag & FCF_DISCOVERY) {
3361 spin_lock_irq(&phba->hbalock);
3362 if (phba->hba_flag & FCF_DISC_INPROGRESS) {
3363 spin_unlock_irq(&phba->hbalock);
3364 break;
3365 }
3366 /* If fast FCF failover rescan event is pending, do nothing */
3367 if (phba->fcf.fcf_flag & FCF_REDISC_EVT) {
3368 spin_unlock_irq(&phba->hbalock);
3369 break;
3370 }
3371 spin_unlock_irq(&phba->hbalock);
3372
3373 if ((phba->fcf.fcf_flag & FCF_DISCOVERY) &&
3374 !(phba->fcf.fcf_flag & FCF_REDISC_FOV)) {
3375 /* 3380 /*
3376 * During period of FCF discovery, read the FCF 3381 * During period of FCF discovery, read the FCF
3377 * table record indexed by the event to update 3382 * table record indexed by the event to update
@@ -3385,13 +3390,26 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3385 acqe_fcoe->index); 3390 acqe_fcoe->index);
3386 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fcoe->index); 3391 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fcoe->index);
3387 } 3392 }
3388 /* If the FCF has been in discovered state, do nothing. */ 3393
3394 /* If the FCF discovery is in progress, do nothing. */
3389 spin_lock_irq(&phba->hbalock); 3395 spin_lock_irq(&phba->hbalock);
3396 if (phba->hba_flag & FCF_DISC_INPROGRESS) {
3397 spin_unlock_irq(&phba->hbalock);
3398 break;
3399 }
3400 /* If fast FCF failover rescan event is pending, do nothing */
3401 if (phba->fcf.fcf_flag & FCF_REDISC_EVT) {
3402 spin_unlock_irq(&phba->hbalock);
3403 break;
3404 }
3405
3406 /* If the FCF has been in discovered state, do nothing. */
3390 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) { 3407 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) {
3391 spin_unlock_irq(&phba->hbalock); 3408 spin_unlock_irq(&phba->hbalock);
3392 break; 3409 break;
3393 } 3410 }
3394 spin_unlock_irq(&phba->hbalock); 3411 spin_unlock_irq(&phba->hbalock);
3412
3395 /* Otherwise, scan the entire FCF table and re-discover SAN */ 3413 /* Otherwise, scan the entire FCF table and re-discover SAN */
3396 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, 3414 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
3397 "2770 Start FCF table scan due to new FCF " 3415 "2770 Start FCF table scan due to new FCF "
@@ -3417,13 +3435,9 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3417 "2549 FCF disconnected from network index 0x%x" 3435 "2549 FCF disconnected from network index 0x%x"
3418 " tag 0x%x\n", acqe_fcoe->index, 3436 " tag 0x%x\n", acqe_fcoe->index,
3419 acqe_fcoe->event_tag); 3437 acqe_fcoe->event_tag);
3420 /* If the event is not for currently used fcf do nothing */ 3438 /*
3421 if (phba->fcf.current_rec.fcf_indx != acqe_fcoe->index) 3439 * If we are in the middle of FCF failover process, clear
3422 break; 3440 * the corresponding FCF bit in the roundrobin bitmap.
3423 /* We request port to rediscover the entire FCF table for
3424 * a fast recovery from case that the current FCF record
3425 * is no longer valid if we are not in the middle of FCF
3426 * failover process already.
3427 */ 3441 */
3428 spin_lock_irq(&phba->hbalock); 3442 spin_lock_irq(&phba->hbalock);
3429 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { 3443 if (phba->fcf.fcf_flag & FCF_DISCOVERY) {
@@ -3432,9 +3446,23 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3432 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fcoe->index); 3446 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fcoe->index);
3433 break; 3447 break;
3434 } 3448 }
3449 spin_unlock_irq(&phba->hbalock);
3450
3451 /* If the event is not for currently used fcf do nothing */
3452 if (phba->fcf.current_rec.fcf_indx != acqe_fcoe->index)
3453 break;
3454
3455 /*
3456 * Otherwise, request the port to rediscover the entire FCF
3457 * table for a fast recovery from case that the current FCF
3458 * is no longer valid as we are not in the middle of FCF
3459 * failover process already.
3460 */
3461 spin_lock_irq(&phba->hbalock);
3435 /* Mark the fast failover process in progress */ 3462 /* Mark the fast failover process in progress */
3436 phba->fcf.fcf_flag |= FCF_DEAD_DISC; 3463 phba->fcf.fcf_flag |= FCF_DEAD_DISC;
3437 spin_unlock_irq(&phba->hbalock); 3464 spin_unlock_irq(&phba->hbalock);
3465
3438 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, 3466 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
3439 "2771 Start FCF fast failover process due to " 3467 "2771 Start FCF fast failover process due to "
3440 "FCF DEAD event: evt_tag:x%x, fcf_index:x%x " 3468 "FCF DEAD event: evt_tag:x%x, fcf_index:x%x "
@@ -3454,12 +3482,16 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3454 * as a link down to FCF registration. 3482 * as a link down to FCF registration.
3455 */ 3483 */
3456 lpfc_sli4_fcf_dead_failthrough(phba); 3484 lpfc_sli4_fcf_dead_failthrough(phba);
3457 } else 3485 } else {
3458 /* Handling fast FCF failover to a DEAD FCF event 3486 /* Reset FCF roundrobin bmask for new discovery */
3459 * is considered equalivant to receiving CVL to all 3487 memset(phba->fcf.fcf_rr_bmask, 0,
3460 * vports. 3488 sizeof(*phba->fcf.fcf_rr_bmask));
3489 /*
3490 * Handling fast FCF failover to a DEAD FCF event is
3491 * considered equalivant to receiving CVL to all vports.
3461 */ 3492 */
3462 lpfc_sli4_perform_all_vport_cvl(phba); 3493 lpfc_sli4_perform_all_vport_cvl(phba);
3494 }
3463 break; 3495 break;
3464 case LPFC_FCOE_EVENT_TYPE_CVL: 3496 case LPFC_FCOE_EVENT_TYPE_CVL:
3465 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, 3497 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY,
@@ -3534,7 +3566,13 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3534 * the current registered FCF entry. 3566 * the current registered FCF entry.
3535 */ 3567 */
3536 lpfc_retry_pport_discovery(phba); 3568 lpfc_retry_pport_discovery(phba);
3537 } 3569 } else
3570 /*
3571 * Reset FCF roundrobin bmask for new
3572 * discovery.
3573 */
3574 memset(phba->fcf.fcf_rr_bmask, 0,
3575 sizeof(*phba->fcf.fcf_rr_bmask));
3538 } 3576 }
3539 break; 3577 break;
3540 default: 3578 default:
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 9c2c7c7140c..0dfa310cd60 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -815,9 +815,15 @@ void
815lpfc_reg_vpi(struct lpfc_vport *vport, LPFC_MBOXQ_t *pmb) 815lpfc_reg_vpi(struct lpfc_vport *vport, LPFC_MBOXQ_t *pmb)
816{ 816{
817 MAILBOX_t *mb = &pmb->u.mb; 817 MAILBOX_t *mb = &pmb->u.mb;
818 struct lpfc_hba *phba = vport->phba;
818 819
819 memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); 820 memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
820 821 /*
822 * Set the re-reg VPI bit for f/w to update the MAC address.
823 */
824 if ((phba->sli_rev == LPFC_SLI_REV4) &&
825 !(vport->fc_flag & FC_VPORT_NEEDS_REG_VPI))
826 mb->un.varRegVpi.upd = 1;
821 mb->un.varRegVpi.vpi = vport->vpi + vport->phba->vpi_base; 827 mb->un.varRegVpi.vpi = vport->vpi + vport->phba->vpi_base;
822 mb->un.varRegVpi.sid = vport->fc_myDID; 828 mb->un.varRegVpi.sid = vport->fc_myDID;
823 mb->un.varRegVpi.vfi = vport->vfi + vport->phba->vfi_base; 829 mb->un.varRegVpi.vfi = vport->vfi + vport->phba->vfi_base;
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index c818a725596..2e51aa6b45b 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -1325,7 +1325,7 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1325 bf_set(pde5_type, pde5, LPFC_PDE5_DESCRIPTOR); 1325 bf_set(pde5_type, pde5, LPFC_PDE5_DESCRIPTOR);
1326 pde5->reftag = reftag; 1326 pde5->reftag = reftag;
1327 1327
1328 /* Endian convertion if necessary for PDE5 */ 1328 /* Endianness conversion if necessary for PDE5 */
1329 pde5->word0 = cpu_to_le32(pde5->word0); 1329 pde5->word0 = cpu_to_le32(pde5->word0);
1330 pde5->reftag = cpu_to_le32(pde5->reftag); 1330 pde5->reftag = cpu_to_le32(pde5->reftag);
1331 1331
@@ -1347,7 +1347,7 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1347 bf_set(pde6_ai, pde6, 1); 1347 bf_set(pde6_ai, pde6, 1);
1348 bf_set(pde6_apptagval, pde6, apptagval); 1348 bf_set(pde6_apptagval, pde6, apptagval);
1349 1349
1350 /* Endian convertion if necessary for PDE6 */ 1350 /* Endianness conversion if necessary for PDE6 */
1351 pde6->word0 = cpu_to_le32(pde6->word0); 1351 pde6->word0 = cpu_to_le32(pde6->word0);
1352 pde6->word1 = cpu_to_le32(pde6->word1); 1352 pde6->word1 = cpu_to_le32(pde6->word1);
1353 pde6->word2 = cpu_to_le32(pde6->word2); 1353 pde6->word2 = cpu_to_le32(pde6->word2);
@@ -1459,7 +1459,7 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1459 bf_set(pde5_type, pde5, LPFC_PDE5_DESCRIPTOR); 1459 bf_set(pde5_type, pde5, LPFC_PDE5_DESCRIPTOR);
1460 pde5->reftag = reftag; 1460 pde5->reftag = reftag;
1461 1461
1462 /* Endian convertion if necessary for PDE5 */ 1462 /* Endianness conversion if necessary for PDE5 */
1463 pde5->word0 = cpu_to_le32(pde5->word0); 1463 pde5->word0 = cpu_to_le32(pde5->word0);
1464 pde5->reftag = cpu_to_le32(pde5->reftag); 1464 pde5->reftag = cpu_to_le32(pde5->reftag);
1465 1465
@@ -1479,7 +1479,7 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1479 bf_set(pde6_ai, pde6, 1); 1479 bf_set(pde6_ai, pde6, 1);
1480 bf_set(pde6_apptagval, pde6, apptagval); 1480 bf_set(pde6_apptagval, pde6, apptagval);
1481 1481
1482 /* Endian convertion if necessary for PDE6 */ 1482 /* Endianness conversion if necessary for PDE6 */
1483 pde6->word0 = cpu_to_le32(pde6->word0); 1483 pde6->word0 = cpu_to_le32(pde6->word0);
1484 pde6->word1 = cpu_to_le32(pde6->word1); 1484 pde6->word1 = cpu_to_le32(pde6->word1);
1485 pde6->word2 = cpu_to_le32(pde6->word2); 1485 pde6->word2 = cpu_to_le32(pde6->word2);
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index e758eae0d0f..fb8905f893f 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -1046,7 +1046,7 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
1046 } else 1046 } else
1047 spin_unlock_irq(&phba->hbalock); 1047 spin_unlock_irq(&phba->hbalock);
1048 1048
1049 lpfc_printf_log(phba, KERN_ERR,LOG_SLI, 1049 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
1050 "0318 Failed to allocate IOTAG.last IOTAG is %d\n", 1050 "0318 Failed to allocate IOTAG.last IOTAG is %d\n",
1051 psli->last_iotag); 1051 psli->last_iotag);
1052 1052
@@ -3914,7 +3914,8 @@ lpfc_sli_config_port(struct lpfc_hba *phba, int sli_mode)
3914 phba->sli3_options &= ~(LPFC_SLI3_NPIV_ENABLED | 3914 phba->sli3_options &= ~(LPFC_SLI3_NPIV_ENABLED |
3915 LPFC_SLI3_HBQ_ENABLED | 3915 LPFC_SLI3_HBQ_ENABLED |
3916 LPFC_SLI3_CRP_ENABLED | 3916 LPFC_SLI3_CRP_ENABLED |
3917 LPFC_SLI3_BG_ENABLED); 3917 LPFC_SLI3_BG_ENABLED |
3918 LPFC_SLI3_DSS_ENABLED);
3918 if (rc != MBX_SUCCESS) { 3919 if (rc != MBX_SUCCESS) {
3919 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 3920 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
3920 "0442 Adapter failed to init, mbxCmd x%x " 3921 "0442 Adapter failed to init, mbxCmd x%x "
@@ -3949,8 +3950,23 @@ lpfc_sli_config_port(struct lpfc_hba *phba, int sli_mode)
3949 3950
3950 } else 3951 } else
3951 phba->max_vpi = 0; 3952 phba->max_vpi = 0;
3952 if (pmb->u.mb.un.varCfgPort.gdss) 3953 phba->fips_level = 0;
3954 phba->fips_spec_rev = 0;
3955 if (pmb->u.mb.un.varCfgPort.gdss) {
3953 phba->sli3_options |= LPFC_SLI3_DSS_ENABLED; 3956 phba->sli3_options |= LPFC_SLI3_DSS_ENABLED;
3957 phba->fips_level = pmb->u.mb.un.varCfgPort.fips_level;
3958 phba->fips_spec_rev = pmb->u.mb.un.varCfgPort.fips_rev;
3959 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
3960 "2850 Security Crypto Active. FIPS x%d "
3961 "(Spec Rev: x%d)",
3962 phba->fips_level, phba->fips_spec_rev);
3963 }
3964 if (pmb->u.mb.un.varCfgPort.sec_err) {
3965 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
3966 "2856 Config Port Security Crypto "
3967 "Error: x%x ",
3968 pmb->u.mb.un.varCfgPort.sec_err);
3969 }
3954 if (pmb->u.mb.un.varCfgPort.gerbm) 3970 if (pmb->u.mb.un.varCfgPort.gerbm)
3955 phba->sli3_options |= LPFC_SLI3_HBQ_ENABLED; 3971 phba->sli3_options |= LPFC_SLI3_HBQ_ENABLED;
3956 if (pmb->u.mb.un.varCfgPort.gcrp) 3972 if (pmb->u.mb.un.varCfgPort.gcrp)
@@ -9040,6 +9056,7 @@ lpfc_sli4_sp_handle_cqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
9040 switch (bf_get(lpfc_cqe_code, &cqevt)) { 9056 switch (bf_get(lpfc_cqe_code, &cqevt)) {
9041 case CQE_CODE_COMPL_WQE: 9057 case CQE_CODE_COMPL_WQE:
9042 /* Process the WQ/RQ complete event */ 9058 /* Process the WQ/RQ complete event */
9059 phba->last_completion_time = jiffies;
9043 workposted = lpfc_sli4_sp_handle_els_wcqe(phba, 9060 workposted = lpfc_sli4_sp_handle_els_wcqe(phba,
9044 (struct lpfc_wcqe_complete *)&cqevt); 9061 (struct lpfc_wcqe_complete *)&cqevt);
9045 break; 9062 break;
@@ -9050,11 +9067,13 @@ lpfc_sli4_sp_handle_cqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
9050 break; 9067 break;
9051 case CQE_CODE_XRI_ABORTED: 9068 case CQE_CODE_XRI_ABORTED:
9052 /* Process the WQ XRI abort event */ 9069 /* Process the WQ XRI abort event */
9070 phba->last_completion_time = jiffies;
9053 workposted = lpfc_sli4_sp_handle_abort_xri_wcqe(phba, cq, 9071 workposted = lpfc_sli4_sp_handle_abort_xri_wcqe(phba, cq,
9054 (struct sli4_wcqe_xri_aborted *)&cqevt); 9072 (struct sli4_wcqe_xri_aborted *)&cqevt);
9055 break; 9073 break;
9056 case CQE_CODE_RECEIVE: 9074 case CQE_CODE_RECEIVE:
9057 /* Process the RQ event */ 9075 /* Process the RQ event */
9076 phba->last_completion_time = jiffies;
9058 workposted = lpfc_sli4_sp_handle_rcqe(phba, 9077 workposted = lpfc_sli4_sp_handle_rcqe(phba,
9059 (struct lpfc_rcqe *)&cqevt); 9078 (struct lpfc_rcqe *)&cqevt);
9060 break; 9079 break;
@@ -9276,7 +9295,6 @@ lpfc_sli4_fp_handle_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
9276{ 9295{
9277 struct lpfc_wcqe_release wcqe; 9296 struct lpfc_wcqe_release wcqe;
9278 bool workposted = false; 9297 bool workposted = false;
9279 unsigned long iflag;
9280 9298
9281 /* Copy the work queue CQE and convert endian order if needed */ 9299 /* Copy the work queue CQE and convert endian order if needed */
9282 lpfc_sli_pcimem_bcopy(cqe, &wcqe, sizeof(struct lpfc_cqe)); 9300 lpfc_sli_pcimem_bcopy(cqe, &wcqe, sizeof(struct lpfc_cqe));
@@ -9285,9 +9303,7 @@ lpfc_sli4_fp_handle_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
9285 switch (bf_get(lpfc_wcqe_c_code, &wcqe)) { 9303 switch (bf_get(lpfc_wcqe_c_code, &wcqe)) {
9286 case CQE_CODE_COMPL_WQE: 9304 case CQE_CODE_COMPL_WQE:
9287 /* Process the WQ complete event */ 9305 /* Process the WQ complete event */
9288 spin_lock_irqsave(&phba->hbalock, iflag);
9289 phba->last_completion_time = jiffies; 9306 phba->last_completion_time = jiffies;
9290 spin_unlock_irqrestore(&phba->hbalock, iflag);
9291 lpfc_sli4_fp_handle_fcp_wcqe(phba, 9307 lpfc_sli4_fp_handle_fcp_wcqe(phba,
9292 (struct lpfc_wcqe_complete *)&wcqe); 9308 (struct lpfc_wcqe_complete *)&wcqe);
9293 break; 9309 break;
@@ -9298,6 +9314,7 @@ lpfc_sli4_fp_handle_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
9298 break; 9314 break;
9299 case CQE_CODE_XRI_ABORTED: 9315 case CQE_CODE_XRI_ABORTED:
9300 /* Process the WQ XRI abort event */ 9316 /* Process the WQ XRI abort event */
9317 phba->last_completion_time = jiffies;
9301 workposted = lpfc_sli4_sp_handle_abort_xri_wcqe(phba, cq, 9318 workposted = lpfc_sli4_sp_handle_abort_xri_wcqe(phba, cq,
9302 (struct sli4_wcqe_xri_aborted *)&wcqe); 9319 (struct sli4_wcqe_xri_aborted *)&wcqe);
9303 break; 9320 break;
@@ -12278,12 +12295,9 @@ lpfc_sli4_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, uint16_t fcf_index)
12278 spin_lock_irq(&phba->hbalock); 12295 spin_lock_irq(&phba->hbalock);
12279 phba->hba_flag |= FCF_DISC_INPROGRESS; 12296 phba->hba_flag |= FCF_DISC_INPROGRESS;
12280 spin_unlock_irq(&phba->hbalock); 12297 spin_unlock_irq(&phba->hbalock);
12281 /* Reset FCF round robin index bmask for new scan */ 12298 /* Reset eligible FCF count for new scan */
12282 if (fcf_index == LPFC_FCOE_FCF_GET_FIRST) { 12299 if (fcf_index == LPFC_FCOE_FCF_GET_FIRST)
12283 memset(phba->fcf.fcf_rr_bmask, 0,
12284 sizeof(*phba->fcf.fcf_rr_bmask));
12285 phba->fcf.eligible_fcf_cnt = 0; 12300 phba->fcf.eligible_fcf_cnt = 0;
12286 }
12287 error = 0; 12301 error = 0;
12288 } 12302 }
12289fail_fcf_scan: 12303fail_fcf_scan:
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index d28830af71d..61afb3420a9 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.15" 21#define LPFC_DRIVER_VERSION "8.3.16"
22#define LPFC_DRIVER_NAME "lpfc" 22#define LPFC_DRIVER_NAME "lpfc"
23#define LPFC_SP_DRIVER_HANDLER_NAME "lpfc:sp" 23#define LPFC_SP_DRIVER_HANDLER_NAME "lpfc:sp"
24#define LPFC_FP_DRIVER_HANDLER_NAME "lpfc:fp" 24#define LPFC_FP_DRIVER_HANDLER_NAME "lpfc:fp"