scsi: smartpqi: map more raid errors to SCSI errors
authorKevin Barnett <kevin.barnett@hpe.com>
Wed, 3 May 2017 23:55:07 +0000 (18:55 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 13 Jun 2017 00:48:04 +0000 (20:48 -0400)
enhance mapping of RAID path errors to Linux SCSI host
error codes.

Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/smartpqi/smartpqi_init.c

index 8f71e171095a11a37ab86d960d90a358d790cc5a..affbc4ffb9a5d40f5c82c7c9bd73c28c94a22df9 100644 (file)
@@ -2441,13 +2441,43 @@ static void pqi_process_raid_io_error(struct pqi_io_request *io_request)
        scsi_status = error_info->status;
        host_byte = DID_OK;
 
-       if (error_info->data_out_result == PQI_DATA_IN_OUT_UNDERFLOW) {
+       switch (error_info->data_out_result) {
+       case PQI_DATA_IN_OUT_GOOD:
+               break;
+       case PQI_DATA_IN_OUT_UNDERFLOW:
                xfer_count =
                        get_unaligned_le32(&error_info->data_out_transferred);
                residual_count = scsi_bufflen(scmd) - xfer_count;
                scsi_set_resid(scmd, residual_count);
                if (xfer_count < scmd->underflow)
                        host_byte = DID_SOFT_ERROR;
+               break;
+       case PQI_DATA_IN_OUT_UNSOLICITED_ABORT:
+       case PQI_DATA_IN_OUT_ABORTED:
+               host_byte = DID_ABORT;
+               break;
+       case PQI_DATA_IN_OUT_TIMEOUT:
+               host_byte = DID_TIME_OUT;
+               break;
+       case PQI_DATA_IN_OUT_BUFFER_OVERFLOW:
+       case PQI_DATA_IN_OUT_PROTOCOL_ERROR:
+       case PQI_DATA_IN_OUT_BUFFER_ERROR:
+       case PQI_DATA_IN_OUT_BUFFER_OVERFLOW_DESCRIPTOR_AREA:
+       case PQI_DATA_IN_OUT_BUFFER_OVERFLOW_BRIDGE:
+       case PQI_DATA_IN_OUT_ERROR:
+       case PQI_DATA_IN_OUT_HARDWARE_ERROR:
+       case PQI_DATA_IN_OUT_PCIE_FABRIC_ERROR:
+       case PQI_DATA_IN_OUT_PCIE_COMPLETION_TIMEOUT:
+       case PQI_DATA_IN_OUT_PCIE_COMPLETER_ABORT_RECEIVED:
+       case PQI_DATA_IN_OUT_PCIE_UNSUPPORTED_REQUEST_RECEIVED:
+       case PQI_DATA_IN_OUT_PCIE_ECRC_CHECK_FAILED:
+       case PQI_DATA_IN_OUT_PCIE_UNSUPPORTED_REQUEST:
+       case PQI_DATA_IN_OUT_PCIE_ACS_VIOLATION:
+       case PQI_DATA_IN_OUT_PCIE_TLP_PREFIX_BLOCKED:
+       case PQI_DATA_IN_OUT_PCIE_POISONED_MEMORY_READ:
+       default:
+               host_byte = DID_ERROR;
+               break;
        }
 
        sense_data_length = get_unaligned_le16(&error_info->sense_data_length);