From owner-p4-projects@FreeBSD.ORG Sat Sep 16 20:12:34 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1C10216A4B3; Sat, 16 Sep 2006 20:12:34 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C28B116A47E for ; Sat, 16 Sep 2006 20:12:33 +0000 (UTC) (envelope-from mjacob@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0A6FE43D5C for ; Sat, 16 Sep 2006 20:12:29 +0000 (GMT) (envelope-from mjacob@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k8GKCT40093150 for ; Sat, 16 Sep 2006 20:12:29 GMT (envelope-from mjacob@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k8GKCT9Z093147 for perforce@freebsd.org; Sat, 16 Sep 2006 20:12:29 GMT (envelope-from mjacob@freebsd.org) Date: Sat, 16 Sep 2006 20:12:29 GMT Message-Id: <200609162012.k8GKCT9Z093147@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mjacob@freebsd.org using -f From: Matt Jacob To: Perforce Change Reviews Cc: Subject: PERFORCE change 106221 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2006 20:12:34 -0000 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,