mirror of
https://github.com/opnsense/src.git
synced 2026-03-14 06:35:31 -04:00
This is an MFC of 205236
Put gone device timer into a structure tag that can hold more than 32 seconds. Oops. Untangle some of the confusion about what role means when it's in the FCPARAM/SDPARAM or isp_fc/isp_spi structures. This fixed a problem about seeing targets appear if you've turned off autologin and find them, or rather don't, via camcontrol rescan.
This commit is contained in:
parent
47fd5bf73a
commit
fbcd5da22b
4 changed files with 24 additions and 17 deletions
|
|
@ -3945,11 +3945,15 @@ isp_gdt(void *arg)
|
|||
if (lp->dev_map_idx == 0 || lp->target_mode) {
|
||||
continue;
|
||||
}
|
||||
if (lp->new_reserved == 0) {
|
||||
/*
|
||||
* We can use new_portid here because it is untouched
|
||||
* while the state is ZOMBIE
|
||||
*/
|
||||
if (lp->new_portid == 0) {
|
||||
continue;
|
||||
}
|
||||
lp->new_reserved -= 1;
|
||||
if (lp->new_reserved != 0) {
|
||||
lp->new_portid -= 1;
|
||||
if (lp->new_portid != 0) {
|
||||
more_to_do++;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -4059,7 +4063,7 @@ isp_kthread(void *arg)
|
|||
*
|
||||
* If not, we simply just wait for loop to come up.
|
||||
*/
|
||||
if (lb && (fc->role & ISP_ROLE_INITIATOR)) {
|
||||
if (lb && (FCPARAM(isp, chan)->role & ISP_ROLE_INITIATOR)) {
|
||||
/*
|
||||
* Increment loop down time by the last sleep interval
|
||||
*/
|
||||
|
|
@ -4927,7 +4931,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
|
|||
/*
|
||||
* We don't do any simq freezing if we are only in target mode
|
||||
*/
|
||||
if (fc->role & ISP_ROLE_INITIATOR) {
|
||||
if (FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) {
|
||||
if (fc->path) {
|
||||
isp_freeze_loopdown(isp, bus, msg);
|
||||
}
|
||||
|
|
@ -4963,7 +4967,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
|
|||
va_end(ap);
|
||||
fc = ISP_FC_PC(isp, bus);
|
||||
lp->reserved = 0;
|
||||
if ((fc->role & ISP_ROLE_INITIATOR) && (lp->roles & (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT))) {
|
||||
if ((FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) && (lp->roles & (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT))) {
|
||||
int dbidx = lp - FCPARAM(isp, bus)->portdb;
|
||||
int i;
|
||||
|
||||
|
|
@ -5051,10 +5055,13 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
|
|||
*
|
||||
* If it isn't marked that isp_gdt is going to get rid of it,
|
||||
* announce that it's gone.
|
||||
*
|
||||
* We can use new_portid for the gone timer because it's
|
||||
* undefined while the state is ZOMBIE.
|
||||
*/
|
||||
if (lp->dev_map_idx && lp->reserved == 0) {
|
||||
lp->reserved = 1;
|
||||
lp->new_reserved = ISP_FC_PC(isp, bus)->gone_device_time;
|
||||
lp->new_portid = ISP_FC_PC(isp, bus)->gone_device_time;
|
||||
lp->state = FC_PORTDB_STATE_ZOMBIE;
|
||||
if (fc->ready && !callout_active(&fc->gdt)) {
|
||||
isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d starting Gone Device Timer", bus);
|
||||
|
|
@ -5101,7 +5108,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
|
|||
callout_stop(&fc->ldt);
|
||||
}
|
||||
isp_prt(isp, ISP_LOGINFO, msg, bus);
|
||||
if (fc->role & ISP_ROLE_INITIATOR) {
|
||||
if (FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) {
|
||||
isp_freeze_loopdown(isp, bus, msg);
|
||||
}
|
||||
wakeup(fc);
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ struct isp_fc {
|
|||
simqfrozen : 3,
|
||||
default_id : 8,
|
||||
hysteresis : 8,
|
||||
role : 2,
|
||||
def_role : 2, /* default role */
|
||||
gdt_running : 1,
|
||||
loop_dead : 1,
|
||||
fcbsy : 1,
|
||||
|
|
@ -203,7 +203,7 @@ struct isp_spi {
|
|||
tm_enabled : 1,
|
||||
#endif
|
||||
simqfrozen : 3,
|
||||
role : 3,
|
||||
def_role : 2,
|
||||
iid : 4;
|
||||
#ifdef ISP_TARGET_MODE
|
||||
struct tslist lun_hash[LUN_HASH_SIZE];
|
||||
|
|
@ -469,12 +469,12 @@ default: \
|
|||
#define DEFAULT_EXEC_THROTTLE(isp) isp->isp_osinfo.exec_throttle
|
||||
|
||||
#define GET_DEFAULT_ROLE(isp, chan) \
|
||||
(IS_FC(isp)? ISP_FC_PC(isp, chan)->role : ISP_SPI_PC(isp, chan)->role)
|
||||
(IS_FC(isp)? ISP_FC_PC(isp, chan)->def_role : ISP_SPI_PC(isp, chan)->def_role)
|
||||
#define SET_DEFAULT_ROLE(isp, chan, val) \
|
||||
if (IS_FC(isp)) { \
|
||||
ISP_FC_PC(isp, chan)->role = val; \
|
||||
ISP_FC_PC(isp, chan)->def_role = val; \
|
||||
} else { \
|
||||
ISP_SPI_PC(isp, chan)->role = val; \
|
||||
ISP_SPI_PC(isp, chan)->def_role = val; \
|
||||
}
|
||||
|
||||
#define DEFAULT_IID(isp, chan) isp->isp_osinfo.pc.spi[chan].iid
|
||||
|
|
|
|||
|
|
@ -547,10 +547,10 @@ isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp)
|
|||
}
|
||||
|
||||
if (IS_SCSI(isp)) {
|
||||
ISP_SPI_PC(isp, chan)->role = tval;
|
||||
ISP_SPI_PC(isp, chan)->def_role = tval;
|
||||
return;
|
||||
}
|
||||
ISP_FC_PC(isp, chan)->role = tval;
|
||||
ISP_FC_PC(isp, chan)->def_role = tval;
|
||||
|
||||
tval = 0;
|
||||
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "fullduplex", &tval) == 0 && tval != 0) {
|
||||
|
|
@ -833,7 +833,7 @@ isp_pci_attach(device_t dev)
|
|||
* The 'it' suffix really only matters for SCSI cards in target mode.
|
||||
*/
|
||||
isp->isp_osinfo.fw = NULL;
|
||||
if (IS_SCSI(isp) && (ISP_SPI_PC(isp, 0)->role & ISP_ROLE_TARGET)) {
|
||||
if (IS_SCSI(isp) && (ISP_SPI_PC(isp, 0)->def_role & ISP_ROLE_TARGET)) {
|
||||
snprintf(fwname, sizeof (fwname), "isp_%04x_it", did);
|
||||
isp->isp_osinfo.fw = firmware_get(fwname);
|
||||
} else if (IS_24XX(isp) && (isp->isp_nchan > 1 || isp->isp_osinfo.forcemulti)) {
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ isp_sbus_attach(device_t dev)
|
|||
isp->isp_revision = 0; /* XXX */
|
||||
isp->isp_dev = dev;
|
||||
isp->isp_nchan = 1;
|
||||
ISP_SET_PC(isp, 0, role, role);
|
||||
ISP_SET_PC(isp, 0, def_role, role);
|
||||
|
||||
/*
|
||||
* Get the clock frequency and convert it from HZ to MHz,
|
||||
|
|
|
|||
Loading…
Reference in a new issue