@@ -2760,5 +2760,7 @@ void megasas_exit_debugfs(void);
void megasas_setup_debugfs(struct megasas_instance *instance);
void megasas_destroy_debugfs(struct megasas_instance *instance);
int megasas_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num);
+void megasas_dcmd_timeout(struct megasas_instance *instance,
+ struct megasas_cmd *cmd);
#endif /*LSI_MEGARAID_SAS_H */
@@ -4529,6 +4529,30 @@ dcmd_timeout_ocr_possible(struct megasas_instance *instance) {
return INITIATE_OCR;
}
+/*
+ * megasas_dcmd_timeout - Classification processing dcmd timeout.
+ * @instance: Adapter soft state
+ */
+void megasas_dcmd_timeout(struct megasas_instance *instance, struct megasas_cmd *cmd)
+{
+ switch (dcmd_timeout_ocr_possible(instance)) {
+ case INITIATE_OCR:
+ cmd->flags |= DRV_DCMD_SKIP_REFIRE;
+ mutex_unlock(&instance->reset_mutex);
+ megasas_reset_fusion(instance->host,
+ MFI_IO_TIMEOUT_OCR);
+ mutex_lock(&instance->reset_mutex);
+ break;
+ case KILL_ADAPTER:
+ megaraid_sas_kill_hba(instance);
+ break;
+ case IGNORE_TIMEOUT:
+ dev_info(&instance->pdev->dev, "Ignore DCMD timeout: %s %d\n",
+ __func__, __LINE__);
+ break;
+ }
+}
+
static void
megasas_get_pd_info(struct megasas_instance *instance, struct scsi_device *sdev)
{
@@ -4580,24 +4604,7 @@ megasas_get_pd_info(struct megasas_instance *instance, struct scsi_device *sdev)
break;
case DCMD_TIMEOUT:
-
- switch (dcmd_timeout_ocr_possible(instance)) {
- case INITIATE_OCR:
- cmd->flags |= DRV_DCMD_SKIP_REFIRE;
- mutex_unlock(&instance->reset_mutex);
- megasas_reset_fusion(instance->host,
- MFI_IO_TIMEOUT_OCR);
- mutex_lock(&instance->reset_mutex);
- break;
- case KILL_ADAPTER:
- megaraid_sas_kill_hba(instance);
- break;
- case IGNORE_TIMEOUT:
- dev_info(&instance->pdev->dev, "Ignore DCMD timeout: %s %d\n",
- __func__, __LINE__);
- break;
- }
-
+ megasas_dcmd_timeout(instance, cmd);
break;
}
@@ -4676,29 +4683,7 @@ megasas_get_pd_list(struct megasas_instance *instance)
instance->pd_list_not_supported = 1;
break;
case DCMD_TIMEOUT:
-
- switch (dcmd_timeout_ocr_possible(instance)) {
- case INITIATE_OCR:
- cmd->flags |= DRV_DCMD_SKIP_REFIRE;
- /*
- * DCMD failed from AEN path.
- * AEN path already hold reset_mutex to avoid PCI access
- * while OCR is in progress.
- */
- mutex_unlock(&instance->reset_mutex);
- megasas_reset_fusion(instance->host,
- MFI_IO_TIMEOUT_OCR);
- mutex_lock(&instance->reset_mutex);
- break;
- case KILL_ADAPTER:
- megaraid_sas_kill_hba(instance);
- break;
- case IGNORE_TIMEOUT:
- dev_info(&instance->pdev->dev, "Ignore DCMD timeout: %s %d \n",
- __func__, __LINE__);
- break;
- }
-
+ megasas_dcmd_timeout(instance, cmd);
break;
case DCMD_SUCCESS:
@@ -4803,29 +4788,7 @@ megasas_get_ld_list(struct megasas_instance *instance)
megaraid_sas_kill_hba(instance);
break;
case DCMD_TIMEOUT:
-
- switch (dcmd_timeout_ocr_possible(instance)) {
- case INITIATE_OCR:
- cmd->flags |= DRV_DCMD_SKIP_REFIRE;
- /*
- * DCMD failed from AEN path.
- * AEN path already hold reset_mutex to avoid PCI access
- * while OCR is in progress.
- */
- mutex_unlock(&instance->reset_mutex);
- megasas_reset_fusion(instance->host,
- MFI_IO_TIMEOUT_OCR);
- mutex_lock(&instance->reset_mutex);
- break;
- case KILL_ADAPTER:
- megaraid_sas_kill_hba(instance);
- break;
- case IGNORE_TIMEOUT:
- dev_info(&instance->pdev->dev, "Ignore DCMD timeout: %s %d\n",
- __func__, __LINE__);
- break;
- }
-
+ megasas_dcmd_timeout(instance, cmd);
break;
case DCMD_SUCCESS:
@@ -4923,28 +4886,7 @@ megasas_ld_list_query(struct megasas_instance *instance, u8 query_type)
ret = megasas_get_ld_list(instance);
break;
case DCMD_TIMEOUT:
- switch (dcmd_timeout_ocr_possible(instance)) {
- case INITIATE_OCR:
- cmd->flags |= DRV_DCMD_SKIP_REFIRE;
- /*
- * DCMD failed from AEN path.
- * AEN path already hold reset_mutex to avoid PCI access
- * while OCR is in progress.
- */
- mutex_unlock(&instance->reset_mutex);
- megasas_reset_fusion(instance->host,
- MFI_IO_TIMEOUT_OCR);
- mutex_lock(&instance->reset_mutex);
- break;
- case KILL_ADAPTER:
- megaraid_sas_kill_hba(instance);
- break;
- case IGNORE_TIMEOUT:
- dev_info(&instance->pdev->dev, "Ignore DCMD timeout: %s %d\n",
- __func__, __LINE__);
- break;
- }
-
+ megasas_dcmd_timeout(instance, cmd);
break;
case DCMD_SUCCESS:
tgtid_count = le32_to_cpu(ci->count);
@@ -5079,22 +5021,7 @@ megasas_host_device_list_query(struct megasas_instance *instance,
break;
case DCMD_TIMEOUT:
- switch (dcmd_timeout_ocr_possible(instance)) {
- case INITIATE_OCR:
- cmd->flags |= DRV_DCMD_SKIP_REFIRE;
- mutex_unlock(&instance->reset_mutex);
- megasas_reset_fusion(instance->host,
- MFI_IO_TIMEOUT_OCR);
- mutex_lock(&instance->reset_mutex);
- break;
- case KILL_ADAPTER:
- megaraid_sas_kill_hba(instance);
- break;
- case IGNORE_TIMEOUT:
- dev_info(&instance->pdev->dev, "Ignore DCMD timeout: %s %d\n",
- __func__, __LINE__);
- break;
- }
+ megasas_dcmd_timeout(instance, cmd);
break;
case DCMD_FAILED:
dev_err(&instance->pdev->dev,
@@ -5230,22 +5157,7 @@ void megasas_get_snapdump_properties(struct megasas_instance *instance)
break;
case DCMD_TIMEOUT:
- switch (dcmd_timeout_ocr_possible(instance)) {
- case INITIATE_OCR:
- cmd->flags |= DRV_DCMD_SKIP_REFIRE;
- mutex_unlock(&instance->reset_mutex);
- megasas_reset_fusion(instance->host,
- MFI_IO_TIMEOUT_OCR);
- mutex_lock(&instance->reset_mutex);
- break;
- case KILL_ADAPTER:
- megaraid_sas_kill_hba(instance);
- break;
- case IGNORE_TIMEOUT:
- dev_info(&instance->pdev->dev, "Ignore DCMD timeout: %s %d\n",
- __func__, __LINE__);
- break;
- }
+ megasas_dcmd_timeout(instance, cmd);
}
if (ret != DCMD_TIMEOUT)
@@ -5370,22 +5282,7 @@ megasas_get_ctrl_info(struct megasas_instance *instance)
break;
case DCMD_TIMEOUT:
- switch (dcmd_timeout_ocr_possible(instance)) {
- case INITIATE_OCR:
- cmd->flags |= DRV_DCMD_SKIP_REFIRE;
- mutex_unlock(&instance->reset_mutex);
- megasas_reset_fusion(instance->host,
- MFI_IO_TIMEOUT_OCR);
- mutex_lock(&instance->reset_mutex);
- break;
- case KILL_ADAPTER:
- megaraid_sas_kill_hba(instance);
- break;
- case IGNORE_TIMEOUT:
- dev_info(&instance->pdev->dev, "Ignore DCMD timeout: %s %d\n",
- __func__, __LINE__);
- break;
- }
+ megasas_dcmd_timeout(instance, cmd);
break;
case DCMD_FAILED:
megaraid_sas_kill_hba(instance);
@@ -5452,20 +5349,7 @@ int megasas_set_crash_dump_params(struct megasas_instance *instance,
ret = megasas_issue_polled(instance, cmd);
if (ret == DCMD_TIMEOUT) {
- switch (dcmd_timeout_ocr_possible(instance)) {
- case INITIATE_OCR:
- cmd->flags |= DRV_DCMD_SKIP_REFIRE;
- megasas_reset_fusion(instance->host,
- MFI_IO_TIMEOUT_OCR);
- break;
- case KILL_ADAPTER:
- megaraid_sas_kill_hba(instance);
- break;
- case IGNORE_TIMEOUT:
- dev_info(&instance->pdev->dev, "Ignore DCMD timeout: %s %d\n",
- __func__, __LINE__);
- break;
- }
+ megasas_dcmd_timeout(instance, cmd);
} else
megasas_return_cmd(instance, cmd);
@@ -6838,23 +6722,7 @@ megasas_get_target_prop(struct megasas_instance *instance,
switch (ret) {
case DCMD_TIMEOUT:
- switch (dcmd_timeout_ocr_possible(instance)) {
- case INITIATE_OCR:
- cmd->flags |= DRV_DCMD_SKIP_REFIRE;
- mutex_unlock(&instance->reset_mutex);
- megasas_reset_fusion(instance->host,
- MFI_IO_TIMEOUT_OCR);
- mutex_lock(&instance->reset_mutex);
- break;
- case KILL_ADAPTER:
- megaraid_sas_kill_hba(instance);
- break;
- case IGNORE_TIMEOUT:
- dev_info(&instance->pdev->dev,
- "Ignore DCMD timeout: %s %d\n",
- __func__, __LINE__);
- break;
- }
+ megasas_dcmd_timeout(instance, cmd);
break;
default: