Commit 9af36808 authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: rtl8723au: OnBeacon23a() tidy up code

Clean up the excessive if() levels at the end, and use struct
ieee80211_mgmt to calculate pointers passed on to check_assoc_AP23a()
Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9aac910a
...@@ -740,8 +740,8 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) ...@@ -740,8 +740,8 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
pie = mgmt->u.beacon.variable; pie = mgmt->u.beacon.variable;
pie_len = pkt_len - offsetof(struct ieee80211_mgmt, u.beacon.variable); pie_len = pkt_len - offsetof(struct ieee80211_mgmt, u.beacon.variable);
p = rtw_get_ie23a(pie, WLAN_EID_EXT_SUPP_RATES, &ielen, pie_len); p = rtw_get_ie23a(pie, WLAN_EID_EXT_SUPP_RATES, &ielen, pie_len);
if ((p != NULL) && (ielen > 0)) { if (p && ielen > 0) {
if ((*(p + 1 + ielen) == 0x2D) && (*(p + 2 + ielen) != 0x2D)) { if (p[1 + ielen] == 0x2D && p[2 + ielen] != 0x2D) {
/* Invalid value 0x2D is detected in Extended Supported /* Invalid value 0x2D is detected in Extended Supported
* Rates (ESR) IE. Try to fix the IE length to avoid * Rates (ESR) IE. Try to fix the IE length to avoid
* failed Beacon parsing. * failed Beacon parsing.
...@@ -750,7 +750,7 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) ...@@ -750,7 +750,7 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
"Beacon of BSSID: %pM. Fix the length of " "Beacon of BSSID: %pM. Fix the length of "
"ESR IE to avoid failed Beacon parsing.\n", "ESR IE to avoid failed Beacon parsing.\n",
mgmt->bssid); mgmt->bssid);
*(p + 1) = ielen - 1; p[1] = ielen - 1;
} }
} }
...@@ -759,25 +759,30 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) ...@@ -759,25 +759,30 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
return _SUCCESS; return _SUCCESS;
} }
if (ether_addr_equal(mgmt->bssid, if (!ether_addr_equal(mgmt->bssid,
get_my_bssid23a(&pmlmeinfo->network))){ get_my_bssid23a(&pmlmeinfo->network)))
goto out;
if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) { if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) {
/* we should update current network before auth, /* we should update current network before auth,
or some IE is wrong */ or some IE is wrong */
pbss = (struct wlan_bssid_ex *) pbss = (struct wlan_bssid_ex *)
kmalloc(sizeof(struct wlan_bssid_ex), kmalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC);
GFP_ATOMIC);
if (pbss) { if (pbss) {
if (collect_bss_info23a(padapter, precv_frame, if (collect_bss_info23a(padapter, precv_frame, pbss) ==
pbss) == _SUCCESS) { _SUCCESS) {
update_network23a(&pmlmepriv->cur_network.network, pbss, padapter, true); update_network23a(
&pmlmepriv->cur_network.network, pbss,
padapter, true);
rtw_get_bcn_info23a(&pmlmepriv->cur_network); rtw_get_bcn_info23a(&pmlmepriv->cur_network);
} }
kfree(pbss); kfree(pbss);
} }
/* check the vendor of the assoc AP */ /* check the vendor of the assoc AP */
pmlmeinfo->assoc_AP_vendor = check_assoc_AP23a(pframe + sizeof(struct ieee80211_hdr_3addr), pkt_len-sizeof(struct ieee80211_hdr_3addr)); pmlmeinfo->assoc_AP_vendor =
check_assoc_AP23a((u8 *)&mgmt->u.beacon, pkt_len -
offsetof(struct ieee80211_mgmt, u));
/* update TSF Value */ /* update TSF Value */
update_TSF23a(pmlmeext, pframe, pkt_len); update_TSF23a(pmlmeext, pframe, pkt_len);
...@@ -788,15 +793,13 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) ...@@ -788,15 +793,13 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
return _SUCCESS; return _SUCCESS;
} }
if (((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) && if (((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE) &&
(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) { (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) {
psta = rtw_get_stainfo23a(pstapriv, mgmt->sa); psta = rtw_get_stainfo23a(pstapriv, mgmt->sa);
if (psta) { if (psta) {
ret = rtw_check_bcn_info23a(padapter, mgmt, ret = rtw_check_bcn_info23a(padapter, mgmt, pkt_len);
pkt_len);
if (!ret) { if (!ret) {
DBG_8723A_LEVEL(_drv_always_, DBG_8723A_LEVEL(_drv_always_, "ap has changed, "
"ap has changed, "
"disconnect now\n"); "disconnect now\n");
receive_disconnect23a(padapter, pmlmeinfo->network.MacAddress, 65535); receive_disconnect23a(padapter, pmlmeinfo->network.MacAddress, 65535);
return _SUCCESS; return _SUCCESS;
...@@ -825,14 +828,13 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) ...@@ -825,14 +828,13 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
/* allocate a new CAM entry for IBSS station */ /* allocate a new CAM entry for IBSS station */
cam_idx = allocate_fw_sta_entry23a(padapter); cam_idx = allocate_fw_sta_entry23a(padapter);
if (cam_idx == NUM_STA) if (cam_idx == NUM_STA)
goto _END_ONBEACON_; goto out;
/* get supported rate */ /* get supported rate */
if (update_sta_support_rate23a(padapter, pie, if (update_sta_support_rate23a(padapter, pie, pie_len,
pie_len,
cam_idx) == _FAIL) { cam_idx) == _FAIL) {
pmlmeinfo->FW_sta_info[cam_idx].status = 0; pmlmeinfo->FW_sta_info[cam_idx].status = 0;
goto _END_ONBEACON_; goto out;
} }
/* update TSF Value */ /* update TSF Value */
...@@ -843,9 +845,8 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) ...@@ -843,9 +845,8 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
cam_idx); cam_idx);
} }
} }
}
_END_ONBEACON_: out:
return _SUCCESS; return _SUCCESS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment