123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314 |
- From: Rajkumar Manoharan <[email protected]>
- Date: Tue, 27 Oct 2015 17:51:13 +0530
- Subject: [PATCH] ath10k: move static HT/VHT capability setup functions
- Move HT and VHT capabiltity setup static functions to avoid
- forward declaration.
- Signed-off-by: Rajkumar Manoharan <[email protected]>
- Signed-off-by: Kalle Valo <[email protected]>
- ---
- --- a/drivers/net/wireless/ath/ath10k/mac.c
- +++ b/drivers/net/wireless/ath/ath10k/mac.c
- @@ -3757,6 +3757,146 @@ static void ath10k_check_chain_mask(stru
- dbg, cm);
- }
-
- +static int ath10k_mac_get_vht_cap_bf_sts(struct ath10k *ar)
- +{
- + int nsts = ar->vht_cap_info;
- +
- + nsts &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK;
- + nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT;
- +
- + /* If firmware does not deliver to host number of space-time
- + * streams supported, assume it support up to 4 BF STS and return
- + * the value for VHT CAP: nsts-1)
- + */
- + if (nsts == 0)
- + return 3;
- +
- + return nsts;
- +}
- +
- +static int ath10k_mac_get_vht_cap_bf_sound_dim(struct ath10k *ar)
- +{
- + int sound_dim = ar->vht_cap_info;
- +
- + sound_dim &= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK;
- + sound_dim >>= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
- +
- + /* If the sounding dimension is not advertised by the firmware,
- + * let's use a default value of 1
- + */
- + if (sound_dim == 0)
- + return 1;
- +
- + return sound_dim;
- +}
- +
- +static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
- +{
- + struct ieee80211_sta_vht_cap vht_cap = {0};
- + u16 mcs_map;
- + u32 val;
- + int i;
- +
- + vht_cap.vht_supported = 1;
- + vht_cap.cap = ar->vht_cap_info;
- +
- + if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
- + IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE)) {
- + val = ath10k_mac_get_vht_cap_bf_sts(ar);
- + val <<= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT;
- + val &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK;
- +
- + vht_cap.cap |= val;
- + }
- +
- + if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
- + IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)) {
- + val = ath10k_mac_get_vht_cap_bf_sound_dim(ar);
- + val <<= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
- + val &= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK;
- +
- + vht_cap.cap |= val;
- + }
- +
- + mcs_map = 0;
- + for (i = 0; i < 8; i++) {
- + if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i)))
- + mcs_map |= IEEE80211_VHT_MCS_SUPPORT_0_9 << (i * 2);
- + else
- + mcs_map |= IEEE80211_VHT_MCS_NOT_SUPPORTED << (i * 2);
- + }
- +
- + vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map);
- + vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map);
- +
- + return vht_cap;
- +}
- +
- +static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar)
- +{
- + int i;
- + struct ieee80211_sta_ht_cap ht_cap = {0};
- +
- + if (!(ar->ht_cap_info & WMI_HT_CAP_ENABLED))
- + return ht_cap;
- +
- + ht_cap.ht_supported = 1;
- + ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
- + ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_8;
- + ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
- + ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40;
- + ht_cap.cap |= WLAN_HT_CAP_SM_PS_STATIC << IEEE80211_HT_CAP_SM_PS_SHIFT;
- +
- + if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI)
- + ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
- +
- + if (ar->ht_cap_info & WMI_HT_CAP_HT40_SGI)
- + ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
- +
- + if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) {
- + u32 smps;
- +
- + smps = WLAN_HT_CAP_SM_PS_DYNAMIC;
- + smps <<= IEEE80211_HT_CAP_SM_PS_SHIFT;
- +
- + ht_cap.cap |= smps;
- + }
- +
- + if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC)
- + ht_cap.cap |= IEEE80211_HT_CAP_TX_STBC;
- +
- + if (ar->ht_cap_info & WMI_HT_CAP_RX_STBC) {
- + u32 stbc;
- +
- + stbc = ar->ht_cap_info;
- + stbc &= WMI_HT_CAP_RX_STBC;
- + stbc >>= WMI_HT_CAP_RX_STBC_MASK_SHIFT;
- + stbc <<= IEEE80211_HT_CAP_RX_STBC_SHIFT;
- + stbc &= IEEE80211_HT_CAP_RX_STBC;
- +
- + ht_cap.cap |= stbc;
- + }
- +
- + if (ar->ht_cap_info & WMI_HT_CAP_LDPC)
- + ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
- +
- + if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT)
- + ht_cap.cap |= IEEE80211_HT_CAP_LSIG_TXOP_PROT;
- +
- + /* max AMSDU is implicitly taken from vht_cap_info */
- + if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK)
- + ht_cap.cap |= IEEE80211_HT_CAP_MAX_AMSDU;
- +
- + for (i = 0; i < ar->num_rf_chains; i++) {
- + if (ar->cfg_rx_chainmask & BIT(i))
- + ht_cap.mcs.rx_mask[i] = 0xFF;
- + }
- +
- + ht_cap.mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED;
- +
- + return ht_cap;
- +}
- +
- static int __ath10k_set_antenna(struct ath10k *ar, u32 tx_ant, u32 rx_ant)
- {
- int ret;
- @@ -4068,39 +4208,6 @@ static u32 get_nss_from_chainmask(u16 ch
- return 1;
- }
-
- -static int ath10k_mac_get_vht_cap_bf_sts(struct ath10k *ar)
- -{
- - int nsts = ar->vht_cap_info;
- -
- - nsts &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK;
- - nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT;
- -
- - /* If firmware does not deliver to host number of space-time
- - * streams supported, assume it support up to 4 BF STS and return
- - * the value for VHT CAP: nsts-1)
- - * */
- - if (nsts == 0)
- - return 3;
- -
- - return nsts;
- -}
- -
- -static int ath10k_mac_get_vht_cap_bf_sound_dim(struct ath10k *ar)
- -{
- - int sound_dim = ar->vht_cap_info;
- -
- - sound_dim &= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK;
- - sound_dim >>= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
- -
- - /* If the sounding dimension is not advertised by the firmware,
- - * let's use a default value of 1
- - */
- - if (sound_dim == 0)
- - return 1;
- -
- - return sound_dim;
- -}
- -
- static int ath10k_mac_set_txbf_conf(struct ath10k_vif *arvif)
- {
- u32 value = 0;
- @@ -6954,113 +7061,6 @@ static const struct ieee80211_iface_comb
- },
- };
-
- -static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
- -{
- - struct ieee80211_sta_vht_cap vht_cap = {0};
- - u16 mcs_map;
- - u32 val;
- - int i;
- -
- - vht_cap.vht_supported = 1;
- - vht_cap.cap = ar->vht_cap_info;
- -
- - if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
- - IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE)) {
- - val = ath10k_mac_get_vht_cap_bf_sts(ar);
- - val <<= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT;
- - val &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK;
- -
- - vht_cap.cap |= val;
- - }
- -
- - if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
- - IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)) {
- - val = ath10k_mac_get_vht_cap_bf_sound_dim(ar);
- - val <<= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
- - val &= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK;
- -
- - vht_cap.cap |= val;
- - }
- -
- - mcs_map = 0;
- - for (i = 0; i < 8; i++) {
- - if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i)))
- - mcs_map |= IEEE80211_VHT_MCS_SUPPORT_0_9 << (i*2);
- - else
- - mcs_map |= IEEE80211_VHT_MCS_NOT_SUPPORTED << (i*2);
- - }
- -
- - vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map);
- - vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map);
- -
- - return vht_cap;
- -}
- -
- -static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar)
- -{
- - int i;
- - struct ieee80211_sta_ht_cap ht_cap = {0};
- -
- - if (!(ar->ht_cap_info & WMI_HT_CAP_ENABLED))
- - return ht_cap;
- -
- - ht_cap.ht_supported = 1;
- - ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
- - ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_8;
- - ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
- - ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40;
- - ht_cap.cap |= WLAN_HT_CAP_SM_PS_STATIC << IEEE80211_HT_CAP_SM_PS_SHIFT;
- -
- - if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI)
- - ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
- -
- - if (ar->ht_cap_info & WMI_HT_CAP_HT40_SGI)
- - ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
- -
- - if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) {
- - u32 smps;
- -
- - smps = WLAN_HT_CAP_SM_PS_DYNAMIC;
- - smps <<= IEEE80211_HT_CAP_SM_PS_SHIFT;
- -
- - ht_cap.cap |= smps;
- - }
- -
- - if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC)
- - ht_cap.cap |= IEEE80211_HT_CAP_TX_STBC;
- -
- - if (ar->ht_cap_info & WMI_HT_CAP_RX_STBC) {
- - u32 stbc;
- -
- - stbc = ar->ht_cap_info;
- - stbc &= WMI_HT_CAP_RX_STBC;
- - stbc >>= WMI_HT_CAP_RX_STBC_MASK_SHIFT;
- - stbc <<= IEEE80211_HT_CAP_RX_STBC_SHIFT;
- - stbc &= IEEE80211_HT_CAP_RX_STBC;
- -
- - ht_cap.cap |= stbc;
- - }
- -
- - if (ar->ht_cap_info & WMI_HT_CAP_LDPC)
- - ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
- -
- - if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT)
- - ht_cap.cap |= IEEE80211_HT_CAP_LSIG_TXOP_PROT;
- -
- - /* max AMSDU is implicitly taken from vht_cap_info */
- - if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK)
- - ht_cap.cap |= IEEE80211_HT_CAP_MAX_AMSDU;
- -
- - for (i = 0; i < ar->num_rf_chains; i++) {
- - if (ar->cfg_rx_chainmask & BIT(i))
- - ht_cap.mcs.rx_mask[i] = 0xFF;
- - }
- -
- - ht_cap.mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED;
- -
- - return ht_cap;
- -}
- -
- static void ath10k_get_arvif_iter(void *data, u8 *mac,
- struct ieee80211_vif *vif)
- {
|