PERFORCE change 151545 for review

Sam Leffler sam at FreeBSD.org
Sun Oct 19 06:43:53 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=151545

Change 151545 by sam at 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);


More information about the p4-projects mailing list