staging: r8188eu: clean up OnBeacon
cover staging: r8188eu: clean up OnBeacon
This series cleans up the OnBeacon function. It tries to replace driver-sepcific message parsing with ieee80211 helper functions.
Please apply this after the "another round of cleanups" series.
Martin Kaiser (10):
staging: r8188eu: replace one GetAddr3Ptr call
staging: r8188eu: read timestamp from ieee80211_mgmt
staging: r8188eu: replace GetAddr2Ptr calls
staging: r8188eu: pass only ies to process_p2p_ps_ie
staging: r8188eu: use ie buffer in update_beacon_info
staging: r8188eu: simplify update_sta_support_rate params
staging: r8188eu: exit if beacon is not from our bss
staging: r8188eu: stop beacon processing if kmalloc fails
staging: r8188eu: simplify error handling for missing station
staging: r8188eu: remove a variable
drivers/staging/r8188eu/core/rtw_mlme_ext.c | 130 ++++++++---------- drivers/staging/r8188eu/core/rtw_p2p.c | 11 +- drivers/staging/r8188eu/core/rtw_wlan_util.c | 9 +- .../staging/r8188eu/include/rtw_mlme_ext.h | 3 +- 4 files changed, 66 insertions(+), 87 deletions(-)
Signature · 1 line
2.30.2
PATCH 1/10 staging: r8188eu: replace one GetAddr3Ptr call
Define a struct ieee80211_mgmt in the OnBeacon function. Use it to replace one GetAddr3Ptr call. This is a tiny step towards making GetAddr3Ptr obsolete.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +2 -1
@@ -560,6 +560,7 @@ static void OnProbeRsp(struct adapter *padapter, struct recv_frame *precv_frame)static void OnBeacon (struct adapter *padapter,struct recv_frame *precv_frame) { +struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data;int cam_idx;struct sta_info *psta;struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -576,7 +577,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)return ; } -if (!memcmp (GetAddr3Ptr (pframe),get_my_bssid (&pmlmeinfo->network),ETH_ALEN )) { +if (!memcmp (mgmt->bssid,get_my_bssid (&pmlmeinfo->network),ETH_ALEN )) {if (pmlmeinfo->state &WIFI_FW_AUTH_NULL ) {/* we should update current network before auth, or some IE is wrong */ pbss =kmalloc (sizeof (struct wlan_bssid_ex ),GFP_ATOMIC );
Signature · 1 line
2.30.2
PATCH 2/10 staging: r8188eu: read timestamp from ieee80211_mgmt
In reply to Martin KaiserRead the 64-bit timestamp from struct ieee80211_mgmt instead of parsing the beacon message ourselves.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +2 -19
@@ -389,21 +389,6 @@ static u32 p2p_listen_state_process(struct adapter *padapter, unsigned char *da)return _SUCCESS; } -static void update_TSF (struct mlme_ext_priv *pmlmeext,u8 *pframe) -{ -u8 *pIE; -__le32 *pbuf; - - pIE = pframe +sizeof (struct ieee80211_hdr_3addr ); - pbuf = (__le32 *)pIE; - - pmlmeext->TSFValue =le32_to_cpu (*(pbuf +1 )); - - pmlmeext->TSFValue = pmlmeext->TSFValue <<32 ; - - pmlmeext->TSFValue |=le32_to_cpu (*pbuf); -} -static void correct_TSF (struct adapter *padapter) {u8 reg;
@@ -592,8 +577,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)/* check the vendor of the assoc AP */ pmlmeinfo->assoc_AP_vendor =check_assoc_AP (pframe +sizeof (struct ieee80211_hdr_3addr ), len -sizeof (struct ieee80211_hdr_3addr )); -/* update TSF Value */ -update_TSF (pmlmeext, pframe); + pmlmeext->TSFValue =le64_to_cpu (mgmt->u.beacon.timestamp);/* start auth */ start_clnt_auth (padapter);
@@ -635,8 +619,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)return ; } -/* update TSF Value */ -update_TSF (pmlmeext, pframe); + pmlmeext->TSFValue =le64_to_cpu (mgmt->u.beacon.timestamp);/* report sta add event */ report_add_sta_event (padapter,GetAddr2Ptr (pframe), cam_idx);
Signature · 1 line
2.30.2
PATCH 3/10 staging: r8188eu: replace GetAddr2Ptr calls
In reply to Martin KaiserGet the source address of a beacon frame from our struct ieee80211_mgmt instead of using the driver's internal GetAddr2Ptr helper.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +3 -4
@@ -586,7 +586,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame) }if (((pmlmeinfo->state &0x03 ) ==WIFI_FW_STATION_STATE ) && (pmlmeinfo->state &WIFI_FW_ASSOC_SUCCESS )) { - psta =rtw_get_stainfo (pstapriv,GetAddr2Ptr (pframe)); + psta =rtw_get_stainfo (pstapriv, mgmt->sa);if (psta) { ret =rtw_check_bcn_info (padapter, pframe, len);if (!ret) {
@@ -601,7 +601,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)process_p2p_ps_ie (padapter, (pframe +WLAN_HDR_A3_LEN ), (len -WLAN_HDR_A3_LEN )); } }else if ((pmlmeinfo->state &0x03 ) ==WIFI_FW_ADHOC_STATE ) { - psta =rtw_get_stainfo (pstapriv,GetAddr2Ptr (pframe)); + psta =rtw_get_stainfo (pstapriv, mgmt->sa);if (psta) {/* update WMM, ERP in the beacon */ /* todo: the timer is used instead of the number of the beacon received */
@@ -621,8 +621,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame) pmlmeext->TSFValue =le64_to_cpu (mgmt->u.beacon.timestamp); -/* report sta add event */ -report_add_sta_event (padapter,GetAddr2Ptr (pframe), cam_idx); +report_add_sta_event (padapter, mgmt->sa, cam_idx); } } }
Signature · 1 line
2.30.2
PATCH 4/10 staging: r8188eu: pass only ies to process_p2p_ps_ie
In reply to Martin KaiserThe process_p2p_ps_ie function parses the information elements of a beacon message and extracts p2p-related info.
process_p2p_ps_ie does not receive a pointer to the information elements as one would expect. Instead it receives a pointer to the timestamp field in the beacon message. process_p2p_ps_ie increments this pointer by _BEACON_IE_OFFSET_ to jump to the start of the information elements (and decreases the buffer length accordingly).
This is clumsy and hard to understand. Rewrite this such that process_p2p_ps_ie takes a pointer to the information elements and the total length of all elements. Check up-front that the total length is not negative.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 9 ++++++++- drivers/staging/r8188eu/core/rtw_p2p.c | 11 ++--------- 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +8 -1
@@ -556,6 +556,13 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)uint len = precv_frame->len;struct wlan_bssid_ex *pbss;int ret = _SUCCESS; +u8 *ie_ptr; +u32 ie_len; + + ie_ptr = (u8 *)&mgmt->u.beacon.variable; + if (precv_frame->len < offsetof(struct ieee80211_mgmt, u.beacon.variable)) +return ; + ie_len = precv_frame->len - offsetof(struct ieee80211_mgmt, u.beacon.variable);if (pmlmeext->sitesurvey_res.state ==SCAN_PROCESS ) {report_survey_event (padapter, precv_frame);
@@ -598,7 +605,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)/* todo: the timer is used instead of the number of the beacon received */ if ((sta_rx_pkts (psta) &0xf ) ==0 )update_beacon_info (padapter, pframe, len, psta); -process_p2p_ps_ie (padapter, (pframe +WLAN_HDR_A3_LEN ), (len -WLAN_HDR_A3_LEN )); +process_p2p_ps_ie (padapter, ie_ptr, ie_len); } }else if ((pmlmeinfo->state &0x03 ) ==WIFI_FW_ADHOC_STATE ) { psta =rtw_get_stainfo (pstapriv, mgmt->sa);
drivers/staging/r8188eu/core/rtw_p2p.c +2 -9
@@ -1505,8 +1505,6 @@ void p2p_protocol_wk_hdl(struct adapter *padapter, int intCmdType)void process_p2p_ps_ie (struct adapter *padapter,u8 *IEs,u32 IELength) { -u8 *ies; -u32 ies_len;u8 *p2p_ie;u32 p2p_ielen =0 ;u8 noa_attr[MAX_P2P_IE_LEN ] = {0x00 };/* NoA length should be n*(13) + 2 */
@@ -1518,13 +1516,8 @@ void process_p2p_ps_ie(struct adapter *padapter, u8 *IEs, u32 IELength)if (rtw_p2p_chk_state (pwdinfo,P2P_STATE_NONE ))return ; -if (IELength <= _BEACON_IE_OFFSET_) -return ; - ies = IEs + _BEACON_IE_OFFSET_; - ies_len = IELength - _BEACON_IE_OFFSET_; - - p2p_ie =rtw_get_p2p_ie (ies, ies_len,NULL , &p2p_ielen); + p2p_ie =rtw_get_p2p_ie (IEs, IELength,NULL , &p2p_ielen);while (p2p_ie) { find_p2p = true;
@@ -1579,7 +1572,7 @@ void process_p2p_ps_ie(struct adapter *padapter, u8 *IEs, u32 IELength) }/* Get the next P2P IE */ - p2p_ie =rtw_get_p2p_ie (p2p_ie + p2p_ielen, ies_len - (p2p_ie - ies + p2p_ielen),NULL , &p2p_ielen); + p2p_ie =rtw_get_p2p_ie (p2p_ie + p2p_ielen, IELength - (p2p_ie - IEs + p2p_ielen),NULL , &p2p_ielen); }if (find_p2p) {
Signature · 1 line
2.30.2
PATCH 5/10 staging: r8188eu: use ie buffer in update_beacon_info
In reply to Martin KaiserThe update_beacon_info function parses information elements of a beacon message. It should take the pointer to the information elements and their total length, not the entire beacon message.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 4 ++-- drivers/staging/r8188eu/core/rtw_wlan_util.c | 9 +++------ drivers/staging/r8188eu/include/rtw_mlme_ext.h | 3 +-- 3 files changed, 6 insertions(+), 10 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +2 -2
@@ -604,7 +604,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)/* update WMM, ERP in the beacon */ /* todo: the timer is used instead of the number of the beacon received */ if ((sta_rx_pkts (psta) &0xf ) ==0 ) -update_beacon_info (padapter, pframe, len, psta); +update_beacon_info (padapter, ie_ptr, ie_len, psta);process_p2p_ps_ie (padapter, ie_ptr, ie_len); } }else if ((pmlmeinfo->state &0x03 ) ==WIFI_FW_ADHOC_STATE ) {
@@ -613,7 +613,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)/* update WMM, ERP in the beacon */ /* todo: the timer is used instead of the number of the beacon received */ if ((sta_rx_pkts (psta) &0xf ) ==0 ) -update_beacon_info (padapter, pframe, len, psta); +update_beacon_info (padapter, ie_ptr, ie_len, psta); }else {/* allocate a new CAM entry for IBSS station */ cam_idx =allocate_fw_sta_entry (padapter);
drivers/staging/r8188eu/core/rtw_wlan_util.c +3 -6
@@ -1035,16 +1035,13 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)return _FAIL; } -void update_beacon_info (struct adapter *padapter,u8 *pframe,uint pkt_len,struct sta_info *psta) +void update_beacon_info (struct adapter *padapter,u8 *ie_ptr,uint ie_len,struct sta_info *psta) {unsigned int i; -unsigned int len;struct ndis_802_11_var_ie *pIE; - len = pkt_len - (_BEACON_IE_OFFSET_ +WLAN_HDR_A3_LEN ); - -for (i =0 ; i < len;) { - pIE = (struct ndis_802_11_var_ie *)(pframe + (_BEACON_IE_OFFSET_ +WLAN_HDR_A3_LEN ) + i); +for (i =0 ; i < ie_len;) { + pIE = (struct ndis_802_11_var_ie *)(ie_ptr + i);switch (pIE->ElementID) {case _HT_EXTRA_INFO_IE_:/* HT info */
drivers/staging/r8188eu/include/rtw_mlme_ext.h +1 -2
@@ -447,8 +447,7 @@ void HTOnAssocRsp(struct adapter *padapter);void ERP_IE_handler (struct adapter *padapter,struct ndis_802_11_var_ie *pIE);void VCS_update (struct adapter *padapter,struct sta_info *psta); -void update_beacon_info (struct adapter *padapter,u8 *pframe,uint len, -struct sta_info *psta); +void update_beacon_info (struct adapter *padapter,u8 *ie_ptr,uint ie_len,struct sta_info *psta);int rtw_check_bcn_info (struct adapter *Adapter,u8 *pframe,u32 packet_len);void update_IOT_info (struct adapter *padapter);void update_capinfo (struct adapter *adapter,u16 updatecap);
Signature · 1 line
2.30.2
PATCH 6/10 staging: r8188eu: simplify update_sta_support_rate params
In reply to Martin KaiserThe update_sta_support_rate function takes a pointer to information elements and the total length of all these elements. Use our variables for pointer and length instead of calculating them manually.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +1 -1
@@ -621,7 +621,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)return ;/* get supported rate */ -if (update_sta_support_rate (padapter, (pframe +WLAN_HDR_A3_LEN + _BEACON_IE_OFFSET_), (len -WLAN_HDR_A3_LEN - _BEACON_IE_OFFSET_), cam_idx) == _FAIL) { +if (update_sta_support_rate (padapter, ie_ptr, ie_len, cam_idx) == _FAIL) { pmlmeinfo->FW_sta_info[cam_idx].status =0 ;return ; }
Signature · 1 line
2.30.2
PATCH 7/10 staging: r8188eu: exit if beacon is not from our bss
In reply to Martin KaiserDo not process an incoming beacon message in the OnBeacon function if the beacon was sent by a base station other than the one to which we're connected.
This patch does not modify the behaviour of the code. It reverts the if condition and returns if the beacon should not be processed. This is simpler than wrapping the entire processing into a large if clause.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 103 ++++++++++---------- 1 file changed, 52 insertions(+), 51 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +52 -51
@@ -569,67 +569,68 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)return ; } -if (!memcmp (mgmt->bssid,get_my_bssid (&pmlmeinfo->network),ETH_ALEN )) { -if (pmlmeinfo->state &WIFI_FW_AUTH_NULL ) { -/* we should update current network before auth, or some IE is wrong */ - pbss =kmalloc (sizeof (struct wlan_bssid_ex ),GFP_ATOMIC ); -if (pbss) { -if (collect_bss_info (padapter, precv_frame, pbss) == _SUCCESS) { -update_network (&pmlmepriv->cur_network.network, pbss, padapter, true); -rtw_get_bcn_info (&pmlmepriv->cur_network); - } -kfree (pbss); +if (memcmp (mgmt->bssid,get_my_bssid (&pmlmeinfo->network),ETH_ALEN )) +return ; + +if (pmlmeinfo->state &WIFI_FW_AUTH_NULL ) { +/* we should update current network before auth, or some IE is wrong */ + pbss =kmalloc (sizeof (struct wlan_bssid_ex ),GFP_ATOMIC ); +if (pbss) { +if (collect_bss_info (padapter, precv_frame, pbss) == _SUCCESS) { +update_network (&pmlmepriv->cur_network.network, pbss, padapter, true); +rtw_get_bcn_info (&pmlmepriv->cur_network); } +kfree (pbss); + } -/* check the vendor of the assoc AP */ - pmlmeinfo->assoc_AP_vendor =check_assoc_AP (pframe +sizeof (struct ieee80211_hdr_3addr ), len -sizeof (struct ieee80211_hdr_3addr )); +/* check the vendor of the assoc AP */ + pmlmeinfo->assoc_AP_vendor =check_assoc_AP (pframe +sizeof (struct ieee80211_hdr_3addr ), len -sizeof (struct ieee80211_hdr_3addr )); - pmlmeext->TSFValue =le64_to_cpu (mgmt->u.beacon.timestamp); + pmlmeext->TSFValue =le64_to_cpu (mgmt->u.beacon.timestamp); -/* start auth */ -start_clnt_auth (padapter); +/* start auth */ +start_clnt_auth (padapter); -return ; - } +return ; + } -if (((pmlmeinfo->state &0x03 ) ==WIFI_FW_STATION_STATE ) && (pmlmeinfo->state &WIFI_FW_ASSOC_SUCCESS )) { - psta =rtw_get_stainfo (pstapriv, mgmt->sa); -if (psta) { - ret =rtw_check_bcn_info (padapter, pframe, len); -if (!ret) { -receive_disconnect (padapter, - pmlmeinfo->network.MacAddress,0 ); -return ; - } -/* update WMM, ERP in the beacon */ -/* todo: the timer is used instead of the number of the beacon received */ -if ((sta_rx_pkts (psta) &0xf ) ==0 ) -update_beacon_info (padapter, ie_ptr, ie_len, psta); -process_p2p_ps_ie (padapter, ie_ptr, ie_len); +if (((pmlmeinfo->state &0x03 ) ==WIFI_FW_STATION_STATE ) && (pmlmeinfo->state &WIFI_FW_ASSOC_SUCCESS )) { + psta =rtw_get_stainfo (pstapriv, mgmt->sa); +if (psta) { + ret =rtw_check_bcn_info (padapter, pframe, len); +if (!ret) { +receive_disconnect (padapter, + pmlmeinfo->network.MacAddress,0 ); +return ; } - }else if ((pmlmeinfo->state &0x03 ) ==WIFI_FW_ADHOC_STATE ) { - psta =rtw_get_stainfo (pstapriv, mgmt->sa); -if (psta) { -/* update WMM, ERP in the beacon */ -/* todo: the timer is used instead of the number of the beacon received */ -if ((sta_rx_pkts (psta) &0xf ) ==0 ) -update_beacon_info (padapter, ie_ptr, ie_len, psta); - }else { -/* allocate a new CAM entry for IBSS station */ - cam_idx =allocate_fw_sta_entry (padapter); -if (cam_idx ==NUM_STA ) -return ; +/* update WMM, ERP in the beacon */ +/* todo: the timer is used instead of the number of the beacon received */ +if ((sta_rx_pkts (psta) &0xf ) ==0 ) +update_beacon_info (padapter, ie_ptr, ie_len, psta); +process_p2p_ps_ie (padapter, ie_ptr, ie_len); + } + }else if ((pmlmeinfo->state &0x03 ) ==WIFI_FW_ADHOC_STATE ) { + psta =rtw_get_stainfo (pstapriv, mgmt->sa); +if (psta) { +/* update WMM, ERP in the beacon */ +/* todo: the timer is used instead of the number of the beacon received */ +if ((sta_rx_pkts (psta) &0xf ) ==0 ) +update_beacon_info (padapter, ie_ptr, ie_len, psta); + }else { +/* allocate a new CAM entry for IBSS station */ + cam_idx =allocate_fw_sta_entry (padapter); +if (cam_idx ==NUM_STA ) +return ; -/* get supported rate */ -if (update_sta_support_rate (padapter, ie_ptr, ie_len, cam_idx) == _FAIL) { - pmlmeinfo->FW_sta_info[cam_idx].status =0 ; -return ; - } +/* get supported rate */ +if (update_sta_support_rate (padapter, ie_ptr, ie_len, cam_idx) == _FAIL) { + pmlmeinfo->FW_sta_info[cam_idx].status =0 ; +return ; + } - pmlmeext->TSFValue =le64_to_cpu (mgmt->u.beacon.timestamp); + pmlmeext->TSFValue =le64_to_cpu (mgmt->u.beacon.timestamp); -report_add_sta_event (padapter, mgmt->sa, cam_idx); - } +report_add_sta_event (padapter, mgmt->sa, cam_idx); } } }
Signature · 1 line
2.30.2
PATCH 8/10 staging: r8188eu: stop beacon processing if kmalloc fails
In reply to Martin KaiserIf we cannot allocate a struct wlan_bssid_ex in the OnBeacon function, we should stop processing the incoming beacon message and return.
For kmalloc failures, the current code just skips the update of network and beacon info and tries to continue with the authentication. The update would set the encryption algorithm that should be used for the authentication.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +7 -6
@@ -575,13 +575,14 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)if (pmlmeinfo->state &WIFI_FW_AUTH_NULL ) {/* we should update current network before auth, or some IE is wrong */ pbss =kmalloc (sizeof (struct wlan_bssid_ex ),GFP_ATOMIC ); -if (pbss) { -if (collect_bss_info (padapter, precv_frame, pbss) == _SUCCESS) { -update_network (&pmlmepriv->cur_network.network, pbss, padapter, true); -rtw_get_bcn_info (&pmlmepriv->cur_network); - } -kfree (pbss); +if (!pbss) +return ; + +if (collect_bss_info (padapter, precv_frame, pbss) == _SUCCESS) { +update_network (&pmlmepriv->cur_network.network, pbss, padapter, true); +rtw_get_bcn_info (&pmlmepriv->cur_network); } +kfree (pbss);/* check the vendor of the assoc AP */ pmlmeinfo->assoc_AP_vendor =check_assoc_AP (pframe +sizeof (struct ieee80211_hdr_3addr ), len -sizeof (struct ieee80211_hdr_3addr ));
Signature · 1 line
2.30.2
PATCH 9/10 staging: r8188eu: simplify error handling for missing station
In reply to Martin KaiserSimplify the code to handle the case where we're associated to a station that is not in our list of known stations.
We can simply exit in this case. This patch reverts the if-condition and saves one level of indentation.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +12 -12
@@ -597,19 +597,19 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)if (((pmlmeinfo->state &0x03 ) ==WIFI_FW_STATION_STATE ) && (pmlmeinfo->state &WIFI_FW_ASSOC_SUCCESS )) { psta =rtw_get_stainfo (pstapriv, mgmt->sa); -if (psta) { - ret =rtw_check_bcn_info (padapter, pframe, len); -if (!ret) { -receive_disconnect (padapter, - pmlmeinfo->network.MacAddress,0 ); -return ; - } -/* update WMM, ERP in the beacon */ -/* todo: the timer is used instead of the number of the beacon received */ -if ((sta_rx_pkts (psta) &0xf ) ==0 ) -update_beacon_info (padapter, ie_ptr, ie_len, psta); -process_p2p_ps_ie (padapter, ie_ptr, ie_len); +if (!psta) +return ; + + ret =rtw_check_bcn_info (padapter, pframe, len); +if (!ret) { +receive_disconnect (padapter, pmlmeinfo->network.MacAddress,0 ); +return ; } +/* update WMM, ERP in the beacon */ +/* todo: the timer is used instead of the number of the beacon received */ +if ((sta_rx_pkts (psta) &0xf ) ==0 ) +update_beacon_info (padapter, ie_ptr, ie_len, psta); +process_p2p_ps_ie (padapter, ie_ptr, ie_len); }else if ((pmlmeinfo->state &0x03 ) ==WIFI_FW_ADHOC_STATE ) { psta =rtw_get_stainfo (pstapriv, mgmt->sa);if (psta) {
Signature · 1 line
2.30.2
PATCH 10/10 staging: r8188eu: remove a variable
In reply to Martin KaiserCheck the result of rtw_check_bcn_info directly and remove the ret variable.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +1 -3
@@ -555,7 +555,6 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)u8 *pframe = precv_frame->rx_data;uint len = precv_frame->len;struct wlan_bssid_ex *pbss; -int ret = _SUCCESS;u8 *ie_ptr;u32 ie_len;
@@ -600,8 +599,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame)if (!psta)return ; - ret =rtw_check_bcn_info (padapter, pframe, len); -if (!ret) { +if (rtw_check_bcn_info (padapter, pframe, len) != _SUCCESS) {receive_disconnect (padapter, pmlmeinfo->network.MacAddress,0 );return ; }
Signature · 1 line
2.30.2
Quoted 17 lines · Martin Kaiser
This series cleans up the OnBeacon function. It tries to replace driver-sepcific message parsing with ieee80211 helper functions.
Please apply this after the "another round of cleanups" series.
Martin Kaiser (10):
staging: r8188eu: replace one GetAddr3Ptr call
staging: r8188eu: read timestamp fromieee80211_mgmt
staging: r8188eu: replace GetAddr2Ptr calls
staging: r8188eu: pass only ies toprocess_p2p_ps_ie
staging: r8188eu: use ie buffer inupdate_beacon_info
staging: r8188eu: simplifyupdate_sta_support_rateparams
staging: r8188eu: exit if beacon is not from our bss
staging: r8188eu: stop beacon processing if kmalloc fails
staging: r8188eu: simplify error handling for missing station
staging: r8188eu: remove a variable
Quoted 6 lines
drivers/staging/r8188eu/core/rtw_mlme_ext.c | 130 ++++++++---------- drivers/staging/r8188eu/core/rtw_p2p.c | 11 +- drivers/staging/r8188eu/core/rtw_wlan_util.c | 9 +- .../staging/r8188eu/include/rtw_mlme_ext.h | 3 +- 4 files changed, 66 insertions(+), 87 deletions(-)