Skip to content

Commit ed17c71

Browse files
Ravi AnandJames Bottomley
authored andcommitted
[SCSI] qla2xxx: Use FW calculated residual count for underrun handling.
With ISP24XX and ISP54XX parts. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1 parent 45aeaf1 commit ed17c71

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

drivers/scsi/qla2xxx/qla_fw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ struct sts_entry_24xx {
463463
uint16_t comp_status; /* Completion status. */
464464
uint16_t ox_id; /* OX_ID used by the firmware. */
465465

466-
uint32_t residual_len; /* Residual transfer length. */
466+
uint32_t residual_len; /* FW calc residual transfer length. */
467467

468468
uint16_t reserved_1;
469469
uint16_t state_flags; /* State flags. */

drivers/scsi/qla2xxx/qla_isr.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
805805
uint16_t scsi_status;
806806
uint8_t lscsi_status;
807807
int32_t resid;
808-
uint32_t sense_len, rsp_info_len, resid_len;
808+
uint32_t sense_len, rsp_info_len, resid_len, fw_resid_len;
809809
uint8_t *rsp_info, *sense_data;
810810

811811
sts = (sts_entry_t *) pkt;
@@ -859,11 +859,12 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
859859

860860
fcport = sp->fcport;
861861

862-
sense_len = rsp_info_len = resid_len = 0;
862+
sense_len = rsp_info_len = resid_len = fw_resid_len = 0;
863863
if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
864864
sense_len = le32_to_cpu(sts24->sense_len);
865865
rsp_info_len = le32_to_cpu(sts24->rsp_data_len);
866866
resid_len = le32_to_cpu(sts24->rsp_residual_count);
867+
fw_resid_len = le32_to_cpu(sts24->residual_len);
867868
rsp_info = sts24->data;
868869
sense_data = sts24->data;
869870
host_to_fcp_swap(sts24->data, sizeof(sts24->data));
@@ -963,14 +964,21 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
963964

964965
case CS_DATA_UNDERRUN:
965966
resid = resid_len;
967+
/* Use F/W calculated residual length. */
968+
if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
969+
resid = fw_resid_len;
970+
966971
if (scsi_status & SS_RESIDUAL_UNDER) {
967972
cp->resid = resid;
968973
CMD_RESID_LEN(cp) = resid;
969974
} else {
970975
DEBUG2(printk(KERN_INFO
971976
"scsi(%ld:%d:%d) UNDERRUN status detected "
972-
"0x%x-0x%x.\n", ha->host_no, cp->device->id,
973-
cp->device->lun, comp_status, scsi_status));
977+
"0x%x-0x%x. resid=0x%x fw_resid=0x%x cdb=0x%x "
978+
"os_underflow=0x%x\n", ha->host_no,
979+
cp->device->id, cp->device->lun, comp_status,
980+
scsi_status, resid_len, resid, cp->cmnd[0],
981+
cp->underflow));
974982

975983
}
976984

0 commit comments

Comments
 (0)