diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 132 |
1 files changed, 85 insertions, 47 deletions
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: |