aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_os.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c86
1 files changed, 10 insertions, 76 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index fd14c7bfc62..f9e5b85e84d 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -201,12 +201,12 @@ MODULE_PARM_DESC(ql2xmdcapmask,
201 "Set the Minidump driver capture mask level. " 201 "Set the Minidump driver capture mask level. "
202 "Default is 0x7F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F."); 202 "Default is 0x7F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F.");
203 203
204int ql2xmdenable; 204int ql2xmdenable = 1;
205module_param(ql2xmdenable, int, S_IRUGO); 205module_param(ql2xmdenable, int, S_IRUGO);
206MODULE_PARM_DESC(ql2xmdenable, 206MODULE_PARM_DESC(ql2xmdenable,
207 "Enable/disable MiniDump. " 207 "Enable/disable MiniDump. "
208 "0 (Default) - MiniDump disabled. " 208 "0 - MiniDump disabled. "
209 "1 - MiniDump enabled."); 209 "1 (Default) - MiniDump enabled.");
210 210
211/* 211/*
212 * SCSI host template entry points 212 * SCSI host template entry points
@@ -423,6 +423,7 @@ fail2:
423 qla25xx_delete_queues(vha); 423 qla25xx_delete_queues(vha);
424 destroy_workqueue(ha->wq); 424 destroy_workqueue(ha->wq);
425 ha->wq = NULL; 425 ha->wq = NULL;
426 vha->req = ha->req_q_map[0];
426fail: 427fail:
427 ha->mqenable = 0; 428 ha->mqenable = 0;
428 kfree(ha->req_q_map); 429 kfree(ha->req_q_map);
@@ -814,49 +815,6 @@ qla2x00_wait_for_chip_reset(scsi_qla_host_t *vha)
814 return return_status; 815 return return_status;
815} 816}
816 817
817/*
818 * qla2x00_wait_for_loop_ready
819 * Wait for MAX_LOOP_TIMEOUT(5 min) value for loop
820 * to be in LOOP_READY state.
821 * Input:
822 * ha - pointer to host adapter structure
823 *
824 * Note:
825 * Does context switching-Release SPIN_LOCK
826 * (if any) before calling this routine.
827 *
828 *
829 * Return:
830 * Success (LOOP_READY) : 0
831 * Failed (LOOP_NOT_READY) : 1
832 */
833static inline int
834qla2x00_wait_for_loop_ready(scsi_qla_host_t *vha)
835{
836 int return_status = QLA_SUCCESS;
837 unsigned long loop_timeout ;
838 struct qla_hw_data *ha = vha->hw;
839 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
840
841 /* wait for 5 min at the max for loop to be ready */
842 loop_timeout = jiffies + (MAX_LOOP_TIMEOUT * HZ);
843
844 while ((!atomic_read(&base_vha->loop_down_timer) &&
845 atomic_read(&base_vha->loop_state) == LOOP_DOWN) ||
846 atomic_read(&base_vha->loop_state) != LOOP_READY) {
847 if (atomic_read(&base_vha->loop_state) == LOOP_DEAD) {
848 return_status = QLA_FUNCTION_FAILED;
849 break;
850 }
851 msleep(1000);
852 if (time_after_eq(jiffies, loop_timeout)) {
853 return_status = QLA_FUNCTION_FAILED;
854 break;
855 }
856 }
857 return (return_status);
858}
859
860static void 818static void
861sp_get(struct srb *sp) 819sp_get(struct srb *sp)
862{ 820{
@@ -1035,12 +993,6 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
1035 "Wait for hba online failed for cmd=%p.\n", cmd); 993 "Wait for hba online failed for cmd=%p.\n", cmd);
1036 goto eh_reset_failed; 994 goto eh_reset_failed;
1037 } 995 }
1038 err = 1;
1039 if (qla2x00_wait_for_loop_ready(vha) != QLA_SUCCESS) {
1040 ql_log(ql_log_warn, vha, 0x800b,
1041 "Wait for loop ready failed for cmd=%p.\n", cmd);
1042 goto eh_reset_failed;
1043 }
1044 err = 2; 996 err = 2;
1045 if (do_reset(fcport, cmd->device->lun, cmd->request->cpu + 1) 997 if (do_reset(fcport, cmd->device->lun, cmd->request->cpu + 1)
1046 != QLA_SUCCESS) { 998 != QLA_SUCCESS) {
@@ -1137,10 +1089,9 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
1137 goto eh_bus_reset_done; 1089 goto eh_bus_reset_done;
1138 } 1090 }
1139 1091
1140 if (qla2x00_wait_for_loop_ready(vha) == QLA_SUCCESS) { 1092 if (qla2x00_loop_reset(vha) == QLA_SUCCESS)
1141 if (qla2x00_loop_reset(vha) == QLA_SUCCESS) 1093 ret = SUCCESS;
1142 ret = SUCCESS; 1094
1143 }
1144 if (ret == FAILED) 1095 if (ret == FAILED)
1145 goto eh_bus_reset_done; 1096 goto eh_bus_reset_done;
1146 1097
@@ -1206,15 +1157,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
1206 if (qla2x00_wait_for_reset_ready(vha) != QLA_SUCCESS) 1157 if (qla2x00_wait_for_reset_ready(vha) != QLA_SUCCESS)
1207 goto eh_host_reset_lock; 1158 goto eh_host_reset_lock;
1208 1159
1209 /*
1210 * Fixme-may be dpc thread is active and processing
1211 * loop_resync,so wait a while for it to
1212 * be completed and then issue big hammer.Otherwise
1213 * it may cause I/O failure as big hammer marks the
1214 * devices as lost kicking of the port_down_timer
1215 * while dpc is stuck for the mailbox to complete.
1216 */
1217 qla2x00_wait_for_loop_ready(vha);
1218 if (vha != base_vha) { 1160 if (vha != base_vha) {
1219 if (qla2x00_vp_abort_isp(vha)) 1161 if (qla2x00_vp_abort_isp(vha))
1220 goto eh_host_reset_lock; 1162 goto eh_host_reset_lock;
@@ -1297,16 +1239,13 @@ qla2x00_loop_reset(scsi_qla_host_t *vha)
1297 atomic_set(&vha->loop_state, LOOP_DOWN); 1239 atomic_set(&vha->loop_state, LOOP_DOWN);
1298 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); 1240 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
1299 qla2x00_mark_all_devices_lost(vha, 0); 1241 qla2x00_mark_all_devices_lost(vha, 0);
1300 qla2x00_wait_for_loop_ready(vha);
1301 } 1242 }
1302 1243
1303 if (ha->flags.enable_lip_reset) { 1244 if (ha->flags.enable_lip_reset) {
1304 ret = qla2x00_lip_reset(vha); 1245 ret = qla2x00_lip_reset(vha);
1305 if (ret != QLA_SUCCESS) { 1246 if (ret != QLA_SUCCESS)
1306 ql_dbg(ql_dbg_taskm, vha, 0x802e, 1247 ql_dbg(ql_dbg_taskm, vha, 0x802e,
1307 "lip_reset failed (%d).\n", ret); 1248 "lip_reset failed (%d).\n", ret);
1308 } else
1309 qla2x00_wait_for_loop_ready(vha);
1310 } 1249 }
1311 1250
1312 /* Issue marker command only when we are going to start the I/O */ 1251 /* Issue marker command only when we are going to start the I/O */
@@ -4070,13 +4009,8 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
4070 /* For ISP82XX complete any pending mailbox cmd */ 4009 /* For ISP82XX complete any pending mailbox cmd */
4071 if (IS_QLA82XX(ha)) { 4010 if (IS_QLA82XX(ha)) {
4072 ha->flags.isp82xx_fw_hung = 1; 4011 ha->flags.isp82xx_fw_hung = 1;
4073 if (ha->flags.mbox_busy) { 4012 ql_dbg(ql_dbg_aer, vha, 0x9001, "Pci channel io frozen\n");
4074 ha->flags.mbox_int = 1; 4013 qla82xx_clear_pending_mbx(vha);
4075 ql_dbg(ql_dbg_aer, vha, 0x9001,
4076 "Due to pci channel io frozen, doing premature "
4077 "completion of mbx command.\n");
4078 complete(&ha->mbx_intr_comp);
4079 }
4080 } 4014 }
4081 qla2x00_free_irqs(vha); 4015 qla2x00_free_irqs(vha);
4082 pci_disable_device(pdev); 4016 pci_disable_device(pdev);