aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rc80211_minstrel.c
diff options
context:
space:
mode:
authorThomas Huehn <thomas@net.t-labs.tu-berlin.de>2015-03-24 16:09:43 -0400
committerJohannes Berg <johannes.berg@intel.com>2015-04-01 14:44:33 -0400
commit5f919abc76fc3de1e5965ea03c925f7563c7fc15 (patch)
tree8ed67f827d3b66cbfb140c66d8cd2d0f115633a6 /net/mac80211/rc80211_minstrel.c
parentade6d4a2ec57d258bc181a155288c267dd8cf094 (diff)
mac80211: add standard deviation to Minstrel stats
This patch adds the statistical descriptor "standard deviation" to better describe the current properties of Minstrel and Minstrel-HTs success probability distribution. The standard deviation (SD) is calculated as exponential weighted moving standard deviation (EWMSD) and its current value is added as new column in all rc_stats (in debugfs). Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de> Acked-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/rc80211_minstrel.c')
-rw-r--r--net/mac80211/rc80211_minstrel.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index c4a3477812ee..247552a7f6c2 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -153,7 +153,7 @@ minstrel_update_rates(struct minstrel_priv *mp, struct minstrel_sta_info *mi)
153} 153}
154 154
155/* 155/*
156* Recalculate success probabilities and counters for a given rate using EWMA 156* Recalculate statistics and counters of a given rate
157*/ 157*/
158void 158void
159minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs) 159minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs)
@@ -161,11 +161,20 @@ minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs)
161 if (unlikely(mrs->attempts > 0)) { 161 if (unlikely(mrs->attempts > 0)) {
162 mrs->sample_skipped = 0; 162 mrs->sample_skipped = 0;
163 mrs->cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); 163 mrs->cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts);
164 if (unlikely(!mrs->att_hist)) 164 if (unlikely(!mrs->att_hist)) {
165 mrs->prob_ewma = mrs->cur_prob; 165 mrs->prob_ewma = mrs->cur_prob;
166 else 166 } else {
167 /* update exponential weighted moving variance */
168 mrs->prob_ewmsd = minstrel_ewmsd(mrs->prob_ewmsd,
169 mrs->cur_prob,
170 mrs->prob_ewma,
171 EWMA_LEVEL);
172
173 /*update exponential weighted moving avarage */
167 mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma, 174 mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma,
168 mrs->cur_prob, EWMA_LEVEL); 175 mrs->cur_prob,
176 EWMA_LEVEL);
177 }
169 mrs->att_hist += mrs->attempts; 178 mrs->att_hist += mrs->attempts;
170 mrs->succ_hist += mrs->success; 179 mrs->succ_hist += mrs->success;
171 } else { 180 } else {
@@ -193,7 +202,7 @@ minstrel_update_stats(struct minstrel_priv *mp, struct minstrel_sta_info *mi)
193 struct minstrel_rate_stats *mrs = &mi->r[i].stats; 202 struct minstrel_rate_stats *mrs = &mi->r[i].stats;
194 struct minstrel_rate_stats *tmp_mrs = &mi->r[tmp_prob_rate].stats; 203 struct minstrel_rate_stats *tmp_mrs = &mi->r[tmp_prob_rate].stats;
195 204
196 /* Update success probabilities per rate */ 205 /* Update statistics of success probability per rate */
197 minstrel_calc_rate_stats(mrs); 206 minstrel_calc_rate_stats(mrs);
198 207
199 /* Sample less often below the 10% chance of success. 208 /* Sample less often below the 10% chance of success.