svn commit: r361098 - head/sys/dev/ath/ath_rate/sample

Adrian Chadd adrian at FreeBSD.org
Sat May 16 01:56:06 UTC 2020


Author: adrian
Date: Sat May 16 01:56:06 2020
New Revision: 361098
URL: https://svnweb.freebsd.org/changeset/base/361098

Log:
  [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

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	Sat May 16 01:50:28 2020	(r361097)
+++ head/sys/dev/ath/ath_rate/sample/sample.c	Sat May 16 01:56:06 2020	(r361098)
@@ -712,10 +712,13 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod
 	 * 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_nod
 			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_nod
 			/* 
 			 * 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]++;


More information about the svn-src-head mailing list