Accomodate old style XPT_IMMED_NOTIFY and XPT_NOTIFY_ACK so that

we at least don't panic.

We don't really support dual role mode (INITIATOR/TARGET) any more. We
should but it's broken and will take a fair amount of effort to fix
and correctly manage both initiator and target roles sharing the port
database. So, for now, disallow it.
This commit is contained in:
Matt Jacob 2009-09-15 02:25:03 +00:00
parent 3b208f7ca0
commit ae5db1186f
2 changed files with 43 additions and 27 deletions

View File

@ -2771,21 +2771,15 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
/*
* Make sure we're okay for doing this right now.
*/
if (fcp->isp_loopstate != LOOP_PDB_RCVD &&
fcp->isp_loopstate != LOOP_FSCAN_DONE &&
fcp->isp_loopstate != LOOP_LSCAN_DONE) {
isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: bad loopstate %d",
fcp->isp_loopstate);
if (fcp->isp_loopstate != LOOP_PDB_RCVD && fcp->isp_loopstate != LOOP_FSCAN_DONE && fcp->isp_loopstate != LOOP_LSCAN_DONE) {
isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: bad loopstate %d", fcp->isp_loopstate);
return (-1);
}
if (fcp->isp_topo == TOPO_FL_PORT ||
fcp->isp_topo == TOPO_NL_PORT ||
fcp->isp_topo == TOPO_N_PORT) {
if (fcp->isp_topo == TOPO_FL_PORT || fcp->isp_topo == TOPO_NL_PORT || fcp->isp_topo == TOPO_N_PORT) {
if (fcp->isp_loopstate < LOOP_LSCAN_DONE) {
if (isp_scan_loop(isp, chan) != 0) {
isp_prt(isp, ISP_LOGWARN,
"isp_pdb_sync: isp_scan_loop failed");
isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: isp_scan_loop failed");
return (-1);
}
}
@ -2794,15 +2788,13 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
if (fcp->isp_topo == TOPO_F_PORT || fcp->isp_topo == TOPO_FL_PORT) {
if (fcp->isp_loopstate < LOOP_FSCAN_DONE) {
if (isp_scan_fabric(isp, chan) != 0) {
isp_prt(isp, ISP_LOGWARN,
"isp_pdb_sync: isp_scan_fabric failed");
isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: isp_scan_fabric failed");
return (-1);
}
}
}
isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0,
"Chan %d Synchronizing PDBs", chan);
isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d Synchronizing PDBs", chan);
fcp->isp_loopstate = LOOP_SYNCING_PDB;
@ -2831,11 +2823,7 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
lp->state = FC_PORTDB_STATE_NIL;
isp_async(isp, ISPASYNC_DEV_GONE, chan, lp);
if (lp->autologin == 0) {
(void) isp_plogx(isp, chan, lp->handle,
lp->portid,
PLOGX_FLG_CMD_LOGO |
PLOGX_FLG_IMPLICIT |
PLOGX_FLG_FREE_NPHDL, 0);
(void) isp_plogx(isp, chan, lp->handle, lp->portid, PLOGX_FLG_CMD_LOGO | PLOGX_FLG_IMPLICIT | PLOGX_FLG_FREE_NPHDL, 0);
} else {
lp->autologin = 0;
}
@ -3081,8 +3069,7 @@ isp_scan_loop(ispsoftc_t *isp, int chan)
for (i = 0; i < MAX_FC_TARG; i++) {
lp = &fcp->portdb[i];
if (lp->state == FC_PORTDB_STATE_NIL ||
lp->target_mode) {
if (lp->state == FC_PORTDB_STATE_NIL || lp->target_mode) {
continue;
}
if (lp->node_wwn != tmp.node_wwn) {
@ -3600,8 +3587,7 @@ isp_scan_fabric(ispsoftc_t *isp, int chan)
for (dbidx = 0; dbidx < MAX_FC_TARG; dbidx++) {
lp = &fcp->portdb[dbidx];
if (lp->state != FC_PORTDB_STATE_PROBATIONAL ||
lp->target_mode) {
if (lp->state != FC_PORTDB_STATE_PROBATIONAL || lp->target_mode) {
continue;
}
if (lp->portid == portid) {
@ -3838,8 +3824,7 @@ isp_scan_fabric(ispsoftc_t *isp, int chan)
if (fcp->portdb[dbidx].target_mode) {
continue;
}
if (fcp->portdb[dbidx].node_wwn == wwnn &&
fcp->portdb[dbidx].port_wwn == wwpn) {
if (fcp->portdb[dbidx].node_wwn == wwnn && fcp->portdb[dbidx].port_wwn == wwpn) {
break;
}
}

View File

@ -343,6 +343,17 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int flags, struct thread *td)
break;
}
if (IS_FC(isp)) {
/*
* We don't really support dual role at present on FC cards.
*
* We should, but a bunch of things are currently broken,
* so don't allow it.
*/
if (nr == ISP_ROLE_BOTH) {
isp_prt(isp, ISP_LOGERR, "cannot support dual role at present");
retval = EINVAL;
break;
}
*(int *)addr = FCPARAM(isp, chan)->role;
#ifdef ISP_INTERNAL_TARGET
ISP_LOCK(isp);
@ -2943,8 +2954,8 @@ isp_target_mark_aborted_early(ispsoftc_t *isp, tstate_t *tptr, uint32_t tag_id)
#ifdef ISP_INTERNAL_TARGET
// #define ISP_FORCE_TIMEOUT 1
#define ISP_TEST_WWNS 1
#define ISP_TEST_SEPARATE_STATUS 1
// #define ISP_TEST_WWNS 1
// #define ISP_TEST_SEPARATE_STATUS 1
#define ccb_data_offset ppriv_field0
#define ccb_atio ppriv_ptr1
@ -4238,6 +4249,7 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
isp_disable_lun(isp, ccb);
}
break;
case XPT_IMMED_NOTIFY:
case XPT_IMMEDIATE_NOTIFY: /* Add Immediate Notify Resource */
case XPT_ACCEPT_TARGET_IO: /* Add Accept Target IO Resource */
{
@ -4287,11 +4299,19 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
SLIST_INSERT_HEAD(&tptr->inots, &ccb->ccb_h, sim_links.sle);
ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, ccb->ccb_h.path, "Put FREE INOT, (seq id 0x%x) count now %d\n",
((struct ccb_immediate_notify *)ccb)->seq_id, tptr->inot_count);
} else if (ccb->ccb_h.func_code == XPT_IMMED_NOTIFY) {
tptr->inot_count++;
SLIST_INSERT_HEAD(&tptr->inots, &ccb->ccb_h, sim_links.sle);
ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, ccb->ccb_h.path, "Put FREE INOT, (seq id 0x%x) count now %d\n",
((struct ccb_immediate_notify *)ccb)->seq_id, tptr->inot_count);
}
rls_lun_statep(isp, tptr);
ccb->ccb_h.status = CAM_REQ_INPROG;
break;
}
case XPT_NOTIFY_ACK:
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
break;
case XPT_NOTIFY_ACKNOWLEDGE: /* notify ack */
{
tstate_t *tptr;
@ -4601,10 +4621,21 @@ isp_prt(isp, ISP_LOGALL, "Setting Channel %d wwns to 0x%jx 0x%jx", bus, fcp->isp
}
break;
case KNOB_ROLE_BOTH:
#if 0
if (fcp->role != ISP_ROLE_BOTH) {
rchange = 1;
newrole = ISP_ROLE_BOTH;
}
#else
/*
* We don't really support dual role at present on FC cards.
*
* We should, but a bunch of things are currently broken,
* so don't allow it.
*/
isp_prt(isp, ISP_LOGERR, "cannot support dual role at present");
ccb->ccb_h.status = CAM_REQ_INVALID;
#endif
break;
}
if (rchange) {