aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_isr.c
diff options
context:
space:
mode:
author <andrew.vasquez@qlogic.com>2005-04-17 16:02:26 -0400
committerJames Bottomley <jejb@titanic>2005-04-18 14:46:53 -0400
commitf4f051ebb40e74ad0ba02d2cb3a6c16b0393472b (patch)
treecc5b5267465d833d36037bd717cef9368f6c9472 /drivers/scsi/qla2xxx/qla_isr.c
parentc46f2ffb9e7fce7208c2639790e1ade42e00b146 (diff)
[PATCH] qla2xxx: remove internal queuing...
Remove internal command queuing from the driver. As is, this driver cannot tolerate cable-pulls as I/Os will begin to fail by the upper layers. o Should be used in conjuction with the 11-fc_rport_adds_2.diff patch. o Removes qla_listops.h file -- no longer needed. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_isr.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c147
1 files changed, 8 insertions, 139 deletions
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 603d4c683c6c..6e7eaaf33679 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -27,8 +27,6 @@ static void qla2x00_status_cont_entry(scsi_qla_host_t *, sts_cont_entry_t *);
27static void qla2x00_error_entry(scsi_qla_host_t *, sts_entry_t *); 27static void qla2x00_error_entry(scsi_qla_host_t *, sts_entry_t *);
28static void qla2x00_ms_entry(scsi_qla_host_t *, ms_iocb_entry_t *); 28static void qla2x00_ms_entry(scsi_qla_host_t *, ms_iocb_entry_t *);
29 29
30static int qla2x00_check_sense(struct scsi_cmnd *cp, os_lun_t *);
31
32/** 30/**
33 * qla2100_intr_handler() - Process interrupts for the ISP2100 and ISP2200. 31 * qla2100_intr_handler() - Process interrupts for the ISP2100 and ISP2200.
34 * @irq: 32 * @irq:
@@ -93,7 +91,6 @@ qla2100_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
93 } 91 }
94 spin_unlock_irqrestore(&ha->hardware_lock, flags); 92 spin_unlock_irqrestore(&ha->hardware_lock, flags);
95 93
96 qla2x00_next(ha);
97 ha->last_irq_cpu = _smp_processor_id(); 94 ha->last_irq_cpu = _smp_processor_id();
98 ha->total_isr_cnt++; 95 ha->total_isr_cnt++;
99 96
@@ -107,9 +104,6 @@ qla2100_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
107 spin_unlock_irqrestore(&ha->mbx_reg_lock, flags); 104 spin_unlock_irqrestore(&ha->mbx_reg_lock, flags);
108 } 105 }
109 106
110 if (!list_empty(&ha->done_queue))
111 qla2x00_done(ha);
112
113 return (IRQ_HANDLED); 107 return (IRQ_HANDLED);
114} 108}
115 109
@@ -206,7 +200,6 @@ qla2300_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
206 } 200 }
207 spin_unlock_irqrestore(&ha->hardware_lock, flags); 201 spin_unlock_irqrestore(&ha->hardware_lock, flags);
208 202
209 qla2x00_next(ha);
210 ha->last_irq_cpu = _smp_processor_id(); 203 ha->last_irq_cpu = _smp_processor_id();
211 ha->total_isr_cnt++; 204 ha->total_isr_cnt++;
212 205
@@ -220,9 +213,6 @@ qla2300_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
220 spin_unlock_irqrestore(&ha->mbx_reg_lock, flags); 213 spin_unlock_irqrestore(&ha->mbx_reg_lock, flags);
221 } 214 }
222 215
223 if (!list_empty(&ha->done_queue))
224 qla2x00_done(ha);
225
226 return (IRQ_HANDLED); 216 return (IRQ_HANDLED);
227} 217}
228 218
@@ -714,7 +704,7 @@ qla2x00_process_completed_request(struct scsi_qla_host *ha, uint32_t index)
714 /* Save ISP completion status */ 704 /* Save ISP completion status */
715 sp->cmd->result = DID_OK << 16; 705 sp->cmd->result = DID_OK << 16;
716 sp->fo_retry_cnt = 0; 706 sp->fo_retry_cnt = 0;
717 add_to_done_queue(ha, sp); 707 qla2x00_sp_compl(ha, sp);
718 } else { 708 } else {
719 DEBUG2(printk("scsi(%ld): Invalid ISP SCSI completion handle\n", 709 DEBUG2(printk("scsi(%ld): Invalid ISP SCSI completion handle\n",
720 ha->host_no)); 710 ha->host_no));
@@ -914,24 +904,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
914 tq = sp->tgt_queue; 904 tq = sp->tgt_queue;
915 lq = sp->lun_queue; 905 lq = sp->lun_queue;
916 906
917 /*
918 * If loop is in transient state Report DID_BUS_BUSY
919 */
920 if ((comp_status != CS_COMPLETE || scsi_status != 0)) {
921 if (!(sp->flags & (SRB_IOCTL | SRB_TAPE)) &&
922 (atomic_read(&ha->loop_down_timer) ||
923 atomic_read(&ha->loop_state) != LOOP_READY)) {
924
925 DEBUG2(printk("scsi(%ld:%d:%d:%d): Loop Not Ready - "
926 "pid=%lx.\n",
927 ha->host_no, b, t, l, cp->serial_number));
928
929 qla2x00_extend_timeout(cp, EXTEND_CMD_TIMEOUT);
930 add_to_retry_queue(ha, sp);
931 return;
932 }
933 }
934
935 /* Check for any FCP transport errors. */ 907 /* Check for any FCP transport errors. */
936 if (scsi_status & SS_RESPONSE_INFO_LEN_VALID) { 908 if (scsi_status & SS_RESPONSE_INFO_LEN_VALID) {
937 rsp_info_len = le16_to_cpu(pkt->rsp_info_len); 909 rsp_info_len = le16_to_cpu(pkt->rsp_info_len);
@@ -945,7 +917,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
945 pkt->rsp_info[6], pkt->rsp_info[7])); 917 pkt->rsp_info[6], pkt->rsp_info[7]));
946 918
947 cp->result = DID_BUS_BUSY << 16; 919 cp->result = DID_BUS_BUSY << 16;
948 add_to_done_queue(ha, sp); 920 qla2x00_sp_compl(ha, sp);
949 return; 921 return;
950 } 922 }
951 } 923 }
@@ -964,11 +936,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
964 cp->resid = resid; 936 cp->resid = resid;
965 CMD_RESID_LEN(cp) = resid; 937 CMD_RESID_LEN(cp) = resid;
966 } 938 }
967 if (lscsi_status == SS_BUSY_CONDITION) {
968 cp->result = DID_BUS_BUSY << 16 | lscsi_status;
969 break;
970 }
971
972 cp->result = DID_OK << 16 | lscsi_status; 939 cp->result = DID_OK << 16 | lscsi_status;
973 940
974 if (lscsi_status != SS_CHECK_CONDITION) 941 if (lscsi_status != SS_CHECK_CONDITION)
@@ -1002,14 +969,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
1002 if (sp->request_sense_length != 0) 969 if (sp->request_sense_length != 0)
1003 ha->status_srb = sp; 970 ha->status_srb = sp;
1004 971
1005 if (!(sp->flags & (SRB_IOCTL | SRB_TAPE)) &&
1006 qla2x00_check_sense(cp, lq) == QLA_SUCCESS) {
1007 /* Throw away status_cont if any */
1008 ha->status_srb = NULL;
1009 add_to_scsi_retry_queue(ha, sp);
1010 return;
1011 }
1012
1013 DEBUG5(printk("%s(): Check condition Sense data, " 972 DEBUG5(printk("%s(): Check condition Sense data, "
1014 "scsi(%ld:%d:%d:%d) cmd=%p pid=%ld\n", 973 "scsi(%ld:%d:%d:%d) cmd=%p pid=%ld\n",
1015 __func__, ha->host_no, b, t, l, cp, 974 __func__, ha->host_no, b, t, l, cp,
@@ -1035,12 +994,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
1035 * Status. 994 * Status.
1036 */ 995 */
1037 if (lscsi_status != 0) { 996 if (lscsi_status != 0) {
1038 if (lscsi_status == SS_BUSY_CONDITION) {
1039 cp->result = DID_BUS_BUSY << 16 |
1040 lscsi_status;
1041 break;
1042 }
1043
1044 cp->result = DID_OK << 16 | lscsi_status; 997 cp->result = DID_OK << 16 | lscsi_status;
1045 998
1046 if (lscsi_status != SS_CHECK_CONDITION) 999 if (lscsi_status != SS_CHECK_CONDITION)
@@ -1072,12 +1025,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
1072 if (sp->request_sense_length != 0) 1025 if (sp->request_sense_length != 0)
1073 ha->status_srb = sp; 1026 ha->status_srb = sp;
1074 1027
1075 if (!(sp->flags & (SRB_IOCTL | SRB_TAPE)) &&
1076 (qla2x00_check_sense(cp, lq) == QLA_SUCCESS)) {
1077 ha->status_srb = NULL;
1078 add_to_scsi_retry_queue(ha, sp);
1079 return;
1080 }
1081 DEBUG5(printk("%s(): Check condition Sense data, " 1028 DEBUG5(printk("%s(): Check condition Sense data, "
1082 "scsi(%ld:%d:%d:%d) cmd=%p pid=%ld\n", 1029 "scsi(%ld:%d:%d:%d) cmd=%p pid=%ld\n",
1083 __func__, ha->host_no, b, t, l, cp, 1030 __func__, ha->host_no, b, t, l, cp,
@@ -1155,24 +1102,10 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
1155 ha->host_no, t, l, cp->serial_number, comp_status, 1102 ha->host_no, t, l, cp->serial_number, comp_status,
1156 atomic_read(&fcport->state))); 1103 atomic_read(&fcport->state)));
1157 1104
1158 if ((sp->flags & (SRB_IOCTL | SRB_TAPE)) || 1105 cp->result = DID_BUS_BUSY << 16;
1159 atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
1160 cp->result = DID_NO_CONNECT << 16;
1161 if (atomic_read(&ha->loop_state) == LOOP_DOWN)
1162 sp->err_id = SRB_ERR_LOOP;
1163 else
1164 sp->err_id = SRB_ERR_PORT;
1165 add_to_done_queue(ha, sp);
1166 } else {
1167 qla2x00_extend_timeout(cp, EXTEND_CMD_TIMEOUT);
1168 add_to_retry_queue(ha, sp);
1169 }
1170
1171 if (atomic_read(&fcport->state) == FCS_ONLINE) { 1106 if (atomic_read(&fcport->state) == FCS_ONLINE) {
1172 qla2x00_mark_device_lost(ha, fcport, 1); 1107 qla2x00_mark_device_lost(ha, fcport, 1);
1173 } 1108 }
1174
1175 return;
1176 break; 1109 break;
1177 1110
1178 case CS_RESET: 1111 case CS_RESET:
@@ -1180,13 +1113,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
1180 "scsi(%ld): RESET status detected 0x%x-0x%x.\n", 1113 "scsi(%ld): RESET status detected 0x%x-0x%x.\n",
1181 ha->host_no, comp_status, scsi_status)); 1114 ha->host_no, comp_status, scsi_status));
1182 1115
1183 if (sp->flags & (SRB_IOCTL | SRB_TAPE)) { 1116 cp->result = DID_RESET << 16;
1184 cp->result = DID_RESET << 16;
1185 } else {
1186 qla2x00_extend_timeout(cp, EXTEND_CMD_TIMEOUT);
1187 add_to_retry_queue(ha, sp);
1188 return;
1189 }
1190 break; 1117 break;
1191 1118
1192 case CS_ABORTED: 1119 case CS_ABORTED:
@@ -1253,7 +1180,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
1253 1180
1254 /* Place command on done queue. */ 1181 /* Place command on done queue. */
1255 if (ha->status_srb == NULL) 1182 if (ha->status_srb == NULL)
1256 add_to_done_queue(ha, sp); 1183 qla2x00_sp_compl(ha, sp);
1257} 1184}
1258 1185
1259/** 1186/**
@@ -1298,8 +1225,8 @@ qla2x00_status_cont_entry(scsi_qla_host_t *ha, sts_cont_entry_t *pkt)
1298 1225
1299 /* Place command on done queue. */ 1226 /* Place command on done queue. */
1300 if (sp->request_sense_length == 0) { 1227 if (sp->request_sense_length == 0) {
1301 add_to_done_queue(ha, sp);
1302 ha->status_srb = NULL; 1228 ha->status_srb = NULL;
1229 qla2x00_sp_compl(ha, sp);
1303 } 1230 }
1304 } 1231 }
1305} 1232}
@@ -1353,8 +1280,7 @@ qla2x00_error_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
1353 } else { 1280 } else {
1354 sp->cmd->result = DID_ERROR << 16; 1281 sp->cmd->result = DID_ERROR << 16;
1355 } 1282 }
1356 /* Place command on done queue. */ 1283 qla2x00_sp_compl(ha, sp);
1357 add_to_done_queue(ha, sp);
1358 1284
1359 } else if (pkt->entry_type == COMMAND_A64_TYPE || 1285 } else if (pkt->entry_type == COMMAND_A64_TYPE ||
1360 pkt->entry_type == COMMAND_TYPE) { 1286 pkt->entry_type == COMMAND_TYPE) {
@@ -1403,62 +1329,5 @@ qla2x00_ms_entry(scsi_qla_host_t *ha, ms_iocb_entry_t *pkt)
1403 /* Free outstanding command slot. */ 1329 /* Free outstanding command slot. */
1404 ha->outstanding_cmds[pkt->handle1] = NULL; 1330 ha->outstanding_cmds[pkt->handle1] = NULL;
1405 1331
1406 add_to_done_queue(ha, sp); 1332 qla2x00_sp_compl(ha, sp);
1407}
1408
1409/**
1410 * qla2x00_check_sense() - Perform any sense data interrogation.
1411 * @cp: SCSI Command
1412 * @lq: Lun queue
1413 *
1414 * Returns QLA_SUCCESS if the lun queue is suspended, else
1415 * QLA_FUNCTION_FAILED (lun queue not suspended).
1416 */
1417static int
1418qla2x00_check_sense(struct scsi_cmnd *cp, os_lun_t *lq)
1419{
1420 scsi_qla_host_t *ha;
1421 srb_t *sp;
1422 fc_port_t *fcport;
1423
1424 ha = (scsi_qla_host_t *) cp->device->host->hostdata;
1425 if ((cp->sense_buffer[0] & 0x70) != 0x70) {
1426 return (QLA_FUNCTION_FAILED);
1427 }
1428
1429 sp = (srb_t * )CMD_SP(cp);
1430 sp->flags |= SRB_GOT_SENSE;
1431
1432 switch (cp->sense_buffer[2] & 0xf) {
1433 case RECOVERED_ERROR:
1434 cp->result = DID_OK << 16;
1435 cp->sense_buffer[0] = 0;
1436 break;
1437
1438 case NOT_READY:
1439 fcport = lq->fclun->fcport;
1440
1441 /*
1442 * Suspend the lun only for hard disk device type.
1443 */
1444 if ((fcport->flags & FCF_TAPE_PRESENT) == 0 &&
1445 lq->q_state != LUN_STATE_TIMEOUT) {
1446 /*
1447 * If target is in process of being ready then suspend
1448 * lun for 6 secs and retry all the commands.
1449 */
1450 if (cp->sense_buffer[12] == 0x4 &&
1451 cp->sense_buffer[13] == 0x1) {
1452
1453 /* Suspend the lun for 6 secs */
1454 qla2x00_suspend_lun(ha, lq, 6,
1455 ql2xsuspendcount);
1456
1457 return (QLA_SUCCESS);
1458 }
1459 }
1460 break;
1461 }
1462
1463 return (QLA_FUNCTION_FAILED);
1464} 1333}