From 4313cbd9a0790b663ef30a89a782765d837a1073 Mon Sep 17 00:00:00 2001 From: Alexander Egorenkov Date: Wed, 10 Mar 2010 15:27:18 +0100 Subject: [PATCH] Added statistic counters for cipher errors --- rt2870.c | 25 +++++++++++++++++++++++++ rt2870_softc.h | 4 ++++ 2 files changed, 29 insertions(+) diff --git a/rt2870.c b/rt2870.c index c52b6ec..6fd4375 100644 --- a/rt2870.c +++ b/rt2870.c @@ -4015,6 +4015,8 @@ static void rt2870_rx_frame(struct rt2870_softc *sc, wh->i_fc[1] &= ~IEEE80211_FC1_WEP; m->m_flags |= M_WEP; + + sc->rx_cipher_no_errors++; } else { @@ -4022,6 +4024,13 @@ static void rt2870_rx_frame(struct rt2870_softc *sc, "%s: rxinfo: cipher error=0x%02x\n", device_get_nameunit(sc->dev), cipher_err); + if (cipher_err == RT2870_RXINFO_FLAGS_CIPHER_ERR_ICV) + sc->rx_cipher_icv_errors++; + else if (cipher_err == RT2870_RXINFO_FLAGS_CIPHER_ERR_MIC) + sc->rx_cipher_mic_errors++; + else if (cipher_err == RT2870_RXINFO_FLAGS_CIPHER_ERR_INVALID_KEY) + sc->rx_cipher_invalid_key_errors++; + if ((cipher_err == RT2870_RXINFO_FLAGS_CIPHER_ERR_MIC) && (rxinfo_flags & RT2870_RXINFO_FLAGS_MYBSS)) { @@ -6024,6 +6033,22 @@ static void rt2870_sysctl_attach(struct rt2870_softc *sc) SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "rx_fifo_overflows", CTLFLAG_RD, &sc->rx_fifo_overflows, 0, "Rx FIFO overflows"); + + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_cipher_no_errors", CTLFLAG_RD, &sc->rx_cipher_no_errors, 0, + "Rx cipher no errors"); + + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_cipher_icv_errors", CTLFLAG_RD, &sc->rx_cipher_icv_errors, 0, + "Rx cipher ICV errors"); + + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_cipher_mic_errors", CTLFLAG_RD, &sc->rx_cipher_mic_errors, 0, + "Rx cipher MIC errors"); + + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_cipher_invalid_key_errors", CTLFLAG_RD, &sc->rx_cipher_invalid_key_errors, 0, + "Rx cipher invalid key errors"); } static device_method_t rt2870_dev_methods[] = diff --git a/rt2870_softc.h b/rt2870_softc.h index b60319f..448d421 100644 --- a/rt2870_softc.h +++ b/rt2870_softc.h @@ -352,6 +352,10 @@ struct rt2870_softc unsigned long rx_plcp_errors; unsigned long rx_dup_packets; unsigned long rx_fifo_overflows; + unsigned long rx_cipher_no_errors; + unsigned long rx_cipher_icv_errors; + unsigned long rx_cipher_mic_errors; + unsigned long rx_cipher_invalid_key_errors; #ifdef RT2870_DEBUG int debug; -- 2.11.4.GIT