From 8051c5f3b3ffa3401bc89f0c8b85047612cb762e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Garc=C3=A9s?= Date: Sun, 30 Oct 2022 18:39:00 +0000 Subject: [PATCH] Fix update_beacon calls Error introduced at 3555bdb25800fe9fb280c64663ab2e3a46762d63 Also clean up validate_recv_ctrl_frame Link: https://github.com/torvalds/linux/commit/797afdf24872a087567b680402bde62b06697b42 Link https://github.com/torvalds/linux/commit/aaa0bc19facf31426ca57267edc681a42dbd1ee1 --- core/rtw_ap.c | 16 ++++++++-------- core/rtw_cmd.c | 2 +- core/rtw_recv.c | 26 ++++++++++---------------- core/rtw_xmit.c | 14 +++++++------- os_dep/linux/ioctl_cfg80211.c | 2 +- 5 files changed, 27 insertions(+), 33 deletions(-) diff --git a/core/rtw_ap.c b/core/rtw_ap.c index 49f525b..98848f5 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -102,7 +102,7 @@ static void update_BCNTIM(_adapter *padapter) u8 *p, *dst_ie, *premainder_ie = NULL, *pbackup_remainder_ie = NULL; uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, WLAN_EID_DS_PARAMS, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_); + p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, WLAN_EID_TIM, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_); if (p != NULL && tim_ielen > 0) { tim_ielen += 2; @@ -599,7 +599,7 @@ void expire_timeout_chk(_adapter *padapter) /* to update bcn with tim_bitmap for this station */ rtw_tim_map_set(padapter, pstapriv->tim_bitmap, psta->cmn.aid); - update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _TRUE); + update_beacon(padapter, WLAN_EID_TIM, NULL, _TRUE); if (!pmlmeext->active_keep_alive_check) continue; @@ -1817,7 +1817,7 @@ update_beacon: } #endif - update_beacon(pdvobj->padapters[i], WLAN_EID_DS_PARAMS, NULL, _FALSE); + update_beacon(pdvobj->padapters[i], WLAN_EID_TIM, NULL, _FALSE); } if (mlme_act != MLME_OPCH_SWITCH @@ -2875,7 +2875,7 @@ u8 rtw_ap_bmc_frames_hdl(_adapter *padapter) if ((rtw_tim_map_is_set(padapter, pstapriv->tim_bitmap, 0)) && (psta_bmc->sleepq_len > 0)) { int tx_counts = 0; - _update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _FALSE, "update TIM with TIB=1"); + _update_beacon(padapter, WLAN_EID_TIM, NULL, _FALSE, "update TIM with TIB=1"); RTW_INFO("sleepq_len of bmc_sta = %d\n", psta_bmc->sleepq_len); @@ -2925,7 +2925,7 @@ u8 rtw_ap_bmc_frames_hdl(_adapter *padapter) if (update_tim == _TRUE) { RTW_INFO("clear TIB\n"); - _update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _TRUE, "bmc sleepq and HIQ empty"); + _update_beacon(padapter, WLAN_EID_TIM, NULL, _TRUE, "bmc sleepq and HIQ empty"); } } } @@ -3261,7 +3261,7 @@ void _update_beacon(_adapter *padapter, u8 ie_id, u8 *oui, u8 tx, const char *ta _enter_critical_bh(&pmlmepriv->bcn_update_lock, &irqL); switch (ie_id) { - case WLAN_EID_DS_PARAMS: + case WLAN_EID_TIM: update_BCNTIM(padapter); break; @@ -3738,7 +3738,7 @@ u8 bss_cap_update_on_sta_leave(_adapter *padapter, struct sta_info *psta) if (rtw_tim_map_is_set(padapter, pstapriv->tim_bitmap, psta->cmn.aid)) { rtw_tim_map_clear(padapter, pstapriv->tim_bitmap, psta->cmn.aid); beacon_updated = _TRUE; - update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _FALSE); + update_beacon(padapter, WLAN_EID_TIM, NULL, _FALSE); } if (psta->no_short_preamble_set) { @@ -5101,7 +5101,7 @@ void tx_beacon_handlder(struct dvobj_priv *pdvobj) if (!check_fwstate(&padapter->mlmepriv, WIFI_OP_CH_SWITCHING) && !IS_CH_WAITING(adapter_to_rfctl(padapter)) ) { - /*update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _FALSE);*/ + /*update_beacon(padapter, WLAN_EID_TIM, NULL, _FALSE);*/ /*issue_beacon(padapter, 0);*/ send_beacon(padapter); } diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index dd1fe3d..d2907e3 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -4147,7 +4147,7 @@ static void rtw_chk_hi_queue_hdl(_adapter *padapter) rtw_tim_map_clear(padapter, pstapriv->sta_dz_bitmap, 0); if (update_tim == _TRUE) - _update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _TRUE, "bmc sleepq and HIQ empty"); + _update_beacon(padapter, WLAN_EID_TIM, NULL, _TRUE, "bmc sleepq and HIQ empty"); } else /* re check again */ rtw_chk_hi_queue_cmd(padapter); diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 5bc6501..78e821f 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -1550,8 +1550,7 @@ exit: } -sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame); -sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame) +void validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame) { struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; struct sta_priv *pstapriv = &padapter->stapriv; @@ -1562,15 +1561,15 @@ sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame) /* RTW_INFO("+validate_recv_ctrl_frame\n"); */ if (GetFrameType(pframe) != IEEE80211_FTYPE_CTL) - return _FAIL; + return; /* receive the frames that ra(a1) is my address */ if (!_rtw_memcmp(GetAddr1Ptr(pframe), adapter_mac_addr(padapter), ETH_ALEN)) - return _FAIL; + return; psta = rtw_get_stainfo(pstapriv, get_addr2_ptr(pframe)); if (psta == NULL) - return _FAIL; + return; /* for rx pkt statistics */ psta->sta_stats.last_rx_time = jiffies; @@ -1584,7 +1583,7 @@ sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame) aid = GetAid(pframe); if (psta->cmn.aid != aid) - return _FAIL; + return; switch (pattrib->priority) { case 1: @@ -1607,7 +1606,7 @@ sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame) } if (wmmps_ac) - return _FAIL; + return; if (psta->state & WIFI_STA_ALIVE_CHK_STATE) { RTW_INFO("%s alive check-rx ps-poll\n", __func__); @@ -1662,7 +1661,7 @@ sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame) /* upate BCN for TIM IE */ /* update_BCNTIM(padapter); */ - update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _TRUE); + update_beacon(padapter, WLAN_EID_TIM, NULL, _TRUE); } /* _exit_critical_bh(&psta->sleep_q.lock, &irqL); */ @@ -1688,7 +1687,7 @@ sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame) /* upate BCN for TIM IE */ /* update_BCNTIM(padapter); */ - update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _TRUE); + update_beacon(padapter, WLAN_EID_TIM, NULL, _TRUE); } } } @@ -1700,9 +1699,6 @@ sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame) } else if (get_frame_sub_type(pframe) == IEEE80211_STYPE_BACK_REQ) { rtw_process_bar_frame(padapter, precv_frame); } - - return _FAIL; - } #if defined(CONFIG_IEEE80211W) || defined(CONFIG_RTW_MESH) @@ -2307,10 +2303,8 @@ sint validate_recv_frame(_adapter *adapter, union recv_frame *precv_frame) break; case IEEE80211_FTYPE_CTL: /* ctrl */ DBG_COUNTER(adapter->rx_logs.core_rx_pre_ctrl); - retval = validate_recv_ctrl_frame(adapter, precv_frame); - if (retval == _FAIL) { - DBG_COUNTER(adapter->rx_logs.core_rx_pre_ctrl_err); - } + validate_recv_ctrl_frame(adapter, precv_frame); + DBG_COUNTER(adapter->rx_logs.core_rx_pre_ctrl_err); retval = _FAIL; /* only data frame return _SUCCESS */ break; case IEEE80211_FTYPE_DATA: /* data */ diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index b000442..b0c7fc4 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -4816,9 +4816,9 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p /* RTW_INFO_DUMP("enqueue, tim=", pstapriv->tim_bitmap, pstapriv->aid_bmp_len); */ if (update_tim == _TRUE) { if (is_broadcast_mac_addr(pattrib->ra)) - _update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _TRUE, "buffer BC"); + _update_beacon(padapter, WLAN_EID_TIM, NULL, _TRUE, "buffer BC"); else - _update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _TRUE, "buffer MC"); + _update_beacon(padapter, WLAN_EID_TIM, NULL, _TRUE, "buffer MC"); } else chk_bmc_sleepq_cmd(padapter); @@ -4885,7 +4885,7 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p if (update_tim == _TRUE) { /* RTW_INFO("sleepq_len==1, update BCNTIM\n"); */ /* upate BCN for TIM IE */ - _update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _TRUE, "buffer UC"); + _update_beacon(padapter, WLAN_EID_TIM, NULL, _TRUE, "buffer UC"); } } @@ -5170,11 +5170,11 @@ _exit: if (update_mask) { /* update_BCNTIM(padapter); */ if ((update_mask & (BIT(0) | BIT(1))) == (BIT(0) | BIT(1))) - _update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _TRUE, "clear UC&BMC"); + _update_beacon(padapter, WLAN_EID_TIM, NULL, _TRUE, "clear UC&BMC"); else if ((update_mask & BIT(1)) == BIT(1)) - _update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _TRUE, "clear BMC"); + _update_beacon(padapter, WLAN_EID_TIM, NULL, _TRUE, "clear BMC"); else - _update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _TRUE, "clear UC"); + _update_beacon(padapter, WLAN_EID_TIM, NULL, _TRUE, "clear UC"); } } @@ -5252,7 +5252,7 @@ void xmit_delivery_enabled_frames(_adapter *padapter, struct sta_info *psta) /* RTW_INFO_DUMP("update_BCNTIM, tim=", pstapriv->tim_bitmap, pstapriv->aid_bmp_len); */ /* upate BCN for TIM IE */ /* update_BCNTIM(padapter); */ - update_beacon(padapter, WLAN_EID_DS_PARAMS, NULL, _TRUE); + update_beacon(padapter, WLAN_EID_TIM, NULL, _TRUE); /* update_mask = BIT(0); */ } diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index dbbf10f..1f9be57 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -8211,7 +8211,7 @@ u8 *rtw_cfg80211_construct_mesh_beacon_ies(struct wiphy *wiphy, _adapter *adapte *c = WLAN_EID_TIM; *(c + 1) = 4; c += 6; - //c = rtw_set_ie(c, WLAN_EID_DS_PARAMS, 4, NULL, NULL); + //c = rtw_set_ie(c, WLAN_EID_TIM, 4, NULL, NULL); /* Extended Supported Rates */ if (n_bitrates > 8)