From ae0944b8f82daffc294277c33f42e8d06e1ae1c9 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Thu, 3 Mar 2011 08:09:49 +0000 Subject: [PATCH] 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. --- sys/dev/ath/ath_rate/sample/sample.c | 30 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c index 1ab81592b9d..bf2e4ff7107 100644 --- a/sys/dev/ath/ath_rate/sample/sample.c +++ b/sys/dev/ath/ath_rate/sample/sample.c @@ -150,6 +150,12 @@ dot11rate(const HAL_RATE_TABLE *rt, int rix) 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 *sc, struct ath_node *an, * 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 *sc, struct ath_node *an, 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, struct ieee80211_node *ni) 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_node *ni) 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_node *ni) 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,