Date: Sat, 16 Sep 2006 20:12:29 GMT From: Matt Jacob <mjacob@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 106221 for review Message-ID: <200609162012.k8GKCT9Z093147@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=106221 Change 106221 by mjacob@newisp on 2006/09/16 20:12:26 Add a slightly tighter interpretation of 'loop down' such that we have a 'quick boot' time limit (loop down count when we're booting) and a 'running' time limit (loop down count when we've seen loop up once). Affected files ... .. //depot/projects/newisp/dev/isp/isp_freebsd.c#7 edit .. //depot/projects/newisp/dev/isp/isp_freebsd.h#5 edit .. //depot/projects/newisp/dev/isp/isp_library.c#6 edit Differences ... ==== //depot/projects/newisp/dev/isp/isp_freebsd.c#7 (text+ko) ==== @@ -45,6 +45,7 @@ int isp_announced = 0; int isp_fabric_hysteresis = 5; int isp_loop_down_limit = 300; /* default loop down limit */ +int isp_quickboot_time = 5; /* don't wait more than N secs for loop up */ static d_ioctl_t ispioctl; static void isp_intr_enable(void *); @@ -2083,12 +2084,33 @@ isp_prt(isp, ISP_LOGDEBUG0, "kthread: checking FC state"); lb = isp_fc_runstate(isp, 250000); - isp->isp_osinfo.ktmature = 1; if (lb) { unsigned int inc = 1; - isp_prt(isp, ISP_LOGDEBUG0, "kthread: FC state %d", lb); - if (isp->isp_osinfo.loop_down_time > 30) { + if (lb < 0) { + isp_prt(isp, ISP_LOGDEBUG0, + "kthread: FC loop not up (down count %d)", + isp->isp_osinfo.loop_down_time); + } else { + isp_prt(isp, ISP_LOGDEBUG0, + "kthread: FC got to %d (down count %d)", + lb, isp->isp_osinfo.loop_down_time); + } + + + /* + * If we've never seen loop up and we've waited longer + * than quickboot time, give up and go to sleep until + * loop comes up. Otherwise, increment the loop down + * time and figure out how long to sleep to the next + * check. + */ + if (FCPARAM(isp)->loop_seen_once == 0 && + isp->isp_osinfo.loop_down_time >= + isp_quickboot_time) { + isp->isp_osinfo.loop_down_time = 0xffff; + slp = 0; + } else if (isp->isp_osinfo.loop_down_time > 30) { inc = 30; slp = 30 * hz; } else if (isp->isp_osinfo.loop_down_time > 1) { @@ -2235,14 +2257,10 @@ */ KASSERT((IS_FC(isp)), ("CMD_RQLATER for FC only")); /* - * If we've never seen loop up and we've at least - * looked once, just fail these commands. Also, - * if we've exceeded the loop down limit- fail them - * as well. + * If we've exceeded the loop down limit start + * failing commands. */ - if ((FCPARAM(isp)->loop_seen_once == 0 && - isp->isp_osinfo.ktmature) || - isp->isp_osinfo.loop_down_time > + if (isp->isp_osinfo.loop_down_time > isp->isp_osinfo.loop_down_limit) { ISPLOCK_2_CAMLOCK(isp); XS_SETERR(ccb, CAM_SEL_TIMEOUT); ==== //depot/projects/newisp/dev/isp/isp_freebsd.h#5 (text+ko) ==== @@ -156,7 +156,7 @@ hysteresis : 8, disabled : 1, fcbsy : 1, - ktmature : 1, + : 1, mboxwaiting : 1, intsok : 1, simqfrozen : 3; @@ -433,6 +433,7 @@ extern int isp_announced; extern int isp_fabric_hysteresis; extern int isp_loop_down_limit; +extern int isp_quickboot_time; /* * Platform private flags ==== //depot/projects/newisp/dev/isp/isp_library.c#6 (text) ==== @@ -193,10 +193,6 @@ fcparam *fcp; int *tptr; - if (IS_SCSI(isp)) { - isp_prt(isp, ISP_LOGERR, "isp_fc_runstate for SCSI card?"); - return (-1); - } fcp = FCPARAM(isp); tptr = &tval; if (fcp->isp_fwstate < FW_READY || @@ -215,16 +211,16 @@ } if (isp_control(isp, ISPCTL_SCAN_LOOP, NULL) != 0) { isp_prt(isp, ISP_LOGINFO, "isp_fc_runstate: scan loop fails"); - return (-1); + return (LOOP_PDB_RCVD); } if (isp_control(isp, ISPCTL_SCAN_FABRIC, NULL) != 0) { isp_prt(isp, ISP_LOGINFO, "isp_fc_runstate: scan fabric fails"); - return (-1); + return (LOOP_LSCAN_DONE); } if (isp_control(isp, ISPCTL_PDB_SYNC, NULL) != 0) { isp_prt(isp, ISP_LOGINFO, "isp_fc_runstate: pdb_sync fails"); - return (-1); + return (LOOP_FSCAN_DONE); } if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate != LOOP_READY) { isp_prt(isp, ISP_LOGINFO,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609162012.k8GKCT9Z093147>