335-mac80211-minstrel_ht-move-short-preamble-check-out-o.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Date: Wed, 14 Dec 2016 20:06:08 +0100
  3. Subject: [PATCH] mac80211: minstrel_ht: move short preamble check out of
  4. get_rate
  5. Test short preamble support in minstrel_ht_update_caps instead of
  6. looking at the per-packet flag. Makes the code more efficient.
  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. @@ -14,6 +14,7 @@
  12. #include <linux/ieee80211.h>
  13. #include <net/mac80211.h>
  14. #include "rate.h"
  15. +#include "sta_info.h"
  16. #include "rc80211_minstrel.h"
  17. #include "rc80211_minstrel_ht.h"
  18. @@ -1049,22 +1050,6 @@ minstrel_get_sample_rate(struct minstrel
  19. }
  20. static void
  21. -minstrel_ht_check_cck_shortpreamble(struct minstrel_priv *mp,
  22. - struct minstrel_ht_sta *mi, bool val)
  23. -{
  24. - u8 supported = mi->supported[MINSTREL_CCK_GROUP];
  25. -
  26. - if (!supported || !mi->cck_supported_short)
  27. - return;
  28. -
  29. - if (supported & (mi->cck_supported_short << (val * 4)))
  30. - return;
  31. -
  32. - supported ^= mi->cck_supported_short | (mi->cck_supported_short << 4);
  33. - mi->supported[MINSTREL_CCK_GROUP] = supported;
  34. -}
  35. -
  36. -static void
  37. minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
  38. struct ieee80211_tx_rate_control *txrc)
  39. {
  40. @@ -1087,7 +1072,6 @@ minstrel_ht_get_rate(void *priv, struct
  41. minstrel_aggr_check(sta, txrc->skb);
  42. info->flags |= mi->tx_flags;
  43. - minstrel_ht_check_cck_shortpreamble(mp, mi, txrc->short_preamble);
  44. #ifdef CPTCFG_MAC80211_DEBUGFS
  45. if (mp->fixed_rate_idx != -1)
  46. @@ -1168,6 +1152,7 @@ minstrel_ht_update_caps(void *priv, stru
  47. struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
  48. u16 ht_cap = sta->ht_cap.cap;
  49. struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
  50. + struct sta_info *sinfo = container_of(sta, struct sta_info, sta);
  51. int use_vht;
  52. int n_supported = 0;
  53. int ack_dur;
  54. @@ -1302,6 +1287,9 @@ minstrel_ht_update_caps(void *priv, stru
  55. if (!n_supported)
  56. goto use_legacy;
  57. + if (test_sta_flag(sinfo, WLAN_STA_SHORT_PREAMBLE))
  58. + mi->cck_supported_short |= mi->cck_supported_short << 4;
  59. +
  60. /* create an initial rate table with the lowest supported rates */
  61. minstrel_ht_update_stats(mp, mi);
  62. minstrel_ht_update_rates(mp, mi);