Date: Wed, 27 Jan 2010 19:43:14 +0000 (UTC) From: Weongyo Jeong <weongyo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r203087 - head/sys/dev/usb/wlan Message-ID: <201001271943.o0RJhEeJ009952@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: weongyo Date: Wed Jan 27 19:43:14 2010 New Revision: 203087 URL: http://svn.freebsd.org/changeset/base/203087 Log: adds sysctl knobs to show rate statistics that it could be useful to debug slow TX speed. Modified: head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_urtwvar.h Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Wed Jan 27 19:30:44 2010 (r203086) +++ head/sys/dev/usb/wlan/if_urtw.c Wed Jan 27 19:43:14 2010 (r203087) @@ -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: head/sys/dev/usb/wlan/if_urtwvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_urtwvar.h Wed Jan 27 19:30:44 2010 (r203086) +++ head/sys/dev/usb/wlan/if_urtwvar.h Wed Jan 27 19:43:14 2010 (r203087) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001271943.o0RJhEeJ009952>