From ddf5c2bd1044d923ad82f519c68cdf12a055a568 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 19 Jun 2014 11:37:24 +0200 Subject: [PATCH] staging: rtl8723au: Update bss beacon info in rtw_add_beacon() Pull out the core info beacon_interval, capability, and tsf and update cur_network.network with the info in rtw_add_beacon() instead of relying on it being in ->IEs. This will help later when getting rid of the beacon struct info from ->IEs and only carrying the actual IEs there. Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_ap.c | 6 ------ drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 9 ++++++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 73161b943b30..e943b6be6496 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -798,7 +798,6 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf, u8 *pHT_caps_ie = NULL; u8 *pHT_info_ie = NULL; struct sta_info *psta = NULL; - __le16 *pbeacon; u16 cap, ht_cap = false; uint ie_len = 0; int group_cipher, pairwise_cipher; @@ -844,11 +843,6 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf, memcpy(pbss_network->MacAddress, myid(&padapter->eeprompriv), ETH_ALEN); - /* beacon interval */ - /* ie + 8; 8: TimeStamp, 2: Beacon Interval 2:Capability */ - pbeacon = rtw_get_beacon_interval23a_from_ie(ie); - pbss_network->beacon_interval = get_unaligned_le16(pbeacon); - /* capability */ cap = get_unaligned_le16(ie); diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index 80d5fe7bf00b..6c06d5772cb4 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -2915,6 +2915,8 @@ static int rtw_add_beacon(struct rtw_adapter *adapter, const u8 *head, u8 *pbuf; uint len, wps_ielen = 0; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; + struct wlan_bssid_ex *bss = &pmlmepriv->cur_network.network; + const struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)head; /* struct sta_priv *pstapriv = &padapter->stapriv; */ DBG_8723A("%s beacon_head_len =%zu, beacon_tail_len =%zu\n", @@ -2923,12 +2925,17 @@ static int rtw_add_beacon(struct rtw_adapter *adapter, const u8 *head, if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) return -EINVAL; - if (head_len < sizeof(struct ieee80211_hdr_3addr)) + if (head_len < offsetof(struct ieee80211_mgmt, u.beacon.variable)) return -EINVAL; pbuf = kzalloc(head_len + tail_len, GFP_KERNEL); if (!pbuf) return -ENOMEM; + + bss->beacon_interval = get_unaligned_le16(&mgmt->u.beacon.beacon_int); + bss->capability = get_unaligned_le16(&mgmt->u.beacon.capab_info); + bss->tsf = get_unaligned_le64(&mgmt->u.beacon.timestamp); + /* 24 = beacon header len. */ memcpy(pbuf, (void *)head + sizeof(struct ieee80211_hdr_3addr), head_len - sizeof(struct ieee80211_hdr_3addr)); -- 2.11.0