diff options
author | Jamie Wellnitz <Jamie.Wellnitz@emulex.com> | 2006-02-28 19:25:34 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-02-28 20:04:28 -0500 |
commit | 25594c6b84ff96e156d8cf8168d68f50e07e8318 (patch) | |
tree | c692ec480f9399a940d45bdb148baf0e05bcaac5 /drivers/scsi | |
parent | 367c27134a94dce351080ae66ab87a1b296d1e64 (diff) |
[SCSI] lpfc 8.1.2: Code cleanup of lpfc_mbx_cmpl_config_link
Code cleanup of lpfc_mbx_cmpl_config_link
Signed-off-by: Jamie Wellnitz <Jamie.Wellnitz@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 107 |
1 files changed, 43 insertions, 64 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index b2aec79eed80..aa58ff0e3218 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -538,80 +538,59 @@ out: | |||
538 | } | 538 | } |
539 | 539 | ||
540 | static void | 540 | static void |
541 | lpfc_mbx_cmpl_config_link(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | 541 | lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
542 | { | 542 | { |
543 | struct lpfc_sli *psli; | 543 | struct lpfc_sli *psli = &phba->sli; |
544 | MAILBOX_t *mb; | 544 | int rc; |
545 | |||
546 | psli = &phba->sli; | ||
547 | mb = &pmb->mb; | ||
548 | /* Check for error */ | ||
549 | if (mb->mbxStatus) { | ||
550 | /* CONFIG_LINK mbox error <mbxStatus> state <hba_state> */ | ||
551 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | ||
552 | "%d:0306 CONFIG_LINK mbxStatus error x%x " | ||
553 | "HBA state x%x\n", | ||
554 | phba->brd_no, mb->mbxStatus, phba->hba_state); | ||
555 | 545 | ||
556 | lpfc_linkdown(phba); | 546 | if (pmb->mb.mbxStatus) |
557 | phba->hba_state = LPFC_HBA_ERROR; | ||
558 | goto out; | 547 | goto out; |
559 | } | ||
560 | 548 | ||
561 | if (phba->hba_state == LPFC_LOCAL_CFG_LINK) { | 549 | mempool_free(pmb, phba->mbox_mem_pool); |
562 | if (phba->fc_topology == TOPOLOGY_LOOP) { | 550 | |
563 | /* If we are public loop and L bit was set */ | 551 | if (phba->fc_topology == TOPOLOGY_LOOP && |
564 | if ((phba->fc_flag & FC_PUBLIC_LOOP) && | 552 | phba->fc_flag & FC_PUBLIC_LOOP && |
565 | !(phba->fc_flag & FC_LBIT)) { | 553 | !(phba->fc_flag & FC_LBIT)) { |
566 | /* Need to wait for FAN - use discovery timer | 554 | /* Need to wait for FAN - use discovery timer |
567 | * for timeout. hba_state is identically | 555 | * for timeout. hba_state is identically |
568 | * LPFC_LOCAL_CFG_LINK while waiting for FAN | 556 | * LPFC_LOCAL_CFG_LINK while waiting for FAN |
569 | */ | 557 | */ |
570 | lpfc_set_disctmo(phba); | 558 | lpfc_set_disctmo(phba); |
571 | mempool_free( pmb, phba->mbox_mem_pool); | 559 | return; |
572 | return; | ||
573 | } | ||
574 | } | 560 | } |
575 | 561 | ||
576 | /* Start discovery by sending a FLOGI hba_state is identically | 562 | /* Start discovery by sending a FLOGI. hba_state is identically |
577 | * LPFC_FLOGI while waiting for FLOGI cmpl | 563 | * LPFC_FLOGI while waiting for FLOGI cmpl |
578 | */ | 564 | */ |
579 | phba->hba_state = LPFC_FLOGI; | 565 | phba->hba_state = LPFC_FLOGI; |
580 | lpfc_set_disctmo(phba); | 566 | lpfc_set_disctmo(phba); |
581 | lpfc_initial_flogi(phba); | 567 | lpfc_initial_flogi(phba); |
582 | mempool_free( pmb, phba->mbox_mem_pool); | 568 | return; |
583 | return; | ||
584 | } | ||
585 | if (phba->hba_state == LPFC_FABRIC_CFG_LINK) { | ||
586 | mempool_free( pmb, phba->mbox_mem_pool); | ||
587 | return; | ||
588 | } | ||
589 | 569 | ||
590 | out: | 570 | out: |
591 | /* CONFIG_LINK bad hba state <hba_state> */ | 571 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, |
592 | lpfc_printf_log(phba, | 572 | "%d:0306 CONFIG_LINK mbxStatus error x%x " |
593 | KERN_ERR, | 573 | "HBA state x%x\n", |
594 | LOG_DISCOVERY, | 574 | phba->brd_no, pmb->mb.mbxStatus, phba->hba_state); |
575 | |||
576 | lpfc_linkdown(phba); | ||
577 | |||
578 | phba->hba_state = LPFC_HBA_ERROR; | ||
579 | |||
580 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | ||
595 | "%d:0200 CONFIG_LINK bad hba state x%x\n", | 581 | "%d:0200 CONFIG_LINK bad hba state x%x\n", |
596 | phba->brd_no, phba->hba_state); | 582 | phba->brd_no, phba->hba_state); |
597 | 583 | ||
598 | if (phba->hba_state != LPFC_CLEAR_LA) { | 584 | lpfc_clear_la(phba, pmb); |
599 | lpfc_clear_la(phba, pmb); | 585 | pmb->mbox_cmpl = lpfc_mbx_cmpl_clear_la; |
600 | pmb->mbox_cmpl = lpfc_mbx_cmpl_clear_la; | 586 | rc = lpfc_sli_issue_mbox(phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB)); |
601 | if (lpfc_sli_issue_mbox(phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB)) | 587 | if (rc == MBX_NOT_FINISHED) { |
602 | == MBX_NOT_FINISHED) { | 588 | mempool_free(pmb, phba->mbox_mem_pool); |
603 | mempool_free( pmb, phba->mbox_mem_pool); | 589 | lpfc_disc_flush_list(phba); |
604 | lpfc_disc_flush_list(phba); | 590 | psli->ring[(psli->ip_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; |
605 | psli->ring[(psli->ip_ring)].flag &= | 591 | psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; |
606 | ~LPFC_STOP_IOCB_EVENT; | 592 | psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; |
607 | psli->ring[(psli->fcp_ring)].flag &= | 593 | phba->hba_state = LPFC_HBA_READY; |
608 | ~LPFC_STOP_IOCB_EVENT; | ||
609 | psli->ring[(psli->next_ring)].flag &= | ||
610 | ~LPFC_STOP_IOCB_EVENT; | ||
611 | phba->hba_state = LPFC_HBA_READY; | ||
612 | } | ||
613 | } else { | ||
614 | mempool_free( pmb, phba->mbox_mem_pool); | ||
615 | } | 594 | } |
616 | return; | 595 | return; |
617 | } | 596 | } |
@@ -765,7 +744,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) | |||
765 | if (cfglink_mbox) { | 744 | if (cfglink_mbox) { |
766 | phba->hba_state = LPFC_LOCAL_CFG_LINK; | 745 | phba->hba_state = LPFC_LOCAL_CFG_LINK; |
767 | lpfc_config_link(phba, cfglink_mbox); | 746 | lpfc_config_link(phba, cfglink_mbox); |
768 | cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_config_link; | 747 | cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link; |
769 | lpfc_sli_issue_mbox(phba, cfglink_mbox, | 748 | lpfc_sli_issue_mbox(phba, cfglink_mbox, |
770 | (MBX_NOWAIT | MBX_STOP_IOCB)); | 749 | (MBX_NOWAIT | MBX_STOP_IOCB)); |
771 | } | 750 | } |