diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 164 |
1 files changed, 154 insertions, 10 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 25a97dfd4ea7..6e04679167e3 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -2073,6 +2073,44 @@ lpfc_stop_vport_timers(struct lpfc_vport *vport) | |||
2073 | } | 2073 | } |
2074 | 2074 | ||
2075 | /** | 2075 | /** |
2076 | * __lpfc_sli4_stop_fcf_redisc_wait_timer - Stop FCF rediscovery wait timer | ||
2077 | * @phba: pointer to lpfc hba data structure. | ||
2078 | * | ||
2079 | * This routine stops the SLI4 FCF rediscover wait timer if it's on. The | ||
2080 | * caller of this routine should already hold the host lock. | ||
2081 | **/ | ||
2082 | void | ||
2083 | __lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) | ||
2084 | { | ||
2085 | /* Clear pending FCF rediscovery wait timer */ | ||
2086 | phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; | ||
2087 | /* Now, try to stop the timer */ | ||
2088 | del_timer(&phba->fcf.redisc_wait); | ||
2089 | } | ||
2090 | |||
2091 | /** | ||
2092 | * lpfc_sli4_stop_fcf_redisc_wait_timer - Stop FCF rediscovery wait timer | ||
2093 | * @phba: pointer to lpfc hba data structure. | ||
2094 | * | ||
2095 | * This routine stops the SLI4 FCF rediscover wait timer if it's on. It | ||
2096 | * checks whether the FCF rediscovery wait timer is pending with the host | ||
2097 | * lock held before proceeding with disabling the timer and clearing the | ||
2098 | * wait timer pendig flag. | ||
2099 | **/ | ||
2100 | void | ||
2101 | lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) | ||
2102 | { | ||
2103 | spin_lock_irq(&phba->hbalock); | ||
2104 | if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { | ||
2105 | /* FCF rediscovery timer already fired or stopped */ | ||
2106 | spin_unlock_irq(&phba->hbalock); | ||
2107 | return; | ||
2108 | } | ||
2109 | __lpfc_sli4_stop_fcf_redisc_wait_timer(phba); | ||
2110 | spin_unlock_irq(&phba->hbalock); | ||
2111 | } | ||
2112 | |||
2113 | /** | ||
2076 | * lpfc_stop_hba_timers - Stop all the timers associated with an HBA | 2114 | * lpfc_stop_hba_timers - Stop all the timers associated with an HBA |
2077 | * @phba: pointer to lpfc hba data structure. | 2115 | * @phba: pointer to lpfc hba data structure. |
2078 | * | 2116 | * |
@@ -2096,6 +2134,7 @@ lpfc_stop_hba_timers(struct lpfc_hba *phba) | |||
2096 | break; | 2134 | break; |
2097 | case LPFC_PCI_DEV_OC: | 2135 | case LPFC_PCI_DEV_OC: |
2098 | /* Stop any OneConnect device sepcific driver timers */ | 2136 | /* Stop any OneConnect device sepcific driver timers */ |
2137 | lpfc_sli4_stop_fcf_redisc_wait_timer(phba); | ||
2099 | break; | 2138 | break; |
2100 | default: | 2139 | default: |
2101 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 2140 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
@@ -2706,7 +2745,7 @@ lpfc_sli_remove_dflt_fcf(struct lpfc_hba *phba) | |||
2706 | del_fcf_record = &mboxq->u.mqe.un.del_fcf_entry; | 2745 | del_fcf_record = &mboxq->u.mqe.un.del_fcf_entry; |
2707 | bf_set(lpfc_mbx_del_fcf_tbl_count, del_fcf_record, 1); | 2746 | bf_set(lpfc_mbx_del_fcf_tbl_count, del_fcf_record, 1); |
2708 | bf_set(lpfc_mbx_del_fcf_tbl_index, del_fcf_record, | 2747 | bf_set(lpfc_mbx_del_fcf_tbl_index, del_fcf_record, |
2709 | phba->fcf.fcf_indx); | 2748 | phba->fcf.current_rec.fcf_indx); |
2710 | 2749 | ||
2711 | if (!phba->sli4_hba.intr_enable) | 2750 | if (!phba->sli4_hba.intr_enable) |
2712 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | 2751 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); |
@@ -2730,6 +2769,57 @@ lpfc_sli_remove_dflt_fcf(struct lpfc_hba *phba) | |||
2730 | } | 2769 | } |
2731 | 2770 | ||
2732 | /** | 2771 | /** |
2772 | * lpfc_fcf_redisc_wait_start_timer - Start fcf rediscover wait timer | ||
2773 | * @phba: Pointer to hba for which this call is being executed. | ||
2774 | * | ||
2775 | * This routine starts the timer waiting for the FCF rediscovery to complete. | ||
2776 | **/ | ||
2777 | void | ||
2778 | lpfc_fcf_redisc_wait_start_timer(struct lpfc_hba *phba) | ||
2779 | { | ||
2780 | unsigned long fcf_redisc_wait_tmo = | ||
2781 | (jiffies + msecs_to_jiffies(LPFC_FCF_REDISCOVER_WAIT_TMO)); | ||
2782 | /* Start fcf rediscovery wait period timer */ | ||
2783 | mod_timer(&phba->fcf.redisc_wait, fcf_redisc_wait_tmo); | ||
2784 | spin_lock_irq(&phba->hbalock); | ||
2785 | /* Allow action to new fcf asynchronous event */ | ||
2786 | phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE); | ||
2787 | /* Mark the FCF rediscovery pending state */ | ||
2788 | phba->fcf.fcf_flag |= FCF_REDISC_PEND; | ||
2789 | spin_unlock_irq(&phba->hbalock); | ||
2790 | } | ||
2791 | |||
2792 | /** | ||
2793 | * lpfc_sli4_fcf_redisc_wait_tmo - FCF table rediscover wait timeout | ||
2794 | * @ptr: Map to lpfc_hba data structure pointer. | ||
2795 | * | ||
2796 | * This routine is invoked when waiting for FCF table rediscover has been | ||
2797 | * timed out. If new FCF record(s) has (have) been discovered during the | ||
2798 | * wait period, a new FCF event shall be added to the FCOE async event | ||
2799 | * list, and then worker thread shall be waked up for processing from the | ||
2800 | * worker thread context. | ||
2801 | **/ | ||
2802 | void | ||
2803 | lpfc_sli4_fcf_redisc_wait_tmo(unsigned long ptr) | ||
2804 | { | ||
2805 | struct lpfc_hba *phba = (struct lpfc_hba *)ptr; | ||
2806 | |||
2807 | /* Don't send FCF rediscovery event if timer cancelled */ | ||
2808 | spin_lock_irq(&phba->hbalock); | ||
2809 | if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { | ||
2810 | spin_unlock_irq(&phba->hbalock); | ||
2811 | return; | ||
2812 | } | ||
2813 | /* Clear FCF rediscovery timer pending flag */ | ||
2814 | phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; | ||
2815 | /* FCF rediscovery event to worker thread */ | ||
2816 | phba->fcf.fcf_flag |= FCF_REDISC_EVT; | ||
2817 | spin_unlock_irq(&phba->hbalock); | ||
2818 | /* wake up worker thread */ | ||
2819 | lpfc_worker_wake_up(phba); | ||
2820 | } | ||
2821 | |||
2822 | /** | ||
2733 | * lpfc_sli4_fw_cfg_check - Read the firmware config and verify FCoE support | 2823 | * lpfc_sli4_fw_cfg_check - Read the firmware config and verify FCoE support |
2734 | * @phba: pointer to lpfc hba data structure. | 2824 | * @phba: pointer to lpfc hba data structure. |
2735 | * | 2825 | * |
@@ -3020,17 +3110,26 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | |||
3020 | phba->fcoe_eventtag = acqe_fcoe->event_tag; | 3110 | phba->fcoe_eventtag = acqe_fcoe->event_tag; |
3021 | switch (event_type) { | 3111 | switch (event_type) { |
3022 | case LPFC_FCOE_EVENT_TYPE_NEW_FCF: | 3112 | case LPFC_FCOE_EVENT_TYPE_NEW_FCF: |
3113 | case LPFC_FCOE_EVENT_TYPE_FCF_PARAM_MOD: | ||
3023 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 3114 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, |
3024 | "2546 New FCF found index 0x%x tag 0x%x\n", | 3115 | "2546 New FCF found index 0x%x tag 0x%x\n", |
3025 | acqe_fcoe->index, | 3116 | acqe_fcoe->index, |
3026 | acqe_fcoe->event_tag); | 3117 | acqe_fcoe->event_tag); |
3027 | /* | ||
3028 | * If the current FCF is in discovered state, or | ||
3029 | * FCF discovery is in progress do nothing. | ||
3030 | */ | ||
3031 | spin_lock_irq(&phba->hbalock); | 3118 | spin_lock_irq(&phba->hbalock); |
3032 | if ((phba->fcf.fcf_flag & FCF_DISCOVERED) || | 3119 | if ((phba->fcf.fcf_flag & FCF_SCAN_DONE) || |
3033 | (phba->hba_flag & FCF_DISC_INPROGRESS)) { | 3120 | (phba->hba_flag & FCF_DISC_INPROGRESS)) { |
3121 | /* | ||
3122 | * If the current FCF is in discovered state or | ||
3123 | * FCF discovery is in progress, do nothing. | ||
3124 | */ | ||
3125 | spin_unlock_irq(&phba->hbalock); | ||
3126 | break; | ||
3127 | } | ||
3128 | if (phba->fcf.fcf_flag & FCF_REDISC_EVT) { | ||
3129 | /* | ||
3130 | * If fast FCF failover rescan event is pending, | ||
3131 | * do nothing. | ||
3132 | */ | ||
3034 | spin_unlock_irq(&phba->hbalock); | 3133 | spin_unlock_irq(&phba->hbalock); |
3035 | break; | 3134 | break; |
3036 | } | 3135 | } |
@@ -3057,7 +3156,7 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | |||
3057 | " tag 0x%x\n", acqe_fcoe->index, | 3156 | " tag 0x%x\n", acqe_fcoe->index, |
3058 | acqe_fcoe->event_tag); | 3157 | acqe_fcoe->event_tag); |
3059 | /* If the event is not for currently used fcf do nothing */ | 3158 | /* If the event is not for currently used fcf do nothing */ |
3060 | if (phba->fcf.fcf_indx != acqe_fcoe->index) | 3159 | if (phba->fcf.current_rec.fcf_indx != acqe_fcoe->index) |
3061 | break; | 3160 | break; |
3062 | /* | 3161 | /* |
3063 | * Currently, driver support only one FCF - so treat this as | 3162 | * Currently, driver support only one FCF - so treat this as |
@@ -3121,7 +3220,19 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | |||
3121 | ndlp->nlp_last_elscmd = ELS_CMD_FDISC; | 3220 | ndlp->nlp_last_elscmd = ELS_CMD_FDISC; |
3122 | vport->port_state = LPFC_FDISC; | 3221 | vport->port_state = LPFC_FDISC; |
3123 | } else { | 3222 | } else { |
3124 | lpfc_retry_pport_discovery(phba); | 3223 | /* |
3224 | * Otherwise, we request port to rediscover | ||
3225 | * the entire FCF table for a fast recovery | ||
3226 | * from possible case that the current FCF | ||
3227 | * is no longer valid. | ||
3228 | */ | ||
3229 | rc = lpfc_sli4_redisc_fcf_table(phba); | ||
3230 | if (rc) | ||
3231 | /* | ||
3232 | * Last resort will be re-try on the | ||
3233 | * the current registered FCF entry. | ||
3234 | */ | ||
3235 | lpfc_retry_pport_discovery(phba); | ||
3125 | } | 3236 | } |
3126 | break; | 3237 | break; |
3127 | default: | 3238 | default: |
@@ -3198,6 +3309,34 @@ void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) | |||
3198 | } | 3309 | } |
3199 | 3310 | ||
3200 | /** | 3311 | /** |
3312 | * lpfc_sli4_fcf_redisc_event_proc - Process fcf table rediscovery event | ||
3313 | * @phba: pointer to lpfc hba data structure. | ||
3314 | * | ||
3315 | * This routine is invoked by the worker thread to process FCF table | ||
3316 | * rediscovery pending completion event. | ||
3317 | **/ | ||
3318 | void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) | ||
3319 | { | ||
3320 | int rc; | ||
3321 | |||
3322 | spin_lock_irq(&phba->hbalock); | ||
3323 | /* Clear FCF rediscovery timeout event */ | ||
3324 | phba->fcf.fcf_flag &= ~FCF_REDISC_EVT; | ||
3325 | /* Clear driver fast failover FCF record flag */ | ||
3326 | phba->fcf.failover_rec.flag = 0; | ||
3327 | /* Set state for FCF fast failover */ | ||
3328 | phba->fcf.fcf_flag |= FCF_REDISC_FOV; | ||
3329 | spin_unlock_irq(&phba->hbalock); | ||
3330 | |||
3331 | /* Scan FCF table from the first entry to re-discover SAN */ | ||
3332 | rc = lpfc_sli4_read_fcf_record(phba, LPFC_FCOE_FCF_GET_FIRST); | ||
3333 | if (rc) | ||
3334 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | ||
3335 | "2747 Post FCF rediscovery read FCF record " | ||
3336 | "failed 0x%x\n", rc); | ||
3337 | } | ||
3338 | |||
3339 | /** | ||
3201 | * lpfc_api_table_setup - Set up per hba pci-device group func api jump table | 3340 | * lpfc_api_table_setup - Set up per hba pci-device group func api jump table |
3202 | * @phba: pointer to lpfc hba data structure. | 3341 | * @phba: pointer to lpfc hba data structure. |
3203 | * @dev_grp: The HBA PCI-Device group number. | 3342 | * @dev_grp: The HBA PCI-Device group number. |
@@ -3512,6 +3651,11 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) | |||
3512 | init_timer(&phba->eratt_poll); | 3651 | init_timer(&phba->eratt_poll); |
3513 | phba->eratt_poll.function = lpfc_poll_eratt; | 3652 | phba->eratt_poll.function = lpfc_poll_eratt; |
3514 | phba->eratt_poll.data = (unsigned long) phba; | 3653 | phba->eratt_poll.data = (unsigned long) phba; |
3654 | /* FCF rediscover timer */ | ||
3655 | init_timer(&phba->fcf.redisc_wait); | ||
3656 | phba->fcf.redisc_wait.function = lpfc_sli4_fcf_redisc_wait_tmo; | ||
3657 | phba->fcf.redisc_wait.data = (unsigned long)phba; | ||
3658 | |||
3515 | /* | 3659 | /* |
3516 | * We need to do a READ_CONFIG mailbox command here before | 3660 | * We need to do a READ_CONFIG mailbox command here before |
3517 | * calling lpfc_get_cfgparam. For VFs this will report the | 3661 | * calling lpfc_get_cfgparam. For VFs this will report the |
@@ -6039,7 +6183,7 @@ lpfc_sli4_fcfi_unreg(struct lpfc_hba *phba, uint16_t fcfi) | |||
6039 | spin_lock_irqsave(&phba->hbalock, flags); | 6183 | spin_lock_irqsave(&phba->hbalock, flags); |
6040 | /* Mark the FCFI is no longer registered */ | 6184 | /* Mark the FCFI is no longer registered */ |
6041 | phba->fcf.fcf_flag &= | 6185 | phba->fcf.fcf_flag &= |
6042 | ~(FCF_AVAILABLE | FCF_REGISTERED | FCF_DISCOVERED); | 6186 | ~(FCF_AVAILABLE | FCF_REGISTERED | FCF_SCAN_DONE); |
6043 | spin_unlock_irqrestore(&phba->hbalock, flags); | 6187 | spin_unlock_irqrestore(&phba->hbalock, flags); |
6044 | } | 6188 | } |
6045 | } | 6189 | } |