From ec165c61b1ce3504de4d2f8596d89a7769095e39 Mon Sep 17 00:00:00 2001 From: Adrian Chadd <adrian@FreeBSD.org> Date: Mon, 7 Feb 2011 15:09:13 +0000 Subject: [PATCH] Add in a per phy error sysctl. --- sys/dev/ath/if_ath.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index cb651aefc7d7..eb0d27c3b752 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -6332,6 +6332,23 @@ ath_sysctl_clearstats(SYSCTL_HANDLER_ARGS) return 0; } +static void +ath_sysctl_stats_attach_rxphyerr(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, "rx_phy_err", CTLFLAG_RD, NULL, "Per-code RX PHY Errors"); + 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_stats.ast_rx_phy[i], 0, ""); + } +} + static void ath_sysctl_stats_attach(struct ath_softc *sc) { @@ -6503,4 +6520,7 @@ ath_sysctl_stats_attach(struct ath_softc *sc) &sc->sc_stats.ast_ani_cal, 0, "number of ANI polls"); SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_agg", CTLFLAG_RD, &sc->sc_stats.ast_rx_agg, 0, "number of aggregate frames received"); + + /* Attach the RX phy error array */ + ath_sysctl_stats_attach_rxphyerr(sc, child); }