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
This commit is contained in:
Chandrakanth patil 2024-03-14 23:42:49 +05:30 committed by Sumit Saxena
parent 701d776c98
commit 571f1d0638
2 changed files with 2 additions and 12 deletions

View file

@ -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;

View file

@ -1802,7 +1802,6 @@ void mpi3mr_add_device(struct mpi3mr_softc *sc, U16 per_id)
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,