Commit c2922f17 authored by Murthy Bhat's avatar Murthy Bhat Committed by Martin K. Petersen

scsi: smartpqi: fix LUN reset when fw bkgnd thread is hung

Add support for a timeout on LUN resets.

Link: https://lore.kernel.org/r/157048750055.11757.9689400788261610618.stgit@brunhildaReviewed-by: default avatarScott Benesh <scott.benesh@microsemi.com>
Reviewed-by: default avatarScott Teel <scott.teel@microsemi.com>
Reviewed-by: default avatarKevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: default avatarMurthy Bhat <Murthy.Bhat@microsemi.com>
Signed-off-by: default avatarDon Brace <don.brace@microsemi.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 21432010
...@@ -387,7 +387,8 @@ struct pqi_task_management_request { ...@@ -387,7 +387,8 @@ struct pqi_task_management_request {
struct pqi_iu_header header; struct pqi_iu_header header;
__le16 request_id; __le16 request_id;
__le16 nexus_id; __le16 nexus_id;
u8 reserved[4]; u8 reserved[2];
__le16 timeout;
u8 lun_number[8]; u8 lun_number[8];
__le16 protocol_specific; __le16 protocol_specific;
__le16 outbound_queue_id_to_manage; __le16 outbound_queue_id_to_manage;
...@@ -764,6 +765,7 @@ struct pqi_config_table_firmware_features { ...@@ -764,6 +765,7 @@ struct pqi_config_table_firmware_features {
#define PQI_FIRMWARE_FEATURE_SMP 1 #define PQI_FIRMWARE_FEATURE_SMP 1
#define PQI_FIRMWARE_FEATURE_SOFT_RESET_HANDSHAKE 11 #define PQI_FIRMWARE_FEATURE_SOFT_RESET_HANDSHAKE 11
#define PQI_FIRMWARE_FEATURE_RAID_IU_TIMEOUT 13 #define PQI_FIRMWARE_FEATURE_RAID_IU_TIMEOUT 13
#define PQI_FIRMWARE_FEATURE_TMF_IU_TIMEOUT 14
struct pqi_config_table_debug { struct pqi_config_table_debug {
struct pqi_config_table_section_header header; struct pqi_config_table_section_header header;
...@@ -1142,6 +1144,7 @@ struct pqi_ctrl_info { ...@@ -1142,6 +1144,7 @@ struct pqi_ctrl_info {
u8 pqi_reset_quiesce_supported : 1; u8 pqi_reset_quiesce_supported : 1;
u8 soft_reset_handshake_supported : 1; u8 soft_reset_handshake_supported : 1;
u8 raid_iu_timeout_supported: 1; u8 raid_iu_timeout_supported: 1;
u8 tmf_iu_timeout_supported: 1;
struct list_head scsi_device_list; struct list_head scsi_device_list;
spinlock_t scsi_device_list_lock; spinlock_t scsi_device_list_lock;
......
...@@ -5690,7 +5690,8 @@ static void pqi_lun_reset_complete(struct pqi_io_request *io_request, ...@@ -5690,7 +5690,8 @@ static void pqi_lun_reset_complete(struct pqi_io_request *io_request,
complete(waiting); complete(waiting);
} }
#define PQI_LUN_RESET_TIMEOUT_SECS 10 #define PQI_LUN_RESET_TIMEOUT_SECS 60
#define PQI_LUN_RESET_POLL_COMPLETION_SECS 10
static int pqi_wait_for_lun_reset_completion(struct pqi_ctrl_info *ctrl_info, static int pqi_wait_for_lun_reset_completion(struct pqi_ctrl_info *ctrl_info,
struct pqi_scsi_dev *device, struct completion *wait) struct pqi_scsi_dev *device, struct completion *wait)
...@@ -5699,7 +5700,7 @@ static int pqi_wait_for_lun_reset_completion(struct pqi_ctrl_info *ctrl_info, ...@@ -5699,7 +5700,7 @@ static int pqi_wait_for_lun_reset_completion(struct pqi_ctrl_info *ctrl_info,
while (1) { while (1) {
if (wait_for_completion_io_timeout(wait, if (wait_for_completion_io_timeout(wait,
PQI_LUN_RESET_TIMEOUT_SECS * PQI_HZ)) { PQI_LUN_RESET_POLL_COMPLETION_SECS * PQI_HZ)) {
rc = 0; rc = 0;
break; break;
} }
...@@ -5736,6 +5737,9 @@ static int pqi_lun_reset(struct pqi_ctrl_info *ctrl_info, ...@@ -5736,6 +5737,9 @@ static int pqi_lun_reset(struct pqi_ctrl_info *ctrl_info,
memcpy(request->lun_number, device->scsi3addr, memcpy(request->lun_number, device->scsi3addr,
sizeof(request->lun_number)); sizeof(request->lun_number));
request->task_management_function = SOP_TASK_MANAGEMENT_LUN_RESET; request->task_management_function = SOP_TASK_MANAGEMENT_LUN_RESET;
if (ctrl_info->tmf_iu_timeout_supported)
put_unaligned_le16(PQI_LUN_RESET_TIMEOUT_SECS,
&request->timeout);
pqi_start_io(ctrl_info, pqi_start_io(ctrl_info,
&ctrl_info->queue_groups[PQI_DEFAULT_QUEUE_GROUP], RAID_PATH, &ctrl_info->queue_groups[PQI_DEFAULT_QUEUE_GROUP], RAID_PATH,
...@@ -5765,7 +5769,7 @@ static int _pqi_device_reset(struct pqi_ctrl_info *ctrl_info, ...@@ -5765,7 +5769,7 @@ static int _pqi_device_reset(struct pqi_ctrl_info *ctrl_info,
for (retries = 0;;) { for (retries = 0;;) {
rc = pqi_lun_reset(ctrl_info, device); rc = pqi_lun_reset(ctrl_info, device);
if (rc != -EAGAIN || ++retries > PQI_LUN_RESET_RETRIES) if (rc == 0 || ++retries > PQI_LUN_RESET_RETRIES)
break; break;
msleep(PQI_LUN_RESET_RETRY_INTERVAL_MSECS); msleep(PQI_LUN_RESET_RETRY_INTERVAL_MSECS);
} }
...@@ -6886,6 +6890,10 @@ static void pqi_ctrl_update_feature_flags(struct pqi_ctrl_info *ctrl_info, ...@@ -6886,6 +6890,10 @@ static void pqi_ctrl_update_feature_flags(struct pqi_ctrl_info *ctrl_info,
ctrl_info->raid_iu_timeout_supported = ctrl_info->raid_iu_timeout_supported =
firmware_feature->enabled; firmware_feature->enabled;
break; break;
case PQI_FIRMWARE_FEATURE_TMF_IU_TIMEOUT:
ctrl_info->tmf_iu_timeout_supported =
firmware_feature->enabled;
break;
} }
pqi_firmware_feature_status(ctrl_info, firmware_feature); pqi_firmware_feature_status(ctrl_info, firmware_feature);
...@@ -6921,6 +6929,11 @@ static struct pqi_firmware_feature pqi_firmware_features[] = { ...@@ -6921,6 +6929,11 @@ static struct pqi_firmware_feature pqi_firmware_features[] = {
.feature_bit = PQI_FIRMWARE_FEATURE_RAID_IU_TIMEOUT, .feature_bit = PQI_FIRMWARE_FEATURE_RAID_IU_TIMEOUT,
.feature_status = pqi_ctrl_update_feature_flags, .feature_status = pqi_ctrl_update_feature_flags,
}, },
{
.feature_name = "TMF IU Timeout",
.feature_bit = PQI_FIRMWARE_FEATURE_TMF_IU_TIMEOUT,
.feature_status = pqi_ctrl_update_feature_flags,
},
}; };
static void pqi_process_firmware_features( static void pqi_process_firmware_features(
...@@ -8940,6 +8953,8 @@ static void __attribute__((unused)) verify_structures(void) ...@@ -8940,6 +8953,8 @@ static void __attribute__((unused)) verify_structures(void)
request_id) != 8); request_id) != 8);
BUILD_BUG_ON(offsetof(struct pqi_task_management_request, BUILD_BUG_ON(offsetof(struct pqi_task_management_request,
nexus_id) != 10); nexus_id) != 10);
BUILD_BUG_ON(offsetof(struct pqi_task_management_request,
timeout) != 14);
BUILD_BUG_ON(offsetof(struct pqi_task_management_request, BUILD_BUG_ON(offsetof(struct pqi_task_management_request,
lun_number) != 16); lun_number) != 16);
BUILD_BUG_ON(offsetof(struct pqi_task_management_request, BUILD_BUG_ON(offsetof(struct pqi_task_management_request,
......
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