From 3d3cd94d0d695292ba29a918669faca8ecf368cd Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Wed, 24 Aug 2016 15:21:55 +0700 Subject: [PATCH] staging: r8188eu: replace HT_caps_element with ieee80211_ht_cap structure HT_caps_element is reimplementation of ieee80211_ht_cap. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_ap.c | 10 +++---- .../staging/rtl8188eu/core/rtw_ioctl_set.c | 6 ++--- drivers/staging/rtl8188eu/core/rtw_mlme.c | 12 ++++----- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 22 +++++++-------- .../staging/rtl8188eu/core/rtw_wlan_util.c | 27 ++++++++++--------- .../staging/rtl8188eu/include/rtw_mlme_ext.h | 6 ++--- 6 files changed, 42 insertions(+), 41 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index be4d624ce615..3562f118347d 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -706,12 +706,12 @@ static void update_hw_ht_param(struct adapter *padapter) /* handle A-MPDU parameter field */ /* - AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k - AMPDU_para [4:2]:Min MPDU Start Spacing + ampdu_params_info [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k + ampdu_params_info [4:2]:Min MPDU Start Spacing */ - max_AMPDU_len = pmlmeinfo->HT_caps.AMPDU_para & 0x03; + max_AMPDU_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x03; - min_MPDU_spacing = (pmlmeinfo->HT_caps.AMPDU_para & 0x1c) >> 2; + min_MPDU_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2; rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 *)(&min_MPDU_spacing)); @@ -720,7 +720,7 @@ static void update_hw_ht_param(struct adapter *padapter) /* */ /* Config SM Power Save setting */ /* */ - pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & 0x0C) >> 2; + pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) & 0x0C) >> 2; if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) DBG_88E("%s(): WLAN_HT_CAP_SM_PS_STATIC\n", __func__); } diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c index a83075215710..6ed23f4db38c 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c +++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c @@ -588,8 +588,8 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) /* cur_bwmod is updated by beacon, pmlmeinfo is updated by association response */ bw_40MHz = (pmlmeext->cur_bwmode && (HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH & pmlmeinfo->HT_info.infos[0])) ? 1 : 0; - short_GI_20 = (le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & IEEE80211_HT_CAP_SGI_20) ? 1 : 0; - short_GI_40 = (le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & IEEE80211_HT_CAP_SGI_40) ? 1 : 0; + short_GI_20 = (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) & IEEE80211_HT_CAP_SGI_20) ? 1 : 0; + short_GI_40 = (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) & IEEE80211_HT_CAP_SGI_40) ? 1 : 0; rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); max_rate = rtw_mcs_rate( @@ -597,7 +597,7 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) bw_40MHz & (pregistrypriv->cbw40_enable), short_GI_20, short_GI_40, - pmlmeinfo->HT_caps.MCS_rate + pmlmeinfo->HT_caps.mcs.rx_mask ); } } else { diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index 03baaa108f7f..a16d9512d445 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -1971,8 +1971,8 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ rtw_hal_get_def_var(padapter, HAL_DEF_MAX_RECVBUF_SZ, &max_recvbuf_sz); /* - AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k - AMPDU_para [4:2]:Min MPDU Start Spacing + ampdu_params_info [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k + ampdu_params_info [4:2]:Min MPDU Start Spacing */ rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); @@ -2044,7 +2044,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) /* update cur_bwmode & cur_ch_offset */ if ((pregistrypriv->cbw40_enable) && - (le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & BIT(1)) && + (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) & BIT(1)) && (pmlmeinfo->HT_info.infos[0] & BIT(2))) { int i; u8 rf_type; @@ -2054,9 +2054,9 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) /* update the MCS rates */ for (i = 0; i < 16; i++) { if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) - pmlmeinfo->HT_caps.MCS_rate[i] &= MCS_rate_1R[i]; + ((u8 *)&pmlmeinfo->HT_caps.mcs)[i] &= MCS_rate_1R[i]; else - pmlmeinfo->HT_caps.MCS_rate[i] &= MCS_rate_2R[i]; + ((u8 *)&pmlmeinfo->HT_caps.mcs)[i] &= MCS_rate_2R[i]; } /* switch to the 40M Hz mode according to the AP */ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40; @@ -2074,7 +2074,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) } /* Config SM Power Save setting */ - pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & 0x0C) >> 2; + pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) & 0x0C) >> 2; if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) DBG_88E("%s(): WLAN_HT_CAP_SM_PS_STATIC\n", __func__); diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 5b7cb480d6ab..ed026f72b733 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -1132,23 +1132,23 @@ static void issue_assocreq(struct adapter *padapter) if (padapter->mlmepriv.htpriv.ht_option) { p = rtw_get_ie((pmlmeinfo->network.IEs + sizeof(struct ndis_802_11_fixed_ie)), _HT_CAPABILITY_IE_, &ie_len, (pmlmeinfo->network.IELength - sizeof(struct ndis_802_11_fixed_ie))); if ((p != NULL) && (!(is_ap_in_tkip(padapter)))) { - memcpy(&(pmlmeinfo->HT_caps), (p + 2), sizeof(struct HT_caps_element)); + memcpy(&pmlmeinfo->HT_caps, p + 2, sizeof(struct ieee80211_ht_cap)); /* to disable 40M Hz support while gd_bw_40MHz_en = 0 */ if (pregpriv->cbw40_enable == 0) - pmlmeinfo->HT_caps.HT_caps_info &= cpu_to_le16(~(BIT(6) | BIT(1))); + pmlmeinfo->HT_caps.cap_info &= cpu_to_le16(~(BIT(6) | BIT(1))); else - pmlmeinfo->HT_caps.HT_caps_info |= cpu_to_le16(BIT(1)); + pmlmeinfo->HT_caps.cap_info |= cpu_to_le16(BIT(1)); /* todo: disable SM power save mode */ - pmlmeinfo->HT_caps.HT_caps_info |= cpu_to_le16(0x000c); + pmlmeinfo->HT_caps.cap_info |= cpu_to_le16(0x000c); rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); switch (rf_type) { case RF_1T1R: if (pregpriv->rx_stbc) - pmlmeinfo->HT_caps.HT_caps_info |= cpu_to_le16(0x0100);/* RX STBC One spatial stream */ - memcpy(pmlmeinfo->HT_caps.MCS_rate, MCS_rate_1R, 16); + pmlmeinfo->HT_caps.cap_info |= cpu_to_le16(0x0100);/* RX STBC One spatial stream */ + memcpy((u8 *)&pmlmeinfo->HT_caps.mcs, MCS_rate_1R, 16); break; case RF_2T2R: case RF_1T2R: @@ -1157,9 +1157,9 @@ static void issue_assocreq(struct adapter *padapter) ((pmlmeext->cur_wireless_mode & WIRELESS_11_24N) && (pregpriv->rx_stbc == 0x1)) || /* enable for 2.4GHz */ (pregpriv->wifi_spec == 1)) { DBG_88E("declare supporting RX STBC\n"); - pmlmeinfo->HT_caps.HT_caps_info |= cpu_to_le16(0x0200);/* RX STBC two spatial stream */ + pmlmeinfo->HT_caps.cap_info |= cpu_to_le16(0x0200);/* RX STBC two spatial stream */ } - memcpy(pmlmeinfo->HT_caps.MCS_rate, MCS_rate_2R, 16); + memcpy(&pmlmeinfo->HT_caps.mcs, MCS_rate_2R, 16); break; } pframe = rtw_set_ie(pframe, _HT_CAPABILITY_IE_, ie_len , (u8 *)(&(pmlmeinfo->HT_caps)), &(pattrib->pktlen)); @@ -2189,10 +2189,10 @@ static u8 collect_bss_info(struct adapter *padapter, struct mlme_priv *pmlmepriv = &padapter->mlmepriv; p = rtw_get_ie(bssid->IEs + ie_offset, _HT_CAPABILITY_IE_, &len, bssid->IELength - ie_offset); if (p && len > 0) { - struct HT_caps_element *pHT_caps; - pHT_caps = (struct HT_caps_element *)(p + 2); + struct ieee80211_ht_cap *pHT_caps = + (struct ieee80211_ht_cap *)(p + 2); - if (le16_to_cpu(pHT_caps->HT_caps_info) & BIT(14)) + if (le16_to_cpu(pHT_caps->cap_info) & BIT(14)) pmlmepriv->num_FortyMHzIntolerant++; } else { pmlmepriv->num_sta_no_ht++; diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 8994e458d72e..2d115d718be2 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c @@ -732,17 +732,17 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) HT_cap[i] &= (pIE->data[i]); } else { /* modify from fw by Thomas 2010/11/17 */ - if ((pmlmeinfo->HT_caps.AMPDU_para & 0x3) > (pIE->data[i] & 0x3)) + if ((pmlmeinfo->HT_caps.ampdu_params_info & 0x3) > (pIE->data[i] & 0x3)) max_AMPDU_len = pIE->data[i] & 0x3; else - max_AMPDU_len = pmlmeinfo->HT_caps.AMPDU_para & 0x3; + max_AMPDU_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x3; - if ((pmlmeinfo->HT_caps.AMPDU_para & 0x1c) > (pIE->data[i] & 0x1c)) - min_MPDU_spacing = pmlmeinfo->HT_caps.AMPDU_para & 0x1c; + if ((pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) > (pIE->data[i] & 0x1c)) + min_MPDU_spacing = pmlmeinfo->HT_caps.ampdu_params_info & 0x1c; else min_MPDU_spacing = pIE->data[i] & 0x1c; - pmlmeinfo->HT_caps.AMPDU_para = max_AMPDU_len | min_MPDU_spacing; + pmlmeinfo->HT_caps.ampdu_params_info = max_AMPDU_len | min_MPDU_spacing; } } @@ -751,9 +751,9 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) /* update the MCS rates */ for (i = 0; i < 16; i++) { if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) - pmlmeinfo->HT_caps.MCS_rate[i] &= MCS_rate_1R[i]; + ((u8 *)&pmlmeinfo->HT_caps.mcs)[i] &= MCS_rate_1R[i]; else - pmlmeinfo->HT_caps.MCS_rate[i] &= MCS_rate_2R[i]; + ((u8 *)&pmlmeinfo->HT_caps.mcs)[i] &= MCS_rate_2R[i]; } } @@ -799,9 +799,9 @@ void HTOnAssocRsp(struct adapter *padapter) AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k AMPDU_para [4:2]:Min MPDU Start Spacing */ - max_AMPDU_len = pmlmeinfo->HT_caps.AMPDU_para & 0x03; + max_AMPDU_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x03; - min_MPDU_spacing = (pmlmeinfo->HT_caps.AMPDU_para & 0x1c) >> 2; + min_MPDU_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2; rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 *)(&min_MPDU_spacing)); @@ -1245,16 +1245,17 @@ unsigned int update_supported_rate(unsigned char *ptn, unsigned int ptn_sz) return mask; } -unsigned int update_MSC_rate(struct HT_caps_element *pHT_caps) +unsigned int update_MSC_rate(struct ieee80211_ht_cap *pHT_caps) { unsigned int mask = 0; - mask = (pHT_caps->MCS_rate[0] << 12) | (pHT_caps->MCS_rate[1] << 20); + mask = (pHT_caps->mcs.rx_mask[0] << 12) | + (pHT_caps->mcs.rx_mask[1] << 20); return mask; } -int support_short_GI(struct adapter *padapter, struct HT_caps_element *pHT_caps) +int support_short_GI(struct adapter *padapter, struct ieee80211_ht_cap *pHT_caps) { unsigned char bit_offset; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -1268,7 +1269,7 @@ int support_short_GI(struct adapter *padapter, struct HT_caps_element *pHT_caps) bit_offset = (pmlmeext->cur_bwmode & HT_CHANNEL_WIDTH_40) ? 6 : 5; - if (__le16_to_cpu(pHT_caps->HT_caps_info) & (0x1 << bit_offset)) + if (__le16_to_cpu(pHT_caps->cap_info) & (0x1 << bit_offset)) return _SUCCESS; else return _FAIL; diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h index 9c2447e6d161..5ee63661b26f 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h @@ -349,7 +349,7 @@ struct mlme_ext_info { struct ADDBA_request ADDBA_req; struct WMM_para_element WMM_param; - struct HT_caps_element HT_caps; + struct ieee80211_ht_cap HT_caps; struct HT_info_element HT_info; struct wlan_bssid_ex network;/* join network or bss_network, * if in ap mode, it is the same @@ -529,12 +529,12 @@ int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, void update_sta_info(struct adapter *padapter, struct sta_info *psta); unsigned int update_basic_rate(unsigned char *ptn, unsigned int ptn_sz); unsigned int update_supported_rate(unsigned char *ptn, unsigned int ptn_sz); -unsigned int update_MSC_rate(struct HT_caps_element *pHT_caps); +unsigned int update_MSC_rate(struct ieee80211_ht_cap *pHT_caps); void Update_RA_Entry(struct adapter *padapter, u32 mac_id); void set_sta_rate(struct adapter *padapter, struct sta_info *psta); unsigned char get_highest_rate_idx(u32 mask); -int support_short_GI(struct adapter *padapter, struct HT_caps_element *caps); +int support_short_GI(struct adapter *padapter, struct ieee80211_ht_cap *caps); unsigned int is_ap_in_tkip(struct adapter *padapter); unsigned int is_ap_in_wep(struct adapter *padapter); unsigned int should_forbid_n_rate(struct adapter *padapter); -- 2.34.1