Skip to contentSkip to conversation

PATCH [9/15] qla2xxx: Tape command handling fixes

PATCH Andrew Vasquez 1 participant 1 message May 7, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

ChangeSet
1.1930 04/04/30 14:01:16 [email protected] +4 -0 Fix several problems when handling commands issued to tape devices:

1) insure commands are not prematurely returned to the mid-layer with a failed status during loop/fabric transitions.

2) tape commands tend to have rather 'long' timeout values, unfortunately, as the these values increase into the 17 to 20 minute range (and larger), the cumulative skew of the RISC's own timer result in commands being held for seconds beyond their defined timeout values. Compensate for this in the driver's command timeout function.

 drivers/scsi/qla2xxx/qla_def.h  |    3 +
 drivers/scsi/qla2xxx/qla_init.c |    4 ++
 drivers/scsi/qla2xxx/qla_isr.c  |   10 ++---
 drivers/scsi/qla2xxx/qla_os.c   |   74 ++++++++++++++++++++++++++++++++++++----
 4 files changed, 79 insertions(+), 12 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +2 -1
diff -Nru a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
@@ -285,7 +285,8 @@
 
 #define SRB_BUSY		BIT_8	/* Command is in busy retry state */
 #define SRB_FO_CANCEL		BIT_9	/* Command don't need to do failover */
-#define	SRB_IOCTL		BIT_10	/* IOCTL command. */
+#define SRB_IOCTL		BIT_10	/* IOCTL command. */
+#define SRB_TAPE		BIT_11	/* FCP2 (Tape) command. */
 
 /*
  * SRB state definitions
drivers/scsi/qla2xxx/qla_init.c +4 -0
diff -Nru a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
@@ -3140,6 +3140,10 @@
 		spin_lock_irqsave(&ha->list_lock,flags);
 		list_for_each_safe(list, temp, &ha->pending_queue) {
 			sp = list_entry(list, srb_t, list);
+
+			if ((sp->flags & SRB_TAPE))
+				continue;
+			 
 			/* 
 			 * When time expire return request back to OS as BUSY 
 			 */
drivers/scsi/qla2xxx/qla_isr.c +5 -5
diff -Nru a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
@@ -907,7 +907,7 @@
 	 * If loop is in transient state Report DID_BUS_BUSY
 	 */
 	if ((comp_status != CS_COMPLETE || scsi_status != 0)) {
-		if (!(sp->flags & SRB_IOCTL) &&
+		if (!(sp->flags & (SRB_IOCTL | SRB_TAPE)) &&
 		    (atomic_read(&ha->loop_down_timer) ||
 			atomic_read(&ha->loop_state) != LOOP_READY)) {
 
@@ -986,7 +986,7 @@
 		if (sp->request_sense_length != 0)
 			ha->status_srb = sp;
 
-		if (!(sp->flags & SRB_IOCTL) &&
+		if (!(sp->flags & (SRB_IOCTL | SRB_TAPE)) &&
 		    qla2x00_check_sense(cp, lq) == QLA_SUCCESS) {
 			/* Throw away status_cont if any */
 			ha->status_srb = NULL;
@@ -1053,7 +1053,7 @@
 			if (sp->request_sense_length != 0)
 				ha->status_srb = sp;
 
-			if (!(sp->flags & SRB_IOCTL) &&
+			if (!(sp->flags & (SRB_IOCTL | SRB_TAPE)) &&
 			    (qla2x00_check_sense(cp, lq) == QLA_SUCCESS)) {
 				ha->status_srb = NULL;
 				add_to_scsi_retry_queue(ha, sp);
@@ -1137,7 +1137,7 @@
 		    ha->host_no, t, l, cp->serial_number, comp_status,
 		    atomic_read(&fcport->state)));
 
-		if ((sp->flags & SRB_IOCTL) ||
+		if ((sp->flags & (SRB_IOCTL | SRB_TAPE)) ||
 		    atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
 			cp->result = DID_NO_CONNECT << 16;
 			if (atomic_read(&ha->loop_state) == LOOP_DOWN) 
@@ -1162,7 +1162,7 @@
 		    "scsi(%ld): RESET status detected 0x%x-0x%x.\n",
 		    ha->host_no, comp_status, scsi_status));
 
-		if (sp->flags & SRB_IOCTL) {
+		if (sp->flags & (SRB_IOCTL | SRB_TAPE)) {
 			cp->result = DID_RESET << 16;
 		} else {
 			qla2x00_extend_timeout(cp, EXTEND_CMD_TIMEOUT);
drivers/scsi/qla2xxx/qla_os.c +68 -6

113 lines not on this page · raw message