diff mbox

[RFC,v2] minstrel_ht: new rate control module for 802.11n

Message ID 201003071859.25848.chunkeey@googlemail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Christian Lamparter March 7, 2010, 5:59 p.m. UTC
None
diff mbox

Patch

diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index 8b60bd8..ef98ccf 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -407,13 +407,15 @@  minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband,
 	 * downgrade to a lower number of streams if necessary.
 	 */
 	rate = minstrel_get_ratestats(mi, mi->max_tp_rate);
-	if (MINSTREL_FRAC(rate->success, rate->attempts) <
-	    MINSTREL_FRAC(20, 100) && rate->attempts > 30)
+	if (rate->attempts > 30 &&
+	    MINSTREL_FRAC(rate->success, rate->attempts) <
+	    MINSTREL_FRAC(20, 100))
 		minstrel_downgrade_rate(mi, &mi->max_tp_rate, true);
 
 	rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate2);
-	if (MINSTREL_FRAC(rate->success, rate->attempts) <
-	    MINSTREL_FRAC(20, 100) && rate->attempts > 30)
+	if (rate->attempts > 30 &&
+	    MINSTREL_FRAC(rate->success, rate->attempts) <
+	    MINSTREL_FRAC(20, 100))
 		minstrel_downgrade_rate(mi, &mi->max_tp_rate2, false);
 
 	if (time_after(jiffies, mi->stats_update + (mp->update_interval / 2 * HZ) / 1000))
@@ -574,6 +576,12 @@  minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
 
 	minstrel_aggr_check(mp, sta, txrc->skb);
 
+	if (!(info->flags & IEEE80211_TX_CTL_AMPDU)) {
+		ar[0].count = mp->hw->max_rate_tries;
+		ar[0].idx = rate_lowest_index(txrc->sband, sta);
+		goto rate_out;
+	}
+
 	sample_idx = minstrel_get_sample_rate(mp, mi);
 	if (sample_idx >= 0) {
 		minstrel_ht_set_rate(mp, mi, &ar[0], sample_idx,
@@ -589,6 +597,7 @@  minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
 	}
 	minstrel_ht_set_rate(mp, mi, &ar[2], mi->max_prob_rate, txrc, false, true);
 
+rate_out:
 	ar[3].count = 0;
 	ar[3].idx = -1;
 
diff --git a/net/mac80211/rc80211_minstrel_ht_debugfs.c b/net/mac80211/rc80211_minstrel_ht_debugfs.c
index 4689aac..4fb3ccb 100644
--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
@@ -57,7 +57,7 @@  minstrel_ht_stats_open(struct inode *inode, struct file *file)
 			struct minstrel_rate_stats *mr = &mi->groups[i].rates[j];
 			int idx = i * MCS_GROUP_RATES + j;
 
-			if (!mi->groups[i].supported & BIT(j))
+			if (!(mi->groups[i].supported & BIT(j)))
 				continue;
 
 			p += sprintf(p, "HT%c0/%cGI ", htmode, gimode);