312-ath10k-move-static-HT-VHT-capability-setup-functions.patch 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. From: Rajkumar Manoharan <[email protected]>
  2. Date: Tue, 27 Oct 2015 17:51:13 +0530
  3. Subject: [PATCH] ath10k: move static HT/VHT capability setup functions
  4. Move HT and VHT capabiltity setup static functions to avoid
  5. forward declaration.
  6. Signed-off-by: Rajkumar Manoharan <[email protected]>
  7. Signed-off-by: Kalle Valo <[email protected]>
  8. ---
  9. --- a/drivers/net/wireless/ath/ath10k/mac.c
  10. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  11. @@ -3757,6 +3757,146 @@ static void ath10k_check_chain_mask(stru
  12. dbg, cm);
  13. }
  14. +static int ath10k_mac_get_vht_cap_bf_sts(struct ath10k *ar)
  15. +{
  16. + int nsts = ar->vht_cap_info;
  17. +
  18. + nsts &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK;
  19. + nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT;
  20. +
  21. + /* If firmware does not deliver to host number of space-time
  22. + * streams supported, assume it support up to 4 BF STS and return
  23. + * the value for VHT CAP: nsts-1)
  24. + */
  25. + if (nsts == 0)
  26. + return 3;
  27. +
  28. + return nsts;
  29. +}
  30. +
  31. +static int ath10k_mac_get_vht_cap_bf_sound_dim(struct ath10k *ar)
  32. +{
  33. + int sound_dim = ar->vht_cap_info;
  34. +
  35. + sound_dim &= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK;
  36. + sound_dim >>= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
  37. +
  38. + /* If the sounding dimension is not advertised by the firmware,
  39. + * let's use a default value of 1
  40. + */
  41. + if (sound_dim == 0)
  42. + return 1;
  43. +
  44. + return sound_dim;
  45. +}
  46. +
  47. +static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
  48. +{
  49. + struct ieee80211_sta_vht_cap vht_cap = {0};
  50. + u16 mcs_map;
  51. + u32 val;
  52. + int i;
  53. +
  54. + vht_cap.vht_supported = 1;
  55. + vht_cap.cap = ar->vht_cap_info;
  56. +
  57. + if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
  58. + IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE)) {
  59. + val = ath10k_mac_get_vht_cap_bf_sts(ar);
  60. + val <<= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT;
  61. + val &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK;
  62. +
  63. + vht_cap.cap |= val;
  64. + }
  65. +
  66. + if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
  67. + IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)) {
  68. + val = ath10k_mac_get_vht_cap_bf_sound_dim(ar);
  69. + val <<= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
  70. + val &= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK;
  71. +
  72. + vht_cap.cap |= val;
  73. + }
  74. +
  75. + mcs_map = 0;
  76. + for (i = 0; i < 8; i++) {
  77. + if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i)))
  78. + mcs_map |= IEEE80211_VHT_MCS_SUPPORT_0_9 << (i * 2);
  79. + else
  80. + mcs_map |= IEEE80211_VHT_MCS_NOT_SUPPORTED << (i * 2);
  81. + }
  82. +
  83. + vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map);
  84. + vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map);
  85. +
  86. + return vht_cap;
  87. +}
  88. +
  89. +static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar)
  90. +{
  91. + int i;
  92. + struct ieee80211_sta_ht_cap ht_cap = {0};
  93. +
  94. + if (!(ar->ht_cap_info & WMI_HT_CAP_ENABLED))
  95. + return ht_cap;
  96. +
  97. + ht_cap.ht_supported = 1;
  98. + ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
  99. + ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_8;
  100. + ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
  101. + ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40;
  102. + ht_cap.cap |= WLAN_HT_CAP_SM_PS_STATIC << IEEE80211_HT_CAP_SM_PS_SHIFT;
  103. +
  104. + if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI)
  105. + ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
  106. +
  107. + if (ar->ht_cap_info & WMI_HT_CAP_HT40_SGI)
  108. + ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
  109. +
  110. + if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) {
  111. + u32 smps;
  112. +
  113. + smps = WLAN_HT_CAP_SM_PS_DYNAMIC;
  114. + smps <<= IEEE80211_HT_CAP_SM_PS_SHIFT;
  115. +
  116. + ht_cap.cap |= smps;
  117. + }
  118. +
  119. + if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC)
  120. + ht_cap.cap |= IEEE80211_HT_CAP_TX_STBC;
  121. +
  122. + if (ar->ht_cap_info & WMI_HT_CAP_RX_STBC) {
  123. + u32 stbc;
  124. +
  125. + stbc = ar->ht_cap_info;
  126. + stbc &= WMI_HT_CAP_RX_STBC;
  127. + stbc >>= WMI_HT_CAP_RX_STBC_MASK_SHIFT;
  128. + stbc <<= IEEE80211_HT_CAP_RX_STBC_SHIFT;
  129. + stbc &= IEEE80211_HT_CAP_RX_STBC;
  130. +
  131. + ht_cap.cap |= stbc;
  132. + }
  133. +
  134. + if (ar->ht_cap_info & WMI_HT_CAP_LDPC)
  135. + ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
  136. +
  137. + if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT)
  138. + ht_cap.cap |= IEEE80211_HT_CAP_LSIG_TXOP_PROT;
  139. +
  140. + /* max AMSDU is implicitly taken from vht_cap_info */
  141. + if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK)
  142. + ht_cap.cap |= IEEE80211_HT_CAP_MAX_AMSDU;
  143. +
  144. + for (i = 0; i < ar->num_rf_chains; i++) {
  145. + if (ar->cfg_rx_chainmask & BIT(i))
  146. + ht_cap.mcs.rx_mask[i] = 0xFF;
  147. + }
  148. +
  149. + ht_cap.mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED;
  150. +
  151. + return ht_cap;
  152. +}
  153. +
  154. static int __ath10k_set_antenna(struct ath10k *ar, u32 tx_ant, u32 rx_ant)
  155. {
  156. int ret;
  157. @@ -4068,39 +4208,6 @@ static u32 get_nss_from_chainmask(u16 ch
  158. return 1;
  159. }
  160. -static int ath10k_mac_get_vht_cap_bf_sts(struct ath10k *ar)
  161. -{
  162. - int nsts = ar->vht_cap_info;
  163. -
  164. - nsts &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK;
  165. - nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT;
  166. -
  167. - /* If firmware does not deliver to host number of space-time
  168. - * streams supported, assume it support up to 4 BF STS and return
  169. - * the value for VHT CAP: nsts-1)
  170. - * */
  171. - if (nsts == 0)
  172. - return 3;
  173. -
  174. - return nsts;
  175. -}
  176. -
  177. -static int ath10k_mac_get_vht_cap_bf_sound_dim(struct ath10k *ar)
  178. -{
  179. - int sound_dim = ar->vht_cap_info;
  180. -
  181. - sound_dim &= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK;
  182. - sound_dim >>= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
  183. -
  184. - /* If the sounding dimension is not advertised by the firmware,
  185. - * let's use a default value of 1
  186. - */
  187. - if (sound_dim == 0)
  188. - return 1;
  189. -
  190. - return sound_dim;
  191. -}
  192. -
  193. static int ath10k_mac_set_txbf_conf(struct ath10k_vif *arvif)
  194. {
  195. u32 value = 0;
  196. @@ -6954,113 +7061,6 @@ static const struct ieee80211_iface_comb
  197. },
  198. };
  199. -static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
  200. -{
  201. - struct ieee80211_sta_vht_cap vht_cap = {0};
  202. - u16 mcs_map;
  203. - u32 val;
  204. - int i;
  205. -
  206. - vht_cap.vht_supported = 1;
  207. - vht_cap.cap = ar->vht_cap_info;
  208. -
  209. - if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
  210. - IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE)) {
  211. - val = ath10k_mac_get_vht_cap_bf_sts(ar);
  212. - val <<= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT;
  213. - val &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK;
  214. -
  215. - vht_cap.cap |= val;
  216. - }
  217. -
  218. - if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
  219. - IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)) {
  220. - val = ath10k_mac_get_vht_cap_bf_sound_dim(ar);
  221. - val <<= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
  222. - val &= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK;
  223. -
  224. - vht_cap.cap |= val;
  225. - }
  226. -
  227. - mcs_map = 0;
  228. - for (i = 0; i < 8; i++) {
  229. - if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i)))
  230. - mcs_map |= IEEE80211_VHT_MCS_SUPPORT_0_9 << (i*2);
  231. - else
  232. - mcs_map |= IEEE80211_VHT_MCS_NOT_SUPPORTED << (i*2);
  233. - }
  234. -
  235. - vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map);
  236. - vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map);
  237. -
  238. - return vht_cap;
  239. -}
  240. -
  241. -static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar)
  242. -{
  243. - int i;
  244. - struct ieee80211_sta_ht_cap ht_cap = {0};
  245. -
  246. - if (!(ar->ht_cap_info & WMI_HT_CAP_ENABLED))
  247. - return ht_cap;
  248. -
  249. - ht_cap.ht_supported = 1;
  250. - ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
  251. - ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_8;
  252. - ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
  253. - ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40;
  254. - ht_cap.cap |= WLAN_HT_CAP_SM_PS_STATIC << IEEE80211_HT_CAP_SM_PS_SHIFT;
  255. -
  256. - if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI)
  257. - ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
  258. -
  259. - if (ar->ht_cap_info & WMI_HT_CAP_HT40_SGI)
  260. - ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
  261. -
  262. - if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) {
  263. - u32 smps;
  264. -
  265. - smps = WLAN_HT_CAP_SM_PS_DYNAMIC;
  266. - smps <<= IEEE80211_HT_CAP_SM_PS_SHIFT;
  267. -
  268. - ht_cap.cap |= smps;
  269. - }
  270. -
  271. - if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC)
  272. - ht_cap.cap |= IEEE80211_HT_CAP_TX_STBC;
  273. -
  274. - if (ar->ht_cap_info & WMI_HT_CAP_RX_STBC) {
  275. - u32 stbc;
  276. -
  277. - stbc = ar->ht_cap_info;
  278. - stbc &= WMI_HT_CAP_RX_STBC;
  279. - stbc >>= WMI_HT_CAP_RX_STBC_MASK_SHIFT;
  280. - stbc <<= IEEE80211_HT_CAP_RX_STBC_SHIFT;
  281. - stbc &= IEEE80211_HT_CAP_RX_STBC;
  282. -
  283. - ht_cap.cap |= stbc;
  284. - }
  285. -
  286. - if (ar->ht_cap_info & WMI_HT_CAP_LDPC)
  287. - ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
  288. -
  289. - if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT)
  290. - ht_cap.cap |= IEEE80211_HT_CAP_LSIG_TXOP_PROT;
  291. -
  292. - /* max AMSDU is implicitly taken from vht_cap_info */
  293. - if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK)
  294. - ht_cap.cap |= IEEE80211_HT_CAP_MAX_AMSDU;
  295. -
  296. - for (i = 0; i < ar->num_rf_chains; i++) {
  297. - if (ar->cfg_rx_chainmask & BIT(i))
  298. - ht_cap.mcs.rx_mask[i] = 0xFF;
  299. - }
  300. -
  301. - ht_cap.mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED;
  302. -
  303. - return ht_cap;
  304. -}
  305. -
  306. static void ath10k_get_arvif_iter(void *data, u8 *mac,
  307. struct ieee80211_vif *vif)
  308. {