aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_hbadisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_hbadisc.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c91
1 files changed, 75 insertions, 16 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 326e05a65a73..0f6e2548f35d 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -160,11 +160,12 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
160 if (!list_empty(&evtp->evt_listp)) 160 if (!list_empty(&evtp->evt_listp))
161 return; 161 return;
162 162
163 evtp->evt_arg1 = lpfc_nlp_get(ndlp);
164
163 spin_lock_irq(&phba->hbalock); 165 spin_lock_irq(&phba->hbalock);
164 /* We need to hold the node by incrementing the reference 166 /* We need to hold the node by incrementing the reference
165 * count until this queued work is done 167 * count until this queued work is done
166 */ 168 */
167 evtp->evt_arg1 = lpfc_nlp_get(ndlp);
168 if (evtp->evt_arg1) { 169 if (evtp->evt_arg1) {
169 evtp->evt = LPFC_EVT_DEV_LOSS; 170 evtp->evt = LPFC_EVT_DEV_LOSS;
170 list_add_tail(&evtp->evt_listp, &phba->work_list); 171 list_add_tail(&evtp->evt_listp, &phba->work_list);
@@ -1008,9 +1009,6 @@ lpfc_linkup(struct lpfc_hba *phba)
1008 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) 1009 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++)
1009 lpfc_linkup_port(vports[i]); 1010 lpfc_linkup_port(vports[i]);
1010 lpfc_destroy_vport_work_array(phba, vports); 1011 lpfc_destroy_vport_work_array(phba, vports);
1011 if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) &&
1012 (phba->sli_rev < LPFC_SLI_REV4))
1013 lpfc_issue_clear_la(phba, phba->pport);
1014 1012
1015 return 0; 1013 return 0;
1016} 1014}
@@ -1436,7 +1434,8 @@ lpfc_register_fcf(struct lpfc_hba *phba)
1436 if (phba->fcf.fcf_flag & FCF_REGISTERED) { 1434 if (phba->fcf.fcf_flag & FCF_REGISTERED) {
1437 phba->fcf.fcf_flag |= (FCF_SCAN_DONE | FCF_IN_USE); 1435 phba->fcf.fcf_flag |= (FCF_SCAN_DONE | FCF_IN_USE);
1438 phba->hba_flag &= ~FCF_TS_INPROG; 1436 phba->hba_flag &= ~FCF_TS_INPROG;
1439 if (phba->pport->port_state != LPFC_FLOGI) { 1437 if (phba->pport->port_state != LPFC_FLOGI &&
1438 phba->pport->fc_flag & FC_FABRIC) {
1440 phba->hba_flag |= FCF_RR_INPROG; 1439 phba->hba_flag |= FCF_RR_INPROG;
1441 spin_unlock_irq(&phba->hbalock); 1440 spin_unlock_irq(&phba->hbalock);
1442 lpfc_initial_flogi(phba->pport); 1441 lpfc_initial_flogi(phba->pport);
@@ -2270,8 +2269,11 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
2270 spin_unlock_irq(&phba->hbalock); 2269 spin_unlock_irq(&phba->hbalock);
2271 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 2270 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
2272 "2836 New FCF matches in-use " 2271 "2836 New FCF matches in-use "
2273 "FCF (x%x)\n", 2272 "FCF (x%x), port_state:x%x, "
2274 phba->fcf.current_rec.fcf_indx); 2273 "fc_flag:x%x\n",
2274 phba->fcf.current_rec.fcf_indx,
2275 phba->pport->port_state,
2276 phba->pport->fc_flag);
2275 goto out; 2277 goto out;
2276 } else 2278 } else
2277 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, 2279 lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
@@ -2796,7 +2798,19 @@ void
2796lpfc_issue_init_vpi(struct lpfc_vport *vport) 2798lpfc_issue_init_vpi(struct lpfc_vport *vport)
2797{ 2799{
2798 LPFC_MBOXQ_t *mboxq; 2800 LPFC_MBOXQ_t *mboxq;
2799 int rc; 2801 int rc, vpi;
2802
2803 if ((vport->port_type != LPFC_PHYSICAL_PORT) && (!vport->vpi)) {
2804 vpi = lpfc_alloc_vpi(vport->phba);
2805 if (!vpi) {
2806 lpfc_printf_vlog(vport, KERN_ERR,
2807 LOG_MBOX,
2808 "3303 Failed to obtain vport vpi\n");
2809 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
2810 return;
2811 }
2812 vport->vpi = vpi;
2813 }
2800 2814
2801 mboxq = mempool_alloc(vport->phba->mbox_mem_pool, GFP_KERNEL); 2815 mboxq = mempool_alloc(vport->phba->mbox_mem_pool, GFP_KERNEL);
2802 if (!mboxq) { 2816 if (!mboxq) {
@@ -2894,9 +2908,14 @@ lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
2894 goto out_free_mem; 2908 goto out_free_mem;
2895 } 2909 }
2896 2910
2897 /* If the VFI is already registered, there is nothing else to do */ 2911 /* If the VFI is already registered, there is nothing else to do
2912 * Unless this was a VFI update and we are in PT2PT mode, then
2913 * we should drop through to set the port state to ready.
2914 */
2898 if (vport->fc_flag & FC_VFI_REGISTERED) 2915 if (vport->fc_flag & FC_VFI_REGISTERED)
2899 goto out_free_mem; 2916 if (!(phba->sli_rev == LPFC_SLI_REV4 &&
2917 vport->fc_flag & FC_PT2PT))
2918 goto out_free_mem;
2900 2919
2901 /* The VPI is implicitly registered when the VFI is registered */ 2920 /* The VPI is implicitly registered when the VFI is registered */
2902 spin_lock_irq(shost->host_lock); 2921 spin_lock_irq(shost->host_lock);
@@ -2913,6 +2932,13 @@ lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
2913 goto out_free_mem; 2932 goto out_free_mem;
2914 } 2933 }
2915 2934
2935 lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
2936 "3313 cmpl reg vfi port_state:%x fc_flag:%x myDid:%x "
2937 "alpacnt:%d LinkState:%x topology:%x\n",
2938 vport->port_state, vport->fc_flag, vport->fc_myDID,
2939 vport->phba->alpa_map[0],
2940 phba->link_state, phba->fc_topology);
2941
2916 if (vport->port_state == LPFC_FABRIC_CFG_LINK) { 2942 if (vport->port_state == LPFC_FABRIC_CFG_LINK) {
2917 /* 2943 /*
2918 * For private loop or for NPort pt2pt, 2944 * For private loop or for NPort pt2pt,
@@ -2925,7 +2951,10 @@ lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
2925 /* Use loop map to make discovery list */ 2951 /* Use loop map to make discovery list */
2926 lpfc_disc_list_loopmap(vport); 2952 lpfc_disc_list_loopmap(vport);
2927 /* Start discovery */ 2953 /* Start discovery */
2928 lpfc_disc_start(vport); 2954 if (vport->fc_flag & FC_PT2PT)
2955 vport->port_state = LPFC_VPORT_READY;
2956 else
2957 lpfc_disc_start(vport);
2929 } else { 2958 } else {
2930 lpfc_start_fdiscs(phba); 2959 lpfc_start_fdiscs(phba);
2931 lpfc_do_scr_ns_plogi(phba, vport); 2960 lpfc_do_scr_ns_plogi(phba, vport);
@@ -3007,6 +3036,15 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la)
3007 break; 3036 break;
3008 } 3037 }
3009 3038
3039 if (phba->fc_topology &&
3040 phba->fc_topology != bf_get(lpfc_mbx_read_top_topology, la)) {
3041 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
3042 "3314 Toplogy changed was 0x%x is 0x%x\n",
3043 phba->fc_topology,
3044 bf_get(lpfc_mbx_read_top_topology, la));
3045 phba->fc_topology_changed = 1;
3046 }
3047
3010 phba->fc_topology = bf_get(lpfc_mbx_read_top_topology, la); 3048 phba->fc_topology = bf_get(lpfc_mbx_read_top_topology, la);
3011 phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED; 3049 phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED;
3012 3050
@@ -4235,7 +4273,7 @@ lpfc_set_disctmo(struct lpfc_vport *vport)
4235 tmo, vport->port_state, vport->fc_flag); 4273 tmo, vport->port_state, vport->fc_flag);
4236 } 4274 }
4237 4275
4238 mod_timer(&vport->fc_disctmo, jiffies + HZ * tmo); 4276 mod_timer(&vport->fc_disctmo, jiffies + msecs_to_jiffies(1000 * tmo));
4239 spin_lock_irq(shost->host_lock); 4277 spin_lock_irq(shost->host_lock);
4240 vport->fc_flag |= FC_DISC_TMO; 4278 vport->fc_flag |= FC_DISC_TMO;
4241 spin_unlock_irq(shost->host_lock); 4279 spin_unlock_irq(shost->host_lock);
@@ -4949,8 +4987,12 @@ lpfc_disc_start(struct lpfc_vport *vport)
4949 uint32_t clear_la_pending; 4987 uint32_t clear_la_pending;
4950 int did_changed; 4988 int did_changed;
4951 4989
4952 if (!lpfc_is_link_up(phba)) 4990 if (!lpfc_is_link_up(phba)) {
4991 lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
4992 "3315 Link is not up %x\n",
4993 phba->link_state);
4953 return; 4994 return;
4995 }
4954 4996
4955 if (phba->link_state == LPFC_CLEAR_LA) 4997 if (phba->link_state == LPFC_CLEAR_LA)
4956 clear_la_pending = 1; 4998 clear_la_pending = 1;
@@ -4983,11 +5025,13 @@ lpfc_disc_start(struct lpfc_vport *vport)
4983 if (num_sent) 5025 if (num_sent)
4984 return; 5026 return;
4985 5027
4986 /* Register the VPI for SLI3, NON-NPIV only. */ 5028 /* Register the VPI for SLI3, NPIV only. */
4987 if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && 5029 if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) &&
4988 !(vport->fc_flag & FC_PT2PT) && 5030 !(vport->fc_flag & FC_PT2PT) &&
4989 !(vport->fc_flag & FC_RSCN_MODE) && 5031 !(vport->fc_flag & FC_RSCN_MODE) &&
4990 (phba->sli_rev < LPFC_SLI_REV4)) { 5032 (phba->sli_rev < LPFC_SLI_REV4)) {
5033 if (vport->port_type == LPFC_PHYSICAL_PORT)
5034 lpfc_issue_clear_la(phba, vport);
4991 lpfc_issue_reg_vpi(phba, vport); 5035 lpfc_issue_reg_vpi(phba, vport);
4992 return; 5036 return;
4993 } 5037 }
@@ -5410,7 +5454,8 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
5410 if (vport->cfg_fdmi_on == 1) 5454 if (vport->cfg_fdmi_on == 1)
5411 lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA); 5455 lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA);
5412 else 5456 else
5413 mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60); 5457 mod_timer(&vport->fc_fdmitmo,
5458 jiffies + msecs_to_jiffies(1000 * 60));
5414 5459
5415 /* decrement the node reference count held for this callback 5460 /* decrement the node reference count held for this callback
5416 * function. 5461 * function.
@@ -5855,7 +5900,7 @@ lpfc_unregister_fcf_prep(struct lpfc_hba *phba)
5855 struct lpfc_vport **vports; 5900 struct lpfc_vport **vports;
5856 struct lpfc_nodelist *ndlp; 5901 struct lpfc_nodelist *ndlp;
5857 struct Scsi_Host *shost; 5902 struct Scsi_Host *shost;
5858 int i, rc; 5903 int i = 0, rc;
5859 5904
5860 /* Unregister RPIs */ 5905 /* Unregister RPIs */
5861 if (lpfc_fcf_inuse(phba)) 5906 if (lpfc_fcf_inuse(phba))
@@ -5883,6 +5928,20 @@ lpfc_unregister_fcf_prep(struct lpfc_hba *phba)
5883 spin_unlock_irq(shost->host_lock); 5928 spin_unlock_irq(shost->host_lock);
5884 } 5929 }
5885 lpfc_destroy_vport_work_array(phba, vports); 5930 lpfc_destroy_vport_work_array(phba, vports);
5931 if (i == 0 && (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED))) {
5932 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID);
5933 if (ndlp)
5934 lpfc_cancel_retry_delay_tmo(phba->pport, ndlp);
5935 lpfc_cleanup_pending_mbox(phba->pport);
5936 if (phba->sli_rev == LPFC_SLI_REV4)
5937 lpfc_sli4_unreg_all_rpis(phba->pport);
5938 lpfc_mbx_unreg_vpi(phba->pport);
5939 shost = lpfc_shost_from_vport(phba->pport);
5940 spin_lock_irq(shost->host_lock);
5941 phba->pport->fc_flag |= FC_VPORT_NEEDS_INIT_VPI;
5942 phba->pport->vpi_state &= ~LPFC_VPI_REGISTERED;
5943 spin_unlock_irq(shost->host_lock);
5944 }
5886 5945
5887 /* Cleanup any outstanding ELS commands */ 5946 /* Cleanup any outstanding ELS commands */
5888 lpfc_els_flush_all_cmd(phba); 5947 lpfc_els_flush_all_cmd(phba);