Commit d37306ca authored by Chaitra P B's avatar Chaitra P B Committed by Martin K. Petersen

scsi: mpt3sas: Fix, False timeout prints for ioctl and other internal commands...

scsi: mpt3sas: Fix, False timeout prints for ioctl and other internal commands during controller reset.

When an ioctl is sent to FW, and if there is a controller reset issued
before ioctl gets completed, then in controller reset path all the pending
ioctl commands are terminated from "mpt3sas_ctl_reset_handler" function.
This will wake up the waiting ioctl commands in ioctl path and print
timeouts which are actually not timeouts.

Introduced "mpt3sas_base_check_cmd_timeout" function to check and print
whether command got timed out (or) terminated due to Host reset.
Signed-off-by: default avatarChaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 20a04433
...@@ -101,6 +101,34 @@ MODULE_PARM_DESC(mpt3sas_fwfault_debug, ...@@ -101,6 +101,34 @@ MODULE_PARM_DESC(mpt3sas_fwfault_debug,
static int static int
_base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc); _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc);
/**
* mpt3sas_base_check_cmd_timeout - Function
* to check timeout and command termination due
* to Host reset.
*
* @ioc: per adapter object.
* @status: Status of issued command.
* @mpi_request:mf request pointer.
* @sz: size of buffer.
*
* @Returns - 1/0 Reset to be done or Not
*/
u8
mpt3sas_base_check_cmd_timeout(struct MPT3SAS_ADAPTER *ioc,
u8 status, void *mpi_request, int sz)
{
u8 issue_reset = 0;
if (!(status & MPT3_CMD_RESET))
issue_reset = 1;
pr_err(MPT3SAS_FMT "Command %s\n", ioc->name,
((issue_reset == 0) ? "terminated due to Host Reset" : "Timeout"));
_debug_dump_mf(mpi_request, sz);
return issue_reset;
}
/** /**
* _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug. * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug.
* *
...@@ -5355,7 +5383,7 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc, ...@@ -5355,7 +5383,7 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc,
{ {
u16 smid; u16 smid;
u32 ioc_state; u32 ioc_state;
bool issue_reset = false; u8 issue_reset = 0;
int rc; int rc;
void *request; void *request;
u16 wait_state_count; u16 wait_state_count;
...@@ -5414,12 +5442,10 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc, ...@@ -5414,12 +5442,10 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc,
ioc->ioc_link_reset_in_progress) ioc->ioc_link_reset_in_progress)
ioc->ioc_link_reset_in_progress = 0; ioc->ioc_link_reset_in_progress = 0;
if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n", issue_reset =
ioc->name, __func__); mpt3sas_base_check_cmd_timeout(ioc,
_debug_dump_mf(mpi_request, ioc->base_cmds.status, mpi_request,
sizeof(Mpi2SasIoUnitControlRequest_t)/4); sizeof(Mpi2SasIoUnitControlRequest_t)/4);
if (!(ioc->base_cmds.status & MPT3_CMD_RESET))
issue_reset = true;
goto issue_host_reset; goto issue_host_reset;
} }
if (ioc->base_cmds.status & MPT3_CMD_REPLY_VALID) if (ioc->base_cmds.status & MPT3_CMD_REPLY_VALID)
...@@ -5457,7 +5483,7 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc, ...@@ -5457,7 +5483,7 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc,
{ {
u16 smid; u16 smid;
u32 ioc_state; u32 ioc_state;
bool issue_reset = false; u8 issue_reset = 0;
int rc; int rc;
void *request; void *request;
u16 wait_state_count; u16 wait_state_count;
...@@ -5510,12 +5536,10 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc, ...@@ -5510,12 +5536,10 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc,
wait_for_completion_timeout(&ioc->base_cmds.done, wait_for_completion_timeout(&ioc->base_cmds.done,
msecs_to_jiffies(10000)); msecs_to_jiffies(10000));
if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n", issue_reset =
ioc->name, __func__); mpt3sas_base_check_cmd_timeout(ioc,
_debug_dump_mf(mpi_request, ioc->base_cmds.status, mpi_request,
sizeof(Mpi2SepRequest_t)/4); sizeof(Mpi2SepRequest_t)/4);
if (!(ioc->base_cmds.status & MPT3_CMD_RESET))
issue_reset = false;
goto issue_host_reset; goto issue_host_reset;
} }
if (ioc->base_cmds.status & MPT3_CMD_REPLY_VALID) if (ioc->base_cmds.status & MPT3_CMD_REPLY_VALID)
......
...@@ -1482,6 +1482,8 @@ int mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc); ...@@ -1482,6 +1482,8 @@ int mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc);
void void
mpt3sas_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc); mpt3sas_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc);
u8 mpt3sas_base_check_cmd_timeout(struct MPT3SAS_ADAPTER *ioc,
u8 status, void *mpi_request, int sz);
/* scsih shared API */ /* scsih shared API */
struct scsi_cmnd *mpt3sas_scsih_scsi_lookup_get(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *mpt3sas_scsih_scsi_lookup_get(struct MPT3SAS_ADAPTER *ioc,
......
...@@ -406,9 +406,8 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t ...@@ -406,9 +406,8 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
mpt3sas_base_put_smid_default(ioc, smid); mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->config_cmds.done, timeout*HZ); wait_for_completion_timeout(&ioc->config_cmds.done, timeout*HZ);
if (!(ioc->config_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->config_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n", mpt3sas_base_check_cmd_timeout(ioc,
ioc->name, __func__); ioc->config_cmds.status, mpi_request,
_debug_dump_mf(mpi_request,
sizeof(Mpi2ConfigRequest_t)/4); sizeof(Mpi2ConfigRequest_t)/4);
retry_count++; retry_count++;
if (ioc->config_cmds.smid == smid) if (ioc->config_cmds.smid == smid)
......
...@@ -995,11 +995,10 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, ...@@ -995,11 +995,10 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
ioc->ignore_loginfos = 0; ioc->ignore_loginfos = 0;
} }
if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n", ioc->name, issue_reset =
__func__); mpt3sas_base_check_cmd_timeout(ioc,
_debug_dump_mf(mpi_request, karg.data_sge_offset); ioc->ctl_cmds.status, mpi_request,
if (!(ioc->ctl_cmds.status & MPT3_CMD_RESET)) karg.data_sge_offset);
issue_reset = 1;
goto issue_host_reset; goto issue_host_reset;
} }
...@@ -1621,12 +1620,10 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, ...@@ -1621,12 +1620,10 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc,
MPT3_IOCTL_DEFAULT_TIMEOUT*HZ); MPT3_IOCTL_DEFAULT_TIMEOUT*HZ);
if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n", ioc->name, issue_reset =
__func__); mpt3sas_base_check_cmd_timeout(ioc,
_debug_dump_mf(mpi_request, ioc->ctl_cmds.status, mpi_request,
sizeof(Mpi2DiagBufferPostRequest_t)/4); sizeof(Mpi2DiagBufferPostRequest_t)/4);
if (!(ioc->ctl_cmds.status & MPT3_CMD_RESET))
issue_reset = 1;
goto issue_host_reset; goto issue_host_reset;
} }
...@@ -1968,12 +1965,9 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, ...@@ -1968,12 +1965,9 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type,
MPT3_IOCTL_DEFAULT_TIMEOUT*HZ); MPT3_IOCTL_DEFAULT_TIMEOUT*HZ);
if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n", ioc->name, *issue_reset = mpt3sas_base_check_cmd_timeout(ioc,
__func__); ioc->ctl_cmds.status, mpi_request,
_debug_dump_mf(mpi_request,
sizeof(Mpi2DiagReleaseRequest_t)/4); sizeof(Mpi2DiagReleaseRequest_t)/4);
if (!(ioc->ctl_cmds.status & MPT3_CMD_RESET))
*issue_reset = 1;
rc = -EFAULT; rc = -EFAULT;
goto out; goto out;
} }
...@@ -2235,12 +2229,10 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) ...@@ -2235,12 +2229,10 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
MPT3_IOCTL_DEFAULT_TIMEOUT*HZ); MPT3_IOCTL_DEFAULT_TIMEOUT*HZ);
if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n", ioc->name, issue_reset =
__func__); mpt3sas_base_check_cmd_timeout(ioc,
_debug_dump_mf(mpi_request, ioc->ctl_cmds.status, mpi_request,
sizeof(Mpi2DiagBufferPostRequest_t)/4); sizeof(Mpi2DiagBufferPostRequest_t)/4);
if (!(ioc->ctl_cmds.status & MPT3_CMD_RESET))
issue_reset = 1;
goto issue_host_reset; goto issue_host_reset;
} }
......
...@@ -2709,11 +2709,9 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun, ...@@ -2709,11 +2709,9 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun,
mpt3sas_base_put_smid_hi_priority(ioc, smid, msix_task); mpt3sas_base_put_smid_hi_priority(ioc, smid, msix_task);
wait_for_completion_timeout(&ioc->tm_cmds.done, timeout*HZ); wait_for_completion_timeout(&ioc->tm_cmds.done, timeout*HZ);
if (!(ioc->tm_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->tm_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n", if (mpt3sas_base_check_cmd_timeout(ioc,
ioc->name, __func__); ioc->tm_cmds.status, mpi_request,
_debug_dump_mf(mpi_request, sizeof(Mpi2SCSITaskManagementRequest_t)/4)) {
sizeof(Mpi2SCSITaskManagementRequest_t)/4);
if (!(ioc->tm_cmds.status & MPT3_CMD_RESET)) {
rc = mpt3sas_base_hard_reset_handler(ioc, rc = mpt3sas_base_hard_reset_handler(ioc,
FORCE_BIG_HAMMER); FORCE_BIG_HAMMER);
rc = (!rc) ? SUCCESS : FAILED; rc = (!rc) ? SUCCESS : FAILED;
...@@ -7741,10 +7739,10 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) ...@@ -7741,10 +7739,10 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num)
wait_for_completion_timeout(&ioc->scsih_cmds.done, 10*HZ); wait_for_completion_timeout(&ioc->scsih_cmds.done, 10*HZ);
if (!(ioc->scsih_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->scsih_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n", issue_reset =
ioc->name, __func__); mpt3sas_base_check_cmd_timeout(ioc,
if (!(ioc->scsih_cmds.status & MPT3_CMD_RESET)) ioc->scsih_cmds.status, mpi_request,
issue_reset = 1; sizeof(Mpi2RaidActionRequest_t)/4);
rc = -EFAULT; rc = -EFAULT;
goto out; goto out;
} }
......
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