aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas/mpt2sas_scsih.c
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2009-09-23 07:53:07 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-10-29 13:03:09 -0400
commit9982f59450930138eb0bf9a4ebf865e8c06ba705 (patch)
tree04ec070534bd97d814e98428a966ceb2e51c4545 /drivers/scsi/mpt2sas/mpt2sas_scsih.c
parenta28eb222e3890a4ce190a430e24c483d2b5bb13b (diff)
[SCSI] mpt2sas: Add support in the driver to check for valid response info
Add support in the driver to check for valid response info in the scsi state, then check to see if the response code is MPI2_SCSITASKMGMT_RSP_INVALID_FRAME; when this condition occurrs, the driver will return DID_SOFT_ERROR. A return code of DID_SOFT_ERROR will result in a retry at the scsi-mid layer level. An additional change added to obtain the response code from the 1st byte of the response info instead of last. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: Eric Moore <Eric.moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_scsih.c')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index d4e890d8b992..efb6270cf261 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -3111,7 +3111,7 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
3111 if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) { 3111 if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) {
3112 response_info = le32_to_cpu(mpi_reply->ResponseInfo); 3112 response_info = le32_to_cpu(mpi_reply->ResponseInfo);
3113 response_bytes = (u8 *)&response_info; 3113 response_bytes = (u8 *)&response_info;
3114 _scsih_response_code(ioc, response_bytes[3]); 3114 _scsih_response_code(ioc, response_bytes[0]);
3115 } 3115 }
3116} 3116}
3117#endif 3117#endif
@@ -3229,7 +3229,7 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
3229 u8 scsi_status; 3229 u8 scsi_status;
3230 u32 log_info; 3230 u32 log_info;
3231 struct MPT2SAS_DEVICE *sas_device_priv_data; 3231 struct MPT2SAS_DEVICE *sas_device_priv_data;
3232 u32 response_code; 3232 u32 response_code = 0;
3233 3233
3234 mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); 3234 mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply);
3235 scmd = _scsih_scsi_lookup_get(ioc, smid); 3235 scmd = _scsih_scsi_lookup_get(ioc, smid);
@@ -3251,16 +3251,16 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
3251 } 3251 }
3252 3252
3253 /* turning off TLR */ 3253 /* turning off TLR */
3254 scsi_state = mpi_reply->SCSIState;
3255 if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID)
3256 response_code =
3257 le32_to_cpu(mpi_reply->ResponseInfo) & 0xFF;
3254 if (!sas_device_priv_data->tlr_snoop_check) { 3258 if (!sas_device_priv_data->tlr_snoop_check) {
3255 sas_device_priv_data->tlr_snoop_check++; 3259 sas_device_priv_data->tlr_snoop_check++;
3256 if (sas_device_priv_data->flags & MPT_DEVICE_TLR_ON) { 3260 if ((sas_device_priv_data->flags & MPT_DEVICE_TLR_ON) &&
3257 response_code = (le32_to_cpu(mpi_reply->ResponseInfo) 3261 response_code == MPI2_SCSITASKMGMT_RSP_INVALID_FRAME)
3258 >> 24); 3262 sas_device_priv_data->flags &=
3259 if (response_code == 3263 ~MPT_DEVICE_TLR_ON;
3260 MPI2_SCSITASKMGMT_RSP_INVALID_FRAME)
3261 sas_device_priv_data->flags &=
3262 ~MPT_DEVICE_TLR_ON;
3263 }
3264 } 3264 }
3265 3265
3266 xfer_cnt = le32_to_cpu(mpi_reply->TransferCount); 3266 xfer_cnt = le32_to_cpu(mpi_reply->TransferCount);
@@ -3271,7 +3271,6 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
3271 else 3271 else
3272 log_info = 0; 3272 log_info = 0;
3273 ioc_status &= MPI2_IOCSTATUS_MASK; 3273 ioc_status &= MPI2_IOCSTATUS_MASK;
3274 scsi_state = mpi_reply->SCSIState;
3275 scsi_status = mpi_reply->SCSIStatus; 3274 scsi_status = mpi_reply->SCSIStatus;
3276 3275
3277 if (ioc_status == MPI2_IOCSTATUS_SCSI_DATA_UNDERRUN && xfer_cnt == 0 && 3276 if (ioc_status == MPI2_IOCSTATUS_SCSI_DATA_UNDERRUN && xfer_cnt == 0 &&
@@ -3356,8 +3355,10 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
3356 case MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR: 3355 case MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR:
3357 case MPI2_IOCSTATUS_SUCCESS: 3356 case MPI2_IOCSTATUS_SUCCESS:
3358 scmd->result = (DID_OK << 16) | scsi_status; 3357 scmd->result = (DID_OK << 16) | scsi_status;
3359 if (scsi_state & (MPI2_SCSI_STATE_AUTOSENSE_FAILED | 3358 if (response_code ==
3360 MPI2_SCSI_STATE_NO_SCSI_STATUS)) 3359 MPI2_SCSITASKMGMT_RSP_INVALID_FRAME ||
3360 (scsi_state & (MPI2_SCSI_STATE_AUTOSENSE_FAILED |
3361 MPI2_SCSI_STATE_NO_SCSI_STATUS)))
3361 scmd->result = DID_SOFT_ERROR << 16; 3362 scmd->result = DID_SOFT_ERROR << 16;
3362 else if (scsi_state & MPI2_SCSI_STATE_TERMINATED) 3363 else if (scsi_state & MPI2_SCSI_STATE_TERMINATED)
3363 scmd->result = DID_RESET << 16; 3364 scmd->result = DID_RESET << 16;