From 48460503c0ff724945c510d361c9815a1f226328 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 1 Apr 2021 14:50:46 +0000 Subject: [PATCH] Add RHEL/CENTOS 8 support --- core/rtw_mlme_ext.c | 217 ++++++++++++++++++------------------- include/basic_types.h | 5 + include/wifi.h | 8 +- os_dep/linux/os_intfs.c | 2 +- os_dep/linux/rtw_android.c | 2 +- 5 files changed, 120 insertions(+), 114 deletions(-) diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 38830b5..af54f02 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -258,7 +258,7 @@ void rtw_txpwr_init_regd(struct rf_ctl_t *rfctl) ); if (rfctl->regd_name) break; - __attribute__ ((__fallthrough__)); + /* fallthrough */ default: rfctl->regd_name = regd_str(TXPWR_LMT_WW); RTW_PRINT("assign %s for default case\n", regd_str(TXPWR_LMT_WW)); @@ -1344,7 +1344,7 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame) else ptable->func = &OnAuthClient; #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0) - __attribute__ ((fallthrough)); + /* fallthrough */ #else __attribute__ ((__fallthrough__)); #endif @@ -1777,17 +1777,17 @@ static void rtw_check_legacy_ap(_adapter *padapter, u8 *pframe, u32 len) if (!padapter->registrypriv.wifi_spec) return; - + if(!MLME_IS_AP(padapter)) return; - + if (pmlmeext->bstart_bss == _TRUE) { int left; unsigned char *pos; struct rtw_ieee802_11_elems elems; #ifdef CONFIG_80211N_HT - u16 cur_op_mode; + u16 cur_op_mode; #endif /* checking IEs */ left = len - sizeof(struct rtw_ieee80211_hdr_3addr) - _BEACON_IE_OFFSET_; @@ -1808,7 +1808,7 @@ static void rtw_check_legacy_ap(_adapter *padapter, u8 *pframe, u32 len) ATOMIC_SET(&pmlmepriv->olbc, _TRUE); ATOMIC_SET(&pmlmepriv->olbc_ht, _TRUE); } - + } } @@ -2734,7 +2734,7 @@ void rtw_roam_nb_discover(_adapter *padapter, u8 bfroce) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *psta; u8 nb_req_issue = _FALSE; @@ -2748,11 +2748,11 @@ void rtw_roam_nb_discover(_adapter *padapter, u8 bfroce) psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress); if (!psta) return; - + if (bfroce || (!pmlmepriv->nb_info.nb_rpt_is_same)) nb_req_issue = _TRUE; - - if (nb_req_issue && (psta->rm_en_cap[0] & RTW_RRM_NB_RPT_EN)) + + if (nb_req_issue && (psta->rm_en_cap[0] & RTW_RRM_NB_RPT_EN)) rm_add_nb_req(padapter, psta); } #endif @@ -2804,7 +2804,7 @@ unsigned int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame) /* AID */ res = pmlmeinfo->aid = (int)(le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN + 4)) & 0x3fff); - + /* check aid value */ if (res < 1 || res > 2007) { RTW_INFO("assoc reject, aid: %d\n", res); @@ -3207,7 +3207,7 @@ unsigned int on_action_wnm(_adapter *adapter, union recv_frame *rframe) u8 *frame = rframe->u.hdr.rx_data; u32 frame_len = rframe->u.hdr.len; u8 *frame_body = (u8 *)(frame + sizeof(struct rtw_ieee80211_hdr_3addr)); - u32 frame_body_len = frame_len - sizeof(struct rtw_ieee80211_hdr_3addr); + u32 frame_body_len = frame_len - sizeof(struct rtw_ieee80211_hdr_3addr); u8 category, action; int cnt = 0; char msg[16]; @@ -3231,7 +3231,7 @@ unsigned int on_action_wnm(_adapter *adapter, union recv_frame *rframe) } ret = _SUCCESS; break; -#endif +#endif default: #ifdef CONFIG_IOCTL_CFG80211 cnt += sprintf((msg + cnt), "ACT_WNM %u", action); @@ -3278,12 +3278,12 @@ u8 rtw_rx_ampdu_size(_adapter *adapter) max_rx_ampdu_factor = (HT_CAP_AMPDU_FACTOR)adapter->driver_rx_ampdu_factor; else rtw_hal_get_def_var(adapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); - + /* In Maximum A-MPDU Length Exponent subfield of A-MPDU Parameters field of HT Capabilities element, the unit of max_rx_ampdu_factor are octets. 8K, 16K, 32K, 64K is right. But the buffer size subfield of Block Ack Parameter Set field in ADDBA action frame indicates - the number of buffers available for this particular TID. Each buffer is equal to max. size of - MSDU or AMSDU. + the number of buffers available for this particular TID. Each buffer is equal to max. size of + MSDU or AMSDU. The size variable means how many MSDUs or AMSDUs, it's not Kbytes. */ if (MAX_AMPDU_FACTOR_64K == max_rx_ampdu_factor) @@ -6640,7 +6640,7 @@ exit: #if defined(CONFIG_RTW_WNM) || defined(CONFIG_RTW_80211K) static u8 rtw_wnm_nb_elem_parsing( - u8* pdata, u32 data_len, u8 from_btm, + u8* pdata, u32 data_len, u8 from_btm, u32 *nb_rpt_num, u8 *nb_rpt_is_same, struct roam_nb_info *pnb, struct wnm_btm_cant *pcandidates) { @@ -6663,7 +6663,7 @@ static u8 rtw_wnm_nb_elem_parsing( subelem_len = (u32)*(pdata+1); for (i=0; i < RTW_MAX_NB_RPT_NUM; i++) { - if (((ptr + 7) > pend) || (elem_len < subelem_len)) + if (((ptr + 7) > pend) || (elem_len < subelem_len)) break; if (*ptr != 0x34) { @@ -6672,10 +6672,10 @@ static u8 rtw_wnm_nb_elem_parsing( break; } - pie = (struct nb_rpt_hdr *)ptr; + pie = (struct nb_rpt_hdr *)ptr; if (from_btm) { - op = rtw_get_ie((u8 *)(ptr+15), - WNM_BTM_CAND_PREF_SUBEID, + op = rtw_get_ie((u8 *)(ptr+15), + WNM_BTM_CAND_PREF_SUBEID, &op_len, (subelem_len - 15)); } @@ -6694,28 +6694,28 @@ static u8 rtw_wnm_nb_elem_parsing( RTW_DBG("WNM: preference check bssid("MAC_FMT ") ,bss_info(0x%04X), reg_class(0x%02X), ch(%d)," " phy_type(0x%02X), preference(0x%02X)\n", - MAC_ARG(pcandidate->nb_rpt.bssid), pcandidate->nb_rpt.bss_info, - pcandidate->nb_rpt.reg_class, pcandidate->nb_rpt.ch_num, + MAC_ARG(pcandidate->nb_rpt.bssid), pcandidate->nb_rpt.bss_info, + pcandidate->nb_rpt.reg_class, pcandidate->nb_rpt.ch_num, pcandidate->nb_rpt.phy_type, pcandidate->preference); } else { if (_rtw_memcmp(&pnb->nb_rpt[i], pie, sizeof(struct nb_rpt_hdr)) == _FALSE) *nb_rpt_is_same = _FALSE; _rtw_memcpy(&pnb->nb_rpt[i], pie, sizeof(struct nb_rpt_hdr)); } - nb_rpt_entries++; - } + nb_rpt_entries++; + } - if (from_btm) - pnb->preference_en = (bfound)?_TRUE:_FALSE; + if (from_btm) + pnb->preference_en = (bfound)?_TRUE:_FALSE; *nb_rpt_num = nb_rpt_entries; return ret; -} +} /* selection sorting based on preference value * IN : nb_rpt_entries - candidate num * IN/OUT : pcandidates - candidate list - * return : TRUE - means pcandidates is updated. + * return : TRUE - means pcandidates is updated. */ static u8 rtw_wnm_candidates_sorting( u32 nb_rpt_entries, struct wnm_btm_cant *pcandidates) @@ -6743,13 +6743,13 @@ static u8 rtw_wnm_candidates_sorting( _rtw_memcpy((pcandidates+i), (pcandidates+pos), sizeof(struct wnm_btm_cant)); _rtw_memcpy((pcandidates+pos), &swap, sizeof(struct wnm_btm_cant)); } - } + } return updated; -} +} static void rtw_wnm_nb_info_update( - u32 nb_rpt_entries, u8 from_btm, - struct roam_nb_info *pnb, struct wnm_btm_cant *pcandidates, + u32 nb_rpt_entries, u8 from_btm, + struct roam_nb_info *pnb, struct wnm_btm_cant *pcandidates, u8 *nb_rpt_is_same) { u8 is_found; @@ -6770,10 +6770,10 @@ static void rtw_wnm_nb_info_update( _rtw_memcpy(&pnb->nb_rpt[i], &pcand->nb_rpt, sizeof(struct nb_rpt_hdr)); } - RTW_DBG("WNM: bssid(" MAC_FMT + RTW_DBG("WNM: bssid(" MAC_FMT ") , bss_info(0x%04X), reg_class(0x%02X), ch_num(%d), phy_type(0x%02X)\n", - MAC_ARG(pnb->nb_rpt[i].bssid), pnb->nb_rpt[i].bss_info, - pnb->nb_rpt[i].reg_class, pnb->nb_rpt[i].ch_num, + MAC_ARG(pnb->nb_rpt[i].bssid), pnb->nb_rpt[i].bss_info, + pnb->nb_rpt[i].reg_class, pnb->nb_rpt[i].ch_num, pnb->nb_rpt[i].phy_type); if (pnb->nb_rpt[i].ch_num == 0) @@ -6785,7 +6785,7 @@ static void rtw_wnm_nb_info_update( break; } } - + if (!is_found) { pnb->nb_rpt_ch_list[pnb->nb_rpt_ch_list_num].hw_value = pnb->nb_rpt[i].ch_num; pnb->nb_rpt_ch_list_num++; @@ -6803,7 +6803,7 @@ static void rtw_wnm_btm_candidate_select(_adapter *padapter) for (i = 0; i < pnb->last_nb_rpt_entries; i++) { pnetwork = rtw_find_network( - &(pmlmepriv->scanned_queue), + &(pmlmepriv->scanned_queue), pnb->nb_rpt[i].bssid); if (pnetwork) { @@ -6820,7 +6820,7 @@ static void rtw_wnm_btm_candidate_select(_adapter *padapter) , MAC_ARG(pnetwork->network.MacAddress) , pnetwork->network.Configuration.DSConfig , (int)pnetwork->network.Rssi); - } else + } else _rtw_memset(pnb->roam_target_addr,0, ETH_ALEN); } @@ -6831,20 +6831,20 @@ u32 rtw_wnm_btm_candidates_survey( struct wnm_btm_cant *pcandidate_list = NULL; u8 nb_rpt_is_same = _TRUE; u32 ret = _FAIL; - u32 nb_rpt_entries = 0; + u32 nb_rpt_entries = 0; if (from_btm) { u32 mlen = sizeof(struct wnm_btm_cant) * RTW_MAX_NB_RPT_NUM; pcandidate_list = (struct wnm_btm_cant *)rtw_malloc(mlen); - if (pcandidate_list == NULL) - goto exit; + if (pcandidate_list == NULL) + goto exit; } /*clean the status set last time*/ _rtw_memset(&pnb->nb_rpt_ch_list, 0, sizeof(pnb->nb_rpt_ch_list)); pnb->nb_rpt_valid = _FALSE; if (!rtw_wnm_nb_elem_parsing( - pframe, elem_len, from_btm, + pframe, elem_len, from_btm, &nb_rpt_entries, &nb_rpt_is_same, pnb, pcandidate_list)) goto exit; @@ -6854,11 +6854,11 @@ u32 rtw_wnm_btm_candidates_survey( rtw_wnm_candidates_sorting(nb_rpt_entries, pcandidate_list); rtw_wnm_nb_info_update( - nb_rpt_entries, from_btm, + nb_rpt_entries, from_btm, pnb, pcandidate_list, &nb_rpt_is_same); } - RTW_INFO("nb_rpt_is_same = %d, nb_rpt_entries = %d, last_nb_rpt_entries = %d\n", + RTW_INFO("nb_rpt_is_same = %d, nb_rpt_entries = %d, last_nb_rpt_entries = %d\n", nb_rpt_is_same, nb_rpt_entries, pnb->last_nb_rpt_entries); if ((nb_rpt_is_same == _TRUE) && (nb_rpt_entries == pnb->last_nb_rpt_entries)) pnb->nb_rpt_is_same = _TRUE; @@ -6869,14 +6869,14 @@ u32 rtw_wnm_btm_candidates_survey( if ((from_btm) && (nb_rpt_entries != 0)) rtw_wnm_btm_candidate_select(padapter); - + pnb->nb_rpt_valid = _TRUE; ret = _SUCCESS; exit: if (from_btm && pcandidate_list) rtw_mfree((u8 *)pcandidate_list, sizeof(struct wnm_btm_cant) * RTW_MAX_NB_RPT_NUM); - + return ret; } #endif @@ -6984,21 +6984,21 @@ u8 rtw_wmn_btm_rsp_reason_decision(_adapter *padapter, u8* req_mode) /* Accept */ reason = 0; goto under_survey; - } + } #endif if (((*req_mode) & DISASSOC_IMMINENT) == 0) { /* Reject - Unspecified reject reason */ reason = 1; goto candidate_remove; - } + } if (precvpriv->signal_strength_data.avg_val >= pmlmepriv->roam_rssi_threshold) { reason = 1; goto candidate_remove; } -under_survey: +under_survey: if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { RTW_INFO("%s reject due to _FW_UNDER_SURVEY\n", __func__); reason = 1; @@ -7025,14 +7025,14 @@ static u32 rtw_wnm_btm_candidates_offset_get(u8* pframe) /* BSS Termination Duration check */ if (wnm_btm_bss_term_inc(pframe)) { offset += 12; - pos += offset; - } + pos += offset; + } /* Session Information URL check*/ if (wnm_btm_ess_disassoc_im(pframe)) { /*URL length field + URL variable length*/ offset = 1 + *(pframe + offset); - pos += offset; + pos += offset; } offset = (pos - pframe); @@ -7052,8 +7052,8 @@ static void rtw_wnm_btm_req_hdr_parsing(u8* pframe, struct btm_req_hdr *phdr) phdr->disassoc_timer = wnm_btm_disassoc_timer(pframe); phdr->validity_interval = wnm_btm_valid_interval(pframe); if (wnm_btm_bss_term_inc(pframe)) { - _rtw_memcpy(&phdr->term_duration, - wnm_btm_term_duration_offset(pframe), + _rtw_memcpy(&phdr->term_duration, + wnm_btm_term_duration_offset(pframe), sizeof(struct btm_term_duration)); } @@ -7069,9 +7069,9 @@ void rtw_wnm_roam_scan_hdl(void *ctx) _adapter *padapter = (_adapter *)ctx; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - if (rtw_is_scan_deny(padapter)) + if (rtw_is_scan_deny(padapter)) RTW_INFO("WNM: roam scan would abort by scan_deny!\n"); - + pmlmepriv->need_to_roam = _TRUE; rtw_drv_scan_by_self(padapter, RTW_AUTO_SCAN_REASON_ROAM); } @@ -7103,10 +7103,10 @@ void rtw_wnm_process_btm_req(_adapter *padapter, u8* pframe, u32 frame_len) elem_len = (frame_len - offset); rtw_wnm_btm_candidates_survey(padapter, ptr, elem_len, _TRUE); reason = rtw_wmn_btm_rsp_reason_decision(padapter, &pframe[3]); - rtw_wnm_issue_action(padapter, + rtw_wnm_issue_action(padapter, RTW_WLAN_ACTION_WNM_BTM_RSP, reason); - if (reason == 0) + if (reason == 0) rtw_wnm_roam_scan(padapter); } @@ -7143,7 +7143,7 @@ void rtw_wnm_issue_action(_adapter *padapter, u8 action, u8 reason) if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) return ; - + pattrib = &(pmgntframe->attrib); update_mgntframe_attrib(padapter, pattrib); _rtw_memset(pmgntframe->buf_addr, 0, (WLANHDR_OFFSET + TXDESC_OFFSET)); @@ -7181,19 +7181,19 @@ void rtw_wnm_issue_action(_adapter *padapter, u8 action, u8 reason) pframe = rtw_set_fixed_ie(pframe, 1, &(reason), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(termination_delay), &(pattrib->pktlen)); if (!is_zero_mac_addr(pmlmepriv->nb_info.roam_target_addr)) { - pframe = rtw_set_fixed_ie(pframe, 6, + pframe = rtw_set_fixed_ie(pframe, 6, pmlmepriv->nb_info.roam_target_addr, &(pattrib->pktlen)); } - RTW_INFO("WNM: RTW_WLAN_ACTION_WNM_BTM_RSP sent. reason = %d\n", reason); - break; + RTW_INFO("WNM: RTW_WLAN_ACTION_WNM_BTM_RSP sent. reason = %d\n", reason); + break; default: goto exit; - } - + } + pattrib->last_txcmdsz = pattrib->pktlen; dump_mgntframe(padapter, pmgntframe); -exit: +exit: return; } #endif @@ -8014,7 +8014,7 @@ void issue_beacon(_adapter *padapter, int timeout_ms) pattrib->pktlen += rtw_build_vendor_ie(padapter , &pframe , WIFI_BEACON_VENDOR_IE_BIT); #endif -#ifdef CONFIG_RTL8812A +#ifdef CONFIG_RTL8812A pframe = rtw_hal_set_8812a_vendor_ie(padapter, pframe, &pattrib->pktlen ); #endif/*CONFIG_RTL8812A*/ @@ -8365,7 +8365,7 @@ void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probe } #endif /* CONFIG_AUTO_AP_MODE */ -#ifdef CONFIG_RTL8812A +#ifdef CONFIG_RTL8812A pframe = rtw_hal_set_8812a_vendor_ie(padapter, pframe, &pattrib->pktlen); #endif/*CONFIG_RTL8812A*/ @@ -8499,7 +8499,7 @@ int _issue_probereq(_adapter *padapter, const NDIS_802_11_SSID *pssid, const u8 pattrib->pktlen += rtw_build_vendor_ie(padapter , &pframe , WIFI_PROBEREQ_VENDOR_IE_BIT); #endif -#ifdef CONFIG_RTL8812A +#ifdef CONFIG_RTL8812A pframe = rtw_hal_set_8812a_vendor_ie(padapter, pframe, &pattrib->pktlen ); #endif/*CONFIG_RTL8812A*/ @@ -8940,7 +8940,7 @@ void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *p pattrib->pktlen += rtw_build_vendor_ie(padapter , &pframe , WIFI_ASSOCRESP_VENDOR_IE_BIT); #endif -#ifdef CONFIG_RTL8812A +#ifdef CONFIG_RTL8812A pframe = rtw_hal_set_8812a_vendor_ie(padapter, pframe, &pattrib->pktlen ); #endif/*CONFIG_RTL8812A*/ @@ -9405,7 +9405,7 @@ void _issue_assocreq(_adapter *padapter, u8 is_reassoc) pattrib->pktlen += rtw_build_vendor_ie(padapter , &pframe , WIFI_ASSOCREQ_VENDOR_IE_BIT); #endif -#ifdef CONFIG_RTL8812A +#ifdef CONFIG_RTL8812A pframe = rtw_hal_set_8812a_vendor_ie(padapter, pframe, &pattrib->pktlen ); #endif/*CONFIG_RTL8812A*/ @@ -10794,7 +10794,7 @@ unsigned int send_beacon(_adapter *padapter) #endif /* CONFIG_PCI_BCN_POLLING is for pci interface beacon polling mode */ -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)|| defined(CONFIG_PCI_BCN_POLLING) +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)|| defined(CONFIG_PCI_BCN_POLLING) u8 bxmitok = _FALSE; int issue = 0; int poll = 0; @@ -10828,14 +10828,14 @@ unsigned int send_beacon(_adapter *padapter) rtw_hal_set_hwreg(padapter, HW_VAR_BCN_HEAD_SEL, &vap_id); #endif do { - #if defined(CONFIG_PCI_BCN_POLLING) + #if defined(CONFIG_PCI_BCN_POLLING) issue_beacon(padapter, 0); #else issue_beacon(padapter, 100); #endif issue++; do { - #if defined(CONFIG_PCI_BCN_POLLING) + #if defined(CONFIG_PCI_BCN_POLLING) rtw_msleep_os(1); #else rtw_yield_os(); @@ -10843,7 +10843,7 @@ unsigned int send_beacon(_adapter *padapter) rtw_hal_get_hwreg(padapter, HW_VAR_BCN_VALID, (u8 *)(&bxmitok)); poll++; } while ((poll % 10) != 0 && _FALSE == bxmitok && !RTW_CANNOT_RUN(padapter)); - #if defined(CONFIG_PCI_BCN_POLLING) + #if defined(CONFIG_PCI_BCN_POLLING) rtw_hal_unmap_beacon_icf(padapter); #endif } while (bxmitok == _FALSE && (issue < 100) && !RTW_CANNOT_RUN(padapter)); @@ -12565,9 +12565,9 @@ void rtw_delba_check(_adapter *padapter, struct sta_info *psta, u8 from_timer) */ if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_BROADCOM) { for (i = 0; i < TID_NUM ; i++) { - if ((psta->recvreorder_ctrl[i].enable) && - (sta_rx_data_qos_pkts(psta, i) == sta_last_rx_data_qos_pkts(psta, i)) ) { - if (_TRUE == rtw_inc_and_chk_continual_no_rx_packet(psta, i)) { + if ((psta->recvreorder_ctrl[i].enable) && + (sta_rx_data_qos_pkts(psta, i) == sta_last_rx_data_qos_pkts(psta, i)) ) { + if (_TRUE == rtw_inc_and_chk_continual_no_rx_packet(psta, i)) { /* send a DELBA frame to the peer STA with the Reason Code field set to TIMEOUT */ if (!from_timer) ret = issue_del_ba_ex(padapter, psta->cmn.mac_addr, i, 39, 0, 3, 1); @@ -12577,7 +12577,7 @@ void rtw_delba_check(_adapter *padapter, struct sta_info *psta, u8 from_timer) if (ret != _FAIL) psta->recvreorder_ctrl[i].ampdu_size = RX_AMPDU_SIZE_INVALID; rtw_reset_continual_no_rx_packet(psta, i); - } + } } else { /* The inactivity timer is reset when MPDUs to the TID is received. */ rtw_reset_continual_no_rx_packet(psta, i); @@ -12858,7 +12858,7 @@ void linked_status_chk(_adapter *padapter, u8 from_timer) is_p2p_enable = !rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE); #endif -#ifdef CONFIG_ISSUE_DELBA_WHEN_NO_TRAFFIC +#ifdef CONFIG_ISSUE_DELBA_WHEN_NO_TRAFFIC /*issue delba when ap does not tx data packet that is Broadcom ap */ rtw_delba_check(padapter, psta, from_timer); #endif @@ -12875,7 +12875,7 @@ void linked_status_chk(_adapter *padapter, u8 from_timer) u8 union_ch = 0, union_bw = 0, union_offset = 0; u8 switch_channel_by_drv = _TRUE; - + #ifdef CONFIG_MCC_MODE if (MCC_EN(padapter)) { /* driver doesn't switch channel under MCC */ @@ -13260,7 +13260,7 @@ void rtw_ft_update_bcn(_adapter *padapter, union recv_frame *precv_frame) uint len = precv_frame->u.hdr.len; WLAN_BSSID_EX *pbss; - if (rtw_ft_chk_status(padapter,RTW_FT_ASSOCIATED_STA) + if (rtw_ft_chk_status(padapter,RTW_FT_ASSOCIATED_STA) && (pmlmepriv->ft_roam.ft_updated_bcn == _FALSE)) { pbss = (WLAN_BSSID_EX*)rtw_malloc(sizeof(WLAN_BSSID_EX)); if (pbss) { @@ -13268,7 +13268,7 @@ void rtw_ft_update_bcn(_adapter *padapter, union recv_frame *precv_frame) struct beacon_keys recv_beacon; update_network(&(pmlmepriv->cur_network.network), pbss, padapter, _TRUE); - + /* update bcn keys */ if (rtw_get_bcn_keys(padapter, pframe, len, &recv_beacon) == _TRUE) { RTW_INFO("%s: beacon keys ready\n", __func__); @@ -13286,7 +13286,7 @@ void rtw_ft_update_bcn(_adapter *padapter, union recv_frame *precv_frame) } /* check the vendor of the assoc AP */ - pmlmeinfo->assoc_AP_vendor = + pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pframe+sizeof(struct rtw_ieee80211_hdr_3addr), (len - sizeof(struct rtw_ieee80211_hdr_3addr))); @@ -13324,26 +13324,26 @@ void rtw_ft_start_clnt_join(_adapter *padapter) } u8 rtw_ft_update_rsnie( - _adapter *padapter, u8 bwrite, + _adapter *padapter, u8 bwrite, struct pkt_attrib *pattrib, u8 **pframe) { struct ft_roam_info *pft_roam = &(padapter->mlmepriv.ft_roam); u8 *pie; u32 len; - pie = rtw_get_ie(pft_roam->updated_ft_ies, EID_WPA2, &len, + pie = rtw_get_ie(pft_roam->updated_ft_ies, EID_WPA2, &len, pft_roam->updated_ft_ies_len); if (!bwrite) return (pie)?_SUCCESS:_FAIL; - + if (pie) { - *pframe = rtw_set_ie(((u8 *)*pframe), EID_WPA2, len, + *pframe = rtw_set_ie(((u8 *)*pframe), EID_WPA2, len, pie+2, &(pattrib->pktlen)); } else return _FAIL; - return _SUCCESS; + return _SUCCESS; } static u8 rtw_ft_update_mdie( @@ -13354,10 +13354,10 @@ static u8 rtw_ft_update_mdie( u32 len = 3; if (rtw_ft_roam(padapter)) { - if ((pie = rtw_get_ie(pft_roam->updated_ft_ies, _MDIE_, + if ((pie = rtw_get_ie(pft_roam->updated_ft_ies, _MDIE_, &len, pft_roam->updated_ft_ies_len))) { pie = (pie + 2); /* ignore md-id & length */ - } else + } else return _FAIL; } else { *((u16 *)&mdie[0]) = pft_roam->mdid; @@ -13366,7 +13366,7 @@ static u8 rtw_ft_update_mdie( } *pframe = rtw_set_ie(((u8 *)*pframe), _MDIE_, len , pie, &(pattrib->pktlen)); - return _SUCCESS; + return _SUCCESS; } static u8 rtw_ft_update_ftie( @@ -13376,17 +13376,17 @@ static u8 rtw_ft_update_ftie( u8 *pie; u32 len; - if ((pie = rtw_get_ie(pft_roam->updated_ft_ies, _FTIE_, &len, + if ((pie = rtw_get_ie(pft_roam->updated_ft_ies, _FTIE_, &len, pft_roam->updated_ft_ies_len)) != NULL) { - *pframe = rtw_set_ie(*pframe, _FTIE_, len , + *pframe = rtw_set_ie(*pframe, _FTIE_, len , (pie+2), &(pattrib->pktlen)); } else return _FAIL; - return _SUCCESS; + return _SUCCESS; } -void rtw_ft_build_auth_req_ies(_adapter *padapter, +void rtw_ft_build_auth_req_ies(_adapter *padapter, struct pkt_attrib *pattrib, u8 **pframe) { u8 ftie_append = _TRUE; @@ -13403,7 +13403,7 @@ void rtw_ft_build_auth_req_ies(_adapter *padapter, rtw_ft_update_ftie(padapter, pattrib, pframe); } -void rtw_ft_build_assoc_req_ies(_adapter *padapter, +void rtw_ft_build_assoc_req_ies(_adapter *padapter, u8 is_reassoc, struct pkt_attrib *pattrib, u8 **pframe) { if (!pattrib || !(*pframe)) @@ -13416,7 +13416,7 @@ void rtw_ft_build_assoc_req_ies(_adapter *padapter, return; if (rtw_ft_update_rsnie(padapter, _FALSE, pattrib, pframe)) - rtw_ft_update_ftie(padapter, pattrib, pframe); + rtw_ft_update_ftie(padapter, pattrib, pframe); } u8 rtw_ft_update_auth_rsp_ies(_adapter *padapter, u8 *pframe, u32 len) @@ -13436,8 +13436,8 @@ u8 rtw_ft_update_auth_rsp_ies(_adapter *padapter, u8 *pframe, u32 len) if (!pframe || !len) return _FAIL; - - rtw_buf_update(&pmlmepriv->auth_rsp, + + rtw_buf_update(&pmlmepriv->auth_rsp, &pmlmepriv->auth_rsp_len, pframe, len); pft_roam->ft_event.ies = (pmlmepriv->auth_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6); @@ -13450,7 +13450,7 @@ u8 rtw_ft_update_auth_rsp_ies(_adapter *padapter, u8 *pframe, u32 len) _rtw_memcpy(target_ap_addr, pmlmepriv->assoc_bssid, ETH_ALEN); rtw_ft_report_reassoc_evt(padapter, target_ap_addr); - return ret; + return ret; } static void rtw_ft_start_clnt_action(_adapter *padapter, u8 *pTargetAddr) @@ -13623,7 +13623,7 @@ void rtw_ft_link_timer_hdl(void *ctx) rtw_ft_issue_action_req(padapter, (u8 *)pmlmepriv->roam_network->network.MacAddress); _set_timer(&pmlmeext->ft_link_timer, REASSOC_TO); } else { - pft_roam->ft_req_retry_cnt = 0; + pft_roam->ft_req_retry_cnt = 0; if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) rtw_ft_set_status(padapter, RTW_FT_ASSOCIATED_STA); else @@ -13645,11 +13645,11 @@ void rtw_ft_roam_status_reset(_adapter *padapter) { struct ft_roam_info *pft_roam = &(padapter->mlmepriv.ft_roam); - if ((rtw_to_roam(padapter) > 0) && + if ((rtw_to_roam(padapter) > 0) && (!rtw_ft_chk_status(padapter, RTW_FT_REQUESTED_STA))) { rtw_ft_reset_status(padapter); - } - + } + padapter->mlmepriv.ft_roam.ft_updated_bcn = _FALSE; } #endif @@ -14352,7 +14352,7 @@ u32 rtw_scan_timeout_decision(_adapter *padapter) struct ss_res *ss = &pmlmeext->sitesurvey_res; if (is_supported_5g(padapter->registrypriv.wireless_mode) - && IsSupported24G(padapter->registrypriv.wireless_mode)) + && IsSupported24G(padapter->registrypriv.wireless_mode)) max_chan_num = MAX_CHANNEL_NUM;/* dual band */ else max_chan_num = MAX_CHANNEL_NUM_2G;/*single band*/ @@ -16309,7 +16309,7 @@ exit: ht_option = adapter->mlmepriv.htpriv.ht_option; #endif /* CONFIG_80211N_HT */ - /* + /* when supplicant send the mlme frame, the bss freq is updated by channel switch event. */ @@ -16579,7 +16579,7 @@ u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf) pchsw_info->ch_offset, (pchsw_info->ch_offset) ? CHANNEL_WIDTH_40 : CHANNEL_WIDTH_20, ptdls_sta->ch_switch_time) == _SUCCESS) { pchsw_info->ch_sw_state &= ~(TDLS_PEER_AT_OFF_STATE); if (pchsw_info->ch_sw_state & TDLS_CH_SW_INITIATOR_STATE) { - if (issue_nulldata_to_TDLS_peer_STA(ptdls_sta->padapter, ptdls_sta->cmn.mac_addr, 0, 1, + if (issue_nulldata_to_TDLS_peer_STA(ptdls_sta->padapter, ptdls_sta->cmn.mac_addr, 0, 1, (padapter->registrypriv.wifi_spec == 0) ? 3 : 0) == _FAIL) rtw_tdls_cmd(padapter, ptdls_sta->cmn.mac_addr, TDLS_CH_SW_TO_BASE_CHNL); } @@ -16785,4 +16785,3 @@ exit: return _SUCCESS; #endif /* CONFIG_IOCTL_CFG80211 */ } - diff --git a/include/basic_types.h b/include/basic_types.h index c0737f5..20cf3ce 100644 --- a/include/basic_types.h +++ b/include/basic_types.h @@ -85,6 +85,11 @@ typedef signed int sint; + #ifndef RHEL_RELEASE_CODE + #define RHEL_RELEASE_VERSION(a,b) (((a) << 8) + (b)) + #define RHEL_RELEASE_CODE 0 + #endif + #ifndef PVOID typedef void *PVOID; /* #define PVOID (void *) */ diff --git a/include/wifi.h b/include/wifi.h index 240ba32..11bb895 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -1033,9 +1033,11 @@ typedef enum _HT_CAP_AMPDU_DENSITY { * A-PMDU buffer sizes * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) */ -#define IEEE80211_MIN_AMPDU_BUF 0x8 -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0)) -#define IEEE80211_MAX_AMPDU_BUF 0x40 +#ifndef IEEE80211_MIN_AMPDU_BUF + #define IEEE80211_MIN_AMPDU_BUF 0x8 +#endif +#ifndef IEEE80211_MAX_AMPDU_BUF + #define IEEE80211_MAX_AMPDU_BUF 0x40 #endif /* Spatial Multiplexing Power Save Modes */ diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 44787f7..03a9c7b 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1337,7 +1337,7 @@ unsigned int rtw_classify8021d(struct sk_buff *skb) static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8,0) , struct net_device *sb_dev #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) , void *accel_priv diff --git a/os_dep/linux/rtw_android.c b/os_dep/linux/rtw_android.c index 868adbd..d0780df 100644 --- a/os_dep/linux/rtw_android.c +++ b/os_dep/linux/rtw_android.c @@ -663,7 +663,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) ret = -ENOMEM; goto exit; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) || (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8,0)) if (!access_ok(priv_cmd.buf, priv_cmd.total_len)){ #else if (!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)) {