Commit 54b28049 authored by Shivasharan S's avatar Shivasharan S Committed by Martin K. Petersen

scsi: megaraid_sas: re-work DCMD refire code

No functional changes.

This patch is a re-work of DCMD refire code to better manage all the
different cases to decide whether to REFIRE or SKIP or COMPLETE certain
DCMD.
Signed-off-by: default avatarSumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: default avatarShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 88d155c6
......@@ -4694,10 +4694,12 @@ megasas_get_ctrl_info(struct megasas_instance *instance)
sizeof(struct megasas_ctrl_info));
if ((instance->adapter_type != MFI_SERIES) &&
!instance->mask_interrupts)
!instance->mask_interrupts) {
ret = megasas_issue_blocked_cmd(instance, cmd, MFI_IO_TIMEOUT_SECS);
else
} else {
ret = megasas_issue_polled(instance, cmd);
cmd->flags |= DRV_DCMD_SKIP_REFIRE;
}
switch (ret) {
case DCMD_SUCCESS:
......
......@@ -3957,6 +3957,8 @@ void megasas_refire_mgmt_cmd(struct megasas_instance *instance)
union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc;
u16 smid;
bool refire_cmd = 0;
u8 result;
u32 opcode = 0;
fusion = instance->ctrl_context;
......@@ -3967,29 +3969,47 @@ void megasas_refire_mgmt_cmd(struct megasas_instance *instance)
cmd_fusion = fusion->cmd_list[j];
cmd_mfi = instance->cmd_list[cmd_fusion->sync_cmd_idx];
smid = le16_to_cpu(cmd_mfi->context.smid);
result = REFIRE_CMD;
if (!smid)
continue;
req_desc = megasas_get_request_descriptor(instance, smid - 1);
switch (cmd_mfi->frame->hdr.cmd) {
case MFI_CMD_DCMD:
opcode = le32_to_cpu(cmd_mfi->frame->dcmd.opcode);
/* Do not refire shutdown command */
if (le32_to_cpu(cmd_mfi->frame->dcmd.opcode) ==
MR_DCMD_CTRL_SHUTDOWN) {
if (opcode == MR_DCMD_CTRL_SHUTDOWN) {
cmd_mfi->frame->dcmd.cmd_status = MFI_STAT_OK;
megasas_complete_cmd(instance, cmd_mfi, DID_OK);
continue;
result = COMPLETE_CMD;
break;
}
refire_cmd = ((opcode != MR_DCMD_LD_MAP_GET_INFO)) &&
(opcode != MR_DCMD_SYSTEM_PD_MAP_GET_INFO) &&
!(cmd_mfi->flags & DRV_DCMD_SKIP_REFIRE);
if (!refire_cmd)
result = RETURN_CMD;
break;
default:
break;
}
req_desc = megasas_get_request_descriptor
(instance, smid - 1);
refire_cmd = req_desc && ((cmd_mfi->frame->dcmd.opcode !=
cpu_to_le32(MR_DCMD_LD_MAP_GET_INFO)) &&
(cmd_mfi->frame->dcmd.opcode !=
cpu_to_le32(MR_DCMD_SYSTEM_PD_MAP_GET_INFO)))
&& !(cmd_mfi->flags & DRV_DCMD_SKIP_REFIRE);
if (refire_cmd)
switch (result) {
case REFIRE_CMD:
megasas_fire_cmd_fusion(instance, req_desc);
else
break;
case RETURN_CMD:
megasas_return_cmd(instance, cmd_mfi);
break;
case COMPLETE_CMD:
megasas_complete_cmd(instance, cmd_mfi, DID_OK);
break;
}
}
}
......@@ -4629,8 +4649,6 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
continue;
}
megasas_refire_mgmt_cmd(instance);
if (megasas_get_ctrl_info(instance)) {
dev_info(&instance->pdev->dev,
"Failed from %s %d\n",
......@@ -4639,6 +4657,9 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
retval = FAILED;
goto out;
}
megasas_refire_mgmt_cmd(instance);
/* Reset load balance info */
if (fusion->load_balance_info)
memset(fusion->load_balance_info, 0,
......
......@@ -1344,6 +1344,12 @@ union desc_value {
} u;
};
enum CMD_RET_VALUES {
REFIRE_CMD = 1,
COMPLETE_CMD = 2,
RETURN_CMD = 3,
};
void megasas_free_cmds_fusion(struct megasas_instance *instance);
int megasas_ioc_init_fusion(struct megasas_instance *instance);
u8 megasas_get_map_info(struct megasas_instance *instance);
......
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