350-mac80211-minstrel_ht-show-sampling-rates-in-debugfs.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From: Felix Fietkau <[email protected]>
  2. Date: Sat, 23 Jan 2021 00:10:34 +0100
  3. Subject: [PATCH] mac80211: minstrel_ht: show sampling rates in debugfs
  4. This makes it easier to see what rates are going to be tested next
  5. Signed-off-by: Felix Fietkau <[email protected]>
  6. ---
  7. --- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
  8. +++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
  9. @@ -32,6 +32,18 @@ minstrel_stats_release(struct inode *ino
  10. return 0;
  11. }
  12. +static bool
  13. +minstrel_ht_is_sample_rate(struct minstrel_ht_sta *mi, int idx)
  14. +{
  15. + int type, i;
  16. +
  17. + for (type = 0; type < ARRAY_SIZE(mi->sample); type++)
  18. + for (i = 0; i < MINSTREL_SAMPLE_RATES; i++)
  19. + if (mi->sample[type].cur_sample_rates[i] == idx)
  20. + return true;
  21. + return false;
  22. +}
  23. +
  24. static char *
  25. minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p)
  26. {
  27. @@ -84,6 +96,7 @@ minstrel_ht_stats_dump(struct minstrel_h
  28. *(p++) = (idx == mi->max_tp_rate[2]) ? 'C' : ' ';
  29. *(p++) = (idx == mi->max_tp_rate[3]) ? 'D' : ' ';
  30. *(p++) = (idx == mi->max_prob_rate) ? 'P' : ' ';
  31. + *(p++) = minstrel_ht_is_sample_rate(mi, idx) ? 'S' : ' ';
  32. if (gflags & IEEE80211_TX_RC_MCS) {
  33. p += sprintf(p, " MCS%-2u", (mg->streams - 1) * 8 + j);
  34. @@ -145,9 +158,9 @@ minstrel_ht_stats_open(struct inode *ino
  35. p += sprintf(p, "\n");
  36. p += sprintf(p,
  37. - " best ____________rate__________ ____statistics___ _____last____ ______sum-of________\n");
  38. + " best ____________rate__________ ____statistics___ _____last____ ______sum-of________\n");
  39. p += sprintf(p,
  40. - "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob)] [retry|suc|att] [#success | #attempts]\n");
  41. + "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob)] [retry|suc|att] [#success | #attempts]\n");
  42. p = minstrel_ht_stats_dump(mi, MINSTREL_CCK_GROUP, p);
  43. for (i = 0; i < MINSTREL_CCK_GROUP; i++)
  44. @@ -228,6 +241,7 @@ minstrel_ht_stats_csv_dump(struct minstr
  45. p += sprintf(p, "%s" ,((idx == mi->max_tp_rate[2]) ? "C" : ""));
  46. p += sprintf(p, "%s" ,((idx == mi->max_tp_rate[3]) ? "D" : ""));
  47. p += sprintf(p, "%s" ,((idx == mi->max_prob_rate) ? "P" : ""));
  48. + p += sprintf(p, "%s", (minstrel_ht_is_sample_rate(mi, idx) ? "S" : ""));
  49. if (gflags & IEEE80211_TX_RC_MCS) {
  50. p += sprintf(p, ",MCS%-2u,", (mg->streams - 1) * 8 + j);