[ath_rate_sample] Fix logic for determining whether to bump up an MCS rate.

* Fix formatting, cause reasons;
* Put back the "and the chosen rate is within 90% of the current rate" logic;
* Ensure the best rate and the current rate aren't the same; this ...
* ... fixes the packets_since_switch[] tracking to actually conut how many
  frames since the rate switched, so now I know how stable stuff is; and
* Ensure that MCS can go up to a higher MCS at this or any other spatial stream.
  My previous quick hack attempt was doing > rather than >= so you had to go
  to both a higher root MCS rate (0..7) and spatial stream. Eg, you couldn't
  go from MCS0 (1ss) to MCS8 (2ss) this way.

The best rate and switching rate logic still have a bunch more work to do
because they're still quite touchy when it comes to average tx time but at least
now it's choosing higher rates correctly when it wants to try a higher rate.

Tested:

* AR9380, STA mode
This commit is contained in:
Adrian Chadd 2020-05-16 01:56:06 +00:00
parent 2e09b2590e
commit 5add701776
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=361098

View File

@ -712,10 +712,13 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an,
* Limit the time measuring the performance of other tx
* rates to sample_rate% of the total transmission time.
*/
if (sn->sample_tt[size_bin] < average_tx_time * (sn->packets_since_sample[size_bin]*ssc->sample_rate/100)) {
if (sn->sample_tt[size_bin] <
average_tx_time *
(sn->packets_since_sample[size_bin]*ssc->sample_rate/100)) {
rix = pick_sample_rate(ssc, an, rt, size_bin);
IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL,
&an->an_node, "att %d sample_tt %d size %u sample rate %d %s current rate %d %s",
&an->an_node, "att %d sample_tt %d size %u "
"sample rate %d %s current rate %d %s",
average_tx_time,
sn->sample_tt[size_bin],
bin_to_size(size_bin),
@ -776,12 +779,9 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an,
printf("cur rix/att %x/%d, best rix/att %x/%d\n",
MCS(cur_rix), cur_att, MCS(best_rix), average_tx_time);
#endif
#if 0
if (((MCS(best_rix) & 0x7) > (MCS(cur_rix) & 0x7)) &&
(average_tx_time * 10) <= (cur_att * 10)) {
#else
if ((average_tx_time * 10) <= (cur_att * 10)) {
#endif
if ((best_rix != cur_rix) &&
((MCS(best_rix) & 0x7) >= (MCS(cur_rix) & 0x7)) &&
(average_tx_time * 9) <= (cur_att * 10)) {
IEEE80211_NOTE(an->an_node.ni_vap,
IEEE80211_MSG_RATECTL, &an->an_node,
"%s: HT: size %d best_rix 0x%x > "
@ -823,7 +823,9 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an,
/*
* Set the visible txrate for this node.
*/
an->an_node.ni_txrate = (rt->info[best_rix].phy == IEEE80211_T_HT) ? MCS(best_rix) : DOT11RATE(best_rix);
an->an_node.ni_txrate =
(rt->info[best_rix].phy == IEEE80211_T_HT) ?
MCS(best_rix) : DOT11RATE(best_rix);
}
rix = sn->current_rix[size_bin];
sn->packets_since_switch[size_bin]++;