334-mac80211-minstrel_ht-move-supported-bitrate-mask-out.patch 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Date: Wed, 14 Dec 2016 19:33:23 +0100
  3. Subject: [PATCH] mac80211: minstrel_ht: move supported bitrate mask out of
  4. group data
  5. Improves dcache footprint by ensuring that fewer cache lines need to be
  6. touched.
  7. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8. ---
  9. --- a/net/mac80211/rc80211_minstrel_ht.c
  10. +++ b/net/mac80211/rc80211_minstrel_ht.c
  11. @@ -301,7 +301,7 @@ minstrel_ht_get_stats(struct minstrel_pr
  12. break;
  13. /* short preamble */
  14. - if (!(mi->groups[group].supported & BIT(idx)))
  15. + if (!(mi->supported[group] & BIT(idx)))
  16. idx += 4;
  17. }
  18. return &mi->groups[group].rates[idx];
  19. @@ -486,7 +486,7 @@ minstrel_ht_prob_rate_reduce_streams(str
  20. MCS_GROUP_RATES].streams;
  21. for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
  22. mg = &mi->groups[group];
  23. - if (!mg->supported || group == MINSTREL_CCK_GROUP)
  24. + if (!mi->supported[group] || group == MINSTREL_CCK_GROUP)
  25. continue;
  26. tmp_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  27. @@ -540,7 +540,7 @@ minstrel_ht_update_stats(struct minstrel
  28. for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
  29. mg = &mi->groups[group];
  30. - if (!mg->supported)
  31. + if (!mi->supported[group])
  32. continue;
  33. mi->sample_count++;
  34. @@ -550,7 +550,7 @@ minstrel_ht_update_stats(struct minstrel
  35. tmp_group_tp_rate[j] = group;
  36. for (i = 0; i < MCS_GROUP_RATES; i++) {
  37. - if (!(mg->supported & BIT(i)))
  38. + if (!(mi->supported[group] & BIT(i)))
  39. continue;
  40. index = MCS_GROUP_RATES * group + i;
  41. @@ -636,7 +636,7 @@ minstrel_set_next_sample_idx(struct mins
  42. mi->sample_group %= ARRAY_SIZE(minstrel_mcs_groups);
  43. mg = &mi->groups[mi->sample_group];
  44. - if (!mg->supported)
  45. + if (!mi->supported[mi->sample_group])
  46. continue;
  47. if (++mg->index >= MCS_GROUP_RATES) {
  48. @@ -657,7 +657,7 @@ minstrel_downgrade_rate(struct minstrel_
  49. while (group > 0) {
  50. group--;
  51. - if (!mi->groups[group].supported)
  52. + if (!mi->supported[group])
  53. continue;
  54. if (minstrel_mcs_groups[group].streams >
  55. @@ -994,7 +994,7 @@ minstrel_get_sample_rate(struct minstrel
  56. sample_idx = sample_table[mg->column][mg->index];
  57. minstrel_set_next_sample_idx(mi);
  58. - if (!(mg->supported & BIT(sample_idx)))
  59. + if (!(mi->supported[sample_group] & BIT(sample_idx)))
  60. return -1;
  61. mrs = &mg->rates[sample_idx];
  62. @@ -1052,7 +1052,7 @@ static void
  63. minstrel_ht_check_cck_shortpreamble(struct minstrel_priv *mp,
  64. struct minstrel_ht_sta *mi, bool val)
  65. {
  66. - u8 supported = mi->groups[MINSTREL_CCK_GROUP].supported;
  67. + u8 supported = mi->supported[MINSTREL_CCK_GROUP];
  68. if (!supported || !mi->cck_supported_short)
  69. return;
  70. @@ -1061,7 +1061,7 @@ minstrel_ht_check_cck_shortpreamble(stru
  71. return;
  72. supported ^= mi->cck_supported_short | (mi->cck_supported_short << 4);
  73. - mi->groups[MINSTREL_CCK_GROUP].supported = supported;
  74. + mi->supported[MINSTREL_CCK_GROUP] = supported;
  75. }
  76. static void
  77. @@ -1154,7 +1154,7 @@ minstrel_ht_update_cck(struct minstrel_p
  78. mi->cck_supported_short |= BIT(i);
  79. }
  80. - mi->groups[MINSTREL_CCK_GROUP].supported = mi->cck_supported;
  81. + mi->supported[MINSTREL_CCK_GROUP] = mi->cck_supported;
  82. }
  83. static void
  84. @@ -1233,7 +1233,7 @@ minstrel_ht_update_caps(void *priv, stru
  85. u32 gflags = minstrel_mcs_groups[i].flags;
  86. int bw, nss;
  87. - mi->groups[i].supported = 0;
  88. + mi->supported[i] = 0;
  89. if (i == MINSTREL_CCK_GROUP) {
  90. minstrel_ht_update_cck(mp, mi, sband, sta);
  91. continue;
  92. @@ -1265,8 +1265,8 @@ minstrel_ht_update_caps(void *priv, stru
  93. if (use_vht && minstrel_vht_only)
  94. continue;
  95. #endif
  96. - mi->groups[i].supported = mcs->rx_mask[nss - 1];
  97. - if (mi->groups[i].supported)
  98. + mi->supported[i] = mcs->rx_mask[nss - 1];
  99. + if (mi->supported[i])
  100. n_supported++;
  101. continue;
  102. }
  103. @@ -1292,10 +1292,10 @@ minstrel_ht_update_caps(void *priv, stru
  104. else
  105. bw = BW_20;
  106. - mi->groups[i].supported = minstrel_get_valid_vht_rates(bw, nss,
  107. + mi->supported[i] = minstrel_get_valid_vht_rates(bw, nss,
  108. vht_cap->vht_mcs.tx_mcs_map);
  109. - if (mi->groups[i].supported)
  110. + if (mi->supported[i])
  111. n_supported++;
  112. }
  113. --- a/net/mac80211/rc80211_minstrel_ht.h
  114. +++ b/net/mac80211/rc80211_minstrel_ht.h
  115. @@ -52,9 +52,6 @@ struct minstrel_mcs_group_data {
  116. u8 index;
  117. u8 column;
  118. - /* bitfield of supported MCS rates of this group */
  119. - u16 supported;
  120. -
  121. /* sorted rate set within a MCS group*/
  122. u16 max_group_tp_rate[MAX_THR_RATES];
  123. u16 max_group_prob_rate;
  124. @@ -101,6 +98,9 @@ struct minstrel_ht_sta {
  125. u8 cck_supported;
  126. u8 cck_supported_short;
  127. + /* Bitfield of supported MCS rates of all groups */
  128. + u16 supported[MINSTREL_GROUPS_NB];
  129. +
  130. /* MCS rate group info and statistics */
  131. struct minstrel_mcs_group_data groups[MINSTREL_GROUPS_NB];
  132. };
  133. --- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
  134. +++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
  135. @@ -24,7 +24,7 @@ minstrel_ht_stats_dump(struct minstrel_h
  136. char gimode = 'L';
  137. u32 gflags;
  138. - if (!mi->groups[i].supported)
  139. + if (!mi->supported[i])
  140. return p;
  141. mg = &minstrel_mcs_groups[i];
  142. @@ -42,7 +42,7 @@ minstrel_ht_stats_dump(struct minstrel_h
  143. static const int bitrates[4] = { 10, 20, 55, 110 };
  144. int idx = i * MCS_GROUP_RATES + j;
  145. - if (!(mi->groups[i].supported & BIT(j)))
  146. + if (!(mi->supported[i] & BIT(j)))
  147. continue;
  148. if (gflags & IEEE80211_TX_RC_MCS) {
  149. @@ -170,7 +170,7 @@ minstrel_ht_stats_csv_dump(struct minstr
  150. char gimode = 'L';
  151. u32 gflags;
  152. - if (!mi->groups[i].supported)
  153. + if (!mi->supported[i])
  154. return p;
  155. mg = &minstrel_mcs_groups[i];
  156. @@ -188,7 +188,7 @@ minstrel_ht_stats_csv_dump(struct minstr
  157. static const int bitrates[4] = { 10, 20, 55, 110 };
  158. int idx = i * MCS_GROUP_RATES + j;
  159. - if (!(mi->groups[i].supported & BIT(j)))
  160. + if (!(mi->supported[i] & BIT(j)))
  161. continue;
  162. if (gflags & IEEE80211_TX_RC_MCS) {