mac80211: minstrel: remove cur_prob from debugfs
authorFelix Fietkau <nbd@nbd.name>
Wed, 14 Dec 2016 19:46:58 +0000 (20:46 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 15 Dec 2016 10:07:52 +0000 (11:07 +0100)
This field is redundant, because it is simply last success divided by
last attempt count. Removing it from the rate stats struct saves about
1.2 KiB per HT station.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/rc80211_minstrel.c
net/mac80211/rc80211_minstrel.h
net/mac80211/rc80211_minstrel_debugfs.c
net/mac80211/rc80211_minstrel_ht_debugfs.c

index 14c5ba3a1b1c6c3b139729f8921ec01ef1b03d3d..a284ea08f0487f0274ea80439c13357ab58cdd16 100644 (file)
@@ -159,21 +159,23 @@ minstrel_update_rates(struct minstrel_priv *mp, struct minstrel_sta_info *mi)
 void
 minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs)
 {
+       unsigned int cur_prob;
+
        if (unlikely(mrs->attempts > 0)) {
                mrs->sample_skipped = 0;
-               mrs->cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts);
+               cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts);
                if (unlikely(!mrs->att_hist)) {
-                       mrs->prob_ewma = mrs->cur_prob;
+                       mrs->prob_ewma = cur_prob;
                } else {
                        /* update exponential weighted moving variance */
                        mrs->prob_ewmsd = minstrel_ewmsd(mrs->prob_ewmsd,
-                                                        mrs->cur_prob,
+                                                        cur_prob,
                                                         mrs->prob_ewma,
                                                         EWMA_LEVEL);
 
                        /*update exponential weighted moving avarage */
                        mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma,
-                                                      mrs->cur_prob,
+                                                      cur_prob,
                                                       EWMA_LEVEL);
                }
                mrs->att_hist += mrs->attempts;
index 209961cbb7e8ef41f896c93d1de3114ee96ce621..94b89b1b406c10b817f1641597191ef176711f58 100644 (file)
@@ -62,10 +62,8 @@ struct minstrel_rate_stats {
        u32 att_hist, succ_hist;
 
        /* statistis of packet delivery probability
-        *  cur_prob  - current prob within last update intervall
         *  prob_ewma - exponential weighted moving average of prob
         *  prob_ewmsd - exp. weighted moving standard deviation of prob */
-       unsigned int cur_prob;
        unsigned int prob_ewma;
        u16 prob_ewmsd;
 
index 820b0abc9c0d6f7662cf7a98cc497b310d1281e3..ca0bafd6a44e8f17898c8e3e6f6d43e8011a3052 100644 (file)
@@ -75,7 +75,7 @@ minstrel_stats_open(struct inode *inode, struct file *file)
 {
        struct minstrel_sta_info *mi = inode->i_private;
        struct minstrel_debugfs_info *ms;
-       unsigned int i, tp_max, tp_avg, prob, eprob;
+       unsigned int i, tp_max, tp_avg, eprob;
        char *p;
 
        ms = kmalloc(2048, GFP_KERNEL);
@@ -86,9 +86,9 @@ minstrel_stats_open(struct inode *inode, struct file *file)
        p = ms->buf;
        p += sprintf(p, "\n");
        p += sprintf(p,
-                    "best   __________rate_________    ________statistics________    ________last_______    ______sum-of________\n");
+                    "best   __________rate_________    ________statistics________    ____last_____    ______sum-of________\n");
        p += sprintf(p,
-                    "rate  [name idx airtime max_tp]  [avg(tp) avg(prob) sd(prob)]  [prob.|retry|suc|att]  [#success | #attempts]\n");
+                    "rate  [name idx airtime max_tp]  [avg(tp) avg(prob) sd(prob)]  [retry|suc|att]  [#success | #attempts]\n");
 
        for (i = 0; i < mi->n_rates; i++) {
                struct minstrel_rate *mr = &mi->r[i];
@@ -107,17 +107,15 @@ minstrel_stats_open(struct inode *inode, struct file *file)
 
                tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100));
                tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma);
-               prob = MINSTREL_TRUNC(mrs->cur_prob * 1000);
                eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
 
                p += sprintf(p, "%4u.%1u    %4u.%1u     %3u.%1u    %3u.%1u"
-                               "     %3u.%1u %3u   %3u %-3u   "
+                               "     %3u   %3u %-3u   "
                                "%9llu   %-9llu\n",
                                tp_max / 10, tp_max % 10,
                                tp_avg / 10, tp_avg % 10,
                                eprob / 10, eprob % 10,
                                mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
-                               prob / 10, prob % 10,
                                mrs->retry_count,
                                mrs->last_success,
                                mrs->last_attempts,
@@ -148,7 +146,7 @@ minstrel_stats_csv_open(struct inode *inode, struct file *file)
 {
        struct minstrel_sta_info *mi = inode->i_private;
        struct minstrel_debugfs_info *ms;
-       unsigned int i, tp_max, tp_avg, prob, eprob;
+       unsigned int i, tp_max, tp_avg, eprob;
        char *p;
 
        ms = kmalloc(2048, GFP_KERNEL);
@@ -175,16 +173,14 @@ minstrel_stats_csv_open(struct inode *inode, struct file *file)
 
                tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100));
                tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma);
-               prob = MINSTREL_TRUNC(mrs->cur_prob * 1000);
                eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
 
-               p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u,"
+               p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u,"
                                "%llu,%llu,%d,%d\n",
                                tp_max / 10, tp_max % 10,
                                tp_avg / 10, tp_avg % 10,
                                eprob / 10, eprob % 10,
                                mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
-                               prob / 10, prob % 10,
                                mrs->retry_count,
                                mrs->last_success,
                                mrs->last_attempts,
index 1942d4b3cd186037e24100e8df873fcce513f24d..0cecd23bb8349ff267fb28bcef55e64cb2fa819d 100644 (file)
@@ -19,7 +19,7 @@ static char *
 minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p)
 {
        const struct mcs_group *mg;
-       unsigned int j, tp_max, tp_avg, prob, eprob, tx_time;
+       unsigned int j, tp_max, tp_avg, eprob, tx_time;
        char htmode = '2';
        char gimode = 'L';
        u32 gflags;
@@ -83,17 +83,15 @@ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p)
 
                tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100));
                tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma);
-               prob = MINSTREL_TRUNC(mrs->cur_prob * 1000);
                eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
 
                p += sprintf(p, "%4u.%1u    %4u.%1u     %3u.%1u    %3u.%1u"
-                               "     %3u.%1u %3u   %3u %-3u   "
+                               "     %3u   %3u %-3u   "
                                "%9llu   %-9llu\n",
                                tp_max / 10, tp_max % 10,
                                tp_avg / 10, tp_avg % 10,
                                eprob / 10, eprob % 10,
                                mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
-                               prob / 10, prob % 10,
                                mrs->retry_count,
                                mrs->last_success,
                                mrs->last_attempts,
@@ -130,9 +128,9 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file)
 
        p += sprintf(p, "\n");
        p += sprintf(p,
-                    "              best   ____________rate__________    ________statistics________    ________last_______    ______sum-of________\n");
+                    "              best   ____________rate__________    ________statistics________    _____last____    ______sum-of________\n");
        p += sprintf(p,
-                    "mode guard #  rate  [name   idx airtime  max_tp]  [avg(tp) avg(prob) sd(prob)]  [prob.|retry|suc|att]  [#success | #attempts]\n");
+                    "mode guard #  rate  [name   idx airtime  max_tp]  [avg(tp) avg(prob) sd(prob)]  [retry|suc|att]  [#success | #attempts]\n");
 
        p = minstrel_ht_stats_dump(mi, MINSTREL_CCK_GROUP, p);
        for (i = 0; i < MINSTREL_CCK_GROUP; i++)
@@ -165,7 +163,7 @@ static char *
 minstrel_ht_stats_csv_dump(struct minstrel_ht_sta *mi, int i, char *p)
 {
        const struct mcs_group *mg;
-       unsigned int j, tp_max, tp_avg, prob, eprob, tx_time;
+       unsigned int j, tp_max, tp_avg, eprob, tx_time;
        char htmode = '2';
        char gimode = 'L';
        u32 gflags;
@@ -226,16 +224,14 @@ minstrel_ht_stats_csv_dump(struct minstrel_ht_sta *mi, int i, char *p)
 
                tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100));
                tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma);
-               prob = MINSTREL_TRUNC(mrs->cur_prob * 1000);
                eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
 
-               p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,"
+               p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,"
                                "%u,%llu,%llu,",
                                tp_max / 10, tp_max % 10,
                                tp_avg / 10, tp_avg % 10,
                                eprob / 10, eprob % 10,
                                mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
-                               prob / 10, prob % 10,
                                mrs->retry_count,
                                mrs->last_success,
                                mrs->last_attempts,