staging: rtl8723au: Eliminate struct HT_info_element
authorJes Sorensen <Jes.Sorensen@redhat.com>
Sat, 31 May 2014 16:05:13 +0000 (18:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jun 2014 19:35:40 +0000 (12:35 -0700)
Yet another duplicate version of struct ieee80211_ht_operation

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_ap.c
drivers/staging/rtl8723au/core/rtw_ieee80211.c
drivers/staging/rtl8723au/core/rtw_ioctl_set.c
drivers/staging/rtl8723au/core/rtw_mlme.c
drivers/staging/rtl8723au/core/rtw_mlme_ext.c
drivers/staging/rtl8723au/core/rtw_wlan_util.c
drivers/staging/rtl8723au/include/rtw_mlme_ext.h
drivers/staging/rtl8723au/include/rtw_rf.h
drivers/staging/rtl8723au/include/wifi.h

index 83be27fdea9bfa0acbe4aa354dd8db0ffa58ae47..d67a5f1bfc448e61d0b4c7005cd24d796cbd3b75 100644 (file)
@@ -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:
index 47ac4e917f2d089e3d0471205219995a42ffa9ef..69d2423ac176d47bf80da7eb3e4d01ad711fd97e 100644 (file)
@@ -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;
 }
index e9f46a6888958466bb3e47ab8d3bdbbb0c280984..1d2ea4e1737c847eb9ea53efd47cc297ff54fe35 100644 (file)
@@ -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; */
index 297e2e47ea5479475777f8569637a658c843771f..99828863eed42c7095eb67def45d9c9a4840b204 100644 (file)
@@ -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,
index b5f1d40eea0789f2f4e52a7a07aebf806cc28755..0dc49d3552ea15a374d4bf3b4a0b6393974c692c 100644 (file)
@@ -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;
index 1194a6e5be42b31a1c7d7198b5aefde3c22e361c..6d69811b904c9edf20159c42543ebed2166bed5f 100644 (file)
@@ -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__);
index 57622fbc6acca8018a4802629a828249640ca213..368e57d255f688397ba1c199b3b2b5671569410c 100644 (file)
@@ -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];
 };
index 91a0a22a2709d38c3ab191c8004d0866d6bb85a0..a7de714137b82ade698bfa82fbd3ff6d050d14ea 100644 (file)
@@ -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,
index 6d221dfc48c55ba1a51f19737bd999d49d0d63ab..4ab28e59f8bafff5fe5e9ed238fcb469438a8b28 100644 (file)
                                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;