From owner-p4-projects@FreeBSD.ORG Mon Aug 28 04:34:45 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 49B1E16A4DF; Mon, 28 Aug 2006 04:34:45 +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 E8B2116A4DA for ; Mon, 28 Aug 2006 04:34:44 +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 9CEF243D49 for ; Mon, 28 Aug 2006 04:34:44 +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 k7S4Yimw050572 for ; Mon, 28 Aug 2006 04:34:44 GMT (envelope-from mjacob@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7S4YiJa050569 for perforce@freebsd.org; Mon, 28 Aug 2006 04:34:44 GMT (envelope-from mjacob@freebsd.org) Date: Mon, 28 Aug 2006 04:34:44 GMT Message-Id: <200608280434.k7S4YiJa050569@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 105206 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: Mon, 28 Aug 2006 04:34:45 -0000 http://perforce.freebsd.org/chv.cgi?CH=105206 Change 105206 by mjacob@newisp on 2006/08/28 04:34:23 Remove some debugging code that kept us from using ZIO mode. Add some more debugging in. Fix a weird botch in usage of '% 4d' in formats. Fix isp_mark_portdb to leave things probational for CHANGED, PENDING_VALID, VALID and PROBATIONAL entries, but to clear to NIL all other entries. This makes sure that 'new' entries that we start to evaluate get reset if we have to restart port database evaluations again. Clean out 'new_roles' and 'new_portid' entries in isp_pdb_sync. Check to make sure that when we are scanning a loop and we get a successful return from isp_get_pdb that the port database entry makes sense. The QLogic 2400 will return success and the PortID (AL_PA, actually) of 'old' entries, but will have null WWPN and WWNN and role entries. Make sure we log out of fabric devices before we log back into them again- it's just a lot cleaner and breaks stale associations. Try some more attempts to figure out what happened to interrupts for the 24XX- that's really the last big problem. Affected files ... .. //depot/projects/newisp/dev/isp/isp.c#3 edit Differences ... ==== //depot/projects/newisp/dev/isp/isp.c#3 (text+ko) ==== @@ -67,9 +67,6 @@ static const char fconf[] = "portdb[%d] confusion: 0x%x,0x%x 0x%x,0x%x, 0x%08x%08x/0x%08x%08x, " "0x%08x%08x/0x%08x%08x"; -static const char dbe[] = - "% 4d: state %d al %d tgt %d role 0x%x PortID 0x%06x nr %x np 0x%06x " - "WWNN 0x%08x%08x WWPN 0x%08x%08x"; static const char notresp[] = "Not RESPONSE in RESPONSE Queue (type 0x%x) @ idx %d (next %d) nlooked %d"; static const char xact1[] = @@ -1874,11 +1871,10 @@ break; } -#if 0 switch (icbp->icb_fwoptions2 & ICB2400_OPT2_TIMER_MASK) { case ICB2400_OPT2_ZIO: case ICB2400_OPT2_ZIO1: - icbp->icb_idelaytimer = 10; + icbp->icb_idelaytimer = 0; break; case 0: break; @@ -1888,9 +1884,6 @@ icbp->icb_fwoptions2 &= ~ICB2400_OPT2_TIMER_MASK; break; } -#else - icbp->icb_fwoptions2 &= ~ICB2400_OPT2_TIMER_MASK; -#endif icbp->icb_fwoptions3 = fcp->isp_zfwoptions; icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_AUTO; @@ -1955,7 +1948,7 @@ icbp->icb_respaddr[RQRSP_ADDR3247] = DMA_WD2(isp->isp_result_dma); icbp->icb_respaddr[RQRSP_ADDR4863] = DMA_WD3(isp->isp_result_dma); - isp_prt(isp, ISP_LOGDEBUG0, + isp_prt(isp, /* ISP_LOGDEBUG0 */ ISP_LOGALL, "isp_fibre_init_2400: fwopt1 0x%x fwopt2 0x%x fwopt3 0x%x", icbp->icb_fwoptions1, icbp->icb_fwoptions2, icbp->icb_fwoptions3); isp_prt(isp, ISP_LOGDEBUG0, @@ -2047,7 +2040,9 @@ if (lp->state == FC_PORTDB_STATE_NIL) { continue; } - isp_prt(isp, ISP_LOGALL, dbe, i, lp->state, lp->autologin, + isp_prt(isp, ISP_LOGALL, "%d: state %d al %d tgt %d role 0x%x" + " PortID 0x%06x nr %x np 0x%06x WWNN 0x%08x%08x WWPN " + "0x%08x%08x", i, lp->state, lp->autologin, ((int) lp->ini_map_idx) - 1, lp->roles, lp->portid, lp->new_roles, lp->new_portid, (uint32_t) (lp->node_wwn >> 32), @@ -2067,8 +2062,22 @@ fcp->isp_ini_map[i] = 0; if (onprobation == 0) { MEMZERO(&fcp->portdb[i], sizeof (fcportdb_t)); - } else if (fcp->portdb[i].state != FC_PORTDB_STATE_NIL) { - fcp->portdb[i].state = FC_PORTDB_STATE_PROBATIONAL; + } else { + switch (fcp->portdb[i].state) { + case FC_PORTDB_STATE_CHANGED: + case FC_PORTDB_STATE_PENDING_VALID: + case FC_PORTDB_STATE_VALID: + case FC_PORTDB_STATE_PROBATIONAL: + fcp->portdb[i].state = + FC_PORTDB_STATE_PROBATIONAL; + break; + case FC_PORTDB_STATE_NIL: + default: + MEMZERO(&fcp->portdb[i], sizeof (fcportdb_t)); + fcp->portdb[i].state = + FC_PORTDB_STATE_NIL; + break; + } } } } @@ -2237,7 +2246,7 @@ break; case MBOX_LOOP_ID_USED: - isp_prt(isp, ISP_LOGERR, + isp_prt(isp, ISP_LOGDEBUG0, "isp_port_login: handle %u in use for port id 0x%02xXXXX", handle, mbs.param[1] & 0xff); return (MBOX_LOOP_ID_USED); @@ -2694,6 +2703,8 @@ } else { lp->autologin = 0; } + lp->new_roles = 0; + lp->new_portid = 0; break; case FC_PORTDB_STATE_NEW: /* @@ -2725,6 +2736,8 @@ } } isp_async(isp, ISPASYNC_DEV_ARRIVED, lp); + lp->new_roles = 0; + lp->new_portid = 0; break; case FC_PORTDB_STATE_CHANGED: lp->portid = lp->new_portid; @@ -2735,6 +2748,8 @@ fcp->isp_ini_map[t] = dbidx + 1; } isp_async(isp, ISPASYNC_DEV_CHANGED, lp); + lp->new_roles = 0; + lp->new_portid = 0; break; case FC_PORTDB_STATE_PENDING_VALID: lp->portid = lp->new_portid; @@ -2745,6 +2760,8 @@ fcp->isp_ini_map[t] = dbidx + 1; } isp_async(isp, ISPASYNC_DEV_STAYED, lp); + lp->new_roles = 0; + lp->new_portid = 0; break; } } @@ -2828,6 +2845,7 @@ */ if (isp_getpdb(isp, dbidx, &pdb, 1) != 0) { if (fcp->isp_loopstate < LOOP_SCANNING_LOOP) { + isp_mark_portdb(isp, 1); return (-1); } continue; @@ -2847,6 +2865,7 @@ if (IS_2100(isp) && pdb.handle != dbidx) { isp_prt(isp, ISP_LOGWARN, "giving up on synchronizing the port database"); + isp_mark_portdb(isp, 1); return (-1); } @@ -2860,6 +2879,18 @@ tmp.handle = pdb.handle; /* + * Check to make sure it's still a valid entry. The 24XX seems + * to return a portid but not a WWPN/WWNN or role for devices + * which shift on a loop. + */ + if (tmp.node_wwn == 0 || tmp.port_wwn == 0 || tmp.portid == 0) { + isp_prt(isp, ISP_LOGWARN, + "bad pdb entry at loop %d", dbidx); + isp_dump_portdb(isp); + continue; + } + + /* * Now search the entire port database * for the same Port and Node WWN. Start * from where we currently are at and @@ -2888,7 +2919,7 @@ } /* - * Okay- we've found an old entry. + * Okay- we've found a non-nil entry that matches. * Check to make sure it's probational. */ if (lp->state != FC_PORTDB_STATE_PROBATIONAL) { @@ -2962,6 +2993,8 @@ lp->autologin = 1; lp->state = FC_PORTDB_STATE_NEW; + lp->portid = 0; + lp->roles = 0; lp->new_portid = tmp.portid; lp->new_roles = tmp.roles; lp->handle = tmp.handle; @@ -3472,6 +3505,20 @@ } /* + * Try and log out of the device first. + */ + if (IS_24XX(isp)) { + logval = 0; + isp_plogx_24xx(isp, handle, portid, &logval); + } else { + isp_port_logout(isp, handle, portid); + } + if (fcp->isp_loopstate != LOOP_SCANNING_FABRIC) { + FC_SCRATCH_RELEASE(isp); + isp_mark_portdb(isp, 1); + return (-1); + } + /* * Try and log into the device. */ if (IS_24XX(isp)) { @@ -3482,6 +3529,7 @@ } if (fcp->isp_loopstate != LOOP_SCANNING_FABRIC) { FC_SCRATCH_RELEASE(isp); + isp_mark_portdb(isp, 1); return (-1); } if (logval == 0) { @@ -3524,8 +3572,9 @@ if (pdb.handle != handle || pdb.portid != portid) { isp_prt(isp, ISP_LOGERR, "newly logged in device changed already"); -isp_prt(isp, ISP_LOGALL, "handle %x portid %x pdb.handle %x pdb.portid %x", -handle, portid, pdb.handle, pdb.portid); + isp_prt(isp, ISP_LOGERR, + "handle %x portid %x pdb.handle %x pdb.portid %x", + handle, portid, pdb.handle, pdb.portid); if (IS_24XX(isp)) { isp_plogx_24xx(isp, pdb.handle, pdb.portid, NULL); @@ -3705,6 +3754,8 @@ } i = fcp->isp_ini_map[XS_TGT(xs)]; + isp_prt(isp, ISP_LOGDEBUG1, "XS_TGT(xs)=%d- handle value %d", + XS_TGT(xs), i); if (i < 1 || i >= MAX_FC_TARG) { XS_SETERR(xs, HBA_SELTIMEOUT); return (CMD_COMPLETE); @@ -3894,6 +3945,9 @@ (long) XS_XFRLEN(xs)); ISP_ADD_REQUEST(isp, nxti); isp->isp_nactive++; + if (IS_24XX(isp) || IS_23XX(isp)) { + isp_intr(isp, 0, 0, 0); + } return (CMD_QUEUED); } @@ -4341,7 +4395,7 @@ MEMZERO(hp, QENTRY_LEN); /* PERF */ continue; } else if (etype == RQSTYPE_MARKER) { -isp_prt(isp, ISP_LOGALL, "MARKER"); + isp_prt(isp, ISP_LOGDEBUG0, "MARKER"); MEMZERO(hp, QENTRY_LEN); /* PERF */ continue; } else {