From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 18:34:28 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1508A106564A; Sun, 30 Nov 2008 18:34:28 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 057B78FC16; Sun, 30 Nov 2008 18:34:28 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAUIYRo3098222; Sun, 30 Nov 2008 18:34:27 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUIYR0V098220; Sun, 30 Nov 2008 18:34:27 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811301834.mAUIYR0V098220@svn.freebsd.org> From: Sam Leffler Date: Sun, 30 Nov 2008 18:34:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185480 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Nov 2008 18:34:28 -0000 Author: sam Date: Sun Nov 30 18:34:27 2008 New Revision: 185480 URL: http://svn.freebsd.org/changeset/base/185480 Log: some of the 11n parts can hang under certain conditions without necessary workarounds, add code to detect these hangs and distinguish them from other events; note this code is only invoked for anomalous conditions and (at the moment) is a noop because the hang detection code is in a new hal that's coming shortly Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sun Nov 30 18:27:10 2008 (r185479) +++ head/sys/dev/ath/if_ath.c Sun Nov 30 18:34:27 2008 (r185480) @@ -1290,14 +1290,33 @@ ath_bmiss_vap(struct ieee80211vap *vap) 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); } /* @@ -6324,7 +6343,14 @@ ath_watchdog(struct ifnet *ifp) 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++;