Skip to content

Commit 4616a4b

Browse files
Ranjan Kumarmartinkpetersen
authored andcommitted
scsi: mpi3mr: Improve wait logic while controller transitions to READY state
During controller transitioning to READY state, if the controller is found in transient states ("becoming ready" or "reset requested"), driver waits for 510 secs even if the controller transitions out of these states early. This causes an unnecessary delay of 510 secs in the overall firmware initialization sequence. Poll the controller state periodically (every 100 milliseconds) while waiting for the controller to come out of the mentioned transient states. Once the controller transits out of the transient states, come out of the wait loop. Signed-off-by: Sumit Saxena <[email protected]> Signed-off-by: Ranjan Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 6e4c825 commit 4616a4b

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

drivers/scsi/mpi3mr/mpi3mr_fw.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,26 +1384,23 @@ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc)
13841384
ioc_info(mrioc, "controller is in %s state during detection\n",
13851385
mpi3mr_iocstate_name(ioc_state));
13861386

1387-
if (ioc_state == MRIOC_STATE_BECOMING_READY ||
1388-
ioc_state == MRIOC_STATE_RESET_REQUESTED) {
1389-
timeout = mrioc->ready_timeout * 10;
1390-
do {
1391-
msleep(100);
1392-
} while (--timeout);
1387+
timeout = mrioc->ready_timeout * 10;
1388+
1389+
do {
1390+
ioc_state = mpi3mr_get_iocstate(mrioc);
1391+
1392+
if (ioc_state != MRIOC_STATE_BECOMING_READY &&
1393+
ioc_state != MRIOC_STATE_RESET_REQUESTED)
1394+
break;
13931395

13941396
if (!pci_device_is_present(mrioc->pdev)) {
13951397
mrioc->unrecoverable = 1;
1396-
ioc_err(mrioc,
1397-
"controller is not present while waiting to reset\n");
1398-
retval = -1;
1398+
ioc_err(mrioc, "controller is not present while waiting to reset\n");
13991399
goto out_device_not_present;
14001400
}
14011401

1402-
ioc_state = mpi3mr_get_iocstate(mrioc);
1403-
ioc_info(mrioc,
1404-
"controller is in %s state after waiting to reset\n",
1405-
mpi3mr_iocstate_name(ioc_state));
1406-
}
1402+
msleep(100);
1403+
} while (--timeout);
14071404

14081405
if (ioc_state == MRIOC_STATE_READY) {
14091406
ioc_info(mrioc, "issuing message unit reset (MUR) to bring to reset state\n");

0 commit comments

Comments
 (0)