1
0

306-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. From: Chaitanya T K <chaitanya.mgit@gmail.com>
  2. Date: Mon, 27 Jun 2016 15:23:26 +0530
  3. Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates
  4. If peer support reception of STBC and LDPC, enable them for better
  5. performance.
  6. Signed-off-by: Chaitanya TK <chaitanya.mgit@gmail.com>
  7. ---
  8. --- a/include/linux/ieee80211.h
  9. +++ b/include/linux/ieee80211.h
  10. @@ -1551,6 +1551,7 @@ struct ieee80211_vht_operation {
  11. #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
  12. #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
  13. #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
  14. +#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8
  15. #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
  16. #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
  17. #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13
  18. --- a/net/mac80211/rc80211_minstrel_ht.c
  19. +++ b/net/mac80211/rc80211_minstrel_ht.c
  20. @@ -1166,13 +1166,14 @@ minstrel_ht_update_caps(void *priv, stru
  21. struct minstrel_ht_sta_priv *msp = priv_sta;
  22. struct minstrel_ht_sta *mi = &msp->ht;
  23. struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
  24. - u16 sta_cap = sta->ht_cap.cap;
  25. + u16 ht_cap = sta->ht_cap.cap;
  26. struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
  27. int use_vht;
  28. int n_supported = 0;
  29. int ack_dur;
  30. int stbc;
  31. int i;
  32. + bool ldpc = false;
  33. /* fall back to the old minstrel for legacy stations */
  34. if (!sta->ht_cap.ht_supported)
  35. @@ -1210,16 +1211,24 @@ minstrel_ht_update_caps(void *priv, stru
  36. }
  37. mi->sample_tries = 4;
  38. - /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */
  39. if (!use_vht) {
  40. - stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >>
  41. + stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >>
  42. IEEE80211_HT_CAP_RX_STBC_SHIFT;
  43. - mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  44. - if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
  45. - mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  46. + if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING)
  47. + ldpc = true;
  48. + } else {
  49. + stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >>
  50. + IEEE80211_VHT_CAP_RXSTBC_SHIFT;
  51. +
  52. + if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)
  53. + ldpc = true;
  54. }
  55. + mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  56. + if (ldpc)
  57. + mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  58. +
  59. for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
  60. u32 gflags = minstrel_mcs_groups[i].flags;
  61. int bw, nss;
  62. @@ -1232,10 +1241,10 @@ minstrel_ht_update_caps(void *priv, stru
  63. if (gflags & IEEE80211_TX_RC_SHORT_GI) {
  64. if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) {
  65. - if (!(sta_cap & IEEE80211_HT_CAP_SGI_40))
  66. + if (!(ht_cap & IEEE80211_HT_CAP_SGI_40))
  67. continue;
  68. } else {
  69. - if (!(sta_cap & IEEE80211_HT_CAP_SGI_20))
  70. + if (!(ht_cap & IEEE80211_HT_CAP_SGI_20))
  71. continue;
  72. }
  73. }