]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: mpi3mr: Clear reset history on ready and recheck state after timeout
authorRanjan Kumar <ranjan.kumar@broadcom.com>
Wed, 25 Feb 2026 08:26:22 +0000 (13:56 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 28 Feb 2026 22:40:25 +0000 (17:40 -0500)
The driver retains reset history even after the IOC has successfully
reached the READY state. That leaves stale reset information active during
normal operation and can mislead recovery and diagnostics.  In addition, if
the IOC becomes READY just as the ready timeout loop exits, the driver
still follows the failure path and may retry or report failure incorrectly.

Clear reset history once READY is confirmed so driver state matches actual
IOC status. After the timeout loop, recheck the IOC state and treat READY
as success instead of failing.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://patch.msgid.link/20260225082622.82588-1-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpi3mr/mpi3mr_fw.c

index 5875065e2849e824536c8757ea87c53e4dcf46e8..c744210cc901886f9a91afb7bdd3698402a8fae0 100644 (file)
@@ -1618,6 +1618,7 @@ retry_bring_ioc_ready:
                        ioc_info(mrioc,
                            "successfully transitioned to %s state\n",
                            mpi3mr_iocstate_name(ioc_state));
+                       mpi3mr_clear_reset_history(mrioc);
                        return 0;
                }
                ioc_status = readl(&mrioc->sysif_regs->ioc_status);
@@ -1637,6 +1638,15 @@ retry_bring_ioc_ready:
                elapsed_time_sec = jiffies_to_msecs(jiffies - start_time)/1000;
        } while (elapsed_time_sec < mrioc->ready_timeout);
 
+       ioc_state = mpi3mr_get_iocstate(mrioc);
+       if (ioc_state == MRIOC_STATE_READY) {
+               ioc_info(mrioc,
+                   "successfully transitioned to %s state after %llu seconds\n",
+                   mpi3mr_iocstate_name(ioc_state), elapsed_time_sec);
+               mpi3mr_clear_reset_history(mrioc);
+               return 0;
+       }
+
 out_failed:
        elapsed_time_sec = jiffies_to_msecs(jiffies - start_time)/1000;
        if ((retry < 2) && (elapsed_time_sec < (mrioc->ready_timeout - 60))) {