aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2013-04-17 20:15:19 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-05-02 15:43:15 -0400
commite74c03c8a8e73c9a0648e1950f8798db0e43a07e (patch)
tree638ec5e730f4a24c788b8ff37ad451d7270dd96e
parent256ec0d05f8050339a9cc4e92bdc96cec1ce82bd (diff)
[SCSI] lpfc 8.3.39: Fixed pt2pt and loop discovery problems on topology changes.
Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/lpfc/lpfc.h1
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c93
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c55
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c9
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c6
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c8
7 files changed, 149 insertions, 25 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index c586db227a9a..4c9f94bd6729 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -673,6 +673,7 @@ struct lpfc_hba {
673 uint32_t lmt; 673 uint32_t lmt;
674 674
675 uint32_t fc_topology; /* link topology, from LINK INIT */ 675 uint32_t fc_topology; /* link topology, from LINK INIT */
676 uint32_t fc_topology_changed; /* link topology, from LINK INIT */
676 677
677 struct lpfc_stats fc_stat; 678 struct lpfc_stats fc_stat;
678 679
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 9290713af253..ad5b0f94a98d 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -2801,6 +2801,8 @@ lpfc_topology_store(struct device *dev, struct device_attribute *attr,
2801 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, 2801 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
2802 "3054 lpfc_topology changed from %d to %d\n", 2802 "3054 lpfc_topology changed from %d to %d\n",
2803 prev_val, val); 2803 prev_val, val);
2804 if (prev_val != val && phba->sli_rev == LPFC_SLI_REV4)
2805 phba->fc_topology_changed = 1;
2804 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); 2806 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport));
2805 if (err) { 2807 if (err) {
2806 phba->cfg_topology = prev_val; 2808 phba->cfg_topology = prev_val;
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 7ea0d35be977..67cd88a48bba 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -29,6 +29,7 @@
29#include <scsi/scsi_host.h> 29#include <scsi/scsi_host.h>
30#include <scsi/scsi_transport_fc.h> 30#include <scsi/scsi_transport_fc.h>
31 31
32
32#include "lpfc_hw4.h" 33#include "lpfc_hw4.h"
33#include "lpfc_hw.h" 34#include "lpfc_hw.h"
34#include "lpfc_sli.h" 35#include "lpfc_sli.h"
@@ -308,16 +309,20 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp,
308 /* Xmit ELS command <elsCmd> to remote NPORT <did> */ 309 /* Xmit ELS command <elsCmd> to remote NPORT <did> */
309 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 310 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
310 "0116 Xmit ELS command x%x to remote " 311 "0116 Xmit ELS command x%x to remote "
311 "NPORT x%x I/O tag: x%x, port state: x%x\n", 312 "NPORT x%x I/O tag: x%x, port state:x%x"
313 " fc_flag:x%x\n",
312 elscmd, did, elsiocb->iotag, 314 elscmd, did, elsiocb->iotag,
313 vport->port_state); 315 vport->port_state,
316 vport->fc_flag);
314 } else { 317 } else {
315 /* Xmit ELS response <elsCmd> to remote NPORT <did> */ 318 /* Xmit ELS response <elsCmd> to remote NPORT <did> */
316 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 319 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
317 "0117 Xmit ELS response x%x to remote " 320 "0117 Xmit ELS response x%x to remote "
318 "NPORT x%x I/O tag: x%x, size: x%x\n", 321 "NPORT x%x I/O tag: x%x, size: x%x "
322 "port_state x%x fc_flag x%x\n",
319 elscmd, ndlp->nlp_DID, elsiocb->iotag, 323 elscmd, ndlp->nlp_DID, elsiocb->iotag,
320 cmdSize); 324 cmdSize, vport->port_state,
325 vport->fc_flag);
321 } 326 }
322 return elsiocb; 327 return elsiocb;
323 328
@@ -909,6 +914,23 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
909 spin_lock_irq(shost->host_lock); 914 spin_lock_irq(shost->host_lock);
910 vport->fc_flag |= FC_PT2PT; 915 vport->fc_flag |= FC_PT2PT;
911 spin_unlock_irq(shost->host_lock); 916 spin_unlock_irq(shost->host_lock);
917 /* If physical FC port changed, unreg VFI and ALL VPIs / RPIs */
918 if ((phba->sli_rev == LPFC_SLI_REV4) && phba->fc_topology_changed) {
919 lpfc_unregister_fcf_prep(phba);
920
921 /* The FC_VFI_REGISTERED flag will get clear in the cmpl
922 * handler for unreg_vfi, but if we don't force the
923 * FC_VFI_REGISTERED flag then the reg_vfi mailbox could be
924 * built with the update bit set instead of just the vp bit to
925 * change the Nport ID. We need to have the vp set and the
926 * Upd cleared on topology changes.
927 */
928 spin_lock_irq(shost->host_lock);
929 vport->fc_flag &= ~FC_VFI_REGISTERED;
930 spin_unlock_irq(shost->host_lock);
931 phba->fc_topology_changed = 0;
932 lpfc_issue_reg_vfi(vport);
933 }
912 934
913 /* Start discovery - this should just do CLEAR_LA */ 935 /* Start discovery - this should just do CLEAR_LA */
914 lpfc_disc_start(vport); 936 lpfc_disc_start(vport);
@@ -1030,9 +1052,19 @@ stop_rr_fcf_flogi:
1030 vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; 1052 vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS;
1031 if ((phba->sli_rev == LPFC_SLI_REV4) && 1053 if ((phba->sli_rev == LPFC_SLI_REV4) &&
1032 (!(vport->fc_flag & FC_VFI_REGISTERED) || 1054 (!(vport->fc_flag & FC_VFI_REGISTERED) ||
1033 (vport->fc_prevDID != vport->fc_myDID))) { 1055 (vport->fc_prevDID != vport->fc_myDID) ||
1034 if (vport->fc_flag & FC_VFI_REGISTERED) 1056 phba->fc_topology_changed)) {
1035 lpfc_sli4_unreg_all_rpis(vport); 1057 if (vport->fc_flag & FC_VFI_REGISTERED) {
1058 if (phba->fc_topology_changed) {
1059 lpfc_unregister_fcf_prep(phba);
1060 spin_lock_irq(shost->host_lock);
1061 vport->fc_flag &= ~FC_VFI_REGISTERED;
1062 spin_unlock_irq(shost->host_lock);
1063 phba->fc_topology_changed = 0;
1064 } else {
1065 lpfc_sli4_unreg_all_rpis(vport);
1066 }
1067 }
1036 lpfc_issue_reg_vfi(vport); 1068 lpfc_issue_reg_vfi(vport);
1037 lpfc_nlp_put(ndlp); 1069 lpfc_nlp_put(ndlp);
1038 goto out; 1070 goto out;
@@ -1055,9 +1087,10 @@ stop_rr_fcf_flogi:
1055 /* FLOGI completes successfully */ 1087 /* FLOGI completes successfully */
1056 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 1088 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
1057 "0101 FLOGI completes successfully " 1089 "0101 FLOGI completes successfully "
1058 "Data: x%x x%x x%x x%x\n", 1090 "Data: x%x x%x x%x x%x x%x x%x\n",
1059 irsp->un.ulpWord[4], sp->cmn.e_d_tov, 1091 irsp->un.ulpWord[4], sp->cmn.e_d_tov,
1060 sp->cmn.w2.r_a_tov, sp->cmn.edtovResolution); 1092 sp->cmn.w2.r_a_tov, sp->cmn.edtovResolution,
1093 vport->port_state, vport->fc_flag);
1061 1094
1062 if (vport->port_state == LPFC_FLOGI) { 1095 if (vport->port_state == LPFC_FLOGI) {
1063 /* 1096 /*
@@ -5047,6 +5080,8 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
5047 struct ls_rjt stat; 5080 struct ls_rjt stat;
5048 uint32_t cmd, did; 5081 uint32_t cmd, did;
5049 int rc; 5082 int rc;
5083 uint32_t fc_flag = 0;
5084 uint32_t port_state = 0;
5050 5085
5051 cmd = *lp++; 5086 cmd = *lp++;
5052 sp = (struct serv_parm *) lp; 5087 sp = (struct serv_parm *) lp;
@@ -5113,16 +5148,25 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
5113 * will be. 5148 * will be.
5114 */ 5149 */
5115 vport->fc_myDID = PT2PT_LocalID; 5150 vport->fc_myDID = PT2PT_LocalID;
5116 } 5151 } else
5152 vport->fc_myDID = PT2PT_RemoteID;
5117 5153
5118 /* 5154 /*
5119 * The vport state should go to LPFC_FLOGI only 5155 * The vport state should go to LPFC_FLOGI only
5120 * AFTER we issue a FLOGI, not receive one. 5156 * AFTER we issue a FLOGI, not receive one.
5121 */ 5157 */
5122 spin_lock_irq(shost->host_lock); 5158 spin_lock_irq(shost->host_lock);
5159 fc_flag = vport->fc_flag;
5160 port_state = vport->port_state;
5123 vport->fc_flag |= FC_PT2PT; 5161 vport->fc_flag |= FC_PT2PT;
5124 vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); 5162 vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
5163 vport->port_state = LPFC_FLOGI;
5125 spin_unlock_irq(shost->host_lock); 5164 spin_unlock_irq(shost->host_lock);
5165 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
5166 "3311 Rcv Flogi PS x%x new PS x%x "
5167 "fc_flag x%x new fc_flag x%x\n",
5168 port_state, vport->port_state,
5169 fc_flag, vport->fc_flag);
5126 5170
5127 /* 5171 /*
5128 * We temporarily set fc_myDID to make it look like we are 5172 * We temporarily set fc_myDID to make it look like we are
@@ -6613,7 +6657,9 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
6613 /* ELS command <elsCmd> received from NPORT <did> */ 6657 /* ELS command <elsCmd> received from NPORT <did> */
6614 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 6658 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
6615 "0112 ELS command x%x received from NPORT x%x " 6659 "0112 ELS command x%x received from NPORT x%x "
6616 "Data: x%x\n", cmd, did, vport->port_state); 6660 "Data: x%x x%x x%x x%x\n",
6661 cmd, did, vport->port_state, vport->fc_flag,
6662 vport->fc_myDID, vport->fc_prevDID);
6617 switch (cmd) { 6663 switch (cmd) {
6618 case ELS_CMD_PLOGI: 6664 case ELS_CMD_PLOGI:
6619 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 6665 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
@@ -6622,6 +6668,19 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
6622 6668
6623 phba->fc_stat.elsRcvPLOGI++; 6669 phba->fc_stat.elsRcvPLOGI++;
6624 ndlp = lpfc_plogi_confirm_nport(phba, payload, ndlp); 6670 ndlp = lpfc_plogi_confirm_nport(phba, payload, ndlp);
6671 if (phba->sli_rev == LPFC_SLI_REV4 &&
6672 (phba->pport->fc_flag & FC_PT2PT)) {
6673 vport->fc_prevDID = vport->fc_myDID;
6674 /* Our DID needs to be updated before registering
6675 * the vfi. This is done in lpfc_rcv_plogi but
6676 * that is called after the reg_vfi.
6677 */
6678 vport->fc_myDID = elsiocb->iocb.un.rcvels.parmRo;
6679 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
6680 "3312 Remote port assigned DID x%x "
6681 "%x\n", vport->fc_myDID,
6682 vport->fc_prevDID);
6683 }
6625 6684
6626 lpfc_send_els_event(vport, ndlp, payload); 6685 lpfc_send_els_event(vport, ndlp, payload);
6627 6686
@@ -6631,6 +6690,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
6631 rjt_exp = LSEXP_NOTHING_MORE; 6690 rjt_exp = LSEXP_NOTHING_MORE;
6632 break; 6691 break;
6633 } 6692 }
6693 shost = lpfc_shost_from_vport(vport);
6634 if (vport->port_state < LPFC_DISC_AUTH) { 6694 if (vport->port_state < LPFC_DISC_AUTH) {
6635 if (!(phba->pport->fc_flag & FC_PT2PT) || 6695 if (!(phba->pport->fc_flag & FC_PT2PT) ||
6636 (phba->pport->fc_flag & FC_PT2PT_PLOGI)) { 6696 (phba->pport->fc_flag & FC_PT2PT_PLOGI)) {
@@ -6642,9 +6702,18 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
6642 * another NPort and the other side has initiated 6702 * another NPort and the other side has initiated
6643 * the PLOGI before responding to our FLOGI. 6703 * the PLOGI before responding to our FLOGI.
6644 */ 6704 */
6705 if (phba->sli_rev == LPFC_SLI_REV4 &&
6706 (phba->fc_topology_changed ||
6707 vport->fc_myDID != vport->fc_prevDID)) {
6708 lpfc_unregister_fcf_prep(phba);
6709 spin_lock_irq(shost->host_lock);
6710 vport->fc_flag &= ~FC_VFI_REGISTERED;
6711 spin_unlock_irq(shost->host_lock);
6712 phba->fc_topology_changed = 0;
6713 lpfc_issue_reg_vfi(vport);
6714 }
6645 } 6715 }
6646 6716
6647 shost = lpfc_shost_from_vport(vport);
6648 spin_lock_irq(shost->host_lock); 6717 spin_lock_irq(shost->host_lock);
6649 ndlp->nlp_flag &= ~NLP_TARGET_REMOVE; 6718 ndlp->nlp_flag &= ~NLP_TARGET_REMOVE;
6650 spin_unlock_irq(shost->host_lock); 6719 spin_unlock_irq(shost->host_lock);
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 62deb31fa4b8..3081db730b44 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1436,7 +1436,8 @@ lpfc_register_fcf(struct lpfc_hba *phba)
1436 if (phba->fcf.fcf_flag & FCF_REGISTERED) { 1436 if (phba->fcf.fcf_flag & FCF_REGISTERED) {
1437 phba->fcf.fcf_flag |= (FCF_SCAN_DONE | FCF_IN_USE); 1437 phba->fcf.fcf_flag |= (FCF_SCAN_DONE | FCF_IN_USE);
1438 phba->hba_flag &= ~FCF_TS_INPROG; 1438 phba->hba_flag &= ~FCF_TS_INPROG;
1439 if (phba->pport->port_state != LPFC_FLOGI) { 1439 if (phba->pport->port_state != LPFC_FLOGI &&
1440 phba->pport->fc_flag & FC_FABRIC) {
1440 phba->hba_flag |= FCF_RR_INPROG; 1441 phba->hba_flag |= FCF_RR_INPROG;
1441 spin_unlock_irq(&phba->hbalock); 1442 spin_unlock_irq(&phba->hbalock);
1442 lpfc_initial_flogi(phba->pport); 1443 lpfc_initial_flogi(phba->pport);
@@ -2906,9 +2907,14 @@ lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
2906 goto out_free_mem; 2907 goto out_free_mem;
2907 } 2908 }
2908 2909
2909 /* If the VFI is already registered, there is nothing else to do */ 2910 /* If the VFI is already registered, there is nothing else to do
2911 * Unless this was a VFI update and we are in PT2PT mode, then
2912 * we should drop through to set the port state to ready.
2913 */
2910 if (vport->fc_flag & FC_VFI_REGISTERED) 2914 if (vport->fc_flag & FC_VFI_REGISTERED)
2911 goto out_free_mem; 2915 if (!(phba->sli_rev == LPFC_SLI_REV4 &&
2916 vport->fc_flag & FC_PT2PT))
2917 goto out_free_mem;
2912 2918
2913 /* The VPI is implicitly registered when the VFI is registered */ 2919 /* The VPI is implicitly registered when the VFI is registered */
2914 spin_lock_irq(shost->host_lock); 2920 spin_lock_irq(shost->host_lock);
@@ -2925,6 +2931,13 @@ lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
2925 goto out_free_mem; 2931 goto out_free_mem;
2926 } 2932 }
2927 2933
2934 lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
2935 "3313 cmpl reg vfi port_state:%x fc_flag:%x myDid:%x "
2936 "alpacnt:%d LinkState:%x topology:%x\n",
2937 vport->port_state, vport->fc_flag, vport->fc_myDID,
2938 vport->phba->alpa_map[0],
2939 phba->link_state, phba->fc_topology);
2940
2928 if (vport->port_state == LPFC_FABRIC_CFG_LINK) { 2941 if (vport->port_state == LPFC_FABRIC_CFG_LINK) {
2929 /* 2942 /*
2930 * For private loop or for NPort pt2pt, 2943 * For private loop or for NPort pt2pt,
@@ -2937,7 +2950,10 @@ lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
2937 /* Use loop map to make discovery list */ 2950 /* Use loop map to make discovery list */
2938 lpfc_disc_list_loopmap(vport); 2951 lpfc_disc_list_loopmap(vport);
2939 /* Start discovery */ 2952 /* Start discovery */
2940 lpfc_disc_start(vport); 2953 if (vport->fc_flag & FC_PT2PT)
2954 vport->port_state = LPFC_VPORT_READY;
2955 else
2956 lpfc_disc_start(vport);
2941 } else { 2957 } else {
2942 lpfc_start_fdiscs(phba); 2958 lpfc_start_fdiscs(phba);
2943 lpfc_do_scr_ns_plogi(phba, vport); 2959 lpfc_do_scr_ns_plogi(phba, vport);
@@ -3019,6 +3035,15 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la)
3019 break; 3035 break;
3020 } 3036 }
3021 3037
3038 if (phba->fc_topology &&
3039 phba->fc_topology != bf_get(lpfc_mbx_read_top_topology, la)) {
3040 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
3041 "3314 Toplogy changed was 0x%x is 0x%x\n",
3042 phba->fc_topology,
3043 bf_get(lpfc_mbx_read_top_topology, la));
3044 phba->fc_topology_changed = 1;
3045 }
3046
3022 phba->fc_topology = bf_get(lpfc_mbx_read_top_topology, la); 3047 phba->fc_topology = bf_get(lpfc_mbx_read_top_topology, la);
3023 phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED; 3048 phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED;
3024 3049
@@ -4961,8 +4986,12 @@ lpfc_disc_start(struct lpfc_vport *vport)
4961 uint32_t clear_la_pending; 4986 uint32_t clear_la_pending;
4962 int did_changed; 4987 int did_changed;
4963 4988
4964 if (!lpfc_is_link_up(phba)) 4989 if (!lpfc_is_link_up(phba)) {
4990 lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
4991 "3315 Link is not up %x\n",
4992 phba->link_state);
4965 return; 4993 return;
4994 }
4966 4995
4967 if (phba->link_state == LPFC_CLEAR_LA) 4996 if (phba->link_state == LPFC_CLEAR_LA)
4968 clear_la_pending = 1; 4997 clear_la_pending = 1;
@@ -5868,7 +5897,7 @@ lpfc_unregister_fcf_prep(struct lpfc_hba *phba)
5868 struct lpfc_vport **vports; 5897 struct lpfc_vport **vports;
5869 struct lpfc_nodelist *ndlp; 5898 struct lpfc_nodelist *ndlp;
5870 struct Scsi_Host *shost; 5899 struct Scsi_Host *shost;
5871 int i, rc; 5900 int i = 0, rc;
5872 5901
5873 /* Unregister RPIs */ 5902 /* Unregister RPIs */
5874 if (lpfc_fcf_inuse(phba)) 5903 if (lpfc_fcf_inuse(phba))
@@ -5896,6 +5925,20 @@ lpfc_unregister_fcf_prep(struct lpfc_hba *phba)
5896 spin_unlock_irq(shost->host_lock); 5925 spin_unlock_irq(shost->host_lock);
5897 } 5926 }
5898 lpfc_destroy_vport_work_array(phba, vports); 5927 lpfc_destroy_vport_work_array(phba, vports);
5928 if (i == 0 && (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED))) {
5929 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID);
5930 if (ndlp)
5931 lpfc_cancel_retry_delay_tmo(phba->pport, ndlp);
5932 lpfc_cleanup_pending_mbox(phba->pport);
5933 if (phba->sli_rev == LPFC_SLI_REV4)
5934 lpfc_sli4_unreg_all_rpis(phba->pport);
5935 lpfc_mbx_unreg_vpi(phba->pport);
5936 shost = lpfc_shost_from_vport(phba->pport);
5937 spin_lock_irq(shost->host_lock);
5938 phba->pport->fc_flag |= FC_VPORT_NEEDS_INIT_VPI;
5939 phba->pport->vpi_state &= ~LPFC_VPI_REGISTERED;
5940 spin_unlock_irq(shost->host_lock);
5941 }
5899 5942
5900 /* Cleanup any outstanding ELS commands */ 5943 /* Cleanup any outstanding ELS commands */
5901 lpfc_els_flush_all_cmd(phba); 5944 lpfc_els_flush_all_cmd(phba);
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index a7a9fa468308..41363db7d426 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -2149,18 +2149,21 @@ lpfc_reg_vfi(struct lpfcMboxq *mbox, struct lpfc_vport *vport, dma_addr_t phys)
2149 2149
2150 /* Only FC supports upd bit */ 2150 /* Only FC supports upd bit */
2151 if ((phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC) && 2151 if ((phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC) &&
2152 (vport->fc_flag & FC_VFI_REGISTERED)) { 2152 (vport->fc_flag & FC_VFI_REGISTERED) &&
2153 (!phba->fc_topology_changed)) {
2153 bf_set(lpfc_reg_vfi_vp, reg_vfi, 0); 2154 bf_set(lpfc_reg_vfi_vp, reg_vfi, 0);
2154 bf_set(lpfc_reg_vfi_upd, reg_vfi, 1); 2155 bf_set(lpfc_reg_vfi_upd, reg_vfi, 1);
2155 } 2156 }
2156 lpfc_printf_vlog(vport, KERN_INFO, LOG_MBOX, 2157 lpfc_printf_vlog(vport, KERN_INFO, LOG_MBOX,
2157 "3134 Register VFI, mydid:x%x, fcfi:%d, " 2158 "3134 Register VFI, mydid:x%x, fcfi:%d, "
2158 " vfi:%d, vpi:%d, fc_pname:%x%x\n", 2159 " vfi:%d, vpi:%d, fc_pname:%x%x fc_flag:x%x"
2160 " port_state:x%x topology chg:%d\n",
2159 vport->fc_myDID, 2161 vport->fc_myDID,
2160 phba->fcf.fcfi, 2162 phba->fcf.fcfi,
2161 phba->sli4_hba.vfi_ids[vport->vfi], 2163 phba->sli4_hba.vfi_ids[vport->vfi],
2162 phba->vpi_ids[vport->vpi], 2164 phba->vpi_ids[vport->vpi],
2163 reg_vfi->wwn[0], reg_vfi->wwn[1]); 2165 reg_vfi->wwn[0], reg_vfi->wwn[1], vport->fc_flag,
2166 vport->port_state, phba->fc_topology_changed);
2164} 2167}
2165 2168
2166/** 2169/**
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 41e833ede571..31e9b92f5a9b 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -332,9 +332,11 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
332 332
333 /* PLOGI chkparm OK */ 333 /* PLOGI chkparm OK */
334 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 334 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
335 "0114 PLOGI chkparm OK Data: x%x x%x x%x x%x\n", 335 "0114 PLOGI chkparm OK Data: x%x x%x x%x "
336 "x%x x%x x%x\n",
336 ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, 337 ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag,
337 ndlp->nlp_rpi); 338 ndlp->nlp_rpi, vport->port_state,
339 vport->fc_flag);
338 340
339 if (vport->cfg_fcp_class == 2 && sp->cls2.classValid) 341 if (vport->cfg_fcp_class == 2 && sp->cls2.classValid)
340 ndlp->nlp_fcp_info |= CLASS2; 342 ndlp->nlp_fcp_info |= CLASS2;
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 89a3a4059064..3e02d4427f40 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -2342,7 +2342,8 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
2342 /* Mailbox cmd <cmd> Cmpl <cmpl> */ 2342 /* Mailbox cmd <cmd> Cmpl <cmpl> */
2343 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, 2343 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
2344 "(%d):0307 Mailbox cmd x%x (x%x/x%x) Cmpl x%p " 2344 "(%d):0307 Mailbox cmd x%x (x%x/x%x) Cmpl x%p "
2345 "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n", 2345 "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x "
2346 "x%x x%x x%x\n",
2346 pmb->vport ? pmb->vport->vpi : 0, 2347 pmb->vport ? pmb->vport->vpi : 0,
2347 pmbox->mbxCommand, 2348 pmbox->mbxCommand,
2348 lpfc_sli_config_mbox_subsys_get(phba, pmb), 2349 lpfc_sli_config_mbox_subsys_get(phba, pmb),
@@ -2356,7 +2357,10 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
2356 pmbox->un.varWords[4], 2357 pmbox->un.varWords[4],
2357 pmbox->un.varWords[5], 2358 pmbox->un.varWords[5],
2358 pmbox->un.varWords[6], 2359 pmbox->un.varWords[6],
2359 pmbox->un.varWords[7]); 2360 pmbox->un.varWords[7],
2361 pmbox->un.varWords[8],
2362 pmbox->un.varWords[9],
2363 pmbox->un.varWords[10]);
2360 2364
2361 if (pmb->mbox_cmpl) 2365 if (pmb->mbox_cmpl)
2362 pmb->mbox_cmpl(phba,pmb); 2366 pmb->mbox_cmpl(phba,pmb);