public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* PATCH [6/15] qla2xxx:  Track error-state of SBRs
@ 2004-03-14  8:24 Andrew Vasquez
  0 siblings, 0 replies; only message in thread
From: Andrew Vasquez @ 2004-03-14  8:24 UTC (permalink / raw)
  To: James Bottomley; +Cc: SCSI Mailing List

ChangeSet
  1.1662 04/03/01 09:39:39 andrew.vasquez@apc.qlogic.com +3 -0
  Consistenly track the error-state of a failed SRB.

  drivers/scsi/qla2xxx/qla_os.c
    1.10 04/03/01 09:37:21 andrew.vasquez@apc.qlogic.com +30 -13
    Set the error-state of a failed SRB.

  drivers/scsi/qla2xxx/qla_isr.c
    1.7 04/03/01 09:37:21 andrew.vasquez@apc.qlogic.com +4 -0
    Set the error-state of a failed SRB.

  drivers/scsi/qla2xxx/qla_def.h
    1.9 04/03/01 09:37:21 andrew.vasquez@apc.qlogic.com +4 -0
    Add error-state definitions.

 drivers/scsi/qla2xxx/qla_def.h |    4 +++
 drivers/scsi/qla2xxx/qla_isr.c |    4 +++
 drivers/scsi/qla2xxx/qla_os.c  |   43 ++++++++++++++++++++++++++++-------------
 3 files changed, 38 insertions(+), 13 deletions(-)

ftp://ftp.qlogic.com/outgoing/linux/patches/8.x/8.00.00b11k/15_track_srb_state.patch

diff -Nru a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
--- a/drivers/scsi/qla2xxx/qla_def.h	Fri Mar 12 17:07:39 2004
+++ b/drivers/scsi/qla2xxx/qla_def.h	Fri Mar 12 17:07:39 2004
@@ -265,6 +265,10 @@
 	/* Raw completion info for use by failover ? */
 	uint8_t	fo_retry_cnt;		/* Retry count this request */
 	uint8_t	err_id;			/* error id */
+#define SRB_ERR_PORT	1		/* Request failed -- "port down" */
+#define SRB_ERR_LOOP	2		/* Request failed -- "loop down" */
+#define SRB_ERR_DEVICE	3		/* Request failed -- "device error" */
+#define SRB_ERR_OTHER	4
 
 	/* Segment/entries counts */
 	uint16_t	req_cnt;	/* !0 indicates counts determined */
diff -Nru a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
--- a/drivers/scsi/qla2xxx/qla_isr.c	Fri Mar 12 17:07:39 2004
+++ b/drivers/scsi/qla2xxx/qla_isr.c	Fri Mar 12 17:07:39 2004
@@ -1139,6 +1139,10 @@
 		if ((sp->flags & SRB_IOCTL) ||
 		    atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
 			cp->result = DID_NO_CONNECT << 16;
+			if (atomic_read(&ha->loop_state) == LOOP_DOWN) 
+				sp->err_id = SRB_ERR_LOOP;
+			else
+				sp->err_id = SRB_ERR_PORT;
 			add_to_done_queue(ha, sp);
 		} else {
 			qla2x00_extend_timeout(cp, EXTEND_CMD_TIMEOUT);
diff -Nru a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c	Fri Mar 12 17:07:39 2004
+++ b/drivers/scsi/qla2xxx/qla_os.c	Fri Mar 12 17:07:39 2004
@@ -736,6 +736,7 @@
 	}
 
 	sp->fo_retry_cnt = 0;
+	sp->err_id = 0;
 
 	/* Generate LU queue on bus, target, LUN */
 	b = cmd->device->channel;
@@ -755,6 +756,7 @@
 
 	if (l >= ha->max_luns) {
 		cmd->result = DID_NO_CONNECT << 16;
+		sp->err_id = SRB_ERR_PORT;
 
 		spin_lock_irq(ha->host->host_lock);
 
@@ -801,6 +803,7 @@
 		    ha->host_no,t,l));
 
 		cmd->result = DID_NO_CONNECT << 16;
+		sp->err_id = SRB_ERR_PORT;
 
 		spin_lock_irq(ha->host->host_lock);
 
@@ -846,6 +849,11 @@
 		 * processing
 		 */
 		cmd->result = DID_NO_CONNECT << 16;
+		if (atomic_read(&ha2->loop_state) == LOOP_DOWN) 
+			sp->err_id = SRB_ERR_LOOP;
+		else
+			sp->err_id = SRB_ERR_PORT;
+
 		add_to_done_queue(ha, sp);
 		if (!list_empty(&ha->done_queue))
 			qla2x00_done(ha);
@@ -3253,6 +3261,11 @@
 
 					__del_from_retry_queue(ha, sp);
 					sp->cmd->result = DID_NO_CONNECT << 16;
+					if (atomic_read(&fcport->ha->loop_state) ==
+					    LOOP_DOWN) 
+						sp->err_id = SRB_ERR_LOOP;
+					else
+						sp->err_id = SRB_ERR_PORT;
 					sp->cmd->host_scribble =
 					    (unsigned char *) NULL;
 					__add_to_done_queue(ha, sp);
@@ -3940,6 +3953,10 @@
 		if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
 		    atomic_read(&vis_ha->loop_state) == LOOP_DEAD) {
 			cmd->result = DID_NO_CONNECT << 16;
+			if (atomic_read(&fcport->ha->loop_state) == LOOP_DOWN) 
+				sp->err_id = SRB_ERR_LOOP;
+			else
+				sp->err_id = SRB_ERR_PORT;
 		} else {
 			cmd->result = DID_BUS_BUSY << 16;
 		}
@@ -3978,6 +3995,10 @@
 		    atomic_read(&dest_ha->loop_state) == LOOP_DEAD) {
 			qla2x00_extend_timeout(cmd, EXTEND_CMD_TIMEOUT);
 			cmd->result = DID_NO_CONNECT << 16;
+			if (atomic_read(&dest_ha->loop_state) == LOOP_DOWN) 
+				sp->err_id = SRB_ERR_LOOP;
+			else
+				sp->err_id = SRB_ERR_PORT;
 		} else {
 			cmd->result = DID_BUS_BUSY << 16;
 		}
@@ -4237,20 +4258,16 @@
 
 		/* If device is dead then send request back to OS */
 		if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
-
 			sp->cmd->result = DID_NO_CONNECT << 16;
-
-			if (!atomic_read(&dest_ha->loop_down_timer) &&
-			    atomic_read(&dest_ha->loop_state) == LOOP_DOWN) {
-				sp->err_id = 2;
-			} else {
-				sp->err_id = 1;
-			}
-			DEBUG3(printk("scsi(%ld): loop/port is down - "
-			    "pid=%ld, sp=%p loopid=0x%x queued to dest HBA "
-			    "scsi%ld.\n",
-			    dest_ha->host_no,
-			    sp->cmd->serial_number, sp,
+			if (atomic_read(&dest_ha->loop_state) == LOOP_DOWN) 
+				sp->err_id = SRB_ERR_LOOP;
+			else
+				sp->err_id = SRB_ERR_PORT;
+
+			DEBUG3(printk("scsi(%ld): loop/port is down - pid=%ld, "
+			    "sp=%p err_id=%d loopid=0x%x queued to dest HBA "
+			    "scsi%ld.\n", dest_ha->host_no,
+			    sp->cmd->serial_number, sp, sp->err_id,
 			    fcport->loop_id, dest_ha->host_no));
 			/* 
 			 * Initiate a failover - done routine will initiate.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-03-14  8:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-14  8:24 PATCH [6/15] qla2xxx: Track error-state of SBRs Andrew Vasquez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox