From owner-p4-projects@FreeBSD.ORG Sun Oct 19 06:43:53 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 59A2D10656A6; Sun, 19 Oct 2008 06:43:53 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D2D110656A1 for ; Sun, 19 Oct 2008 06:43:53 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 0C3758FC12 for ; Sun, 19 Oct 2008 06:43:53 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m9J6hqqR039458 for ; Sun, 19 Oct 2008 06:43:52 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m9J6hqxN039456 for perforce@freebsd.org; Sun, 19 Oct 2008 06:43:52 GMT (envelope-from sam@freebsd.org) Date: Sun, 19 Oct 2008 06:43:52 GMT Message-Id: <200810190643.m9J6hqxN039456@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 151545 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2008 06:43:53 -0000 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);