diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_init.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 89 |
1 files changed, 77 insertions, 12 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 259f51137493..f948e1a73aec 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -498,6 +498,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha) | |||
498 | vha->flags.reset_active = 0; | 498 | vha->flags.reset_active = 0; |
499 | ha->flags.pci_channel_io_perm_failure = 0; | 499 | ha->flags.pci_channel_io_perm_failure = 0; |
500 | ha->flags.eeh_busy = 0; | 500 | ha->flags.eeh_busy = 0; |
501 | ha->flags.thermal_supported = 1; | ||
501 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); | 502 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); |
502 | atomic_set(&vha->loop_state, LOOP_DOWN); | 503 | atomic_set(&vha->loop_state, LOOP_DOWN); |
503 | vha->device_flags = DFLG_NO_CABLE; | 504 | vha->device_flags = DFLG_NO_CABLE; |
@@ -2023,6 +2024,7 @@ qla2x00_configure_hba(scsi_qla_host_t *vha) | |||
2023 | &loop_id, &al_pa, &area, &domain, &topo, &sw_cap); | 2024 | &loop_id, &al_pa, &area, &domain, &topo, &sw_cap); |
2024 | if (rval != QLA_SUCCESS) { | 2025 | if (rval != QLA_SUCCESS) { |
2025 | if (LOOP_TRANSITION(vha) || atomic_read(&ha->loop_down_timer) || | 2026 | if (LOOP_TRANSITION(vha) || atomic_read(&ha->loop_down_timer) || |
2027 | IS_QLA8XXX_TYPE(ha) || | ||
2026 | (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) { | 2028 | (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) { |
2027 | DEBUG2(printk("%s(%ld) Loop is in a transition state\n", | 2029 | DEBUG2(printk("%s(%ld) Loop is in a transition state\n", |
2028 | __func__, vha->host_no)); | 2030 | __func__, vha->host_no)); |
@@ -2928,6 +2930,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) | |||
2928 | fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); | 2930 | fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); |
2929 | 2931 | ||
2930 | qla2x00_iidma_fcport(vha, fcport); | 2932 | qla2x00_iidma_fcport(vha, fcport); |
2933 | qla24xx_update_fcport_fcp_prio(vha, fcport); | ||
2931 | qla2x00_reg_remote_port(vha, fcport); | 2934 | qla2x00_reg_remote_port(vha, fcport); |
2932 | atomic_set(&fcport->state, FCS_ONLINE); | 2935 | atomic_set(&fcport->state, FCS_ONLINE); |
2933 | } | 2936 | } |
@@ -3844,6 +3847,37 @@ qla2x00_loop_resync(scsi_qla_host_t *vha) | |||
3844 | return (rval); | 3847 | return (rval); |
3845 | } | 3848 | } |
3846 | 3849 | ||
3850 | /* | ||
3851 | * qla2x00_perform_loop_resync | ||
3852 | * Description: This function will set the appropriate flags and call | ||
3853 | * qla2x00_loop_resync. If successful loop will be resynced | ||
3854 | * Arguments : scsi_qla_host_t pointer | ||
3855 | * returm : Success or Failure | ||
3856 | */ | ||
3857 | |||
3858 | int qla2x00_perform_loop_resync(scsi_qla_host_t *ha) | ||
3859 | { | ||
3860 | int32_t rval = 0; | ||
3861 | |||
3862 | if (!test_and_set_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) { | ||
3863 | /*Configure the flags so that resync happens properly*/ | ||
3864 | atomic_set(&ha->loop_down_timer, 0); | ||
3865 | if (!(ha->device_flags & DFLG_NO_CABLE)) { | ||
3866 | atomic_set(&ha->loop_state, LOOP_UP); | ||
3867 | set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags); | ||
3868 | set_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags); | ||
3869 | set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags); | ||
3870 | |||
3871 | rval = qla2x00_loop_resync(ha); | ||
3872 | } else | ||
3873 | atomic_set(&ha->loop_state, LOOP_DEAD); | ||
3874 | |||
3875 | clear_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags); | ||
3876 | } | ||
3877 | |||
3878 | return rval; | ||
3879 | } | ||
3880 | |||
3847 | void | 3881 | void |
3848 | qla2x00_update_fcports(scsi_qla_host_t *base_vha) | 3882 | qla2x00_update_fcports(scsi_qla_host_t *base_vha) |
3849 | { | 3883 | { |
@@ -3857,7 +3891,7 @@ qla2x00_update_fcports(scsi_qla_host_t *base_vha) | |||
3857 | list_for_each_entry(vha, &base_vha->hw->vp_list, list) { | 3891 | list_for_each_entry(vha, &base_vha->hw->vp_list, list) { |
3858 | atomic_inc(&vha->vref_count); | 3892 | atomic_inc(&vha->vref_count); |
3859 | list_for_each_entry(fcport, &vha->vp_fcports, list) { | 3893 | list_for_each_entry(fcport, &vha->vp_fcports, list) { |
3860 | if (fcport && fcport->drport && | 3894 | if (fcport->drport && |
3861 | atomic_read(&fcport->state) != FCS_UNCONFIGURED) { | 3895 | atomic_read(&fcport->state) != FCS_UNCONFIGURED) { |
3862 | spin_unlock_irqrestore(&ha->vport_slock, flags); | 3896 | spin_unlock_irqrestore(&ha->vport_slock, flags); |
3863 | 3897 | ||
@@ -3871,11 +3905,43 @@ qla2x00_update_fcports(scsi_qla_host_t *base_vha) | |||
3871 | spin_unlock_irqrestore(&ha->vport_slock, flags); | 3905 | spin_unlock_irqrestore(&ha->vport_slock, flags); |
3872 | } | 3906 | } |
3873 | 3907 | ||
3908 | /* | ||
3909 | * qla82xx_quiescent_state_cleanup | ||
3910 | * Description: This function will block the new I/Os | ||
3911 | * Its not aborting any I/Os as context | ||
3912 | * is not destroyed during quiescence | ||
3913 | * Arguments: scsi_qla_host_t | ||
3914 | * return : void | ||
3915 | */ | ||
3916 | void | ||
3917 | qla82xx_quiescent_state_cleanup(scsi_qla_host_t *vha) | ||
3918 | { | ||
3919 | struct qla_hw_data *ha = vha->hw; | ||
3920 | struct scsi_qla_host *vp; | ||
3921 | |||
3922 | qla_printk(KERN_INFO, ha, | ||
3923 | "Performing ISP error recovery - ha= %p.\n", ha); | ||
3924 | |||
3925 | atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); | ||
3926 | if (atomic_read(&vha->loop_state) != LOOP_DOWN) { | ||
3927 | atomic_set(&vha->loop_state, LOOP_DOWN); | ||
3928 | qla2x00_mark_all_devices_lost(vha, 0); | ||
3929 | list_for_each_entry(vp, &ha->vp_list, list) | ||
3930 | qla2x00_mark_all_devices_lost(vha, 0); | ||
3931 | } else { | ||
3932 | if (!atomic_read(&vha->loop_down_timer)) | ||
3933 | atomic_set(&vha->loop_down_timer, | ||
3934 | LOOP_DOWN_TIME); | ||
3935 | } | ||
3936 | /* Wait for pending cmds to complete */ | ||
3937 | qla2x00_eh_wait_for_pending_commands(vha, 0, 0, WAIT_HOST); | ||
3938 | } | ||
3939 | |||
3874 | void | 3940 | void |
3875 | qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha) | 3941 | qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha) |
3876 | { | 3942 | { |
3877 | struct qla_hw_data *ha = vha->hw; | 3943 | struct qla_hw_data *ha = vha->hw; |
3878 | struct scsi_qla_host *vp, *base_vha = pci_get_drvdata(ha->pdev); | 3944 | struct scsi_qla_host *vp; |
3879 | unsigned long flags; | 3945 | unsigned long flags; |
3880 | 3946 | ||
3881 | vha->flags.online = 0; | 3947 | vha->flags.online = 0; |
@@ -3896,7 +3962,7 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha) | |||
3896 | qla2x00_mark_all_devices_lost(vha, 0); | 3962 | qla2x00_mark_all_devices_lost(vha, 0); |
3897 | 3963 | ||
3898 | spin_lock_irqsave(&ha->vport_slock, flags); | 3964 | spin_lock_irqsave(&ha->vport_slock, flags); |
3899 | list_for_each_entry(vp, &base_vha->hw->vp_list, list) { | 3965 | list_for_each_entry(vp, &ha->vp_list, list) { |
3900 | atomic_inc(&vp->vref_count); | 3966 | atomic_inc(&vp->vref_count); |
3901 | spin_unlock_irqrestore(&ha->vport_slock, flags); | 3967 | spin_unlock_irqrestore(&ha->vport_slock, flags); |
3902 | 3968 | ||
@@ -5410,7 +5476,7 @@ qla81xx_update_fw_options(scsi_qla_host_t *vha) | |||
5410 | * the tag (priority) value is returned. | 5476 | * the tag (priority) value is returned. |
5411 | * | 5477 | * |
5412 | * Input: | 5478 | * Input: |
5413 | * ha = adapter block po | 5479 | * vha = scsi host structure pointer. |
5414 | * fcport = port structure pointer. | 5480 | * fcport = port structure pointer. |
5415 | * | 5481 | * |
5416 | * Return: | 5482 | * Return: |
@@ -5504,7 +5570,7 @@ qla24xx_get_fcp_prio(scsi_qla_host_t *vha, fc_port_t *fcport) | |||
5504 | * Activates fcp priority for the logged in fc port | 5570 | * Activates fcp priority for the logged in fc port |
5505 | * | 5571 | * |
5506 | * Input: | 5572 | * Input: |
5507 | * ha = adapter block pointer. | 5573 | * vha = scsi host structure pointer. |
5508 | * fcp = port structure pointer. | 5574 | * fcp = port structure pointer. |
5509 | * | 5575 | * |
5510 | * Return: | 5576 | * Return: |
@@ -5514,25 +5580,24 @@ qla24xx_get_fcp_prio(scsi_qla_host_t *vha, fc_port_t *fcport) | |||
5514 | * Kernel context. | 5580 | * Kernel context. |
5515 | */ | 5581 | */ |
5516 | int | 5582 | int |
5517 | qla24xx_update_fcport_fcp_prio(scsi_qla_host_t *ha, fc_port_t *fcport) | 5583 | qla24xx_update_fcport_fcp_prio(scsi_qla_host_t *vha, fc_port_t *fcport) |
5518 | { | 5584 | { |
5519 | int ret; | 5585 | int ret; |
5520 | uint8_t priority; | 5586 | uint8_t priority; |
5521 | uint16_t mb[5]; | 5587 | uint16_t mb[5]; |
5522 | 5588 | ||
5523 | if (atomic_read(&fcport->state) == FCS_UNCONFIGURED || | 5589 | if (fcport->port_type != FCT_TARGET || |
5524 | fcport->port_type != FCT_TARGET || | 5590 | fcport->loop_id == FC_NO_LOOP_ID) |
5525 | fcport->loop_id == FC_NO_LOOP_ID) | ||
5526 | return QLA_FUNCTION_FAILED; | 5591 | return QLA_FUNCTION_FAILED; |
5527 | 5592 | ||
5528 | priority = qla24xx_get_fcp_prio(ha, fcport); | 5593 | priority = qla24xx_get_fcp_prio(vha, fcport); |
5529 | ret = qla24xx_set_fcp_prio(ha, fcport->loop_id, priority, mb); | 5594 | ret = qla24xx_set_fcp_prio(vha, fcport->loop_id, priority, mb); |
5530 | if (ret == QLA_SUCCESS) | 5595 | if (ret == QLA_SUCCESS) |
5531 | fcport->fcp_prio = priority; | 5596 | fcport->fcp_prio = priority; |
5532 | else | 5597 | else |
5533 | DEBUG2(printk(KERN_WARNING | 5598 | DEBUG2(printk(KERN_WARNING |
5534 | "scsi(%ld): Unable to activate fcp priority, " | 5599 | "scsi(%ld): Unable to activate fcp priority, " |
5535 | " ret=0x%x\n", ha->host_no, ret)); | 5600 | " ret=0x%x\n", vha->host_no, ret)); |
5536 | 5601 | ||
5537 | return ret; | 5602 | return ret; |
5538 | } | 5603 | } |