From: Jes Sorensen Date: Sat, 31 May 2014 16:05:17 +0000 (+0200) Subject: staging: rtl8723au: Rewrite update_beacon23a_info() tto use cfg80211_find_ie() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7882ef454c613c8e79700ca1c81274357e1286ff;p=linux-beck.git staging: rtl8723au: Rewrite update_beacon23a_info() tto use cfg80211_find_ie() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 0dc49d3552ea..bf0d62e53ffd 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -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 { diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c b/drivers/staging/rtl8723au/core/rtw_wlan_util.c index a9fa109ed1d0..82904d067b2e 100644 --- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c @@ -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); } } diff --git a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h index 368e57d255f6..b8a108bc80de 100644 --- a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h @@ -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);