From owner-p4-projects@FreeBSD.ORG Fri Nov 7 18:24:34 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 36C8E106567B; Fri, 7 Nov 2008 18:24:34 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF2101065679 for ; Fri, 7 Nov 2008 18:24:33 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id DE3588FC0A for ; Fri, 7 Nov 2008 18:24:33 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mA7IOX3p016880 for ; Fri, 7 Nov 2008 18:24:33 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mA7IOXfw016878 for perforce@freebsd.org; Fri, 7 Nov 2008 18:24:33 GMT (envelope-from sam@freebsd.org) Date: Fri, 7 Nov 2008 18:24:33 GMT Message-Id: <200811071824.mA7IOXfw016878@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 152627 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: Fri, 07 Nov 2008 18:24:34 -0000 http://perforce.freebsd.org/chv.cgi?CH=152627 Change 152627 by sam@sam_ebb on 2008/11/07 18:23:37 sowl parts have "issues"; first crack at dealing with them (still have other unresolved bb hangs that could be misprogramming) Affected files ... .. //depot/projects/vap/sys/dev/ath/if_ath.c#120 edit Differences ... ==== //depot/projects/vap/sys/dev/ath/if_ath.c#120 (text+ko) ==== @@ -1293,7 +1293,8 @@ static void ath_bmiss_vap(struct ieee80211vap *vap) { - struct ath_softc *sc = vap->iv_ic->ic_ifp->if_softc; + struct ifnet *ifp = vap->iv_ic->ic_ifp; + struct ath_softc *sc = ifp->if_softc; u_int64_t lastrx = sc->sc_lastrx; u_int64_t tsf = ath_hal_gettsf64(sc->sc_ah); u_int bmisstimeout = @@ -1317,14 +1318,33 @@ sc->sc_stats.ast_bmiss_phantom++; } +static int +ath_hal_gethangstate(struct ath_hal *ah, uint32_t mask, uint32_t *hangs) +{ + uint32_t rsize; + void *sp; + + if (!ath_hal_getdiagstate(ah, 32, &mask, sizeof(&mask), &sp, &rsize)) + return 0; + KASSERT(rsize == sizeof(uint32_t), ("resultsize %u", rsize)); + *hangs = *(uint32_t *)sp; + return 1; +} + static void ath_bmiss_proc(void *arg, int pending) { struct ath_softc *sc = arg; struct ifnet *ifp = sc->sc_ifp; + uint32_t hangs; DPRINTF(sc, ATH_DEBUG_ANY, "%s: pending %u\n", __func__, pending); - ieee80211_beacon_miss(ifp->if_l2com); + + if (ath_hal_gethangstate(sc->sc_ah, 0xff, &hangs) && hangs != 0) { + if_printf(ifp, "bb hang detected (0x%x), reseting\n", hangs); + ath_reset(ifp); + } else + ieee80211_beacon_miss(ifp->if_l2com); } /* @@ -5534,6 +5554,7 @@ { struct ath_softc *sc = arg; struct ath_hal *ah = sc->sc_ah; + struct ifnet *ifp = sc->sc_ifp; HAL_BOOL iqCalDone; sc->sc_stats.ast_per_cal++; @@ -5546,7 +5567,7 @@ DPRINTF(sc, ATH_DEBUG_CALIBRATE, "%s: rfgain change\n", __func__); sc->sc_stats.ast_per_rfgain++; - ath_reset(sc->sc_ifp); + ath_reset(ifp); } if (!ath_hal_calibrate(ah, &sc->sc_curchan, &iqCalDone)) { DPRINTF(sc, ATH_DEBUG_ANY, @@ -6347,7 +6368,14 @@ struct ath_softc *sc = ifp->if_softc; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && !sc->sc_invalid) { - if_printf(ifp, "device timeout\n"); + uint32_t hangs; + + if (ath_hal_gethangstate(sc->sc_ah, 0xffff, &hangs) && + hangs != 0) { + if_printf(ifp, "%s hang detected (0x%x)\n", + hangs & 0xff ? "bb" : "mac", hangs); + } else + if_printf(ifp, "device timeout\n"); ath_reset(ifp); ifp->if_oerrors++; sc->sc_stats.ast_watchdog++;