From 97148fdad2422bec93acb13d69b05c03efce0ac0 Mon Sep 17 00:00:00 2001 From: Alexander Egorenkov Date: Sat, 13 Feb 2010 18:32:08 +0100 Subject: [PATCH] Added statistic counters for Tx data queue full --- rt2870.c | 41 +++++++++++++++++++++++++++++++++++++++++ rt2870_softc.h | 2 ++ 2 files changed, 43 insertions(+) diff --git a/rt2870.c b/rt2870.c index 52ef647..74b165f 100644 --- a/rt2870.c +++ b/rt2870.c @@ -1576,8 +1576,12 @@ static void rt2870_start(struct ifnet *ifp) m_freem(m); ieee80211_free_node(ni); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; ifp->if_oerrors++; + + sc->tx_data_queue_full[qid]++; + break; } @@ -2420,8 +2424,10 @@ static int rt2870_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { RT2870_SOFTC_UNLOCK(sc); + m_freem(m); ieee80211_free_node(ni); + return ENETDOWN; } @@ -2432,17 +2438,25 @@ static int rt2870_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, device_get_nameunit(sc->dev), sc->tx_ring_mgtqid); ifp->if_drv_flags |= IFF_DRV_OACTIVE; + RT2870_SOFTC_UNLOCK(sc); + m_freem(m); ieee80211_free_node(ni); + + sc->tx_data_queue_full[sc->tx_ring_mgtqid]++; + return ENOBUFS; } if (rt2870_tx_mgmt(sc, m, ni, sc->tx_ring_mgtqid) != 0) { ifp->if_oerrors++; + RT2870_SOFTC_UNLOCK(sc); + ieee80211_free_node(ni); + return EIO; } @@ -5523,6 +5537,33 @@ static void rt2870_sysctl_attach(struct rt2870_softc *sc) "tx_ac0_data_queued", CTLFLAG_RD, &sc->tx_ring[0].queued, 0, "Tx AC0 data queued"); + if (sc->usb_endpoints == RT2870_SOFTC_USB_XFER_COUNT) + { + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "tx_mgmt_data_queue_full", CTLFLAG_RD, &sc->tx_data_queue_full[5], 0, + "Tx MGMT data queue full"); + + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "tx_hcca_data_queue_full", CTLFLAG_RD, &sc->tx_data_queue_full[4], 0, + "Tx HCCA data queue full"); + } + + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "tx_ac3_data_queue_full", CTLFLAG_RD, &sc->tx_data_queue_full[3], 0, + "Tx AC3 data queue full"); + + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "tx_ac2_data_queue_full", CTLFLAG_RD, &sc->tx_data_queue_full[2], 0, + "Tx AC2 data queue full"); + + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "tx_ac1_data_queue_full", CTLFLAG_RD, &sc->tx_data_queue_full[1], 0, + "Tx AC1 data queue full"); + + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "tx_ac0_data_queue_full", CTLFLAG_RD, &sc->tx_data_queue_full[0], 0, + "Tx AC0 data queue full"); + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "tx_watchdog_timeouts", CTLFLAG_RD, &sc->tx_watchdog_timeouts, 0, "Tx watchdog timeouts"); diff --git a/rt2870_softc.h b/rt2870_softc.h index 0161f75..d9f47c5 100644 --- a/rt2870_softc.h +++ b/rt2870_softc.h @@ -311,6 +311,8 @@ struct rt2870_softc unsigned long rx_interrupts; unsigned long tx_interrupts[RT2870_SOFTC_TX_RING_COUNT]; + unsigned long tx_data_queue_full[RT2870_SOFTC_TX_RING_COUNT]; + unsigned long tx_watchdog_timeouts; unsigned long rx_mbuf_alloc_errors; -- 2.11.4.GIT