Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211: minstrel: remove cur_prob from debugfs

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>

authored by

Felix Fietkau and committed by
Johannes Berg
1109dc39 95cd470c

+18 -26
+6 -4
net/mac80211/rc80211_minstrel.c
··· 159 159 void 160 160 minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs) 161 161 { 162 + unsigned int cur_prob; 163 + 162 164 if (unlikely(mrs->attempts > 0)) { 163 165 mrs->sample_skipped = 0; 164 - mrs->cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); 166 + cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); 165 167 if (unlikely(!mrs->att_hist)) { 166 - mrs->prob_ewma = mrs->cur_prob; 168 + mrs->prob_ewma = cur_prob; 167 169 } else { 168 170 /* update exponential weighted moving variance */ 169 171 mrs->prob_ewmsd = minstrel_ewmsd(mrs->prob_ewmsd, 170 - mrs->cur_prob, 172 + cur_prob, 171 173 mrs->prob_ewma, 172 174 EWMA_LEVEL); 173 175 174 176 /*update exponential weighted moving avarage */ 175 177 mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma, 176 - mrs->cur_prob, 178 + cur_prob, 177 179 EWMA_LEVEL); 178 180 } 179 181 mrs->att_hist += mrs->attempts;
-2
net/mac80211/rc80211_minstrel.h
··· 62 62 u32 att_hist, succ_hist; 63 63 64 64 /* statistis of packet delivery probability 65 - * cur_prob - current prob within last update intervall 66 65 * prob_ewma - exponential weighted moving average of prob 67 66 * prob_ewmsd - exp. weighted moving standard deviation of prob */ 68 - unsigned int cur_prob; 69 67 unsigned int prob_ewma; 70 68 u16 prob_ewmsd; 71 69
+6 -10
net/mac80211/rc80211_minstrel_debugfs.c
··· 75 75 { 76 76 struct minstrel_sta_info *mi = inode->i_private; 77 77 struct minstrel_debugfs_info *ms; 78 - unsigned int i, tp_max, tp_avg, prob, eprob; 78 + unsigned int i, tp_max, tp_avg, eprob; 79 79 char *p; 80 80 81 81 ms = kmalloc(2048, GFP_KERNEL); ··· 86 86 p = ms->buf; 87 87 p += sprintf(p, "\n"); 88 88 p += sprintf(p, 89 - "best __________rate_________ ________statistics________ ________last_______ ______sum-of________\n"); 89 + "best __________rate_________ ________statistics________ ____last_____ ______sum-of________\n"); 90 90 p += sprintf(p, 91 - "rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [prob.|retry|suc|att] [#success | #attempts]\n"); 91 + "rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [retry|suc|att] [#success | #attempts]\n"); 92 92 93 93 for (i = 0; i < mi->n_rates; i++) { 94 94 struct minstrel_rate *mr = &mi->r[i]; ··· 107 107 108 108 tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); 109 109 tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma); 110 - prob = MINSTREL_TRUNC(mrs->cur_prob * 1000); 111 110 eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); 112 111 113 112 p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u %3u.%1u" 114 - " %3u.%1u %3u %3u %-3u " 113 + " %3u %3u %-3u " 115 114 "%9llu %-9llu\n", 116 115 tp_max / 10, tp_max % 10, 117 116 tp_avg / 10, tp_avg % 10, 118 117 eprob / 10, eprob % 10, 119 118 mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10, 120 - prob / 10, prob % 10, 121 119 mrs->retry_count, 122 120 mrs->last_success, 123 121 mrs->last_attempts, ··· 146 148 { 147 149 struct minstrel_sta_info *mi = inode->i_private; 148 150 struct minstrel_debugfs_info *ms; 149 - unsigned int i, tp_max, tp_avg, prob, eprob; 151 + unsigned int i, tp_max, tp_avg, eprob; 150 152 char *p; 151 153 152 154 ms = kmalloc(2048, GFP_KERNEL); ··· 173 175 174 176 tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); 175 177 tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma); 176 - prob = MINSTREL_TRUNC(mrs->cur_prob * 1000); 177 178 eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); 178 179 179 - p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u," 180 + p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u," 180 181 "%llu,%llu,%d,%d\n", 181 182 tp_max / 10, tp_max % 10, 182 183 tp_avg / 10, tp_avg % 10, 183 184 eprob / 10, eprob % 10, 184 185 mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10, 185 - prob / 10, prob % 10, 186 186 mrs->retry_count, 187 187 mrs->last_success, 188 188 mrs->last_attempts,
+6 -10
net/mac80211/rc80211_minstrel_ht_debugfs.c
··· 19 19 minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) 20 20 { 21 21 const struct mcs_group *mg; 22 - unsigned int j, tp_max, tp_avg, prob, eprob, tx_time; 22 + unsigned int j, tp_max, tp_avg, eprob, tx_time; 23 23 char htmode = '2'; 24 24 char gimode = 'L'; 25 25 u32 gflags; ··· 83 83 84 84 tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); 85 85 tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma); 86 - prob = MINSTREL_TRUNC(mrs->cur_prob * 1000); 87 86 eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); 88 87 89 88 p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u %3u.%1u" 90 - " %3u.%1u %3u %3u %-3u " 89 + " %3u %3u %-3u " 91 90 "%9llu %-9llu\n", 92 91 tp_max / 10, tp_max % 10, 93 92 tp_avg / 10, tp_avg % 10, 94 93 eprob / 10, eprob % 10, 95 94 mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10, 96 - prob / 10, prob % 10, 97 95 mrs->retry_count, 98 96 mrs->last_success, 99 97 mrs->last_attempts, ··· 128 130 129 131 p += sprintf(p, "\n"); 130 132 p += sprintf(p, 131 - " best ____________rate__________ ________statistics________ ________last_______ ______sum-of________\n"); 133 + " best ____________rate__________ ________statistics________ _____last____ ______sum-of________\n"); 132 134 p += sprintf(p, 133 - "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [prob.|retry|suc|att] [#success | #attempts]\n"); 135 + "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [retry|suc|att] [#success | #attempts]\n"); 134 136 135 137 p = minstrel_ht_stats_dump(mi, MINSTREL_CCK_GROUP, p); 136 138 for (i = 0; i < MINSTREL_CCK_GROUP; i++) ··· 163 165 minstrel_ht_stats_csv_dump(struct minstrel_ht_sta *mi, int i, char *p) 164 166 { 165 167 const struct mcs_group *mg; 166 - unsigned int j, tp_max, tp_avg, prob, eprob, tx_time; 168 + unsigned int j, tp_max, tp_avg, eprob, tx_time; 167 169 char htmode = '2'; 168 170 char gimode = 'L'; 169 171 u32 gflags; ··· 224 226 225 227 tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); 226 228 tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma); 227 - prob = MINSTREL_TRUNC(mrs->cur_prob * 1000); 228 229 eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); 229 230 230 - p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u.%u,%u,%u," 231 + p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u," 231 232 "%u,%llu,%llu,", 232 233 tp_max / 10, tp_max % 10, 233 234 tp_avg / 10, tp_avg % 10, 234 235 eprob / 10, eprob % 10, 235 236 mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10, 236 - prob / 10, prob % 10, 237 237 mrs->retry_count, 238 238 mrs->last_success, 239 239 mrs->last_attempts,