The branch main has been updated by ssaxena: URL: https://cgit.FreeBSD.org/src/commit/?id=571f1d0638fa6b3a08f84118a33e53f941f0820c
commit 571f1d0638fa6b3a08f84118a33e53f941f0820c Author: Chandrakanth patil <chandrakanth.pa...@broadcom.com> AuthorDate: 2024-03-14 18:12:49 +0000 Commit: Sumit Saxena <ssax...@freebsd.org> CommitDate: 2024-06-06 10:39:15 +0000 mpi3mr: Decrement per controller and per target counter post reset Post controller reset, If any device removal events arrive, and if there are any outstanding IOs then the driver will unnecessarily wait in the loop for 30 seconds before removing the device from the OS. reset target outstanding IO counter and controller outstanding IO counter and remove the redundant wait loop. Reviewed by: imp Approved by: imp Differential revision: https://reviews.freebsd.org/D44424 --- sys/dev/mpi3mr/mpi3mr.c | 2 ++ sys/dev/mpi3mr/mpi3mr_cam.c | 12 ------------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c index 72abe76ad085..ba649edbe070 100644 --- a/sys/dev/mpi3mr/mpi3mr.c +++ b/sys/dev/mpi3mr/mpi3mr.c @@ -5692,6 +5692,8 @@ static void mpi3mr_flush_io(struct mpi3mr_softc *sc) if (cmd->callout_owner) { ccb = (union ccb *)(cmd->ccb); ccb->ccb_h.status = CAM_SCSI_BUS_RESET; + mpi3mr_atomic_dec(&sc->fw_outstanding); + mpi3mr_atomic_dec(&cmd->targ->outstanding); mpi3mr_cmd_done(sc, cmd); } else { cmd->ccb = NULL; diff --git a/sys/dev/mpi3mr/mpi3mr_cam.c b/sys/dev/mpi3mr/mpi3mr_cam.c index b8e4e350dfa1..4843aa6ea721 100644 --- a/sys/dev/mpi3mr/mpi3mr_cam.c +++ b/sys/dev/mpi3mr/mpi3mr_cam.c @@ -1802,7 +1802,6 @@ out: int mpi3mr_remove_device_from_os(struct mpi3mr_softc *sc, U16 handle) { - U32 i = 0; int retval = 0; struct mpi3mr_target *target; @@ -1833,17 +1832,6 @@ int mpi3mr_remove_device_from_os(struct mpi3mr_softc *sc, U16 handle) target->per_id); } - while (mpi3mr_atomic_read(&target->outstanding) && (i < 30)) { - i++; - if (!(i % 2)) { - mpi3mr_dprint(sc, MPI3MR_INFO, - "[%2d]waiting for " - "waiting for outstanding commands to complete on target: %d\n", - i, target->per_id); - } - DELAY(1000 * 1000); - } - if (target->exposed_to_os && !sc->reset_in_progress) { mpi3mr_rescan_target(sc, target); mpi3mr_dprint(sc, MPI3MR_INFO,