1
0

338-mac80211-minstrel-remove-cur_prob-from-debugfs.patch 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Date: Wed, 14 Dec 2016 20:13:58 +0100
  3. Subject: [PATCH] mac80211: minstrel: remove cur_prob from debugfs
  4. This field is redundant, because it is simply last success divided by
  5. last attempt count. Removing it from the rate stats struct saves about
  6. 1.2 KiB per HT station.
  7. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8. ---
  9. --- a/net/mac80211/rc80211_minstrel.c
  10. +++ b/net/mac80211/rc80211_minstrel.c
  11. @@ -159,21 +159,23 @@ minstrel_update_rates(struct minstrel_pr
  12. void
  13. minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs)
  14. {
  15. + unsigned int cur_prob;
  16. +
  17. if (unlikely(mrs->attempts > 0)) {
  18. mrs->sample_skipped = 0;
  19. - mrs->cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts);
  20. + cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts);
  21. if (unlikely(!mrs->att_hist)) {
  22. - mrs->prob_ewma = mrs->cur_prob;
  23. + mrs->prob_ewma = cur_prob;
  24. } else {
  25. /* update exponential weighted moving variance */
  26. mrs->prob_ewmsd = minstrel_ewmsd(mrs->prob_ewmsd,
  27. - mrs->cur_prob,
  28. + cur_prob,
  29. mrs->prob_ewma,
  30. EWMA_LEVEL);
  31. /*update exponential weighted moving avarage */
  32. mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma,
  33. - mrs->cur_prob,
  34. + cur_prob,
  35. EWMA_LEVEL);
  36. }
  37. mrs->att_hist += mrs->attempts;
  38. --- a/net/mac80211/rc80211_minstrel.h
  39. +++ b/net/mac80211/rc80211_minstrel.h
  40. @@ -62,10 +62,8 @@ struct minstrel_rate_stats {
  41. u32 att_hist, succ_hist;
  42. /* statistis of packet delivery probability
  43. - * cur_prob - current prob within last update intervall
  44. * prob_ewma - exponential weighted moving average of prob
  45. * prob_ewmsd - exp. weighted moving standard deviation of prob */
  46. - unsigned int cur_prob;
  47. unsigned int prob_ewma;
  48. u16 prob_ewmsd;
  49. --- a/net/mac80211/rc80211_minstrel_debugfs.c
  50. +++ b/net/mac80211/rc80211_minstrel_debugfs.c
  51. @@ -75,7 +75,7 @@ minstrel_stats_open(struct inode *inode,
  52. {
  53. struct minstrel_sta_info *mi = inode->i_private;
  54. struct minstrel_debugfs_info *ms;
  55. - unsigned int i, tp_max, tp_avg, prob, eprob;
  56. + unsigned int i, tp_max, tp_avg, eprob;
  57. char *p;
  58. ms = kmalloc(2048, GFP_KERNEL);
  59. @@ -86,9 +86,9 @@ minstrel_stats_open(struct inode *inode,
  60. p = ms->buf;
  61. p += sprintf(p, "\n");
  62. p += sprintf(p,
  63. - "best __________rate_________ ________statistics________ ________last_______ ______sum-of________\n");
  64. + "best __________rate_________ ________statistics________ ____last_____ ______sum-of________\n");
  65. p += sprintf(p,
  66. - "rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [prob.|retry|suc|att] [#success | #attempts]\n");
  67. + "rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [retry|suc|att] [#success | #attempts]\n");
  68. for (i = 0; i < mi->n_rates; i++) {
  69. struct minstrel_rate *mr = &mi->r[i];
  70. @@ -107,17 +107,15 @@ minstrel_stats_open(struct inode *inode,
  71. tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100));
  72. tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma);
  73. - prob = MINSTREL_TRUNC(mrs->cur_prob * 1000);
  74. eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
  75. p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u %3u.%1u"
  76. - " %3u.%1u %3u %3u %-3u "
  77. + " %3u %3u %-3u "
  78. "%9llu %-9llu\n",
  79. tp_max / 10, tp_max % 10,
  80. tp_avg / 10, tp_avg % 10,
  81. eprob / 10, eprob % 10,
  82. mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
  83. - prob / 10, prob % 10,
  84. mrs->retry_count,
  85. mrs->last_success,
  86. mrs->last_attempts,
  87. @@ -148,7 +146,7 @@ minstrel_stats_csv_open(struct inode *in
  88. {
  89. struct minstrel_sta_info *mi = inode->i_private;
  90. struct minstrel_debugfs_info *ms;
  91. - unsigned int i, tp_max, tp_avg, prob, eprob;
  92. + unsigned int i, tp_max, tp_avg, eprob;
  93. char *p;
  94. ms = kmalloc(2048, GFP_KERNEL);
  95. @@ -175,16 +173,14 @@ minstrel_stats_csv_open(struct inode *in
  96. tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100));
  97. tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma);
  98. - prob = MINSTREL_TRUNC(mrs->cur_prob * 1000);
  99. eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
  100. - p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u,"
  101. + p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u,"
  102. "%llu,%llu,%d,%d\n",
  103. tp_max / 10, tp_max % 10,
  104. tp_avg / 10, tp_avg % 10,
  105. eprob / 10, eprob % 10,
  106. mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
  107. - prob / 10, prob % 10,
  108. mrs->retry_count,
  109. mrs->last_success,
  110. mrs->last_attempts,
  111. --- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
  112. +++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
  113. @@ -19,7 +19,7 @@ static char *
  114. minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p)
  115. {
  116. const struct mcs_group *mg;
  117. - unsigned int j, tp_max, tp_avg, prob, eprob, tx_time;
  118. + unsigned int j, tp_max, tp_avg, eprob, tx_time;
  119. char htmode = '2';
  120. char gimode = 'L';
  121. u32 gflags;
  122. @@ -83,17 +83,15 @@ minstrel_ht_stats_dump(struct minstrel_h
  123. tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100));
  124. tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma);
  125. - prob = MINSTREL_TRUNC(mrs->cur_prob * 1000);
  126. eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
  127. p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u %3u.%1u"
  128. - " %3u.%1u %3u %3u %-3u "
  129. + " %3u %3u %-3u "
  130. "%9llu %-9llu\n",
  131. tp_max / 10, tp_max % 10,
  132. tp_avg / 10, tp_avg % 10,
  133. eprob / 10, eprob % 10,
  134. mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
  135. - prob / 10, prob % 10,
  136. mrs->retry_count,
  137. mrs->last_success,
  138. mrs->last_attempts,
  139. @@ -130,9 +128,9 @@ minstrel_ht_stats_open(struct inode *ino
  140. p += sprintf(p, "\n");
  141. p += sprintf(p,
  142. - " best ____________rate__________ ________statistics________ ________last_______ ______sum-of________\n");
  143. + " best ____________rate__________ ________statistics________ _____last____ ______sum-of________\n");
  144. p += sprintf(p,
  145. - "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [prob.|retry|suc|att] [#success | #attempts]\n");
  146. + "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [retry|suc|att] [#success | #attempts]\n");
  147. p = minstrel_ht_stats_dump(mi, MINSTREL_CCK_GROUP, p);
  148. for (i = 0; i < MINSTREL_CCK_GROUP; i++)
  149. @@ -165,7 +163,7 @@ static char *
  150. minstrel_ht_stats_csv_dump(struct minstrel_ht_sta *mi, int i, char *p)
  151. {
  152. const struct mcs_group *mg;
  153. - unsigned int j, tp_max, tp_avg, prob, eprob, tx_time;
  154. + unsigned int j, tp_max, tp_avg, eprob, tx_time;
  155. char htmode = '2';
  156. char gimode = 'L';
  157. u32 gflags;
  158. @@ -226,16 +224,14 @@ minstrel_ht_stats_csv_dump(struct minstr
  159. tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100));
  160. tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma);
  161. - prob = MINSTREL_TRUNC(mrs->cur_prob * 1000);
  162. eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
  163. - p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,"
  164. + p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,"
  165. "%u,%llu,%llu,",
  166. tp_max / 10, tp_max % 10,
  167. tp_avg / 10, tp_avg % 10,
  168. eprob / 10, eprob % 10,
  169. mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
  170. - prob / 10, prob % 10,
  171. mrs->retry_count,
  172. mrs->last_success,
  173. mrs->last_attempts,