Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Mar 2011 08:09:49 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r219216 - head/sys/dev/ath/ath_rate/sample
Message-ID:  <201103030809.p2389nmq010852@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Thu Mar  3 08:09:49 2011
New Revision: 219216
URL: http://svn.freebsd.org/changeset/base/219216

Log:
  Modify the sample rate module output to be (slightly) easier to understand.
  
  * add dot11rate_label() which returns Mb or MCS based on legacy or HT
  * use it everywhere dot11rate() is used
  * in the "current selection" part at the top of the debugging output,
    otuput what the rate itself is rather than the rix. The rate index
    (rix) has very little meaning to normal humans who don't know how
    to find the PHY settings for each of the chipsets; pointing out the
    rix rate and type is likely more useful.

Modified:
  head/sys/dev/ath/ath_rate/sample/sample.c

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==============================================================================
--- head/sys/dev/ath/ath_rate/sample/sample.c	Thu Mar  3 05:56:29 2011	(r219215)
+++ head/sys/dev/ath/ath_rate/sample/sample.c	Thu Mar  3 08:09:49 2011	(r219216)
@@ -150,6 +150,12 @@ dot11rate(const HAL_RATE_TABLE *rt, int 
 	    rt->info[rix].dot11Rate : (rt->info[rix].dot11Rate & IEEE80211_RATE_VAL) / 2;
 }
 
+static const char *
+dot11rate_label(const HAL_RATE_TABLE *rt, int rix)
+{
+	return rt->info[rix].phy == IEEE80211_T_HT ? "MCS" : "Mb ";
+}
+
 /*
  * Return the rix with the lowest average_tx_time,
  * or -1 if all the average_tx_times are 0.
@@ -553,11 +559,11 @@ ath_rate_tx_complete(struct ath_softc *s
 		 * Only one rate was used; optimize work.
 		 */
 		IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL,
-		     &an->an_node, "%s: size %d %s rate/try %d/%d/%d",
+		     &an->an_node, "%s: size %d %s rate/try %d %s/%d/%d",
 		     __func__,
 		     bin_to_size(size_to_bin(frame_size)),
 		     ts->ts_status ? "FAIL" : "OK",
-		     dot11rate(rt, final_rix), short_tries, long_tries);
+		     dot11rate(rt, final_rix), dot11rate_label(rt, final_rix), short_tries, long_tries);
 		update_stats(sc, an, frame_size, 
 			     final_rix, long_tries,
 			     0, 0,
@@ -580,16 +586,16 @@ ath_rate_tx_complete(struct ath_softc *s
 
 		IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL,
 		    &an->an_node,
-"%s: size %d finaltsidx %d tries %d %s rate/try [%d/%d %d/%d %d/%d %d/%d]", 
+"%s: size %d finaltsidx %d tries %d %s rate/try [%d %s/%d %d %s/%d %d %s/%d %d %s/%d]", 
 		     __func__,
 		     bin_to_size(size_to_bin(frame_size)),
 		     finalTSIdx,
 		     long_tries, 
 		     ts->ts_status ? "FAIL" : "OK",
-		     dot11rate(rt, rix[0]), tries[0],
-		     dot11rate(rt, rix[1]), tries[1],
-		     dot11rate(rt, rix[2]), tries[2],
-		     dot11rate(rt, rix[3]), tries[3]);
+		     dot11rate(rt, rix[0]), dot11rate_label(rt, rix[0]), tries[0],
+		     dot11rate(rt, rix[1]), dot11rate_label(rt, rix[1]), tries[1],
+		     dot11rate(rt, rix[2]), dot11rate_label(rt, rix[2]), tries[2],
+		     dot11rate(rt, rix[3]), dot11rate_label(rt, rix[3]), tries[3]);
 
 		for (i = 0; i < 4; i++) {
 			if (tries[i] && !IS_RATE_DEFINED(sn, rix[i]))
@@ -765,7 +771,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
 		for (mask = sn->ratemask, rix = 0; mask != 0; mask >>= 1, rix++) {
 			if ((mask & 1) == 0)
 				continue;
-			printf(" %d/%d", dot11rate(rt, rix),
+			printf(" %d %s/%d", dot11rate(rt, rix), dot11rate_label(rt, rix),
 			    calc_usecs_unicast_packet(sc, 1600, rix, 0,0,
 			        (ni->ni_htcap & IEEE80211_HTCAP_CHWIDTH40)));
 		}
@@ -835,8 +841,10 @@ sample_stats(void *arg, struct ieee80211
 	    ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni),
 	    sn->static_rix, sn->ratemask);
 	for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) {
-		printf("[%4u] cur rix %d since switch: packets %d ticks %u\n",
+		printf("[%4u] cur rix %d (%d %s) since switch: packets %d ticks %u\n",
 		    bin_to_size(y), sn->current_rix[y],
+		    dot11rate(rt, sn->current_rix[y]),
+		    dot11rate_label(rt, sn->current_rix[y]),
 		    sn->packets_since_switch[y], sn->ticks_since_switch[y]);
 		printf("[%4u] last sample %d cur sample %d packets sent %d\n",
 		    bin_to_size(y), sn->last_sample_rix[y],
@@ -851,8 +859,8 @@ sample_stats(void *arg, struct ieee80211
 		for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) {
 			if (sn->stats[y][rix].total_packets == 0)
 				continue;
-			printf("[%2u:%4u] %8d:%-8d (%3d%%) T %8d F %4d avg %5u last %u\n",
-			    dot11rate(rt, rix),
+			printf("[%2u %s:%4u] %8d:%-8d (%3d%%) T %8d F %4d avg %5u last %u\n",
+			    dot11rate(rt, rix), dot11rate_label(rt, rix),
 			    bin_to_size(y),
 			    sn->stats[y][rix].total_packets,
 			    sn->stats[y][rix].packets_acked,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103030809.p2389nmq010852>