1
0

309-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. @@ -1553,6 +1553,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. @@ -1130,7 +1130,7 @@ 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. struct sta_info *sinfo = container_of(sta, struct sta_info, sta);
  28. int use_vht;
  29. @@ -1138,6 +1138,7 @@ minstrel_ht_update_caps(void *priv, stru
  30. int ack_dur;
  31. int stbc;
  32. int i;
  33. + bool ldpc = false;
  34. /* fall back to the old minstrel for legacy stations */
  35. if (!sta->ht_cap.ht_supported)
  36. @@ -1175,16 +1176,24 @@ minstrel_ht_update_caps(void *priv, stru
  37. }
  38. mi->sample_tries = 4;
  39. - /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */
  40. if (!use_vht) {
  41. - stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >>
  42. + stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >>
  43. IEEE80211_HT_CAP_RX_STBC_SHIFT;
  44. - mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  45. - if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
  46. - mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  47. + if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING)
  48. + ldpc = true;
  49. + } else {
  50. + stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >>
  51. + IEEE80211_VHT_CAP_RXSTBC_SHIFT;
  52. +
  53. + if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)
  54. + ldpc = true;
  55. }
  56. + mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  57. + if (ldpc)
  58. + mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  59. +
  60. for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
  61. u32 gflags = minstrel_mcs_groups[i].flags;
  62. int bw, nss;
  63. @@ -1197,10 +1206,10 @@ minstrel_ht_update_caps(void *priv, stru
  64. if (gflags & IEEE80211_TX_RC_SHORT_GI) {
  65. if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) {
  66. - if (!(sta_cap & IEEE80211_HT_CAP_SGI_40))
  67. + if (!(ht_cap & IEEE80211_HT_CAP_SGI_40))
  68. continue;
  69. } else {
  70. - if (!(sta_cap & IEEE80211_HT_CAP_SGI_20))
  71. + if (!(ht_cap & IEEE80211_HT_CAP_SGI_20))
  72. continue;
  73. }
  74. }