mpi3mr: Cleaup setting of status in processing scsiio requests

More uniformly use mpi3mr_set_ccbstatus in mpi3mr_action_scsiio.  The
routine mostly used it, but also has setting of status by hand. In those
cases where we want to error out the request, use this routine.

As part of this, move setting CAM_SIM_QUEUED later in the function to
when we're sure it's been queued. Remove the places we clear it before
this.

Sponsored by:		Netflix
Reviewed by:		mav, jhb
Differential Revision:	https://reviews.freebsd.org/D42542

(cherry picked from commit cf8c23230aabd30aa9251975dbe705da559a2d02)
This commit is contained in:
Warner Losh 2023-11-28 18:49:30 -07:00 committed by Alexander Motin
parent c351a6ec91
commit ac4f33d2cd

View file

@ -1025,7 +1025,7 @@ mpi3mr_action_scsiio(struct mpi3mr_cam_softc *cam_sc, union ccb *ccb)
cam_sc->flags |= MPI3MRSAS_QUEUE_FROZEN;
}
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
ccb->ccb_h.status |= CAM_REQUEUE_REQ;
mpi3mr_set_ccbstatus(ccb, CAM_REQUEUE_REQ);
xpt_done(ccb);
return;
}
@ -1099,39 +1099,38 @@ mpi3mr_action_scsiio(struct mpi3mr_cam_softc *cam_sc, union ccb *ccb)
mpi3mr_dprint(sc, MPI3MR_TRACE, "[QID:%d]: func: %s line:%d CDB: 0x%x targetid: %x SMID: 0x%x\n",
(queue_idx + 1), __func__, __LINE__, scsi_opcode, csio->ccb_h.target_id, cm->hosttag);
ccb->ccb_h.status |= CAM_SIM_QUEUED;
switch ((ccb->ccb_h.flags & CAM_DATA_MASK)) {
case CAM_DATA_PADDR:
case CAM_DATA_SG_PADDR:
device_printf(sc->mpi3mr_dev, "%s: physical addresses not supported\n",
__func__);
mpi3mr_release_command(cm);
ccb->ccb_h.status = CAM_REQ_INVALID;
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
mpi3mr_set_ccbstatus(ccb, CAM_REQ_INVALID);
xpt_done(ccb);
return;
case CAM_DATA_SG:
device_printf(sc->mpi3mr_dev, "%s: scatter gather is not supported\n",
__func__);
mpi3mr_release_command(cm);
ccb->ccb_h.status = CAM_REQ_INVALID;
mpi3mr_set_ccbstatus(ccb, CAM_REQ_INVALID);
xpt_done(ccb);
return;
case CAM_DATA_VADDR:
case CAM_DATA_BIO:
if (csio->dxfer_len > (MPI3MR_SG_DEPTH * MPI3MR_4K_PGSZ)) {
mpi3mr_set_ccbstatus(ccb, CAM_REQ_TOO_BIG);
mpi3mr_release_command(cm);
ccb->ccb_h.status = CAM_REQ_TOO_BIG;
xpt_done(ccb);
return;
}
ccb->ccb_h.status |= CAM_SIM_QUEUED;
cm->length = csio->dxfer_len;
if (cm->length)
cm->data = csio->data_ptr;
break;
default:
ccb->ccb_h.status = CAM_REQ_INVALID;
mpi3mr_release_command(cm);
mpi3mr_set_ccbstatus(ccb, CAM_REQ_INVALID);
xpt_done(ccb);
return;
}