1 From: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
2 Date: Tue, 27 Oct 2015 17:51:13 +0530
3 Subject: [PATCH] ath10k: move static HT/VHT capability setup functions
5 Move HT and VHT capabiltity setup static functions to avoid
8 Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
9 Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 --- a/drivers/net/wireless/ath/ath10k/mac.c
13 +++ b/drivers/net/wireless/ath/ath10k/mac.c
14 @@ -3757,6 +3757,146 @@ static void ath10k_check_chain_mask(stru
18 +static int ath10k_mac_get_vht_cap_bf_sts(struct ath10k *ar)
20 + int nsts = ar->vht_cap_info;
22 + nsts &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK;
23 + nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT;
25 + /* If firmware does not deliver to host number of space-time
26 + * streams supported, assume it support up to 4 BF STS and return
27 + * the value for VHT CAP: nsts-1)
35 +static int ath10k_mac_get_vht_cap_bf_sound_dim(struct ath10k *ar)
37 + int sound_dim = ar->vht_cap_info;
39 + sound_dim &= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK;
40 + sound_dim >>= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
42 + /* If the sounding dimension is not advertised by the firmware,
43 + * let's use a default value of 1
51 +static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
53 + struct ieee80211_sta_vht_cap vht_cap = {0};
58 + vht_cap.vht_supported = 1;
59 + vht_cap.cap = ar->vht_cap_info;
61 + if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
62 + IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE)) {
63 + val = ath10k_mac_get_vht_cap_bf_sts(ar);
64 + val <<= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT;
65 + val &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK;
70 + if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
71 + IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)) {
72 + val = ath10k_mac_get_vht_cap_bf_sound_dim(ar);
73 + val <<= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
74 + val &= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK;
80 + for (i = 0; i < 8; i++) {
81 + if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i)))
82 + mcs_map |= IEEE80211_VHT_MCS_SUPPORT_0_9 << (i * 2);
84 + mcs_map |= IEEE80211_VHT_MCS_NOT_SUPPORTED << (i * 2);
87 + vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map);
88 + vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map);
93 +static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar)
96 + struct ieee80211_sta_ht_cap ht_cap = {0};
98 + if (!(ar->ht_cap_info & WMI_HT_CAP_ENABLED))
101 + ht_cap.ht_supported = 1;
102 + ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
103 + ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_8;
104 + ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
105 + ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40;
106 + ht_cap.cap |= WLAN_HT_CAP_SM_PS_STATIC << IEEE80211_HT_CAP_SM_PS_SHIFT;
108 + if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI)
109 + ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
111 + if (ar->ht_cap_info & WMI_HT_CAP_HT40_SGI)
112 + ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
114 + if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) {
117 + smps = WLAN_HT_CAP_SM_PS_DYNAMIC;
118 + smps <<= IEEE80211_HT_CAP_SM_PS_SHIFT;
120 + ht_cap.cap |= smps;
123 + if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC)
124 + ht_cap.cap |= IEEE80211_HT_CAP_TX_STBC;
126 + if (ar->ht_cap_info & WMI_HT_CAP_RX_STBC) {
129 + stbc = ar->ht_cap_info;
130 + stbc &= WMI_HT_CAP_RX_STBC;
131 + stbc >>= WMI_HT_CAP_RX_STBC_MASK_SHIFT;
132 + stbc <<= IEEE80211_HT_CAP_RX_STBC_SHIFT;
133 + stbc &= IEEE80211_HT_CAP_RX_STBC;
135 + ht_cap.cap |= stbc;
138 + if (ar->ht_cap_info & WMI_HT_CAP_LDPC)
139 + ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
141 + if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT)
142 + ht_cap.cap |= IEEE80211_HT_CAP_LSIG_TXOP_PROT;
144 + /* max AMSDU is implicitly taken from vht_cap_info */
145 + if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK)
146 + ht_cap.cap |= IEEE80211_HT_CAP_MAX_AMSDU;
148 + for (i = 0; i < ar->num_rf_chains; i++) {
149 + if (ar->cfg_rx_chainmask & BIT(i))
150 + ht_cap.mcs.rx_mask[i] = 0xFF;
153 + ht_cap.mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED;
158 static int __ath10k_set_antenna(struct ath10k *ar, u32 tx_ant, u32 rx_ant)
161 @@ -4068,39 +4208,6 @@ static u32 get_nss_from_chainmask(u16 ch
165 -static int ath10k_mac_get_vht_cap_bf_sts(struct ath10k *ar)
167 - int nsts = ar->vht_cap_info;
169 - nsts &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK;
170 - nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT;
172 - /* If firmware does not deliver to host number of space-time
173 - * streams supported, assume it support up to 4 BF STS and return
174 - * the value for VHT CAP: nsts-1)
182 -static int ath10k_mac_get_vht_cap_bf_sound_dim(struct ath10k *ar)
184 - int sound_dim = ar->vht_cap_info;
186 - sound_dim &= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK;
187 - sound_dim >>= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
189 - /* If the sounding dimension is not advertised by the firmware,
190 - * let's use a default value of 1
192 - if (sound_dim == 0)
198 static int ath10k_mac_set_txbf_conf(struct ath10k_vif *arvif)
201 @@ -6954,113 +7061,6 @@ static const struct ieee80211_iface_comb
205 -static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
207 - struct ieee80211_sta_vht_cap vht_cap = {0};
212 - vht_cap.vht_supported = 1;
213 - vht_cap.cap = ar->vht_cap_info;
215 - if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
216 - IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE)) {
217 - val = ath10k_mac_get_vht_cap_bf_sts(ar);
218 - val <<= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT;
219 - val &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK;
221 - vht_cap.cap |= val;
224 - if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
225 - IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)) {
226 - val = ath10k_mac_get_vht_cap_bf_sound_dim(ar);
227 - val <<= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
228 - val &= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK;
230 - vht_cap.cap |= val;
234 - for (i = 0; i < 8; i++) {
235 - if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i)))
236 - mcs_map |= IEEE80211_VHT_MCS_SUPPORT_0_9 << (i*2);
238 - mcs_map |= IEEE80211_VHT_MCS_NOT_SUPPORTED << (i*2);
241 - vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map);
242 - vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map);
247 -static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar)
250 - struct ieee80211_sta_ht_cap ht_cap = {0};
252 - if (!(ar->ht_cap_info & WMI_HT_CAP_ENABLED))
255 - ht_cap.ht_supported = 1;
256 - ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
257 - ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_8;
258 - ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
259 - ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40;
260 - ht_cap.cap |= WLAN_HT_CAP_SM_PS_STATIC << IEEE80211_HT_CAP_SM_PS_SHIFT;
262 - if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI)
263 - ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
265 - if (ar->ht_cap_info & WMI_HT_CAP_HT40_SGI)
266 - ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
268 - if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) {
271 - smps = WLAN_HT_CAP_SM_PS_DYNAMIC;
272 - smps <<= IEEE80211_HT_CAP_SM_PS_SHIFT;
274 - ht_cap.cap |= smps;
277 - if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC)
278 - ht_cap.cap |= IEEE80211_HT_CAP_TX_STBC;
280 - if (ar->ht_cap_info & WMI_HT_CAP_RX_STBC) {
283 - stbc = ar->ht_cap_info;
284 - stbc &= WMI_HT_CAP_RX_STBC;
285 - stbc >>= WMI_HT_CAP_RX_STBC_MASK_SHIFT;
286 - stbc <<= IEEE80211_HT_CAP_RX_STBC_SHIFT;
287 - stbc &= IEEE80211_HT_CAP_RX_STBC;
289 - ht_cap.cap |= stbc;
292 - if (ar->ht_cap_info & WMI_HT_CAP_LDPC)
293 - ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
295 - if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT)
296 - ht_cap.cap |= IEEE80211_HT_CAP_LSIG_TXOP_PROT;
298 - /* max AMSDU is implicitly taken from vht_cap_info */
299 - if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK)
300 - ht_cap.cap |= IEEE80211_HT_CAP_MAX_AMSDU;
302 - for (i = 0; i < ar->num_rf_chains; i++) {
303 - if (ar->cfg_rx_chainmask & BIT(i))
304 - ht_cap.mcs.rx_mask[i] = 0xFF;
307 - ht_cap.mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED;
312 static void ath10k_get_arvif_iter(void *data, u8 *mac,
313 struct ieee80211_vif *vif)