Commit 4c5d2df4 authored by Andrew Vasquez's avatar Andrew Vasquez Committed by James Bottomley

[PATCH] PATCH [6/15] qla2xxx: Track error-state of SBRs

Consistenly track the error-state of a failed SRB.
parent ae33fa86
......@@ -265,6 +265,10 @@ typedef struct srb {
/* 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 */
......
......@@ -1139,6 +1139,10 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
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);
......
......@@ -736,6 +736,7 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *))
}
sp->fo_retry_cnt = 0;
sp->err_id = 0;
/* Generate LU queue on bus, target, LUN */
b = cmd->device->channel;
......@@ -755,6 +756,7 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *))
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 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *))
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 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *))
* 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 @@ qla2x00_do_dpc(void *data)
__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 @@ qla2x00_cmd_timeout(srb_t *sp)
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 @@ qla2x00_cmd_timeout(srb_t *sp)
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 @@ qla2x00_next(scsi_qla_host_t *vis_ha)
/* 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_state) == LOOP_DOWN)
sp->err_id = SRB_ERR_LOOP;
else
sp->err_id = SRB_ERR_PORT;
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,
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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment