From 4dc5f8bab2663b902b9cb0be29198dbbf38aa3fb Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Sat, 31 May 2014 18:05:13 +0200 Subject: [PATCH] staging: rtl8723au: Eliminate struct HT_info_element Yet another duplicate version of struct ieee80211_ht_operation Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_ap.c | 14 ++++++----- .../staging/rtl8723au/core/rtw_ieee80211.c | 6 ++--- .../staging/rtl8723au/core/rtw_ioctl_set.c | 4 +-- drivers/staging/rtl8723au/core/rtw_mlme.c | 14 ++++++----- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 23 +++++++++-------- .../staging/rtl8723au/core/rtw_wlan_util.c | 25 ++++++++++--------- .../staging/rtl8723au/include/rtw_mlme_ext.h | 2 +- drivers/staging/rtl8723au/include/rtw_rf.h | 11 -------- drivers/staging/rtl8723au/include/wifi.h | 11 -------- 9 files changed, 47 insertions(+), 63 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 83be27fdea9b..d67a5f1bfc44 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -652,7 +652,7 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network; - struct HT_info_element *pht_info = NULL; + struct ieee80211_ht_operation *pht_info = NULL; int bcn_fixed_size; bcn_interval = (u16)pnetwork->BeaconPeriod; @@ -736,18 +736,20 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf) pnetwork->IEs + bcn_fixed_size, pnetwork->IELength - bcn_fixed_size); if (p && p[1]) { - pht_info = (struct HT_info_element *)(p + 2); + pht_info = (struct ieee80211_ht_operation *)(p + 2); - if (pregpriv->cbw40_enable && pht_info->infos[0] & BIT(2)) { + if (pregpriv->cbw40_enable && pht_info->ht_param & + IEEE80211_HT_PARAM_CHAN_WIDTH_ANY) { /* switch to the 40M Hz mode */ cur_bwmode = HT_CHANNEL_WIDTH_40; - switch (pht_info->infos[0] & 0x3) { - case 1: + switch (pht_info->ht_param & + IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { + case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: /* pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; */ cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; break; - case 3: + case IEEE80211_HT_PARAM_CHA_SEC_BELOW: cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; break; default: diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c b/drivers/staging/rtl8723au/core/rtw_ieee80211.c index 47ac4e917f2d..69d2423ac176 100644 --- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c @@ -859,7 +859,7 @@ void rtw_get_bcn_info23a(struct wlan_network *pnetwork) u8 bencrypt = 0; /* u8 wpa_ie[255], rsn_ie[255]; */ u16 wpa_len = 0, rsn_len = 0; - struct HT_info_element *pht_info; + struct ieee80211_ht_operation *pht_info; struct ieee80211_ht_cap *pht_cap; const u8 *p; @@ -916,8 +916,8 @@ void rtw_get_bcn_info23a(struct wlan_network *pnetwork) pnetwork->network.IEs + _FIXED_IE_LENGTH_, pnetwork->network.IELength - _FIXED_IE_LENGTH_); if (p && p[1] > 0) { - pht_info = (struct HT_info_element *)(p + 2); - pnetwork->BcnInfo.ht_info_infos_0 = pht_info->infos[0]; + pht_info = (struct ieee80211_ht_operation *)(p + 2); + pnetwork->BcnInfo.ht_info_infos_0 = pht_info->ht_param; } else pnetwork->BcnInfo.ht_info_infos_0 = 0; } diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c index e9f46a688895..1d2ea4e1737c 100644 --- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c +++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c @@ -394,8 +394,8 @@ u16 rtw_get_cur_max_rate23a(struct rtw_adapter *adapter) /* cur_bwmod is updated by beacon, pmlmeinfo is updated by association response */ bw_40MHz = (pmlmeext->cur_bwmode && - (IEEE80211_HT_PARAM_CHAN_WIDTH_ANY & - pmlmeinfo->HT_info.infos[0])) ? 1:0; + (pmlmeinfo->HT_info.ht_param & + IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) ? 1:0; /* short_GI = (pht_capie->cap_info & (IEEE80211_HT_CAP _SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1 : 0; */ diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c index 297e2e47ea54..99828863eed4 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -2322,7 +2322,7 @@ void rtw_update_ht_cap23a(struct rtw_adapter *padapter, u8 *pie, uint ie_len) if (pregistrypriv->cbw40_enable && pmlmeinfo->ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40) && - pmlmeinfo->HT_info.infos[0] & BIT(2)) { + pmlmeinfo->HT_info.ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY) { int i; u8 rf_type; @@ -2339,13 +2339,13 @@ void rtw_update_ht_cap23a(struct rtw_adapter *padapter, u8 *pie, uint ie_len) } /* switch to the 40M Hz mode accoring to the AP */ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40; - switch ((pmlmeinfo->HT_info.infos[0] & 0x3)) - { - case HT_EXTCHNL_OFFSET_UPPER: + switch (pmlmeinfo->HT_info.ht_param & + IEEE80211_HT_PARAM_CHAN_WIDTH_ANY) { + case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; break; - case HT_EXTCHNL_OFFSET_LOWER: + case IEEE80211_HT_PARAM_CHA_SEC_BELOW: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; break; @@ -2368,7 +2368,9 @@ void rtw_update_ht_cap23a(struct rtw_adapter *padapter, u8 *pie, uint ie_len) /* */ /* Config current HT Protection mode. */ /* */ - pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3; + pmlmeinfo->HT_protection = + le16_to_cpu(pmlmeinfo->HT_info.operation_mode) & + IEEE80211_HT_OP_MODE_PROTECTION; } void rtw_issue_addbareq_cmd23a(struct rtw_adapter *padapter, diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index b5f1d40eea07..0dc49d3552ea 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -4640,9 +4640,9 @@ int collect_bss_info23a(struct rtw_adapter *padapter, bssid->IEs + ie_offset, bssid->IELength - ie_offset); if (p) { - struct HT_info_element *HT_info = - (struct HT_info_element *)(p + 2); - bssid->DSConfig = HT_info->primary_channel; + struct ieee80211_ht_operation *HT_info = + (struct ieee80211_ht_operation *)(p + 2); + bssid->DSConfig = HT_info->primary_chan; } else /* use current channel */ bssid->DSConfig = rtw_get_oper_ch23a(padapter); } @@ -5959,7 +5959,7 @@ int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wlan_bssid_ex *pnetwork = &pmlmeinfo->network; const struct wlan_bssid_ex *pparm = (struct wlan_bssid_ex *)pbuf; - struct HT_info_element *pht_info; + struct ieee80211_ht_operation *pht_info; u32 i; int bcn_fixed_size; u8 *p; @@ -6028,20 +6028,21 @@ int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) /* spec case only for cisco's ap because cisco's ap * issue assoc rsp using mcs rate @40MHz or @20MHz */ - pht_info = (struct HT_info_element *)(p + 2); + pht_info = (struct ieee80211_ht_operation *)(p + 2); - if ((pregpriv->cbw40_enable) && - (pht_info->infos[0] & BIT(2))) { + if (pregpriv->cbw40_enable && + (pht_info->ht_param & + IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) { /* switch to the 40M Hz mode according to AP */ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40; - switch (pht_info->infos[0] & 0x3) - { - case 1: + switch (pht_info->ht_param & + IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { + case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; break; - case 3: + case IEEE80211_HT_PARAM_CHA_SEC_BELOW: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; break; diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c b/drivers/staging/rtl8723au/core/rtw_wlan_util.c index 1194a6e5be42..6d69811b904c 100644 --- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c @@ -635,7 +635,7 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter) static void bwmode_update_check(struct rtw_adapter *padapter, u8 *p) { - struct HT_info_element *pHT_info; + struct ieee80211_ht_operation *pHT_info; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; @@ -648,19 +648,20 @@ static void bwmode_update_check(struct rtw_adapter *padapter, u8 *p) return; if (!phtpriv->ht_option) return; - if (p[1] > sizeof(struct HT_info_element)) + if (p[1] != sizeof(struct ieee80211_ht_operation)) return; - pHT_info = (struct HT_info_element *)(p + 2); + pHT_info = (struct ieee80211_ht_operation *)(p + 2); - if ((pHT_info->infos[0] & BIT(2)) && pregistrypriv->cbw40_enable) { + if ((pHT_info->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY) && + pregistrypriv->cbw40_enable) { new_bwmode = HT_CHANNEL_WIDTH_40; - switch (pHT_info->infos[0] & 0x3) { - case 1: + switch (pHT_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET){ + case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: new_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; break; - case 3: + case IEEE80211_HT_PARAM_CHA_SEC_BELOW: new_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; break; default: @@ -786,7 +787,7 @@ void HT_info_handler23a(struct rtw_adapter *padapter, u8 *p) if (phtpriv->ht_option == false) return; - if (p[1] > sizeof(struct HT_info_element)) + if (p[1] != sizeof(struct ieee80211_ht_operation)) return; pmlmeinfo->HT_info_enable = 1; @@ -883,7 +884,7 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter, struct ieee80211_mgmt *mgmt, u32 pkt_len) { struct wlan_network *cur_network = &Adapter->mlmepriv.cur_network; - struct HT_info_element *pht_info; + struct ieee80211_ht_operation *pht_info; struct ieee80211_ht_cap *pht_cap; struct wlan_bssid_ex *bssid; unsigned short val16; @@ -952,8 +953,8 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter, /* parsing HT_INFO_IE */ p = cfg80211_find_ie(WLAN_EID_HT_OPERATION, pie, pie_len); if (p && p[1] > 0) { - pht_info = (struct HT_info_element *)(p + 2); - ht_info_infos_0 = pht_info->infos[0]; + pht_info = (struct ieee80211_ht_operation *)(p + 2); + ht_info_infos_0 = pht_info->ht_param; } else { pht_info = NULL; ht_info_infos_0 = 0; @@ -985,7 +986,7 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter, p = cfg80211_find_ie(WLAN_EID_HT_OPERATION, pie, pie_len); if (pht_info) - bcn_channel = pht_info->primary_channel; + bcn_channel = pht_info->primary_chan; else { /* we don't find channel IE, so don't check it */ DBG_8723A("Oops: %s we don't find channel IE, so don't " "check it\n", __func__); diff --git a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h index 57622fbc6acc..368e57d255f6 100644 --- a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h @@ -367,7 +367,7 @@ struct mlme_ext_info struct ADDBA_request ADDBA_req; struct WMM_para_element WMM_param; struct ieee80211_ht_cap ht_cap; - struct HT_info_element HT_info; + struct ieee80211_ht_operation HT_info; struct wlan_bssid_ex network;/* join network or bss_network, if in ap mode, it is the same to cur_network.network */ struct FW_Sta_Info FW_sta_info[NUM_STA]; }; diff --git a/drivers/staging/rtl8723au/include/rtw_rf.h b/drivers/staging/rtl8723au/include/rtw_rf.h index 91a0a22a2709..a7de714137b8 100644 --- a/drivers/staging/rtl8723au/include/rtw_rf.h +++ b/drivers/staging/rtl8723au/include/rtw_rf.h @@ -89,17 +89,6 @@ enum ht_channel_width { HT_CHANNEL_WIDTH_10 = 4, }; -/* */ -/* Represent Extention Channel Offset in HT Capabilities */ -/* This is available only in 40Mhz mode. */ -/* */ -enum { - HT_EXTCHNL_OFFSET_NO_EXT = 0, - HT_EXTCHNL_OFFSET_UPPER = 1, - HT_EXTCHNL_OFFSET_NO_DEF = 2, - HT_EXTCHNL_OFFSET_LOWER = 3, -}; - /* 2007/11/15 MH Define different RF type. */ enum { RF_1T2R = 0, diff --git a/drivers/staging/rtl8723au/include/wifi.h b/drivers/staging/rtl8723au/include/wifi.h index 6d221dfc48c5..4ab28e59f8ba 100644 --- a/drivers/staging/rtl8723au/include/wifi.h +++ b/drivers/staging/rtl8723au/include/wifi.h @@ -63,17 +63,6 @@ Below is the definition for 802.11n ------------------------------------------------------------------------------*/ -/* struct rtw_ieee80211_ht_cap - HT additional information - * - * This structure refers to "HT information element" as - * described in 802.11n draft section 7.3.2.53 - */ -struct HT_info_element { - unsigned char primary_channel; - unsigned char infos[5]; - unsigned char MCS_rate[16]; -} __packed; - struct AC_param { unsigned char ACI_AIFSN; unsigned char CW; -- 2.30.2