Try to slight untangle I/O and loop status handling.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2017-03-12 15:36:07 +00:00
parent 229203af68
commit ab23521a49
3 changed files with 14 additions and 50 deletions

View File

@ -4343,13 +4343,6 @@ isp_start(XS_T *xs)
return (CMD_COMPLETE);
}
/*
* Try again later.
*/
if (fcp->isp_loopstate != LOOP_READY) {
return (CMD_RQLATER);
}
isp_prt(isp, ISP_LOGDEBUG2, "XS_TGT(xs)=%d", target);
lp = &fcp->portdb[target];
if (target < 0 || target >= MAX_FC_TARG ||
@ -4357,6 +4350,12 @@ isp_start(XS_T *xs)
XS_SETERR(xs, HBA_SELTIMEOUT);
return (CMD_COMPLETE);
}
if (fcp->isp_loopstate != LOOP_READY) {
isp_prt(isp, ISP_LOGDEBUG1,
"%d.%d.%jx loop is not ready",
XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs));
return (CMD_RQLATER);
}
if (lp->state == FC_PORTDB_STATE_ZOMBIE) {
isp_prt(isp, ISP_LOGDEBUG1,
"%d.%d.%jx target zombie",
@ -6544,7 +6543,8 @@ isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, long *rp)
case RQCS_PORT_CHANGED:
isp_prt(isp, ISP_LOGWARN, "port changed for target %d", XS_TGT(xs));
if (XS_NOERR(xs)) {
XS_SETERR(xs, HBA_SELTIMEOUT);
*XS_STSP(xs) = SCSI_BUSY;
XS_SETERR(xs, HBA_TGTBSY);
}
return;
@ -6693,11 +6693,11 @@ isp_parse_status_24xx(ispsoftc_t *isp, isp24xx_statusreq_t *sp, XS_T *xs, long *
case RQCS_PORT_CHANGED:
isp_prt(isp, ISP_LOGWARN, "port changed for target %d chan %d", XS_TGT(xs), chan);
if (XS_NOERR(xs)) {
XS_SETERR(xs, HBA_SELTIMEOUT);
*XS_STSP(xs) = SCSI_BUSY;
XS_SETERR(xs, HBA_TGTBSY);
}
return;
case RQCS_24XX_ENOMEM: /* f/w resource unavailable */
isp_prt(isp, ISP_LOGWARN, "f/w resource unavailable for target %d chan %d", XS_TGT(xs), chan);
if (XS_NOERR(xs)) {

View File

@ -3073,7 +3073,6 @@ isp_loop_changed(ispsoftc_t *isp, int chan)
isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGDEBUG0, "Chan %d Loop changed", chan);
if (fcp->role & ISP_ROLE_INITIATOR)
isp_freeze_loopdown(isp, chan);
fc->loop_dead = 0;
fc->loop_down_time = time_uptime;
wakeup(fc);
}
@ -3085,7 +3084,6 @@ isp_loop_up(ispsoftc_t *isp, int chan)
isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGDEBUG0, "Chan %d Loop is up", chan);
fc->loop_seen_once = 1;
fc->loop_dead = 0;
fc->loop_down_time = 0;
isp_unfreeze_loopdown(isp, chan);
}
@ -3149,7 +3147,6 @@ isp_loop_dead(ispsoftc_t *isp, int chan)
}
isp_unfreeze_loopdown(isp, chan);
fc->loop_dead = 1;
fc->loop_down_time = 0;
}
@ -3377,18 +3374,6 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
callout_reset(&PISP_PCMD(ccb)->wdog, ts, isp_watchdog, ccb);
break;
case CMD_RQLATER:
/*
* We get this result if the loop isn't ready
* or if the device in question has gone zombie.
*/
if (ISP_FC_PC(isp, bus)->loop_dead) {
isp_prt(isp, ISP_LOGDEBUG0,
"%d.%jx loop is dead",
XS_TGT(ccb), (uintmax_t)XS_LUN(ccb));
ccb->ccb_h.status = CAM_SEL_TIMEOUT;
isp_done((struct ccb_scsiio *) ccb);
break;
}
isp_prt(isp, ISP_LOGDEBUG0, "%d.%jx retry later",
XS_TGT(ccb), (uintmax_t)XS_LUN(ccb));
cam_freeze_devq(ccb->ccb_h.path);
@ -3913,8 +3898,6 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
}
}
#define ISPDDB (CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_CDB)
void
isp_done(XS_T *sccb)
{
@ -3935,27 +3918,10 @@ isp_done(XS_T *sccb)
sccb->ccb_h.status &= ~CAM_SIM_QUEUED;
status = sccb->ccb_h.status & CAM_STATUS_MASK;
if (status != CAM_REQ_CMP) {
if (status != CAM_SEL_TIMEOUT)
isp_prt(isp, ISP_LOGDEBUG0,
"target %d lun %jx CAM status 0x%x SCSI status 0x%x",
XS_TGT(sccb), (uintmax_t)XS_LUN(sccb),
sccb->ccb_h.status, sccb->scsi_status);
else if ((IS_FC(isp))
&& (XS_TGT(sccb) < MAX_FC_TARG)) {
fcparam *fcp;
fcp = FCPARAM(isp, XS_CHANNEL(sccb));
fcp->portdb[XS_TGT(sccb)].is_target = 0;
}
if ((sccb->ccb_h.status & CAM_DEV_QFRZN) == 0) {
sccb->ccb_h.status |= CAM_DEV_QFRZN;
xpt_freeze_devq(sccb->ccb_h.path, 1);
}
}
if ((CAM_DEBUGGED(sccb->ccb_h.path, ISPDDB)) && (sccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
xpt_print(sccb->ccb_h.path, "cam completion status 0x%x\n", sccb->ccb_h.status);
if (status != CAM_REQ_CMP &&
(sccb->ccb_h.status & CAM_DEV_QFRZN) == 0) {
sccb->ccb_h.status |= CAM_DEV_QFRZN;
xpt_freeze_devq(sccb->ccb_h.path, 1);
}
if (ISP_PCMD(sccb)) {

View File

@ -225,8 +225,6 @@ struct isp_fc {
simqfrozen : 3,
default_id : 8,
def_role : 2, /* default role */
gdt_running : 1,
loop_dead : 1,
loop_seen_once : 1,
fcbsy : 1,
ready : 1;