Commit a44502f6 authored by Andrew Vasquez's avatar Andrew Vasquez Committed by James Bottomley

[PATCH] [2/18] qla2xxx: Correct residual counts

  Problem reported/corrected by Tony Battersby [tonyb@cybernetics.com]:

  o The qla2xxx driver calculates data transfer residuals
    for some but not all circumstances.  The patch below
    adds data transfer residual calculations for the
    remaining cases.

  o Interrogate the proper cmnd[] array when determining
    the transfer direction.
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent e5130849
...@@ -43,7 +43,7 @@ qla2x00_get_cmd_direction(struct scsi_cmnd *cmd) ...@@ -43,7 +43,7 @@ qla2x00_get_cmd_direction(struct scsi_cmnd *cmd)
else if (cmd->sc_data_direction == DMA_FROM_DEVICE) else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
cflags = CF_READ; cflags = CF_READ;
else { else {
switch (cmd->data_cmnd[0]) { switch (cmd->cmnd[0]) {
case WRITE_6: case WRITE_6:
case WRITE_10: case WRITE_10:
case WRITE_12: case WRITE_12:
......
...@@ -827,7 +827,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) ...@@ -827,7 +827,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
uint16_t comp_status; uint16_t comp_status;
uint16_t scsi_status; uint16_t scsi_status;
uint8_t lscsi_status; uint8_t lscsi_status;
uint32_t resid; int32_t resid;
uint8_t sense_sz = 0; uint8_t sense_sz = 0;
uint16_t rsp_info_len; uint16_t rsp_info_len;
...@@ -948,6 +948,11 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) ...@@ -948,6 +948,11 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
cp->result = DID_OK << 16; cp->result = DID_OK << 16;
break; break;
} }
if (scsi_status & (SS_RESIDUAL_UNDER | SS_RESIDUAL_OVER)) {
resid = le32_to_cpu(pkt->residual_length);
cp->resid = resid;
CMD_RESID_LEN(cp) = resid;
}
if (lscsi_status == SS_BUSY_CONDITION) { if (lscsi_status == SS_BUSY_CONDITION) {
cp->result = DID_BUS_BUSY << 16 | lscsi_status; cp->result = DID_BUS_BUSY << 16 | lscsi_status;
break; break;
...@@ -1009,7 +1014,10 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) ...@@ -1009,7 +1014,10 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
ha->host_no, t, l, comp_status, scsi_status)); ha->host_no, t, l, comp_status, scsi_status));
resid = le32_to_cpu(pkt->residual_length); resid = le32_to_cpu(pkt->residual_length);
CMD_RESID_LEN(cp) = resid; if (scsi_status & SS_RESIDUAL_UNDER) {
cp->resid = resid;
CMD_RESID_LEN(cp) = resid;
}
/* /*
* Check to see if SCSI Status is non zero. If so report SCSI * Check to see if SCSI Status is non zero. If so report SCSI
...@@ -1085,7 +1093,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) ...@@ -1085,7 +1093,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
} }
/* Handle mid-layer underflow */ /* Handle mid-layer underflow */
cp->resid = resid;
if ((unsigned)(cp->request_bufflen - resid) < if ((unsigned)(cp->request_bufflen - resid) <
cp->underflow) { cp->underflow) {
qla_printk(KERN_INFO, ha, qla_printk(KERN_INFO, ha,
......
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