aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c102
1 files changed, 75 insertions, 27 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 295c7ddb36c1..b3065791f303 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -813,6 +813,7 @@ lpfc_hba_down_post_s3(struct lpfc_hba *phba)
813 813
814 return 0; 814 return 0;
815} 815}
816
816/** 817/**
817 * lpfc_hba_down_post_s4 - Perform lpfc uninitialization after HBA reset 818 * lpfc_hba_down_post_s4 - Perform lpfc uninitialization after HBA reset
818 * @phba: pointer to lpfc HBA data structure. 819 * @phba: pointer to lpfc HBA data structure.
@@ -2234,10 +2235,9 @@ lpfc_stop_vport_timers(struct lpfc_vport *vport)
2234void 2235void
2235__lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) 2236__lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba)
2236{ 2237{
2237 /* Clear pending FCF rediscovery wait and failover in progress flags */ 2238 /* Clear pending FCF rediscovery wait flag */
2238 phba->fcf.fcf_flag &= ~(FCF_REDISC_PEND | 2239 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND;
2239 FCF_DEAD_DISC | 2240
2240 FCF_ACVL_DISC);
2241 /* Now, try to stop the timer */ 2241 /* Now, try to stop the timer */
2242 del_timer(&phba->fcf.redisc_wait); 2242 del_timer(&phba->fcf.redisc_wait);
2243} 2243}
@@ -2261,6 +2261,8 @@ lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba)
2261 return; 2261 return;
2262 } 2262 }
2263 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba); 2263 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba);
2264 /* Clear failover in progress flags */
2265 phba->fcf.fcf_flag &= ~(FCF_DEAD_DISC | FCF_ACVL_DISC);
2264 spin_unlock_irq(&phba->hbalock); 2266 spin_unlock_irq(&phba->hbalock);
2265} 2267}
2266 2268
@@ -2935,8 +2937,7 @@ lpfc_sli4_fcf_redisc_wait_tmo(unsigned long ptr)
2935 phba->fcf.fcf_flag |= FCF_REDISC_EVT; 2937 phba->fcf.fcf_flag |= FCF_REDISC_EVT;
2936 spin_unlock_irq(&phba->hbalock); 2938 spin_unlock_irq(&phba->hbalock);
2937 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 2939 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
2938 "2776 FCF rediscover wait timer expired, post " 2940 "2776 FCF rediscover quiescent timer expired\n");
2939 "a worker thread event for FCF table scan\n");
2940 /* wake up worker thread */ 2941 /* wake up worker thread */
2941 lpfc_worker_wake_up(phba); 2942 lpfc_worker_wake_up(phba);
2942} 2943}
@@ -3311,35 +3312,34 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3311 if (event_type == LPFC_FCOE_EVENT_TYPE_NEW_FCF) 3312 if (event_type == LPFC_FCOE_EVENT_TYPE_NEW_FCF)
3312 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | 3313 lpfc_printf_log(phba, KERN_ERR, LOG_FIP |
3313 LOG_DISCOVERY, 3314 LOG_DISCOVERY,
3314 "2546 New FCF found event: " 3315 "2546 New FCF event, evt_tag:x%x, "
3315 "evt_tag:x%x, fcf_index:x%x\n", 3316 "index:x%x\n",
3316 acqe_fcoe->event_tag, 3317 acqe_fcoe->event_tag,
3317 acqe_fcoe->index); 3318 acqe_fcoe->index);
3318 else 3319 else
3319 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | 3320 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP |
3320 LOG_DISCOVERY, 3321 LOG_DISCOVERY,
3321 "2788 FCF parameter modified event: " 3322 "2788 FCF param modified event, "
3322 "evt_tag:x%x, fcf_index:x%x\n", 3323 "evt_tag:x%x, index:x%x\n",
3323 acqe_fcoe->event_tag, 3324 acqe_fcoe->event_tag,
3324 acqe_fcoe->index); 3325 acqe_fcoe->index);
3325 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { 3326 if (phba->fcf.fcf_flag & FCF_DISCOVERY) {
3326 /* 3327 /*
3327 * During period of FCF discovery, read the FCF 3328 * During period of FCF discovery, read the FCF
3328 * table record indexed by the event to update 3329 * table record indexed by the event to update
3329 * FCF round robin failover eligible FCF bmask. 3330 * FCF roundrobin failover eligible FCF bmask.
3330 */ 3331 */
3331 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | 3332 lpfc_printf_log(phba, KERN_INFO, LOG_FIP |
3332 LOG_DISCOVERY, 3333 LOG_DISCOVERY,
3333 "2779 Read new FCF record with " 3334 "2779 Read FCF (x%x) for updating "
3334 "fcf_index:x%x for updating FCF " 3335 "roundrobin FCF failover bmask\n",
3335 "round robin failover bmask\n",
3336 acqe_fcoe->index); 3336 acqe_fcoe->index);
3337 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fcoe->index); 3337 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fcoe->index);
3338 } 3338 }
3339 3339
3340 /* If the FCF discovery is in progress, do nothing. */ 3340 /* If the FCF discovery is in progress, do nothing. */
3341 spin_lock_irq(&phba->hbalock); 3341 spin_lock_irq(&phba->hbalock);
3342 if (phba->hba_flag & FCF_DISC_INPROGRESS) { 3342 if (phba->hba_flag & FCF_TS_INPROG) {
3343 spin_unlock_irq(&phba->hbalock); 3343 spin_unlock_irq(&phba->hbalock);
3344 break; 3344 break;
3345 } 3345 }
@@ -3358,15 +3358,15 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3358 3358
3359 /* Otherwise, scan the entire FCF table and re-discover SAN */ 3359 /* Otherwise, scan the entire FCF table and re-discover SAN */
3360 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, 3360 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
3361 "2770 Start FCF table scan due to new FCF " 3361 "2770 Start FCF table scan per async FCF "
3362 "event: evt_tag:x%x, fcf_index:x%x\n", 3362 "event, evt_tag:x%x, index:x%x\n",
3363 acqe_fcoe->event_tag, acqe_fcoe->index); 3363 acqe_fcoe->event_tag, acqe_fcoe->index);
3364 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, 3364 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba,
3365 LPFC_FCOE_FCF_GET_FIRST); 3365 LPFC_FCOE_FCF_GET_FIRST);
3366 if (rc) 3366 if (rc)
3367 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, 3367 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY,
3368 "2547 Issue FCF scan read FCF mailbox " 3368 "2547 Issue FCF scan read FCF mailbox "
3369 "command failed 0x%x\n", rc); 3369 "command failed (x%x)\n", rc);
3370 break; 3370 break;
3371 3371
3372 case LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL: 3372 case LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL:
@@ -3378,9 +3378,8 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3378 3378
3379 case LPFC_FCOE_EVENT_TYPE_FCF_DEAD: 3379 case LPFC_FCOE_EVENT_TYPE_FCF_DEAD:
3380 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, 3380 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY,
3381 "2549 FCF disconnected from network index 0x%x" 3381 "2549 FCF (x%x) disconnected from network, "
3382 " tag 0x%x\n", acqe_fcoe->index, 3382 "tag:x%x\n", acqe_fcoe->index, acqe_fcoe->event_tag);
3383 acqe_fcoe->event_tag);
3384 /* 3383 /*
3385 * If we are in the middle of FCF failover process, clear 3384 * If we are in the middle of FCF failover process, clear
3386 * the corresponding FCF bit in the roundrobin bitmap. 3385 * the corresponding FCF bit in the roundrobin bitmap.
@@ -3494,9 +3493,8 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3494 spin_unlock_irq(&phba->hbalock); 3493 spin_unlock_irq(&phba->hbalock);
3495 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | 3494 lpfc_printf_log(phba, KERN_INFO, LOG_FIP |
3496 LOG_DISCOVERY, 3495 LOG_DISCOVERY,
3497 "2773 Start FCF fast failover due " 3496 "2773 Start FCF failover per CVL, "
3498 "to CVL event: evt_tag:x%x\n", 3497 "evt_tag:x%x\n", acqe_fcoe->event_tag);
3499 acqe_fcoe->event_tag);
3500 rc = lpfc_sli4_redisc_fcf_table(phba); 3498 rc = lpfc_sli4_redisc_fcf_table(phba);
3501 if (rc) { 3499 if (rc) {
3502 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | 3500 lpfc_printf_log(phba, KERN_ERR, LOG_FIP |
@@ -3646,8 +3644,7 @@ void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba)
3646 3644
3647 /* Scan FCF table from the first entry to re-discover SAN */ 3645 /* Scan FCF table from the first entry to re-discover SAN */
3648 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, 3646 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
3649 "2777 Start FCF table scan after FCF " 3647 "2777 Start post-quiescent FCF table scan\n");
3650 "rediscovery quiescent period over\n");
3651 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); 3648 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST);
3652 if (rc) 3649 if (rc)
3653 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, 3650 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY,
@@ -4165,7 +4162,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
4165 goto out_free_active_sgl; 4162 goto out_free_active_sgl;
4166 } 4163 }
4167 4164
4168 /* Allocate eligible FCF bmask memory for FCF round robin failover */ 4165 /* Allocate eligible FCF bmask memory for FCF roundrobin failover */
4169 longs = (LPFC_SLI4_FCF_TBL_INDX_MAX + BITS_PER_LONG - 1)/BITS_PER_LONG; 4166 longs = (LPFC_SLI4_FCF_TBL_INDX_MAX + BITS_PER_LONG - 1)/BITS_PER_LONG;
4170 phba->fcf.fcf_rr_bmask = kzalloc(longs * sizeof(unsigned long), 4167 phba->fcf.fcf_rr_bmask = kzalloc(longs * sizeof(unsigned long),
4171 GFP_KERNEL); 4168 GFP_KERNEL);
@@ -7271,6 +7268,51 @@ lpfc_sli4_unset_hba(struct lpfc_hba *phba)
7271} 7268}
7272 7269
7273/** 7270/**
7271 * lpfc_sli4_xri_exchange_busy_wait - Wait for device XRI exchange busy
7272 * @phba: Pointer to HBA context object.
7273 *
7274 * This function is called in the SLI4 code path to wait for completion
7275 * of device's XRIs exchange busy. It will check the XRI exchange busy
7276 * on outstanding FCP and ELS I/Os every 10ms for up to 10 seconds; after
7277 * that, it will check the XRI exchange busy on outstanding FCP and ELS
7278 * I/Os every 30 seconds, log error message, and wait forever. Only when
7279 * all XRI exchange busy complete, the driver unload shall proceed with
7280 * invoking the function reset ioctl mailbox command to the CNA and the
7281 * the rest of the driver unload resource release.
7282 **/
7283static void
7284lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba)
7285{
7286 int wait_time = 0;
7287 int fcp_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_scsi_buf_list);
7288 int els_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list);
7289
7290 while (!fcp_xri_cmpl || !els_xri_cmpl) {
7291 if (wait_time > LPFC_XRI_EXCH_BUSY_WAIT_TMO) {
7292 if (!fcp_xri_cmpl)
7293 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
7294 "2877 FCP XRI exchange busy "
7295 "wait time: %d seconds.\n",
7296 wait_time/1000);
7297 if (!els_xri_cmpl)
7298 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
7299 "2878 ELS XRI exchange busy "
7300 "wait time: %d seconds.\n",
7301 wait_time/1000);
7302 msleep(LPFC_XRI_EXCH_BUSY_WAIT_T2);
7303 wait_time += LPFC_XRI_EXCH_BUSY_WAIT_T2;
7304 } else {
7305 msleep(LPFC_XRI_EXCH_BUSY_WAIT_T1);
7306 wait_time += LPFC_XRI_EXCH_BUSY_WAIT_T1;
7307 }
7308 fcp_xri_cmpl =
7309 list_empty(&phba->sli4_hba.lpfc_abts_scsi_buf_list);
7310 els_xri_cmpl =
7311 list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list);
7312 }
7313}
7314
7315/**
7274 * lpfc_sli4_hba_unset - Unset the fcoe hba 7316 * lpfc_sli4_hba_unset - Unset the fcoe hba
7275 * @phba: Pointer to HBA context object. 7317 * @phba: Pointer to HBA context object.
7276 * 7318 *
@@ -7315,6 +7357,12 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba)
7315 spin_unlock_irq(&phba->hbalock); 7357 spin_unlock_irq(&phba->hbalock);
7316 } 7358 }
7317 7359
7360 /* Abort all iocbs associated with the hba */
7361 lpfc_sli_hba_iocb_abort(phba);
7362
7363 /* Wait for completion of device XRI exchange busy */
7364 lpfc_sli4_xri_exchange_busy_wait(phba);
7365
7318 /* Disable PCI subsystem interrupt */ 7366 /* Disable PCI subsystem interrupt */
7319 lpfc_sli4_disable_intr(phba); 7367 lpfc_sli4_disable_intr(phba);
7320 7368