staging: rtl8723au: Rewrite update_beacon23a_info() tto use cfg80211_find_ie()
authorJes Sorensen <Jes.Sorensen@redhat.com>
Sat, 31 May 2014 16:05:17 +0000 (18:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jun 2014 19:35:40 +0000 (12:35 -0700)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_mlme_ext.c
drivers/staging/rtl8723au/core/rtw_wlan_util.c
drivers/staging/rtl8723au/include/rtw_mlme_ext.h

index 0dc49d3552ea15a374d4bf3b4a0b6393974c692c..bf0d62e53ffd07ea14e1d20b5d44d1641f76d03a 100644 (file)
@@ -789,7 +789,6 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
        struct sta_priv *pstapriv = &padapter->stapriv;
        struct sk_buff *skb = precv_frame->pkt;
        struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) skb->data;
-       u8 *pframe = skb->data;
        int pkt_len = skb->len;
        struct wlan_bssid_ex *pbss;
        int ret = _SUCCESS;
@@ -869,7 +868,7 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
                           the number of the beacon received */
                        if ((sta_rx_pkts(psta) & 0xf) == 0) {
                                /* DBG_8723A("update_bcn_info\n"); */
-                               update_beacon23a_info(padapter, pframe,
+                               update_beacon23a_info(padapter, mgmt,
                                                      pkt_len, psta);
                        }
                }
@@ -881,7 +880,7 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
                           number of the beacon received */
                        if ((sta_rx_pkts(psta) & 0xf) == 0) {
                                /* DBG_8723A("update_bcn_info\n"); */
-                               update_beacon23a_info(padapter, pframe,
+                               update_beacon23a_info(padapter, mgmt,
                                                      pkt_len, psta);
                        }
                } else {
index a9fa109ed1d0112b5bdd430947c24f9d49117f53..82904d067b2e7508831fd8a5d6723d510b3f8e64 100644 (file)
@@ -633,7 +633,7 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
        return;
 }
 
-static void bwmode_update_check(struct rtw_adapter *padapter, u8 *p)
+static void bwmode_update_check(struct rtw_adapter *padapter, const u8 *p)
 {
        struct ieee80211_ht_operation *pHT_info;
        struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -774,7 +774,7 @@ void HT_caps_handler23a(struct rtw_adapter *padapter, u8 *p)
        return;
 }
 
-void HT_info_handler23a(struct rtw_adapter *padapter, u8 *p)
+void HT_info_handler23a(struct rtw_adapter *padapter, const u8 *p)
 {
        struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
@@ -830,7 +830,7 @@ void HTOnAssocRsp23a(struct rtw_adapter *padapter)
        rtl8723a_set_ampdu_factor(padapter, max_AMPDU_len);
 }
 
-void ERP_IE_handler23a(struct rtw_adapter *padapter, u8 *p)
+void ERP_IE_handler23a(struct rtw_adapter *padapter, const u8 *p)
 {
        struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
@@ -1091,32 +1091,24 @@ _mismatch:
        return _FAIL;
 }
 
-void update_beacon23a_info(struct rtw_adapter *padapter, u8 *pframe,
+void update_beacon23a_info(struct rtw_adapter *padapter,
+                          struct ieee80211_mgmt *mgmt,
                           uint pkt_len, struct sta_info *psta)
 {
-       unsigned int i;
        unsigned int len;
-       u8 *p;
+       const u8 *p;
 
-       len = pkt_len -
-               (_BEACON_IE_OFFSET_ + sizeof(struct ieee80211_hdr_3addr));
+       len = pkt_len - offsetof(struct ieee80211_mgmt, u.beacon.variable);
 
-       for (i = 0; i < len;) {
-               p = (u8 *)(pframe + (_BEACON_IE_OFFSET_ + sizeof(struct ieee80211_hdr_3addr)) + i);
+       p = cfg80211_find_ie(WLAN_EID_HT_OPERATION, mgmt->u.beacon.variable,
+                            len);
+       if (p)
+               bwmode_update_check(padapter, p);
 
-               switch (p[0]) {
-               case WLAN_EID_HT_OPERATION:     /* HT info */
-                       /* HT_info_handler23a(padapter, pIE); */
-                       bwmode_update_check(padapter, p);
-                       break;
-               case WLAN_EID_ERP_INFO:
-                       ERP_IE_handler23a(padapter, p);
-                       VCS_update23a(padapter, psta);
-                       break;
-               default:
-                       break;
-               }
-               i += (p[1] + 2);
+       p = cfg80211_find_ie(WLAN_EID_ERP_INFO, mgmt->u.beacon.variable, len);
+       if (p) {
+               ERP_IE_handler23a(padapter, p);
+               VCS_update23a(padapter, psta);
        }
 }
 
index 368e57d255f688397ba1c199b3b2b5671569410c..b8a108bc80deead0255932f481b2970c869912e7 100644 (file)
@@ -514,14 +514,15 @@ int WMM_param_handler23a(struct rtw_adapter *padapter, u8 *p);
 void WMMOnAssocRsp23a(struct rtw_adapter *padapter);
 
 void HT_caps_handler23a(struct rtw_adapter *padapter, u8 *p);
-void HT_info_handler23a(struct rtw_adapter *padapter, u8 *p);
+void HT_info_handler23a(struct rtw_adapter *padapter, const u8 *p);
 void HTOnAssocRsp23a(struct rtw_adapter *padapter);
 
-void ERP_IE_handler23a(struct rtw_adapter *padapter, u8 *p);
+void ERP_IE_handler23a(struct rtw_adapter *padapter, const u8 *p);
 void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta);
 
-void update_beacon23a_info(struct rtw_adapter *padapter, u8 *pframe, uint len,
-                       struct sta_info *psta);
+void update_beacon23a_info(struct rtw_adapter *padapter,
+                          struct ieee80211_mgmt *mgmt, uint len,
+                          struct sta_info *psta);
 int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
                          struct ieee80211_mgmt *mgmt, u32 packet_len);
 void update_IOT_info23a(struct rtw_adapter *padapter);