From owner-svn-src-stable-8@FreeBSD.ORG Wed Apr 7 00:28:00 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50FFD106566C; Wed, 7 Apr 2010 00:28:00 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CAEA8FC0C; Wed, 7 Apr 2010 00:28:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o370S0Vl028462; Wed, 7 Apr 2010 00:28:00 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o370S0pp028459; Wed, 7 Apr 2010 00:28:00 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201004070028.o370S0pp028459@svn.freebsd.org> From: Andrew Thompson Date: Wed, 7 Apr 2010 00:28:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206329 - stable/8/sys/dev/usb/wlan X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2010 00:28:01 -0000 Author: thompsa Date: Wed Apr 7 00:27:59 2010 New Revision: 206329 URL: http://svn.freebsd.org/changeset/base/206329 Log: MFC r203087 adds sysctl knobs to show rate statistics that it could be useful to debug slow TX speed. Modified: stable/8/sys/dev/usb/wlan/if_urtw.c stable/8/sys/dev/usb/wlan/if_urtwvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- stable/8/sys/dev/usb/wlan/if_urtw.c Wed Apr 7 00:26:39 2010 (r206328) +++ stable/8/sys/dev/usb/wlan/if_urtw.c Wed Apr 7 00:27:59 2010 (r206329) @@ -762,6 +762,7 @@ static int urtw_compute_txtime(uint16_t uint8_t); static void urtw_updateslot(struct ifnet *); static void urtw_updateslottask(void *, int); +static void urtw_sysctl_node(struct urtw_softc *); static int urtw_match(device_t dev) @@ -906,6 +907,8 @@ urtw_attach(device_t dev) &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), URTW_RX_RADIOTAP_PRESENT); + urtw_sysctl_node(sc); + if (bootverbose) ieee80211_announce(ic); return (0); @@ -1703,6 +1706,8 @@ urtw_tx_start(struct urtw_softc *sc, str rate = urtw_rtl2rate(sc->sc_currate); } + sc->sc_stats.txrates[sc->sc_currate]++; + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) txdur = pkttime = urtw_compute_txtime(m0->m_pkthdr.len + IEEE80211_CRC_LEN, rate, 0, 0); @@ -4372,6 +4377,54 @@ fail: URTW_UNLOCK(sc); } +static void +urtw_sysctl_node(struct urtw_softc *sc) +{ +#define URTW_SYSCTL_STAT_ADD32(c, h, n, p, d) \ + SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *child, *parent; + struct sysctl_oid *tree; + struct urtw_stats *stats = &sc->sc_stats; + + ctx = device_get_sysctl_ctx(sc->sc_dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->sc_dev)); + + tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "URTW statistics"); + parent = SYSCTL_CHILDREN(tree); + + /* Tx statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "Tx MAC statistics"); + child = SYSCTL_CHILDREN(tree); + URTW_SYSCTL_STAT_ADD32(ctx, child, "1m", &stats->txrates[0], + "1 Mbit/s"); + URTW_SYSCTL_STAT_ADD32(ctx, child, "2m", &stats->txrates[1], + "2 Mbit/s"); + URTW_SYSCTL_STAT_ADD32(ctx, child, "5.5m", &stats->txrates[2], + "5.5 Mbit/s"); + URTW_SYSCTL_STAT_ADD32(ctx, child, "6m", &stats->txrates[4], + "6 Mbit/s"); + URTW_SYSCTL_STAT_ADD32(ctx, child, "9m", &stats->txrates[5], + "9 Mbit/s"); + URTW_SYSCTL_STAT_ADD32(ctx, child, "11m", &stats->txrates[3], + "11 Mbit/s"); + URTW_SYSCTL_STAT_ADD32(ctx, child, "12m", &stats->txrates[6], + "12 Mbit/s"); + URTW_SYSCTL_STAT_ADD32(ctx, child, "18m", &stats->txrates[7], + "18 Mbit/s"); + URTW_SYSCTL_STAT_ADD32(ctx, child, "24m", &stats->txrates[8], + "24 Mbit/s"); + URTW_SYSCTL_STAT_ADD32(ctx, child, "36m", &stats->txrates[9], + "36 Mbit/s"); + URTW_SYSCTL_STAT_ADD32(ctx, child, "48m", &stats->txrates[10], + "48 Mbit/s"); + URTW_SYSCTL_STAT_ADD32(ctx, child, "54m", &stats->txrates[11], + "54 Mbit/s"); +#undef URTW_SYSCTL_STAT_ADD32 +} + static device_method_t urtw_methods[] = { DEVMETHOD(device_probe, urtw_match), DEVMETHOD(device_attach, urtw_attach), Modified: stable/8/sys/dev/usb/wlan/if_urtwvar.h ============================================================================== --- stable/8/sys/dev/usb/wlan/if_urtwvar.h Wed Apr 7 00:26:39 2010 (r206328) +++ stable/8/sys/dev/usb/wlan/if_urtwvar.h Wed Apr 7 00:27:59 2010 (r206329) @@ -81,6 +81,10 @@ struct urtw_tx_radiotap_header { ((1 << IEEE80211_RADIOTAP_FLAGS) | \ (1 << IEEE80211_RADIOTAP_CHANNEL)) +struct urtw_stats { + unsigned int txrates[12]; +}; + struct urtw_vap { struct ieee80211vap vap; int (*newstate)(struct ieee80211vap *, @@ -169,6 +173,8 @@ struct urtw_softc { uint64_t sc_txstatus; /* only for 8187B */ struct task sc_updateslot_task; + struct urtw_stats sc_stats; + struct urtw_rx_radiotap_header sc_rxtap; int sc_rxtap_len; struct urtw_tx_radiotap_header sc_txtap;