diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 277 |
1 files changed, 228 insertions, 49 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index d29ac7c317d9..ea44239eeb33 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -350,7 +350,12 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
350 | mb = &pmb->u.mb; | 350 | mb = &pmb->u.mb; |
351 | 351 | ||
352 | /* Get login parameters for NID. */ | 352 | /* Get login parameters for NID. */ |
353 | lpfc_read_sparam(phba, pmb, 0); | 353 | rc = lpfc_read_sparam(phba, pmb, 0); |
354 | if (rc) { | ||
355 | mempool_free(pmb, phba->mbox_mem_pool); | ||
356 | return -ENOMEM; | ||
357 | } | ||
358 | |||
354 | pmb->vport = vport; | 359 | pmb->vport = vport; |
355 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | 360 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { |
356 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 361 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
@@ -359,7 +364,7 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
359 | mb->mbxCommand, mb->mbxStatus); | 364 | mb->mbxCommand, mb->mbxStatus); |
360 | phba->link_state = LPFC_HBA_ERROR; | 365 | phba->link_state = LPFC_HBA_ERROR; |
361 | mp = (struct lpfc_dmabuf *) pmb->context1; | 366 | mp = (struct lpfc_dmabuf *) pmb->context1; |
362 | mempool_free( pmb, phba->mbox_mem_pool); | 367 | mempool_free(pmb, phba->mbox_mem_pool); |
363 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 368 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
364 | kfree(mp); | 369 | kfree(mp); |
365 | return -EIO; | 370 | return -EIO; |
@@ -544,7 +549,7 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
544 | mempool_free(pmb, phba->mbox_mem_pool); | 549 | mempool_free(pmb, phba->mbox_mem_pool); |
545 | return -EIO; | 550 | return -EIO; |
546 | } | 551 | } |
547 | } else if (phba->cfg_suppress_link_up == 0) { | 552 | } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { |
548 | lpfc_init_link(phba, pmb, phba->cfg_topology, | 553 | lpfc_init_link(phba, pmb, phba->cfg_topology, |
549 | phba->cfg_link_speed); | 554 | phba->cfg_link_speed); |
550 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 555 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
@@ -571,6 +576,11 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
571 | } | 576 | } |
572 | /* MBOX buffer will be freed in mbox compl */ | 577 | /* MBOX buffer will be freed in mbox compl */ |
573 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 578 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
579 | if (!pmb) { | ||
580 | phba->link_state = LPFC_HBA_ERROR; | ||
581 | return -ENOMEM; | ||
582 | } | ||
583 | |||
574 | lpfc_config_async(phba, pmb, LPFC_ELS_RING); | 584 | lpfc_config_async(phba, pmb, LPFC_ELS_RING); |
575 | pmb->mbox_cmpl = lpfc_config_async_cmpl; | 585 | pmb->mbox_cmpl = lpfc_config_async_cmpl; |
576 | pmb->vport = phba->pport; | 586 | pmb->vport = phba->pport; |
@@ -588,6 +598,11 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
588 | 598 | ||
589 | /* Get Option rom version */ | 599 | /* Get Option rom version */ |
590 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 600 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
601 | if (!pmb) { | ||
602 | phba->link_state = LPFC_HBA_ERROR; | ||
603 | return -ENOMEM; | ||
604 | } | ||
605 | |||
591 | lpfc_dump_wakeup_param(phba, pmb); | 606 | lpfc_dump_wakeup_param(phba, pmb); |
592 | pmb->mbox_cmpl = lpfc_dump_wakeup_param_cmpl; | 607 | pmb->mbox_cmpl = lpfc_dump_wakeup_param_cmpl; |
593 | pmb->vport = phba->pport; | 608 | pmb->vport = phba->pport; |
@@ -652,7 +667,7 @@ lpfc_hba_init_link(struct lpfc_hba *phba) | |||
652 | mempool_free(pmb, phba->mbox_mem_pool); | 667 | mempool_free(pmb, phba->mbox_mem_pool); |
653 | return -EIO; | 668 | return -EIO; |
654 | } | 669 | } |
655 | phba->cfg_suppress_link_up = 0; | 670 | phba->cfg_suppress_link_up = LPFC_INITIALIZE_LINK; |
656 | 671 | ||
657 | return 0; | 672 | return 0; |
658 | } | 673 | } |
@@ -807,6 +822,8 @@ lpfc_hba_down_post_s4(struct lpfc_hba *phba) | |||
807 | LIST_HEAD(aborts); | 822 | LIST_HEAD(aborts); |
808 | int ret; | 823 | int ret; |
809 | unsigned long iflag = 0; | 824 | unsigned long iflag = 0; |
825 | struct lpfc_sglq *sglq_entry = NULL; | ||
826 | |||
810 | ret = lpfc_hba_down_post_s3(phba); | 827 | ret = lpfc_hba_down_post_s3(phba); |
811 | if (ret) | 828 | if (ret) |
812 | return ret; | 829 | return ret; |
@@ -822,6 +839,10 @@ lpfc_hba_down_post_s4(struct lpfc_hba *phba) | |||
822 | * list. | 839 | * list. |
823 | */ | 840 | */ |
824 | spin_lock(&phba->sli4_hba.abts_sgl_list_lock); | 841 | spin_lock(&phba->sli4_hba.abts_sgl_list_lock); |
842 | list_for_each_entry(sglq_entry, | ||
843 | &phba->sli4_hba.lpfc_abts_els_sgl_list, list) | ||
844 | sglq_entry->state = SGL_FREED; | ||
845 | |||
825 | list_splice_init(&phba->sli4_hba.lpfc_abts_els_sgl_list, | 846 | list_splice_init(&phba->sli4_hba.lpfc_abts_els_sgl_list, |
826 | &phba->sli4_hba.lpfc_sgl_list); | 847 | &phba->sli4_hba.lpfc_sgl_list); |
827 | spin_unlock(&phba->sli4_hba.abts_sgl_list_lock); | 848 | spin_unlock(&phba->sli4_hba.abts_sgl_list_lock); |
@@ -2178,8 +2199,10 @@ lpfc_stop_vport_timers(struct lpfc_vport *vport) | |||
2178 | void | 2199 | void |
2179 | __lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) | 2200 | __lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) |
2180 | { | 2201 | { |
2181 | /* Clear pending FCF rediscovery wait timer */ | 2202 | /* Clear pending FCF rediscovery wait and failover in progress flags */ |
2182 | phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; | 2203 | phba->fcf.fcf_flag &= ~(FCF_REDISC_PEND | |
2204 | FCF_DEAD_DISC | | ||
2205 | FCF_ACVL_DISC); | ||
2183 | /* Now, try to stop the timer */ | 2206 | /* Now, try to stop the timer */ |
2184 | del_timer(&phba->fcf.redisc_wait); | 2207 | del_timer(&phba->fcf.redisc_wait); |
2185 | } | 2208 | } |
@@ -2576,6 +2599,14 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) | |||
2576 | init_timer(&vport->els_tmofunc); | 2599 | init_timer(&vport->els_tmofunc); |
2577 | vport->els_tmofunc.function = lpfc_els_timeout; | 2600 | vport->els_tmofunc.function = lpfc_els_timeout; |
2578 | vport->els_tmofunc.data = (unsigned long)vport; | 2601 | vport->els_tmofunc.data = (unsigned long)vport; |
2602 | if (phba->pcidev->device == PCI_DEVICE_ID_HORNET) { | ||
2603 | phba->menlo_flag |= HBA_MENLO_SUPPORT; | ||
2604 | /* check for menlo minimum sg count */ | ||
2605 | if (phba->cfg_sg_seg_cnt < LPFC_DEFAULT_MENLO_SG_SEG_CNT) { | ||
2606 | phba->cfg_sg_seg_cnt = LPFC_DEFAULT_MENLO_SG_SEG_CNT; | ||
2607 | shost->sg_tablesize = phba->cfg_sg_seg_cnt; | ||
2608 | } | ||
2609 | } | ||
2579 | 2610 | ||
2580 | error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); | 2611 | error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); |
2581 | if (error) | 2612 | if (error) |
@@ -2912,6 +2943,9 @@ lpfc_sli4_fcf_redisc_wait_tmo(unsigned long ptr) | |||
2912 | /* FCF rediscovery event to worker thread */ | 2943 | /* FCF rediscovery event to worker thread */ |
2913 | phba->fcf.fcf_flag |= FCF_REDISC_EVT; | 2944 | phba->fcf.fcf_flag |= FCF_REDISC_EVT; |
2914 | spin_unlock_irq(&phba->hbalock); | 2945 | spin_unlock_irq(&phba->hbalock); |
2946 | lpfc_printf_log(phba, KERN_INFO, LOG_FIP, | ||
2947 | "2776 FCF rediscover wait timer expired, post " | ||
2948 | "a worker thread event for FCF table scan\n"); | ||
2915 | /* wake up worker thread */ | 2949 | /* wake up worker thread */ |
2916 | lpfc_worker_wake_up(phba); | 2950 | lpfc_worker_wake_up(phba); |
2917 | } | 2951 | } |
@@ -3183,6 +3217,68 @@ out_free_pmb: | |||
3183 | } | 3217 | } |
3184 | 3218 | ||
3185 | /** | 3219 | /** |
3220 | * lpfc_sli4_perform_vport_cvl - Perform clear virtual link on a vport | ||
3221 | * @vport: pointer to vport data structure. | ||
3222 | * | ||
3223 | * This routine is to perform Clear Virtual Link (CVL) on a vport in | ||
3224 | * response to a CVL event. | ||
3225 | * | ||
3226 | * Return the pointer to the ndlp with the vport if successful, otherwise | ||
3227 | * return NULL. | ||
3228 | **/ | ||
3229 | static struct lpfc_nodelist * | ||
3230 | lpfc_sli4_perform_vport_cvl(struct lpfc_vport *vport) | ||
3231 | { | ||
3232 | struct lpfc_nodelist *ndlp; | ||
3233 | struct Scsi_Host *shost; | ||
3234 | struct lpfc_hba *phba; | ||
3235 | |||
3236 | if (!vport) | ||
3237 | return NULL; | ||
3238 | ndlp = lpfc_findnode_did(vport, Fabric_DID); | ||
3239 | if (!ndlp) | ||
3240 | return NULL; | ||
3241 | phba = vport->phba; | ||
3242 | if (!phba) | ||
3243 | return NULL; | ||
3244 | if (phba->pport->port_state <= LPFC_FLOGI) | ||
3245 | return NULL; | ||
3246 | /* If virtual link is not yet instantiated ignore CVL */ | ||
3247 | if (vport->port_state <= LPFC_FDISC) | ||
3248 | return NULL; | ||
3249 | shost = lpfc_shost_from_vport(vport); | ||
3250 | if (!shost) | ||
3251 | return NULL; | ||
3252 | lpfc_linkdown_port(vport); | ||
3253 | lpfc_cleanup_pending_mbox(vport); | ||
3254 | spin_lock_irq(shost->host_lock); | ||
3255 | vport->fc_flag |= FC_VPORT_CVL_RCVD; | ||
3256 | spin_unlock_irq(shost->host_lock); | ||
3257 | |||
3258 | return ndlp; | ||
3259 | } | ||
3260 | |||
3261 | /** | ||
3262 | * lpfc_sli4_perform_all_vport_cvl - Perform clear virtual link on all vports | ||
3263 | * @vport: pointer to lpfc hba data structure. | ||
3264 | * | ||
3265 | * This routine is to perform Clear Virtual Link (CVL) on all vports in | ||
3266 | * response to a FCF dead event. | ||
3267 | **/ | ||
3268 | static void | ||
3269 | lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) | ||
3270 | { | ||
3271 | struct lpfc_vport **vports; | ||
3272 | int i; | ||
3273 | |||
3274 | vports = lpfc_create_vport_work_array(phba); | ||
3275 | if (vports) | ||
3276 | for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) | ||
3277 | lpfc_sli4_perform_vport_cvl(vports[i]); | ||
3278 | lpfc_destroy_vport_work_array(phba, vports); | ||
3279 | } | ||
3280 | |||
3281 | /** | ||
3186 | * lpfc_sli4_async_fcoe_evt - Process the asynchronous fcoe event | 3282 | * lpfc_sli4_async_fcoe_evt - Process the asynchronous fcoe event |
3187 | * @phba: pointer to lpfc hba data structure. | 3283 | * @phba: pointer to lpfc hba data structure. |
3188 | * @acqe_link: pointer to the async fcoe completion queue entry. | 3284 | * @acqe_link: pointer to the async fcoe completion queue entry. |
@@ -3198,7 +3294,6 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | |||
3198 | struct lpfc_vport *vport; | 3294 | struct lpfc_vport *vport; |
3199 | struct lpfc_nodelist *ndlp; | 3295 | struct lpfc_nodelist *ndlp; |
3200 | struct Scsi_Host *shost; | 3296 | struct Scsi_Host *shost; |
3201 | uint32_t link_state; | ||
3202 | int active_vlink_present; | 3297 | int active_vlink_present; |
3203 | struct lpfc_vport **vports; | 3298 | struct lpfc_vport **vports; |
3204 | int i; | 3299 | int i; |
@@ -3208,10 +3303,11 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | |||
3208 | switch (event_type) { | 3303 | switch (event_type) { |
3209 | case LPFC_FCOE_EVENT_TYPE_NEW_FCF: | 3304 | case LPFC_FCOE_EVENT_TYPE_NEW_FCF: |
3210 | case LPFC_FCOE_EVENT_TYPE_FCF_PARAM_MOD: | 3305 | case LPFC_FCOE_EVENT_TYPE_FCF_PARAM_MOD: |
3211 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 3306 | lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, |
3212 | "2546 New FCF found index 0x%x tag 0x%x\n", | 3307 | "2546 New FCF found/FCF parameter modified event: " |
3213 | acqe_fcoe->index, | 3308 | "evt_tag:x%x, fcf_index:x%x\n", |
3214 | acqe_fcoe->event_tag); | 3309 | acqe_fcoe->event_tag, acqe_fcoe->index); |
3310 | |||
3215 | spin_lock_irq(&phba->hbalock); | 3311 | spin_lock_irq(&phba->hbalock); |
3216 | if ((phba->fcf.fcf_flag & FCF_SCAN_DONE) || | 3312 | if ((phba->fcf.fcf_flag & FCF_SCAN_DONE) || |
3217 | (phba->hba_flag & FCF_DISC_INPROGRESS)) { | 3313 | (phba->hba_flag & FCF_DISC_INPROGRESS)) { |
@@ -3222,6 +3318,7 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | |||
3222 | spin_unlock_irq(&phba->hbalock); | 3318 | spin_unlock_irq(&phba->hbalock); |
3223 | break; | 3319 | break; |
3224 | } | 3320 | } |
3321 | |||
3225 | if (phba->fcf.fcf_flag & FCF_REDISC_EVT) { | 3322 | if (phba->fcf.fcf_flag & FCF_REDISC_EVT) { |
3226 | /* | 3323 | /* |
3227 | * If fast FCF failover rescan event is pending, | 3324 | * If fast FCF failover rescan event is pending, |
@@ -3232,12 +3329,33 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | |||
3232 | } | 3329 | } |
3233 | spin_unlock_irq(&phba->hbalock); | 3330 | spin_unlock_irq(&phba->hbalock); |
3234 | 3331 | ||
3235 | /* Read the FCF table and re-discover SAN. */ | 3332 | if ((phba->fcf.fcf_flag & FCF_DISCOVERY) && |
3236 | rc = lpfc_sli4_read_fcf_record(phba, LPFC_FCOE_FCF_GET_FIRST); | 3333 | !(phba->fcf.fcf_flag & FCF_REDISC_FOV)) { |
3334 | /* | ||
3335 | * During period of FCF discovery, read the FCF | ||
3336 | * table record indexed by the event to update | ||
3337 | * FCF round robin failover eligible FCF bmask. | ||
3338 | */ | ||
3339 | lpfc_printf_log(phba, KERN_INFO, LOG_FIP | | ||
3340 | LOG_DISCOVERY, | ||
3341 | "2779 Read new FCF record with " | ||
3342 | "fcf_index:x%x for updating FCF " | ||
3343 | "round robin failover bmask\n", | ||
3344 | acqe_fcoe->index); | ||
3345 | rc = lpfc_sli4_read_fcf_rec(phba, acqe_fcoe->index); | ||
3346 | } | ||
3347 | |||
3348 | /* Otherwise, scan the entire FCF table and re-discover SAN */ | ||
3349 | lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, | ||
3350 | "2770 Start FCF table scan due to new FCF " | ||
3351 | "event: evt_tag:x%x, fcf_index:x%x\n", | ||
3352 | acqe_fcoe->event_tag, acqe_fcoe->index); | ||
3353 | rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, | ||
3354 | LPFC_FCOE_FCF_GET_FIRST); | ||
3237 | if (rc) | 3355 | if (rc) |
3238 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 3356 | lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, |
3239 | "2547 Read FCF record failed 0x%x\n", | 3357 | "2547 Issue FCF scan read FCF mailbox " |
3240 | rc); | 3358 | "command failed 0x%x\n", rc); |
3241 | break; | 3359 | break; |
3242 | 3360 | ||
3243 | case LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL: | 3361 | case LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL: |
@@ -3248,47 +3366,63 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | |||
3248 | break; | 3366 | break; |
3249 | 3367 | ||
3250 | case LPFC_FCOE_EVENT_TYPE_FCF_DEAD: | 3368 | case LPFC_FCOE_EVENT_TYPE_FCF_DEAD: |
3251 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 3369 | lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, |
3252 | "2549 FCF disconnected from network index 0x%x" | 3370 | "2549 FCF disconnected from network index 0x%x" |
3253 | " tag 0x%x\n", acqe_fcoe->index, | 3371 | " tag 0x%x\n", acqe_fcoe->index, |
3254 | acqe_fcoe->event_tag); | 3372 | acqe_fcoe->event_tag); |
3255 | /* If the event is not for currently used fcf do nothing */ | 3373 | /* If the event is not for currently used fcf do nothing */ |
3256 | if (phba->fcf.current_rec.fcf_indx != acqe_fcoe->index) | 3374 | if (phba->fcf.current_rec.fcf_indx != acqe_fcoe->index) |
3257 | break; | 3375 | break; |
3258 | /* | 3376 | /* We request port to rediscover the entire FCF table for |
3259 | * Currently, driver support only one FCF - so treat this as | 3377 | * a fast recovery from case that the current FCF record |
3260 | * a link down, but save the link state because we don't want | 3378 | * is no longer valid if we are not in the middle of FCF |
3261 | * it to be changed to Link Down unless it is already down. | 3379 | * failover process already. |
3262 | */ | 3380 | */ |
3263 | link_state = phba->link_state; | 3381 | spin_lock_irq(&phba->hbalock); |
3264 | lpfc_linkdown(phba); | 3382 | if (phba->fcf.fcf_flag & FCF_DISCOVERY) { |
3265 | phba->link_state = link_state; | 3383 | spin_unlock_irq(&phba->hbalock); |
3266 | /* Unregister FCF if no devices connected to it */ | 3384 | /* Update FLOGI FCF failover eligible FCF bmask */ |
3267 | lpfc_unregister_unused_fcf(phba); | 3385 | lpfc_sli4_fcf_rr_index_clear(phba, acqe_fcoe->index); |
3386 | break; | ||
3387 | } | ||
3388 | /* Mark the fast failover process in progress */ | ||
3389 | phba->fcf.fcf_flag |= FCF_DEAD_DISC; | ||
3390 | spin_unlock_irq(&phba->hbalock); | ||
3391 | lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, | ||
3392 | "2771 Start FCF fast failover process due to " | ||
3393 | "FCF DEAD event: evt_tag:x%x, fcf_index:x%x " | ||
3394 | "\n", acqe_fcoe->event_tag, acqe_fcoe->index); | ||
3395 | rc = lpfc_sli4_redisc_fcf_table(phba); | ||
3396 | if (rc) { | ||
3397 | lpfc_printf_log(phba, KERN_ERR, LOG_FIP | | ||
3398 | LOG_DISCOVERY, | ||
3399 | "2772 Issue FCF rediscover mabilbox " | ||
3400 | "command failed, fail through to FCF " | ||
3401 | "dead event\n"); | ||
3402 | spin_lock_irq(&phba->hbalock); | ||
3403 | phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; | ||
3404 | spin_unlock_irq(&phba->hbalock); | ||
3405 | /* | ||
3406 | * Last resort will fail over by treating this | ||
3407 | * as a link down to FCF registration. | ||
3408 | */ | ||
3409 | lpfc_sli4_fcf_dead_failthrough(phba); | ||
3410 | } else | ||
3411 | /* Handling fast FCF failover to a DEAD FCF event | ||
3412 | * is considered equalivant to receiving CVL to all | ||
3413 | * vports. | ||
3414 | */ | ||
3415 | lpfc_sli4_perform_all_vport_cvl(phba); | ||
3268 | break; | 3416 | break; |
3269 | case LPFC_FCOE_EVENT_TYPE_CVL: | 3417 | case LPFC_FCOE_EVENT_TYPE_CVL: |
3270 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 3418 | lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, |
3271 | "2718 Clear Virtual Link Received for VPI 0x%x" | 3419 | "2718 Clear Virtual Link Received for VPI 0x%x" |
3272 | " tag 0x%x\n", acqe_fcoe->index, acqe_fcoe->event_tag); | 3420 | " tag 0x%x\n", acqe_fcoe->index, acqe_fcoe->event_tag); |
3273 | vport = lpfc_find_vport_by_vpid(phba, | 3421 | vport = lpfc_find_vport_by_vpid(phba, |
3274 | acqe_fcoe->index - phba->vpi_base); | 3422 | acqe_fcoe->index - phba->vpi_base); |
3275 | if (!vport) | 3423 | ndlp = lpfc_sli4_perform_vport_cvl(vport); |
3276 | break; | ||
3277 | ndlp = lpfc_findnode_did(vport, Fabric_DID); | ||
3278 | if (!ndlp) | 3424 | if (!ndlp) |
3279 | break; | 3425 | break; |
3280 | shost = lpfc_shost_from_vport(vport); | ||
3281 | if (phba->pport->port_state <= LPFC_FLOGI) | ||
3282 | break; | ||
3283 | /* If virtual link is not yet instantiated ignore CVL */ | ||
3284 | if (vport->port_state <= LPFC_FDISC) | ||
3285 | break; | ||
3286 | |||
3287 | lpfc_linkdown_port(vport); | ||
3288 | lpfc_cleanup_pending_mbox(vport); | ||
3289 | spin_lock_irq(shost->host_lock); | ||
3290 | vport->fc_flag |= FC_VPORT_CVL_RCVD; | ||
3291 | spin_unlock_irq(shost->host_lock); | ||
3292 | active_vlink_present = 0; | 3426 | active_vlink_present = 0; |
3293 | 3427 | ||
3294 | vports = lpfc_create_vport_work_array(phba); | 3428 | vports = lpfc_create_vport_work_array(phba); |
@@ -3311,6 +3445,7 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | |||
3311 | * re-instantiate the Vlink using FDISC. | 3445 | * re-instantiate the Vlink using FDISC. |
3312 | */ | 3446 | */ |
3313 | mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ); | 3447 | mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ); |
3448 | shost = lpfc_shost_from_vport(vport); | ||
3314 | spin_lock_irq(shost->host_lock); | 3449 | spin_lock_irq(shost->host_lock); |
3315 | ndlp->nlp_flag |= NLP_DELAY_TMO; | 3450 | ndlp->nlp_flag |= NLP_DELAY_TMO; |
3316 | spin_unlock_irq(shost->host_lock); | 3451 | spin_unlock_irq(shost->host_lock); |
@@ -3321,15 +3456,38 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | |||
3321 | * Otherwise, we request port to rediscover | 3456 | * Otherwise, we request port to rediscover |
3322 | * the entire FCF table for a fast recovery | 3457 | * the entire FCF table for a fast recovery |
3323 | * from possible case that the current FCF | 3458 | * from possible case that the current FCF |
3324 | * is no longer valid. | 3459 | * is no longer valid if we are not already |
3460 | * in the FCF failover process. | ||
3325 | */ | 3461 | */ |
3462 | spin_lock_irq(&phba->hbalock); | ||
3463 | if (phba->fcf.fcf_flag & FCF_DISCOVERY) { | ||
3464 | spin_unlock_irq(&phba->hbalock); | ||
3465 | break; | ||
3466 | } | ||
3467 | /* Mark the fast failover process in progress */ | ||
3468 | phba->fcf.fcf_flag |= FCF_ACVL_DISC; | ||
3469 | spin_unlock_irq(&phba->hbalock); | ||
3470 | lpfc_printf_log(phba, KERN_INFO, LOG_FIP | | ||
3471 | LOG_DISCOVERY, | ||
3472 | "2773 Start FCF fast failover due " | ||
3473 | "to CVL event: evt_tag:x%x\n", | ||
3474 | acqe_fcoe->event_tag); | ||
3326 | rc = lpfc_sli4_redisc_fcf_table(phba); | 3475 | rc = lpfc_sli4_redisc_fcf_table(phba); |
3327 | if (rc) | 3476 | if (rc) { |
3477 | lpfc_printf_log(phba, KERN_ERR, LOG_FIP | | ||
3478 | LOG_DISCOVERY, | ||
3479 | "2774 Issue FCF rediscover " | ||
3480 | "mabilbox command failed, " | ||
3481 | "through to CVL event\n"); | ||
3482 | spin_lock_irq(&phba->hbalock); | ||
3483 | phba->fcf.fcf_flag &= ~FCF_ACVL_DISC; | ||
3484 | spin_unlock_irq(&phba->hbalock); | ||
3328 | /* | 3485 | /* |
3329 | * Last resort will be re-try on the | 3486 | * Last resort will be re-try on the |
3330 | * the current registered FCF entry. | 3487 | * the current registered FCF entry. |
3331 | */ | 3488 | */ |
3332 | lpfc_retry_pport_discovery(phba); | 3489 | lpfc_retry_pport_discovery(phba); |
3490 | } | ||
3333 | } | 3491 | } |
3334 | break; | 3492 | break; |
3335 | default: | 3493 | default: |
@@ -3426,11 +3584,14 @@ void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) | |||
3426 | spin_unlock_irq(&phba->hbalock); | 3584 | spin_unlock_irq(&phba->hbalock); |
3427 | 3585 | ||
3428 | /* Scan FCF table from the first entry to re-discover SAN */ | 3586 | /* Scan FCF table from the first entry to re-discover SAN */ |
3429 | rc = lpfc_sli4_read_fcf_record(phba, LPFC_FCOE_FCF_GET_FIRST); | 3587 | lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, |
3588 | "2777 Start FCF table scan after FCF " | ||
3589 | "rediscovery quiescent period over\n"); | ||
3590 | rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); | ||
3430 | if (rc) | 3591 | if (rc) |
3431 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 3592 | lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, |
3432 | "2747 Post FCF rediscovery read FCF record " | 3593 | "2747 Issue FCF scan read FCF mailbox " |
3433 | "failed 0x%x\n", rc); | 3594 | "command failed 0x%x\n", rc); |
3434 | } | 3595 | } |
3435 | 3596 | ||
3436 | /** | 3597 | /** |
@@ -3722,6 +3883,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) | |||
3722 | int rc, i, hbq_count, buf_size, dma_buf_size, max_buf_size; | 3883 | int rc, i, hbq_count, buf_size, dma_buf_size, max_buf_size; |
3723 | uint8_t pn_page[LPFC_MAX_SUPPORTED_PAGES] = {0}; | 3884 | uint8_t pn_page[LPFC_MAX_SUPPORTED_PAGES] = {0}; |
3724 | struct lpfc_mqe *mqe; | 3885 | struct lpfc_mqe *mqe; |
3886 | int longs; | ||
3725 | 3887 | ||
3726 | /* Before proceed, wait for POST done and device ready */ | 3888 | /* Before proceed, wait for POST done and device ready */ |
3727 | rc = lpfc_sli4_post_status_check(phba); | 3889 | rc = lpfc_sli4_post_status_check(phba); |
@@ -3898,13 +4060,24 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) | |||
3898 | goto out_free_active_sgl; | 4060 | goto out_free_active_sgl; |
3899 | } | 4061 | } |
3900 | 4062 | ||
4063 | /* Allocate eligible FCF bmask memory for FCF round robin failover */ | ||
4064 | longs = (LPFC_SLI4_FCF_TBL_INDX_MAX + BITS_PER_LONG - 1)/BITS_PER_LONG; | ||
4065 | phba->fcf.fcf_rr_bmask = kzalloc(longs * sizeof(unsigned long), | ||
4066 | GFP_KERNEL); | ||
4067 | if (!phba->fcf.fcf_rr_bmask) { | ||
4068 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
4069 | "2759 Failed allocate memory for FCF round " | ||
4070 | "robin failover bmask\n"); | ||
4071 | goto out_remove_rpi_hdrs; | ||
4072 | } | ||
4073 | |||
3901 | phba->sli4_hba.fcp_eq_hdl = kzalloc((sizeof(struct lpfc_fcp_eq_hdl) * | 4074 | phba->sli4_hba.fcp_eq_hdl = kzalloc((sizeof(struct lpfc_fcp_eq_hdl) * |
3902 | phba->cfg_fcp_eq_count), GFP_KERNEL); | 4075 | phba->cfg_fcp_eq_count), GFP_KERNEL); |
3903 | if (!phba->sli4_hba.fcp_eq_hdl) { | 4076 | if (!phba->sli4_hba.fcp_eq_hdl) { |
3904 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 4077 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
3905 | "2572 Failed allocate memory for fast-path " | 4078 | "2572 Failed allocate memory for fast-path " |
3906 | "per-EQ handle array\n"); | 4079 | "per-EQ handle array\n"); |
3907 | goto out_remove_rpi_hdrs; | 4080 | goto out_free_fcf_rr_bmask; |
3908 | } | 4081 | } |
3909 | 4082 | ||
3910 | phba->sli4_hba.msix_entries = kzalloc((sizeof(struct msix_entry) * | 4083 | phba->sli4_hba.msix_entries = kzalloc((sizeof(struct msix_entry) * |
@@ -3957,6 +4130,8 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) | |||
3957 | 4130 | ||
3958 | out_free_fcp_eq_hdl: | 4131 | out_free_fcp_eq_hdl: |
3959 | kfree(phba->sli4_hba.fcp_eq_hdl); | 4132 | kfree(phba->sli4_hba.fcp_eq_hdl); |
4133 | out_free_fcf_rr_bmask: | ||
4134 | kfree(phba->fcf.fcf_rr_bmask); | ||
3960 | out_remove_rpi_hdrs: | 4135 | out_remove_rpi_hdrs: |
3961 | lpfc_sli4_remove_rpi_hdrs(phba); | 4136 | lpfc_sli4_remove_rpi_hdrs(phba); |
3962 | out_free_active_sgl: | 4137 | out_free_active_sgl: |
@@ -4002,6 +4177,9 @@ lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) | |||
4002 | lpfc_sli4_remove_rpi_hdrs(phba); | 4177 | lpfc_sli4_remove_rpi_hdrs(phba); |
4003 | lpfc_sli4_remove_rpis(phba); | 4178 | lpfc_sli4_remove_rpis(phba); |
4004 | 4179 | ||
4180 | /* Free eligible FCF index bmask */ | ||
4181 | kfree(phba->fcf.fcf_rr_bmask); | ||
4182 | |||
4005 | /* Free the ELS sgl list */ | 4183 | /* Free the ELS sgl list */ |
4006 | lpfc_free_active_sgl(phba); | 4184 | lpfc_free_active_sgl(phba); |
4007 | lpfc_free_sgl_list(phba); | 4185 | lpfc_free_sgl_list(phba); |
@@ -4397,6 +4575,7 @@ lpfc_init_sgl_list(struct lpfc_hba *phba) | |||
4397 | 4575 | ||
4398 | /* The list order is used by later block SGL registraton */ | 4576 | /* The list order is used by later block SGL registraton */ |
4399 | spin_lock_irq(&phba->hbalock); | 4577 | spin_lock_irq(&phba->hbalock); |
4578 | sglq_entry->state = SGL_FREED; | ||
4400 | list_add_tail(&sglq_entry->list, &phba->sli4_hba.lpfc_sgl_list); | 4579 | list_add_tail(&sglq_entry->list, &phba->sli4_hba.lpfc_sgl_list); |
4401 | phba->sli4_hba.lpfc_els_sgl_array[i] = sglq_entry; | 4580 | phba->sli4_hba.lpfc_els_sgl_array[i] = sglq_entry; |
4402 | phba->sli4_hba.total_sglq_bufs++; | 4581 | phba->sli4_hba.total_sglq_bufs++; |