From owner-svn-src-head@FreeBSD.ORG Tue Apr 10 07:23:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0D886106566C; Tue, 10 Apr 2012 07:23:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED3C18FC08; Tue, 10 Apr 2012 07:23:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3A7Nb4e009407; Tue, 10 Apr 2012 07:23:37 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3A7NbA4009402; Tue, 10 Apr 2012 07:23:37 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201204100723.q3A7NbA4009402@svn.freebsd.org> From: Adrian Chadd Date: Tue, 10 Apr 2012 07:23:37 +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: r234090 - 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: Tue, 10 Apr 2012 07:23:38 -0000 Author: adrian Date: Tue Apr 10 07:23:37 2012 New Revision: 234090 URL: http://svn.freebsd.org/changeset/base/234090 Log: Squirrel away SYNC interrupt debugging if it's enabled in the HAL. Bus errors will show up as various SYNC interrupts which will be passed back up to ath_intr(). Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_sysctl.c head/sys/dev/ath/if_athioctl.h head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Tue Apr 10 07:16:28 2012 (r234089) +++ head/sys/dev/ath/if_ath.c Tue Apr 10 07:23:37 2012 (r234090) @@ -1495,6 +1495,15 @@ ath_intr(void *arg) ah->ah_intrstate[3], ah->ah_intrstate[6]); #endif + + /* Squirrel away SYNC interrupt debugging */ + if (ah->ah_syncstate != 0) { + int i; + for (i = 0; i < 32; i++) + if (ah->ah_syncstate & (i << i)) + sc->sc_intr_stats.sync_intr[i]++; + } + status &= sc->sc_imask; /* discard unasked for bits */ /* Short-circuit un-handled interrupts */ @@ -6476,8 +6485,11 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, ifr->ifr_data, sizeof (sc->sc_stats)); case SIOCZATHSTATS: error = priv_check(curthread, PRIV_DRIVER); - if (error == 0) + if (error == 0) { memset(&sc->sc_stats, 0, sizeof(sc->sc_stats)); + memset(&sc->sc_intr_stats, 0, + sizeof(sc->sc_intr_stats)); + } break; #ifdef ATH_DIAGAPI case SIOCGATHDIAG: Modified: head/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- head/sys/dev/ath/if_ath_sysctl.c Tue Apr 10 07:16:28 2012 (r234089) +++ head/sys/dev/ath/if_ath_sysctl.c Tue Apr 10 07:23:37 2012 (r234090) @@ -655,6 +655,7 @@ ath_sysctl_clearstats(SYSCTL_HANDLER_ARG return 0; /* Not clearing the stats is still valid */ memset(&sc->sc_stats, 0, sizeof(sc->sc_stats)); memset(&sc->sc_aggr_stats, 0, sizeof(sc->sc_aggr_stats)); + memset(&sc->sc_intr_stats, 0, sizeof(sc->sc_intr_stats)); val = 0; return 0; @@ -677,6 +678,26 @@ ath_sysctl_stats_attach_rxphyerr(struct } } +static void +ath_sysctl_stats_attach_intr(struct ath_softc *sc, + struct sysctl_oid_list *parent) +{ + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev); + struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev); + struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree); + int i; + char sn[8]; + + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "sync_intr", + CTLFLAG_RD, NULL, "Sync interrupt statistics"); + child = SYSCTL_CHILDREN(tree); + for (i = 0; i < 32; i++) { + snprintf(sn, sizeof(sn), "%d", i); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, sn, CTLFLAG_RD, + &sc->sc_intr_stats.sync_intr[i], 0, ""); + } +} + void ath_sysctl_stats_attach(struct ath_softc *sc) { @@ -904,6 +925,9 @@ ath_sysctl_stats_attach(struct ath_softc /* Attach the RX phy error array */ ath_sysctl_stats_attach_rxphyerr(sc, child); + + /* Attach the interrupt statistics array */ + ath_sysctl_stats_attach_intr(sc, child); } /* Modified: head/sys/dev/ath/if_athioctl.h ============================================================================== --- head/sys/dev/ath/if_athioctl.h Tue Apr 10 07:16:28 2012 (r234089) +++ head/sys/dev/ath/if_athioctl.h Tue Apr 10 07:23:37 2012 (r234090) @@ -46,6 +46,10 @@ struct ath_tx_aggr_stats { u_int32_t aggr_rts_aggr_limited; }; +struct ath_intr_stats { + u_int32_t sync_intr[32]; +}; + struct ath_stats { u_int32_t ast_watchdog; /* device reset by watchdog */ u_int32_t ast_hardware; /* fatal hardware error interrupts */ Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Tue Apr 10 07:16:28 2012 (r234089) +++ head/sys/dev/ath/if_athvar.h Tue Apr 10 07:23:37 2012 (r234090) @@ -349,6 +349,7 @@ struct ath_softc { struct ifnet *sc_ifp; /* interface common */ struct ath_stats sc_stats; /* interface statistics */ struct ath_tx_aggr_stats sc_aggr_stats; + struct ath_intr_stats sc_intr_stats; int sc_debug; int sc_nvaps; /* # vaps */ int sc_nstavaps; /* # station vaps */