Date: Sun, 19 Oct 2008 06:43:52 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 151545 for review Message-ID: <200810190643.m9J6hqxN039456@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=151545 Change 151545 by sam@sam_ebb on 2008/10/19 06:43:32 handle tx rate display better Affected files ... .. //depot/projects/vap/tools/tools/ath/athstats/athstats.c#5 edit Differences ... ==== //depot/projects/vap/tools/tools/ath/athstats/athstats.c#5 (text+ko) ==== @@ -91,7 +91,7 @@ #else #define S_RATE AFTER(S_MIB) #endif - { 4, "rate", "rate", "current transmit rate" }, + { 5, "rate", "rate", "current transmit rate" }, #define S_WATCHDOG AFTER(S_RATE) { 5, "wdog", "wdog", "watchdog timeouts" }, #define S_FATAL AFTER(S_WATCHDOG) @@ -473,6 +473,17 @@ wf->total = wf->cur; } +static void +snprintrate(char b[], size_t bs, int rate) +{ + if (rate & IEEE80211_RATE_MCS) + snprintf(b, bs, "MCS%u", rate &~ IEEE80211_RATE_MCS); + else if (rate & 1) + snprintf(b, bs, "%u.5M", rate / 2); + else + snprintf(b, bs, "%uM", rate / 2); +} + static int ath_get_curstat(struct statfoo *sf, int s, char b[], size_t bs) { @@ -503,7 +514,7 @@ wf->cur.ath.ast_tx_packets - wf->total.ath.ast_tx_packets); return 1; case S_RATE: - snprintf(b, bs, "%uM", wf->cur.ath.ast_tx_rate / 2); + snprintrate(b, bs, wf->cur.ath.ast_tx_rate); return 1; case S_WATCHDOG: STAT(watchdog); case S_FATAL: STAT(hardware); @@ -712,7 +723,7 @@ snprintf(b, bs, "%lu", wf->total.ath.ast_tx_packets); return 1; case S_RATE: - snprintf(b, bs, "%uM", wf->total.ath.ast_tx_rate / 2); + snprintrate(b, bs, wf->total.ath.ast_tx_rate); return 1; case S_WATCHDOG: STAT(watchdog); case S_FATAL: STAT(hardware);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810190643.m9J6hqxN039456>