diff --git a/Makefile b/Makefile index 2017cab..6fac1e5 100755 --- a/Makefile +++ b/Makefile @@ -14,8 +14,8 @@ EXTRA_CFLAGS += -Wno-unused-parameter EXTRA_CFLAGS += -Wno-unused-function EXTRA_CFLAGS += -Wno-unused EXTRA_CFLAGS += -Wno-date-time -#EXTRA_CFLAGS += -Wno-misleading-indentation -#EXTRA_CFLAGS += -Wno-uninitialized +EXTRA_CFLAGS += -Wno-misleading-indentation +EXTRA_CFLAGS += -Wno-uninitialized GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc ) ifeq ($(GCC_VER_49),1) @@ -62,7 +62,7 @@ CONFIG_TRAFFIC_PROTECT = y CONFIG_LOAD_PHY_PARA_FROM_FILE = y CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY = n CONFIG_CALIBRATE_TX_POWER_TO_MAX = y -CONFIG_RTW_ADAPTIVITY_EN = disable +CONFIG_RTW_ADAPTIVITY_EN = auto CONFIG_RTW_ADAPTIVITY_MODE = normal CONFIG_SIGNAL_SCALE_MAPPING = n CONFIG_80211W = y @@ -895,7 +895,6 @@ ifeq ($(CONFIG_WAPI_SUPPORT), y) EXTRA_CFLAGS += -DCONFIG_WAPI_SUPPORT endif - ifeq ($(CONFIG_EFUSE_CONFIG_FILE), y) EXTRA_CFLAGS += -DCONFIG_EFUSE_CONFIG_FILE @@ -1078,7 +1077,6 @@ KSRC := $(KERNEL_BUILD_PATH) MODULE_NAME :=wlan endif - ifeq ($(CONFIG_PLATFORM_ACTIONS_ATM705X), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN #EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC @@ -1291,8 +1289,6 @@ CROSS_COMPILE := /home/share/CusEnv/FreeScale/arm-eabi-4.4.3/bin/arm-eabi- KSRC ?= /home/share/CusEnv/FreeScale/FS_kernel_env endif - - ifeq ($(CONFIG_PLATFORM_ACTIONS_ATJ227X), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ACTIONS_ATJ227X ARCH := mips @@ -1457,7 +1453,6 @@ KSRC := /home/winuser/work/Plat_sLD2T_V3010/usr/src/linux-2.6.32.2 INSTALL_PREFIX := endif - ifeq ($(CONFIG_PLATFORM_ARM_SUNxI), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUNxI @@ -1807,7 +1802,6 @@ ifeq ($(CONFIG_PCI_HCI), y) MODULE_NAME := rtw_pci endif - endif USER_MODULE_NAME ?= @@ -1851,7 +1845,6 @@ endif $(MODULE_NAME)-y += $(rtk_core) - $(MODULE_NAME)-$(CONFIG_WAPI_SUPPORT) += core/rtw_wapi.o \ core/rtw_wapi_sms4.o @@ -1892,7 +1885,6 @@ config_r: @echo "make config" /bin/bash script/Configure script/config.in - .PHONY: modules clean clean: @@ -1910,4 +1902,3 @@ clean: rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~ rm -fr .tmp_versions endif - diff --git a/README.md b/README.md index 60c3e70..e20a412 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,6 @@ # RTL8812AU/21AU and RTL8814AU drivers # with monitor mode and frame injection -## TODO -These are the problems that needs attention, any help would be appreciated. -``` -* "Associate", "Disassocate" & "Deauthenticate" support is missing. - These should be added in order to get some functions working, like "deauth" attacks. - Check issue report @ https://github.com/aircrack-ng/rtl8812au/issues/35 - -* txpower control has been added, but some issues remain. - Check issue reports for more information. - -* RadioTap FCS flag is set, but frame does not contain FCS. - Check issue report @ https://github.com/aircrack-ng/rtl8812au/issues/28 - -``` ## DKMS This driver can be installed using [DKMS]. This is a system which will automatically recompile and install a kernel module when a new kernel gets installed or updated. To make use of DKMS, install the `dkms` package, which on Debian (based) systems is done like this: ``` diff --git a/core/rtw_debug.c b/core/rtw_debug.c index f32ba0b..166f6ca 100644 --- a/core/rtw_debug.c +++ b/core/rtw_debug.c @@ -47,7 +47,6 @@ const char *rtw_log_level_str[] = { void dump_drv_version(void *sel) { RTW_PRINT_SEL(sel, "%s %s\n", DRV_NAME, DRIVERVERSION); - RTW_PRINT_SEL(sel, "build time: %s %s\n", __DATE__, __TIME__); } void dump_drv_cfg(void *sel) diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index 4cb54db..5954790 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -1228,7 +1228,11 @@ void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf) _enter_critical_bh(&pmlmepriv->lock, &irqL); #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _set_timer(&adapter->recvpriv.signal_stat_timer, adapter->recvpriv.signal_stat_sampling_interval); +#else rtw_set_signal_stat_timer(&adapter->recvpriv); +#endif #endif if (pmlmepriv->to_join == _TRUE) { @@ -1825,7 +1829,11 @@ static void rtw_joinbss_update_network(_adapter *padapter, struct wlan_network * #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _set_timer(&padapter->recvpriv.signal_stat_timer, padapter->recvpriv.signal_stat_sampling_interval); +#else rtw_set_signal_stat_timer(&padapter->recvpriv); +#endif #endif padapter->recvpriv.signal_strength = ptarget_wlan->network.PhyInfo.SignalStrength; padapter->recvpriv.signal_qual = ptarget_wlan->network.PhyInfo.SignalQuality; @@ -1841,7 +1849,11 @@ static void rtw_joinbss_update_network(_adapter *padapter, struct wlan_network * ); #endif #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _set_timer(&padapter->recvpriv.signal_stat_timer, padapter->recvpriv.signal_stat_sampling_interval); +#else rtw_set_signal_stat_timer(&padapter->recvpriv); +#endif #endif /* update fw_state */ /* will clr _FW_UNDER_LINKING here indirectly */ diff --git a/core/rtw_p2p.c b/core/rtw_p2p.c index 2d36a20..7b6bd4f 100644 --- a/core/rtw_p2p.c +++ b/core/rtw_p2p.c @@ -3269,9 +3269,17 @@ static void ro_ch_handler(_adapter *padapter) } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void ro_ch_timer_process(struct timer_list *t) +#else static void ro_ch_timer_process(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, cfg80211_wdinfo.remain_on_ch_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter); /* printk("%s\n", __FUNCTION__); */ @@ -4066,7 +4074,11 @@ void rtw_init_cfg80211_wifidirect_info(_adapter *padapter) _rtw_memset(pcfg80211_wdinfo, 0x00, sizeof(struct cfg80211_wifidirect_info)); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&pcfg80211_wdinfo->remain_on_ch_timer, ro_ch_timer_process, 0); +#else _init_timer(&pcfg80211_wdinfo->remain_on_ch_timer, padapter->pnetdev, ro_ch_timer_process, padapter); +#endif } #endif /* CONFIG_IOCTL_CFG80211 */ @@ -4148,7 +4160,6 @@ int process_p2p_cross_connect_ie(PADAPTER padapter, u8 *IEs, u32 IELength) struct wifidirect_info *pwdinfo = &(padapter->wdinfo); - if (IELength <= _BEACON_IE_OFFSET_) return ret; @@ -4185,7 +4196,6 @@ void process_p2p_ps_ie(PADAPTER padapter, u8 *IEs, u32 IELength) u8 find_p2p = _FALSE, find_p2p_ps = _FALSE; u8 noa_offset, noa_num, noa_index; - if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; #ifdef CONFIG_CONCURRENT_MODE @@ -4268,7 +4278,6 @@ void p2p_ps_wk_hdl(_adapter *padapter, u8 p2p_ps_state) struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct wifidirect_info *pwdinfo = &(padapter->wdinfo); - /* Pre action for p2p state */ switch (p2p_ps_state) { case P2P_PS_DISABLE: @@ -4333,7 +4342,6 @@ u8 p2p_ps_wk_cmd(_adapter *padapter, u8 p2p_ps_state, u8 enqueue) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) #ifdef CONFIG_CONCURRENT_MODE || (padapter->hw_port != HW_PORT0) @@ -4368,15 +4376,22 @@ u8 p2p_ps_wk_cmd(_adapter *padapter, u8 p2p_ps_state, u8 enqueue) exit: - return res; } #endif /* CONFIG_P2P_PS */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void reset_ch_sitesurvey_timer_process(struct timer_list *t) +#else static void reset_ch_sitesurvey_timer_process(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, wdinfo.reset_ch_sitesurvey); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -4393,9 +4408,17 @@ static void reset_ch_sitesurvey_timer_process(void *FunctionContext) pwdinfo->rx_invitereq_info.scan_op_ch_only = 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void reset_ch_sitesurvey_timer_process2(struct timer_list *t) +#else static void reset_ch_sitesurvey_timer_process2(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, wdinfo.reset_ch_sitesurvey2); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -4412,9 +4435,17 @@ static void reset_ch_sitesurvey_timer_process2(void *FunctionContext) pwdinfo->p2p_info.scan_op_ch_only = 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void restore_p2p_state_timer_process (struct timer_list *t) +#else static void restore_p2p_state_timer_process(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, wdinfo.restore_p2p_state_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -4423,9 +4454,17 @@ static void restore_p2p_state_timer_process(void *FunctionContext) p2p_protocol_wk_cmd(adapter, P2P_RESTORE_STATE_WK); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void pre_tx_scan_timer_process (struct timer_list *t) +#else static void pre_tx_scan_timer_process(void *FunctionContext) +#endif { - _adapter *adapter = (_adapter *) FunctionContext; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, wdinfo.pre_tx_scan_timer); +#else + _adapter *adapter = (_adapter *) FunctionContext; +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; _irqL irqL; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; @@ -4436,7 +4475,6 @@ static void pre_tx_scan_timer_process(void *FunctionContext) _enter_critical_bh(&pmlmepriv->lock, &irqL); - if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ)) { if (_TRUE == pwdinfo->tx_prov_disc_info.benable) { /* the provision discovery request frame is trigger to send or not */ p2p_protocol_wk_cmd(adapter, P2P_PRE_TX_PROVDISC_PROCESS_WK); @@ -4455,9 +4493,17 @@ static void pre_tx_scan_timer_process(void *FunctionContext) _exit_critical_bh(&pmlmepriv->lock, &irqL); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void find_phase_timer_process(struct timer_list *t) +#else static void find_phase_timer_process(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, wdinfo.find_phase_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -4714,6 +4760,16 @@ void rtw_init_wifidirect_timers(_adapter *padapter) { struct wifidirect_info *pwdinfo = &padapter->wdinfo; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&pwdinfo->find_phase_timer, find_phase_timer_process, 0); + timer_setup(&pwdinfo->restore_p2p_state_timer, restore_p2p_state_timer_process, 0); + timer_setup(&pwdinfo->pre_tx_scan_timer, pre_tx_scan_timer_process, 0); + timer_setup(&pwdinfo->reset_ch_sitesurvey, reset_ch_sitesurvey_timer_process, 0); + timer_setup(&pwdinfo->reset_ch_sitesurvey2, reset_ch_sitesurvey_timer_process2, 0); +#ifdef CONFIG_CONCURRENT_MODE + timer_setup(&pwdinfo->ap_p2p_switch_timer, ap_p2p_switch_timer_process, 0); +#endif +#else _init_timer(&pwdinfo->find_phase_timer, padapter->pnetdev, find_phase_timer_process, padapter); _init_timer(&pwdinfo->restore_p2p_state_timer, padapter->pnetdev, restore_p2p_state_timer_process, padapter); _init_timer(&pwdinfo->pre_tx_scan_timer, padapter->pnetdev, pre_tx_scan_timer_process, padapter); @@ -4722,6 +4778,7 @@ void rtw_init_wifidirect_timers(_adapter *padapter) #ifdef CONFIG_CONCURRENT_MODE _init_timer(&pwdinfo->ap_p2p_switch_timer, padapter->pnetdev, ap_p2p_switch_timer_process, padapter); #endif +#endif } void rtw_init_wifidirect_addrs(_adapter *padapter, u8 *dev_addr, u8 *iface_addr) @@ -5030,7 +5087,6 @@ void dbg_rtw_p2p_set_role(struct wifidirect_info *wdinfo, enum P2P_ROLE role, co } #endif /* CONFIG_DBG_P2P */ - int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role) { int ret = _SUCCESS; @@ -5078,7 +5134,6 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role) adapter_wdev_data(padapter)->p2p_enabled = _FALSE; #endif /* CONFIG_IOCTL_CFG80211 */ - /* Disable P2P function */ if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { _cancel_timer_ex(&pwdinfo->find_phase_timer); @@ -5086,8 +5141,13 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role) _cancel_timer_ex(&pwdinfo->pre_tx_scan_timer); _cancel_timer_ex(&pwdinfo->reset_ch_sitesurvey); _cancel_timer_ex(&pwdinfo->reset_ch_sitesurvey2); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + reset_ch_sitesurvey_timer_process(&pwdinfo->reset_ch_sitesurvey); + reset_ch_sitesurvey_timer_process2(&pwdinfo->reset_ch_sitesurvey2); +#else reset_ch_sitesurvey_timer_process(padapter); reset_ch_sitesurvey_timer_process2(padapter); +#endif #ifdef CONFIG_CONCURRENT_MODE _cancel_timer_ex(&pwdinfo->ap_p2p_switch_timer); #endif diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index d8b45f4..f61a5b3 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -393,10 +393,17 @@ void rtw_ps_processor(_adapter *padapter) return; } -void pwr_state_check_handler(RTW_TIMER_HDL_ARGS); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void pwr_state_check_handler(struct timer_list *t) +#else void pwr_state_check_handler(RTW_TIMER_HDL_ARGS) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *padapter = from_timer(padapter, t, pwrctrlpriv.pwr_state_check_timer); +#else _adapter *padapter = (_adapter *)FunctionContext; +#endif rtw_ps_cmd(padapter); } @@ -1968,7 +1975,11 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter) #endif /* CONFIG_LPS_RPWM_TIMER */ #endif /* CONFIG_LPS_LCLK */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&pwrctrlpriv->pwr_state_check_timer, pwr_state_check_handler, 0); +#else rtw_init_timer(&pwrctrlpriv->pwr_state_check_timer, padapter, pwr_state_check_handler); +#endif pwrctrlpriv->wowlan_mode = _FALSE; pwrctrlpriv->wowlan_ap_mode = _FALSE; diff --git a/core/rtw_recv.c b/core/rtw_recv.c index d4deb85..ff37aa0 100755 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -28,9 +28,12 @@ #endif - #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void rtw_signal_stat_timer_hdl(struct timer_list *t); +#else void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS); +#endif enum { SIGNAL_STAT_CALC_PROFILE_0 = 0, @@ -52,8 +55,6 @@ u8 signal_stat_calc_profile[SIGNAL_STAT_CALC_PROFILE_MAX][2] = { void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv) { - - _rtw_memset((u8 *)psta_recvpriv, 0, sizeof(struct sta_recv_priv)); _rtw_spinlock_init(&psta_recvpriv->lock); @@ -63,7 +64,6 @@ void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv) _rtw_init_queue(&psta_recvpriv->defrag_q); - } sint _rtw_init_recv_priv(struct recv_priv *precvpriv, _adapter *padapter) @@ -73,7 +73,6 @@ sint _rtw_init_recv_priv(struct recv_priv *precvpriv, _adapter *padapter) union recv_frame *precvframe; sint res = _SUCCESS; - /* We don't need to memset padapter->XXX to zero, because adapter is allocated by rtw_zvmalloc(). */ /* _rtw_memset((unsigned char *)precvpriv, 0, sizeof (struct recv_priv)); */ @@ -113,7 +112,6 @@ sint _rtw_init_recv_priv(struct recv_priv *precvpriv, _adapter *padapter) precvframe = (union recv_frame *) precvpriv->precv_frame_buf; - for (i = 0; i < NR_RECVFRAME ; i++) { _rtw_init_listhead(&(precvframe->u.list)); @@ -139,17 +137,24 @@ sint _rtw_init_recv_priv(struct recv_priv *precvpriv, _adapter *padapter) res = rtw_hal_init_recv_priv(padapter); #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&precvpriv->signal_stat_timer, rtw_signal_stat_timer_hdl, 0); +#else rtw_init_timer(&precvpriv->signal_stat_timer, padapter, RTW_TIMER_HDL_NAME(signal_stat)); +#endif precvpriv->signal_stat_sampling_interval = 2000; /* ms */ /* precvpriv->signal_stat_converging_constant = 5000; */ /* ms */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _set_timer(&precvpriv->signal_stat_timer, precvpriv->signal_stat_sampling_interval); +#else rtw_set_signal_stat_timer(precvpriv); +#endif #endif /* CONFIG_NEW_SIGNAL_STAT_PROCESS */ exit: - return res; } @@ -177,7 +182,6 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv) { _adapter *padapter = precvpriv->adapter; - rtw_free_uc_swdec_pending_queue(padapter); rtw_mfree_recv_priv_lock(precvpriv); @@ -189,7 +193,6 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv) rtw_hal_free_recv_priv(padapter); - } bool rtw_rframe_del_wfd_ie(union recv_frame *rframe, u8 ies_offset) @@ -231,7 +234,6 @@ union recv_frame *_rtw_alloc_recvframe(_queue *pfree_recv_queue) } } - return precvframe; } @@ -264,7 +266,6 @@ int rtw_free_recvframe(union recv_frame *precvframe, _queue *pfree_recv_queue) _adapter *padapter = precvframe->u.hdr.adapter; struct recv_priv *precvpriv = &padapter->recvpriv; - #ifdef CONFIG_CONCURRENT_MODE padapter = GET_PRIMARY_ADAPTER(padapter); precvpriv = &padapter->recvpriv; @@ -272,10 +273,8 @@ int rtw_free_recvframe(union recv_frame *precvframe, _queue *pfree_recv_queue) precvframe->u.hdr.adapter = padapter; #endif - rtw_os_free_recvframe(precvframe); - _enter_critical_bh(&pfree_recv_queue->lock, &irqL); rtw_list_delete(&(precvframe->u.hdr.list)); @@ -291,21 +290,16 @@ int rtw_free_recvframe(union recv_frame *precvframe, _queue *pfree_recv_queue) _exit_critical_bh(&pfree_recv_queue->lock, &irqL); - return _SUCCESS; } - - - sint _rtw_enqueue_recvframe(union recv_frame *precvframe, _queue *queue) { _adapter *padapter = precvframe->u.hdr.adapter; struct recv_priv *precvpriv = &padapter->recvpriv; - /* _rtw_init_listhead(&(precvframe->u.hdr.list)); */ rtw_list_delete(&(precvframe->u.hdr.list)); @@ -317,7 +311,6 @@ sint _rtw_enqueue_recvframe(union recv_frame *precvframe, _queue *queue) precvpriv->free_recvframe_cnt++; } - return _SUCCESS; } @@ -342,9 +335,6 @@ sint rtw_enqueue_recvframe(union recv_frame *precvframe, _queue *queue) } */ - - - /* caller : defrag ; recvframe_chk_defrag in recv_thread (passive) pframequeue: defrag_queue : will be accessed in recv_thread (passive) @@ -375,7 +365,6 @@ void rtw_free_recvframe_queue(_queue *pframequeue, _queue *pfree_recv_queue) _rtw_spinunlock(&pframequeue->lock); - } u32 rtw_free_uc_swdec_pending_queue(_adapter *adapter) @@ -393,7 +382,6 @@ u32 rtw_free_uc_swdec_pending_queue(_adapter *adapter) return cnt; } - sint rtw_enqueue_recvbuf_to_head(struct recv_buf *precvbuf, _queue *queue) { _irqL irqL; @@ -510,7 +498,6 @@ sint recvframe_chkmic(_adapter *adapter, union recv_frame *precvframe) pframe = precvframe->u.hdr.rx_data; payload = pframe + prxattrib->hdrlen + prxattrib->iv_len; - /* rtw_seccalctkipmic(&stainfo->dot11tkiprxmickey.skey[0],pframe,payload, datalen ,&miccode[0],(unsigned char)prxattrib->priority); */ /* care the length of the data */ rtw_seccalctkipmic(mickey, pframe, payload, datalen , &miccode[0], (unsigned char)prxattrib->priority); /* care the length of the data */ @@ -528,8 +515,6 @@ sint recvframe_chkmic(_adapter *adapter, union recv_frame *precvframe) if (bmic_err == _TRUE) { - - /* double check key_index for some timing issue , */ /* cannot compare with psecuritypriv->dot118021XGrpKeyid also cause timing issue */ if ((IS_MCAST(prxattrib->ra) == _TRUE) && (prxattrib->key_index != pmlmeinfo->key_index)) @@ -559,7 +544,6 @@ sint recvframe_chkmic(_adapter *adapter, union recv_frame *precvframe) exit: - return res; } @@ -576,10 +560,8 @@ union recv_frame *decryptor(_adapter *padapter, union recv_frame *precv_frame) union recv_frame *return_packet = precv_frame; u32 res = _SUCCESS; - DBG_COUNTER(padapter->rx_logs.core_rx_post_decrypt); - if (prxattrib->encrypt > 0) { u8 *iv = precv_frame->u.hdr.rx_data + prxattrib->hdrlen; prxattrib->key_index = (((iv[3]) >> 6) & 0x3) ; @@ -693,7 +675,6 @@ union recv_frame *decryptor(_adapter *padapter, union recv_frame *precv_frame) prxattrib->bdecrypted = _TRUE; /* recvframe_chkmic(adapter, precv_frame); */ /* move to recvframme_defrag function */ - return return_packet; } @@ -712,7 +693,6 @@ union recv_frame *portctrl(_adapter *adapter, union recv_frame *precv_frame) u16 eapol_type = 0x888e;/* for Funia BD's WPA issue */ struct rx_pkt_attrib *pattrib; - pstapriv = &adapter->stapriv; auth_alg = adapter->securitypriv.dot11AuthAlgrthm; @@ -726,7 +706,6 @@ union recv_frame *portctrl(_adapter *adapter, union recv_frame *precv_frame) psta = rtw_get_stainfo(pstapriv, psta_addr); - if (auth_alg == dot11AuthAlgrthm_8021X) { if ((psta != NULL) && (psta->ieee8021x_blocked)) { /* blocked */ @@ -775,7 +754,6 @@ sint recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcac u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num & 0xffff) << 4) | (precv_frame->u.hdr.attrib.frag_num & 0xf); - if (tid > 15) { return _FAIL; @@ -790,7 +768,6 @@ sint recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcac prxcache->tid_rxseq[tid] = seq_ctrl; - return _SUCCESS; } @@ -897,7 +874,6 @@ void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame) } - #endif } @@ -1083,7 +1059,6 @@ sint sta2sta_data_frame( u8 *pframe_body = psnap_type + 2 + 1; #endif - /* RTW_INFO("[%s] %d, seqnum:%d\n", __FUNCTION__, __LINE__, pattrib->seq_num); */ if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE) || @@ -1294,7 +1269,6 @@ sint ap2sta_data_frame( goto exit; } - /* check BSSID */ if (_rtw_memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || _rtw_memcmp(mybssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || @@ -1354,7 +1328,6 @@ sint ap2sta_data_frame( goto exit; } - } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) { /* Special case */ ret = RTW_RX_HANDLED; @@ -1387,7 +1360,6 @@ sint ap2sta_data_frame( exit: - return ret; } @@ -1481,7 +1453,6 @@ sint sta2ap_data_frame( exit: - return ret; } @@ -1642,7 +1613,6 @@ sint validate_recv_mgnt_frame(PADAPTER padapter, union recv_frame *precv_frame) { /* struct mlme_priv *pmlmepriv = &adapter->mlmepriv; */ - #if 0 if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) { #ifdef CONFIG_NATIVEAP_MLME @@ -1745,7 +1715,6 @@ sint validate_recv_data_frame(_adapter *adapter, union recv_frame *precv_frame) struct security_priv *psecuritypriv = &adapter->securitypriv; sint ret = _SUCCESS; - bretry = GetRetry(ptr); pda = get_da(ptr); psa = get_sa(ptr); @@ -1816,7 +1785,6 @@ sint validate_recv_data_frame(_adapter *adapter, union recv_frame *precv_frame) /* psta->signal_quality= prxcmd->sq; */ precv_frame->u.hdr.psta = psta; - pattrib->amsdu = 0; pattrib->ack_policy = 0; /* parsing QC field */ @@ -1835,7 +1803,6 @@ sint validate_recv_data_frame(_adapter *adapter, union recv_frame *precv_frame) pattrib->hdrlen = pattrib->to_fr_ds == 3 ? 30 : 24; } - if (pattrib->order) /* HT-CTRL 11n */ pattrib->hdrlen += 4; @@ -1852,7 +1819,6 @@ sint validate_recv_data_frame(_adapter *adapter, union recv_frame *precv_frame) if (pattrib->privacy) { - #ifdef CONFIG_TDLS if ((psta->tdls_sta_state & TDLS_LINKED_STATE) && (psta->dot118021XPrivacy == _AES_)) pattrib->encrypt = psta->dot118021XPrivacy; @@ -1869,7 +1835,6 @@ sint validate_recv_data_frame(_adapter *adapter, union recv_frame *precv_frame) exit: - return ret; } @@ -2190,7 +2155,6 @@ sint validate_recv_frame(_adapter *adapter, union recv_frame *precv_frame) return retval; } - /* remove the wlanhdr and add the eth_hdr */ #if 1 @@ -2210,7 +2174,6 @@ sint wlanhdr_to_ethhdr(union recv_frame *precvframe) u8 *ptr = get_recvframe_data(precvframe) ; /* point to frame_ctrl field */ struct rx_pkt_attrib *pattrib = &precvframe->u.hdr.attrib; - if (pattrib->encrypt) recvframe_pull_tail(precvframe, pattrib->icv_len); @@ -2233,7 +2196,6 @@ sint wlanhdr_to_ethhdr(union recv_frame *precvframe) rmv_len = pattrib->hdrlen + pattrib->iv_len + (bsnaphdr ? SNAP_SIZE : 0); len = precvframe->u.hdr.len - rmv_len; - _rtw_memcpy(ð_type, ptr + rmv_len, 2); eth_type = ntohs((unsigned short)eth_type); /* pattrib->ether_type */ pattrib->eth_type = eth_type; @@ -2415,7 +2377,6 @@ sint wlanhdr_to_ethhdr(union recv_frame *precvframe) exit: - return ret; } #endif @@ -2564,8 +2525,6 @@ union recv_frame *recvframe_defrag(_adapter *adapter, _queue *defrag_q) /* free the defrag_q queue and return the prframe */ rtw_free_recvframe_queue(defrag_q, pfree_recv_queue); - - return prframe; } @@ -2661,7 +2620,6 @@ union recv_frame *recvframe_chk_defrag(PADAPTER padapter, union recv_frame *prec } - if ((prtnframe != NULL) && (prtnframe->u.hdr.attrib.privacy)) { /* after defrag we must check tkip mic code */ if (recvframe_chkmic(padapter, prtnframe) == _FAIL) { @@ -2670,7 +2628,6 @@ union recv_frame *recvframe_chk_defrag(PADAPTER padapter, union recv_frame *prec } } - return prtnframe; } @@ -2835,7 +2792,6 @@ int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union rec /* _enter_critical_ex(&ppending_recvframe_queue->lock, &irql); */ /* _rtw_spinlock_ex(&ppending_recvframe_queue->lock); */ - phead = get_list_head(ppending_recvframe_queue); plist = get_next(phead); @@ -2858,7 +2814,6 @@ int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union rec } - /* _enter_critical_ex(&ppending_recvframe_queue->lock, &irql); */ /* _rtw_spinlock_ex(&ppending_recvframe_queue->lock); */ @@ -2998,7 +2953,6 @@ int recv_indicatepkts_in_order(_adapter *padapter, struct recv_reorder_ctrl *pre /* error condition; */ } - /* Update local variables. */ bPktInBuf = _FALSE; @@ -3129,7 +3083,6 @@ int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prframe) _enter_critical_bh(&ppending_recvframe_queue->lock, &irql); - /* s2. check if winstart_b(indicate_seq) needs to been updated */ if (!check_indicate_seq(preorder_ctrl, pattrib->seq_num)) { pdbgpriv->dbg_rx_ampdu_drop_count++; @@ -3152,7 +3105,6 @@ int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prframe) #endif } - /* s3. Insert all packet into Reorder Queue to maintain its ordering. */ if (!enqueue_reorder_recvframe(preorder_ctrl, prframe)) { /* DbgPrint("recv_indicatepkt_reorder, enqueue_reorder_recvframe fail!\n"); */ @@ -3164,7 +3116,6 @@ int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prframe) goto _err_exit; } - /* s4. */ /* Indication process. */ /* After Packet dropping and Sliding Window shifting as above, we can now just indicate the packets */ @@ -3188,7 +3139,6 @@ int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prframe) _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); } - _success_exit: return _SUCCESS; @@ -3200,7 +3150,6 @@ int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prframe) return _FAIL; } - void rtw_reordering_ctrl_timeout_handler(void *pcontext) { _irqL irql; @@ -3208,7 +3157,6 @@ void rtw_reordering_ctrl_timeout_handler(void *pcontext) _adapter *padapter = preorder_ctrl->padapter; _queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; - if (RTW_CANNOT_RUN(padapter)) return; @@ -3392,7 +3340,6 @@ static sint MPwlanhdr_to_ethhdr(union recv_frame *precvframe) _rtw_memcpy(ptr + 12, &len, 2); } - len = htons(pattrib->seq_num); /* RTW_INFO("wlan seq = %d ,seq_num =%x\n",len,pattrib->seq_num); */ _rtw_memcpy(ptr + 12, &len, 2); @@ -3405,12 +3352,10 @@ static sint MPwlanhdr_to_ethhdr(union recv_frame *precvframe) } - return ret; } - int mp_recv_frame(_adapter *padapter, union recv_frame *rframe) { int ret = _SUCCESS; @@ -3677,7 +3622,6 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe) /* always append FCS */ hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_FCS; - if (0) hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_DATAPAD; @@ -3931,7 +3875,6 @@ int recv_frame_monitor(_adapter *padapter, union recv_frame *rframe) _queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; _pkt *pskb = NULL; - /* fill radiotap header */ if (fill_radiotap_hdr(padapter, rframe) == _FAIL) { ret = _FAIL; @@ -4148,7 +4091,6 @@ int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe) return ret; } - int recv_func(_adapter *padapter, union recv_frame *rframe); int recv_func(_adapter *padapter, union recv_frame *rframe) { @@ -4213,7 +4155,6 @@ int recv_func(_adapter *padapter, union recv_frame *rframe) return ret; } - s32 rtw_recv_entry(union recv_frame *precvframe) { _adapter *padapter; @@ -4232,7 +4173,6 @@ s32 rtw_recv_entry(union recv_frame *precvframe) goto _recv_entry_drop; } - precvpriv->rx_pkts++; @@ -4245,16 +4185,21 @@ s32 rtw_recv_entry(union recv_frame *precvframe) padapter->mppriv.rx_pktloss = precvpriv->rx_drop; #endif - - return ret; } -#ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void rtw_signal_stat_timer_hdl(struct timer_list *t) +#else void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS) +#endif { - _adapter *adapter = (_adapter *)FunctionContext; - struct recv_priv *recvpriv = &adapter->recvpriv; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *padapter = from_timer(padapter, t, recvpriv.signal_stat_timer); +#else + _adapter *padapter = (_adapter *)FunctionContext; +#endif + struct recv_priv *recvpriv = &padapter->recvpriv; u32 tmp_s, tmp_q; u8 avg_signal_strength = 0; @@ -4263,10 +4208,10 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS) u32 num_signal_qual = 0; u8 ratio_pre_stat = 0, ratio_curr_stat = 0, ratio_total = 0, ratio_profile = SIGNAL_STAT_CALC_PROFILE_0; - if (adapter->recvpriv.is_signal_dbg) { + if(padapter->recvpriv.is_signal_dbg) { /* update the user specific value, signal_strength_dbg, to signal_strength, rssi */ - adapter->recvpriv.signal_strength = adapter->recvpriv.signal_strength_dbg; - adapter->recvpriv.rssi = (s8)translate_percentage_to_dbm((u8)adapter->recvpriv.signal_strength_dbg); + padapter->recvpriv.signal_strength = padapter->recvpriv.signal_strength_dbg; + padapter->recvpriv.rssi=(s8)translate_percentage_to_dbm((u8)padapter->recvpriv.signal_strength_dbg); } else { if (recvpriv->signal_strength_data.update_req == 0) { /* update_req is clear, means we got rx */ @@ -4284,14 +4229,14 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS) } if (num_signal_strength == 0) { - if (rtw_get_on_cur_ch_time(adapter) == 0 - || rtw_get_passing_time_ms(rtw_get_on_cur_ch_time(adapter)) < 2 * adapter->mlmeextpriv.mlmext_info.bcn_interval + if (rtw_get_on_cur_ch_time(padapter) == 0 + || rtw_get_passing_time_ms(rtw_get_on_cur_ch_time(padapter)) < 2 * padapter->mlmeextpriv.mlmext_info.bcn_interval ) goto set_timer; } - if (check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY) == _TRUE - || check_fwstate(&adapter->mlmepriv, _FW_LINKED) == _FALSE + if (check_fwstate(&padapter->mlmepriv, _FW_UNDER_SURVEY) == _TRUE + || check_fwstate(&padapter->mlmepriv, _FW_LINKED) == _FALSE ) goto set_timer; @@ -4344,10 +4289,12 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS) } set_timer: +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _set_timer(&recvpriv->signal_stat_timer, recvpriv->signal_stat_sampling_interval); +#else rtw_set_signal_stat_timer(recvpriv); - -} #endif /* CONFIG_NEW_SIGNAL_STAT_PROCESS */ +} static void rx_process_rssi(_adapter *padapter, union recv_frame *prframe) { @@ -4589,7 +4536,6 @@ void rtw_reset_continual_no_rx_packet(struct sta_info *sta, int tid_index) ATOMIC_SET(&sta->continual_no_rx_packet[tid_index], 0); } - s32 pre_recv_entry(union recv_frame *precvframe, u8 *pphy_status) { s32 ret = _SUCCESS; diff --git a/core/rtw_tdls.c b/core/rtw_tdls.c index be31530..1e4c8d1 100644 --- a/core/rtw_tdls.c +++ b/core/rtw_tdls.c @@ -3141,9 +3141,17 @@ void rtw_build_tunneled_probe_rsp_ies(_adapter *padapter, struct xmit_frame *pxm } #endif /* CONFIG_WFD */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void _tdls_tpk_timer_hdl(struct timer_list *t) +#else void _tdls_tpk_timer_hdl(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + struct sta_info *ptdls_sta = from_timer(ptdls_sta, t, sta.TPK_timer); +#else struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; +#endif struct tdls_txmgmt txmgmt; _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt)); @@ -3246,7 +3254,11 @@ void _tdls_pti_timer_hdl(void *FunctionContext) void rtw_init_tdls_timer(_adapter *padapter, struct sta_info *psta) { psta->padapter = padapter; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&psta->TPK_timer, _TPK_timer_hdl, 0); +#else _init_timer(&psta->TPK_timer, padapter->pnetdev, _tdls_tpk_timer_hdl, psta); +#endif #ifdef CONFIG_TDLS_CH_SW _init_timer(&psta->ch_sw_timer, padapter->pnetdev, _tdls_ch_switch_timer_hdl, psta); _init_timer(&psta->delay_timer, padapter->pnetdev, _tdls_delay_timer_hdl, psta); diff --git a/dkms.conf b/dkms.conf index b67a286..acadace 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="realtek-rtl88xxau" -PACKAGE_VERSION="5.1.5~20171022" +PACKAGE_VERSION="5.1.5~20171206" CLEAN="make clean" BUILT_MODULE_NAME[0]=8812au DEST_MODULE_LOCATION[0]="/updates" diff --git a/hal/hal_com_phycfg.c b/hal/hal_com_phycfg.c index dc28867..9b448d2 100644 --- a/hal/hal_com_phycfg.c +++ b/hal/hal_com_phycfg.c @@ -3491,9 +3491,8 @@ PHY_SetTxPowerLimit( if (powerLimit < prevPowerLimit) pHalData->TxPwrLimit_2_4G[regulation][bandwidth][rateSection][channelIndex][RF_PATH_A] = powerLimit; - if (0) - RTW_INFO("2.4G Band value : [regulation %d][bw %d][rate_section %d][chnl %d][val %d]\n" - , regulation, bandwidth, rateSection, channelIndex, pHalData->TxPwrLimit_2_4G[regulation][bandwidth][rateSection][channelIndex][ODM_RF_PATH_A]); + RTW_INFO("2.4G Band value : [regulation %d][bw %d][rate_section %d][chnl %d][val %d]\n" + , regulation, bandwidth, rateSection, channelIndex, pHalData->TxPwrLimit_2_4G[regulation][bandwidth][rateSection][channelIndex][ODM_RF_PATH_A]); } else if (eqNByte(Band, (u8 *)("5G"), 2)) { channelIndex = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_5G, channel); @@ -3512,9 +3511,8 @@ PHY_SetTxPowerLimit( if (powerLimit < prevPowerLimit) pHalData->TxPwrLimit_5G[regulation][bandwidth][rateSection][channelIndex][RF_PATH_A] = powerLimit; - if (0) - RTW_INFO("5G Band value : [regulation %d][bw %d][rate_section %d][chnl %d][val %d]\n" - , regulation, bandwidth, rateSection, channel, pHalData->TxPwrLimit_5G[regulation][bandwidth][rateSection][channelIndex][RF_PATH_A]); + RTW_INFO("5G Band value : [regulation %d][bw %d][rate_section %d][chnl %d][val %d]\n" + , regulation, bandwidth, rateSection, channel, pHalData->TxPwrLimit_5G[regulation][bandwidth][rateSection][channelIndex][RF_PATH_A]); } else { RTW_PRINT("Cannot recognize the band info in %s\n", Band); return; diff --git a/hal/hal_mp.c b/hal/hal_mp.c index 4f53504..f7d8618 100644 --- a/hal/hal_mp.c +++ b/hal/hal_mp.c @@ -985,8 +985,9 @@ void mpt_SetRFPath_8812A(PADAPTER pAdapter) } switch (ulAntennaRx) { - u32 reg0xC50 = 0; + u32 reg0xC50; case ANTENNA_A: + reg0xC50 = 0; PHY_SetBBReg(pAdapter, rRxPath_Jaguar, bMaskByte0, 0x11); PHY_SetRFReg(pAdapter, ODM_RF_PATH_B, RF_AC_Jaguar, 0xF0000, 0x1); /*/ RF_B_0x0[19:16] = 1, Standby mode*/ PHY_SetBBReg(pAdapter, rCCK_RX_Jaguar, bCCK_RX_Jaguar, 0x0); @@ -1013,6 +1014,7 @@ void mpt_SetRFPath_8812A(PADAPTER pAdapter) } break; case ANTENNA_B: + reg0xC50 = 0; PHY_SetBBReg(pAdapter, rRxPath_Jaguar, bMaskByte0, 0x22); PHY_SetRFReg(pAdapter, ODM_RF_PATH_A, RF_AC_Jaguar, 0xF0000, 0x1);/*/ RF_A_0x0[19:16] = 1, Standby mode */ PHY_SetBBReg(pAdapter, rCCK_RX_Jaguar, bCCK_RX_Jaguar, 0x1); diff --git a/hal/led/hal_usb_led.c b/hal/led/hal_usb_led.c index 117bc93..ae0535c 100644 --- a/hal/led/hal_usb_led.c +++ b/hal/led/hal_usb_led.c @@ -1815,9 +1815,17 @@ void BlinkHandler(PLED_USB pLed) * Callback function of LED BlinkTimer, * it just schedules to corresponding BlinkWorkItem/led_blink_hdl * */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void BlinkTimerCallback(struct timer_list *t) +#else void BlinkTimerCallback(void *data) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + PLED_USB pLed = from_timer(pLed, t, BlinkTimer); +#else PLED_USB pLed = (PLED_USB)data; +#endif _adapter *padapter = pLed->padapter; /* RTW_INFO("%s\n", __FUNCTION__); */ @@ -4229,7 +4237,11 @@ InitLed( pLed->LedPin = LedPin; ResetLedStatus(pLed); - _init_timer(&(pLed->BlinkTimer), padapter->pnetdev, BlinkTimerCallback, pLed); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&pLed->BlinkTimer, BlinkTimerCallback, 0); +#else + _init_timer(&pLed->BlinkTimer, padapter->pnetdev, BlinkTimerCallback, pLed); +#endif _init_workitem(&(pLed->BlinkWorkItem), BlinkWorkItemCallback, pLed); } diff --git a/include/osdep_service_linux.h b/include/osdep_service_linux.h index f371343..342c2aa 100644 --- a/include/osdep_service_linux.h +++ b/include/osdep_service_linux.h @@ -269,14 +269,14 @@ __inline static void rtw_list_delete(_list *plist) } #define RTW_TIMER_HDL_ARGS void *FunctionContext - +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) __inline static void _init_timer(_timer *ptimer, _nic_hdl nic_hdl, void *pfunc, void *cntx) { - /* setup_timer(ptimer, pfunc,(u32)cntx); */ ptimer->function = pfunc; ptimer->data = (unsigned long)cntx; init_timer(ptimer); } +#endif __inline static void _set_timer(_timer *ptimer, u32 delay_time) { @@ -429,5 +429,4 @@ extern struct net_device *rtw_alloc_etherdev(int sizeof_priv); #define STRUCT_PACKED __attribute__ ((packed)) - #endif diff --git a/include/rtw_mlme.h b/include/rtw_mlme.h index 839027e..6205484 100644 --- a/include/rtw_mlme.h +++ b/include/rtw_mlme.h @@ -20,7 +20,6 @@ #ifndef __RTW_MLME_H_ #define __RTW_MLME_H_ - #define MAX_BSS_CNT 128 /* #define MAX_JOIN_TIMEOUT 2000 */ /* #define MAX_JOIN_TIMEOUT 2500 */ @@ -162,7 +161,6 @@ enum SCAN_RESULT_TYPE { }; /* - there are several "locks" in mlme_priv, since mlme_priv is a shared resource between many threads, like ISR/Call-Back functions, the OID handlers, and even timer functions. @@ -173,10 +171,8 @@ Other items are protected by mlme_priv.lock. To avoid possible dead lock, any thread trying to modifiying mlme_priv SHALL not lock up more than one locks at a time! - */ - #define traffic_threshold 10 #define traffic_scan_period 500 @@ -761,7 +757,6 @@ extern int hostapd_mode_init(_adapter *padapter); extern void hostapd_mode_unload(_adapter *padapter); #endif - extern void rtw_joinbss_event_prehandle(_adapter *adapter, u8 *pbuf); extern void rtw_survey_event_callback(_adapter *adapter, u8 *pbuf); extern void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf); @@ -775,8 +770,14 @@ extern void rtw_wmm_event_callback(PADAPTER padapter, u8 *pbuf); #ifdef CONFIG_IEEE80211W void rtw_sta_timeout_event_callback(_adapter *adapter, u8 *pbuf); #endif /* CONFIG_IEEE80211W */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void rtw_join_timeout_handler(struct timer_list *t); +void _rtw_scan_timeout_handler(struct timer_list *t); +#else extern void rtw_join_timeout_handler(RTW_TIMER_HDL_ARGS); extern void _rtw_scan_timeout_handler(RTW_TIMER_HDL_ARGS); +#endif thread_return event_thread(thread_context context); @@ -956,16 +957,13 @@ void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv); int rtw_mlme_update_wfd_ie_data(struct mlme_priv *mlme, u8 type, u8 *ie, u32 ie_len); #endif - /* extern struct wlan_network* _rtw_dequeue_network(_queue *queue); */ extern struct wlan_network *_rtw_alloc_network(struct mlme_priv *pmlmepriv); - extern void _rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork, u8 isfreeall); extern void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork); - extern struct wlan_network *_rtw_find_network(_queue *scanned_queue, u8 *addr); extern void _rtw_free_network_queue(_adapter *padapter, u8 isfreeall); @@ -978,7 +976,6 @@ u8 *rtw_get_capability_from_ie(u8 *ie); u8 *rtw_get_timestampe_from_ie(u8 *ie); u8 *rtw_get_beacon_interval_from_ie(u8 *ie); - void rtw_joinbss_reset(_adapter *padapter); #ifdef CONFIG_80211N_HT diff --git a/include/rtw_recv.h b/include/rtw_recv.h index ef3886f..f6dcd82 100644 --- a/include/rtw_recv.h +++ b/include/rtw_recv.h @@ -68,7 +68,6 @@ #define PHY_RSSI_SLID_WIN_MAX 100 #define PHY_LINKQUALITY_SLID_WIN_MAX 20 - #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) #define RX_MPDU_QUEUE 0 @@ -125,7 +124,6 @@ struct stainfo_rxcache { #endif }; - struct smooth_rssi_data { u32 elements[100]; /* array to store values */ u32 index; /* index to current array to store */ @@ -218,7 +216,6 @@ struct rx_raw_rssi { u8 ofdm_snr[4]; }; - struct rx_pkt_attrib { u16 pkt_len; u8 physt; @@ -283,7 +280,6 @@ struct rx_pkt_attrib { struct phy_info phy_info; }; - /* These definition is used for Rx packet reordering. */ #define SN_LESS(a, b) (((a-b) & 0x800) != 0) #define SN_EQUAL(a, b) (a == b) @@ -359,8 +355,6 @@ struct rtw_rx_ring { }; #endif - - /* accesser of recv_priv: rtw_recv_entry(dispatch / passive level); recv_thread(passive) ; returnpkt(dispatch) ; halt(passive) ; @@ -488,7 +482,9 @@ struct recv_priv { }; #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) #define rtw_set_signal_stat_timer(recvpriv) _set_timer(&(recvpriv)->signal_stat_timer, (recvpriv)->signal_stat_sampling_interval) +#endif #endif /* CONFIG_NEW_SIGNAL_STAT_PROCESS */ struct sta_recv_priv { @@ -507,7 +503,6 @@ struct sta_recv_priv { }; - struct recv_buf { _list list; @@ -565,7 +560,6 @@ struct recv_buf { tail -----> - end -----> len = (unsigned int )(tail - data); @@ -597,7 +591,6 @@ struct recv_frame_hdr { void *precvbuf; - /* */ struct sta_info *psta; @@ -614,7 +607,6 @@ struct recv_frame_hdr { }; - union recv_frame { union { @@ -699,7 +691,6 @@ __inline static u8 *recvframe_push(union recv_frame *precvframe, sint sz) if (precvframe == NULL) return NULL; - precvframe->u.hdr.rx_data -= sz ; if (precvframe->u.hdr.rx_data < precvframe->u.hdr.rx_head) { precvframe->u.hdr.rx_data += sz ; @@ -712,18 +703,15 @@ __inline static u8 *recvframe_push(union recv_frame *precvframe, sint sz) } - __inline static u8 *recvframe_pull(union recv_frame *precvframe, sint sz) { /* rx_data += sz; move rx_data sz bytes hereafter */ /* used for extract sz bytes from rx_data, update rx_data and return the updated rx_data to the caller */ - if (precvframe == NULL) return NULL; - precvframe->u.hdr.rx_data += sz; if (precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail) { @@ -765,8 +753,6 @@ __inline static u8 *recvframe_put(union recv_frame *precvframe, sint sz) } - - __inline static u8 *recvframe_pull_tail(union recv_frame *precvframe, sint sz) { /* rmv data from rx_tail (by yitsen) */ @@ -790,8 +776,6 @@ __inline static u8 *recvframe_pull_tail(union recv_frame *precvframe, sint sz) } - - __inline static _buffer *get_rxbuf_desc(union recv_frame *precvframe) { _buffer *buf_desc; @@ -805,7 +789,6 @@ __inline static _buffer *get_rxbuf_desc(union recv_frame *precvframe) return buf_desc; } - __inline static union recv_frame *rxmem_to_recvframe(u8 *rxmem) { /* due to the design of 2048 bytes alignment of recv_frame, we can reference the union recv_frame */ @@ -876,7 +859,6 @@ __inline static s32 translate_percentage_to_dbm(u32 SignalStrengthIndex) return SignalPower; } - struct sta_info; extern void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv); diff --git a/include/rtw_wifi_regd.h b/include/rtw_wifi_regd.h index 249a894..69bd71d 100644 --- a/include/rtw_wifi_regd.h +++ b/include/rtw_wifi_regd.h @@ -7,18 +7,6 @@ #ifndef __RTW_WIFI_REGD_H__ #define __RTW_WIFI_REGD_H__ -struct country_code_to_enum_rd { - u16 countrycode; - const char *iso_name; -}; - -enum country_code_type_t { - COUNTRY_CODE_USER = 0, - - /*add new channel plan above this line */ - COUNTRY_CODE_MAX -}; - int rtw_regd_init(_adapter *padapter); void rtw_reg_notify_by_driver(_adapter *adapter); diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 2ad6ea7..6d34c0e 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1826,20 +1826,21 @@ u8 rtw_reset_drv_sw(_adapter *padapter) mlmeext_set_scan_state(&padapter->mlmeextpriv, SCAN_DISABLE); #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _set_timer(&padapter->recvpriv.signal_stat_timer, padapter->recvpriv.signal_stat_sampling_interval); +#else rtw_set_signal_stat_timer(&padapter->recvpriv); +#endif #endif return ret8; } - u8 rtw_init_drv_sw(_adapter *padapter) { u8 ret8 = _SUCCESS; - - _rtw_init_listhead(&padapter->list); ret8 = rtw_init_default_value(padapter); @@ -1956,8 +1957,6 @@ u8 rtw_init_drv_sw(_adapter *padapter) exit: - - return ret8; } @@ -2074,7 +2073,6 @@ u8 rtw_free_drv_sw(_adapter *padapter) rtw_hal_free_data(padapter); - /* free the old_pnetdev */ if (padapter->rereg_nd_name_priv.old_pnetdev) { free_netdev(padapter->rereg_nd_name_priv.old_pnetdev); @@ -2278,7 +2276,6 @@ _adapter *rtw_drv_add_vir_if(_adapter *primary_padapter, padapter->hw_port = HW_PORT1; #endif - /****** hook vir if into dvobj ******/ pdvobjpriv = adapter_to_dvobj(padapter); padapter->iface_id = pdvobjpriv->iface_nums; @@ -2296,7 +2293,6 @@ _adapter *rtw_drv_add_vir_if(_adapter *primary_padapter, if (rtw_init_drv_sw(padapter) != _SUCCESS) goto free_drv_sw; - /*get mac address from primary_padapter*/ _rtw_memcpy(mac, adapter_mac_addr(primary_padapter), ETH_ALEN); @@ -2777,7 +2773,6 @@ int ips_netdrv_open(_adapter *padapter) return _FAIL; } - int rtw_ips_pwr_up(_adapter *padapter) { int result; @@ -2841,7 +2836,6 @@ void rtw_ips_dev_unload(_adapter *padapter) } - int pm_netdev_open(struct net_device *pnetdev, u8 bnormal) { int status = 0; @@ -3302,7 +3296,6 @@ void rtw_dev_unload(PADAPTER padapter) rtw_intf_stop(padapter); - if (!pwrctl->bInternalAutoSuspend) rtw_stop_drv_threads(padapter); @@ -3317,7 +3310,6 @@ void rtw_dev_unload(PADAPTER padapter) } } - /* check the status of IPS */ if (rtw_hal_check_ips_status(padapter) == _TRUE || pwrctl->rf_pwrstate == rf_off) { /* check HW status and SW state */ RTW_PRINT("%s: driver in IPS-FWLPS\n", __func__); @@ -3429,7 +3421,6 @@ int rtw_suspend_wow(_adapter *padapter) RTW_INFO("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); - RTW_INFO("wowlan_mode: %d\n", pwrpriv->wowlan_mode); RTW_INFO("wowlan_pno_enable: %d\n", pwrpriv->wowlan_pno_enable); #ifdef CONFIG_P2P_WOWLAN @@ -3639,7 +3630,6 @@ int rtw_suspend_ap_wow(_adapter *padapter) } #endif /* #ifdef CONFIG_AP_WOWLAN */ - int rtw_suspend_normal(_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -3658,7 +3648,6 @@ int rtw_suspend_normal(_adapter *padapter) || (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off)) RTW_PRINT("%s: ### ERROR #### driver in IPS ####ERROR###!!!\n", __FUNCTION__); - #ifdef CONFIG_CONCURRENT_MODE rtw_mi_buddy_dev_unload(padapter); #endif @@ -3759,7 +3748,6 @@ int rtw_suspend_common(_adapter *padapter) } else rtw_suspend_normal(padapter); - RTW_PRINT("rtw suspend success in %d ms\n", rtw_get_passing_time_ms(start_time)); @@ -3841,7 +3829,6 @@ int rtw_resume_process_wow(_adapter *padapter) if (psta) set_sta_rate(padapter, psta); - rtw_clr_drv_stopped(padapter); RTW_INFO("%s: wowmode resuming, DriverStopped:%s\n", __func__, rtw_is_drv_stopped(padapter) ? "True" : "False"); @@ -3963,7 +3950,6 @@ int rtw_resume_process_ap_wow(_adapter *padapter) goto exit; } - #ifdef CONFIG_LPS rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "AP-WOWLAN"); #endif /* CONFIG_LPS */ @@ -4191,7 +4177,6 @@ int rtw_resume_common(_adapter *padapter) RTW_PRINT("%s:%d in %d ms\n", __FUNCTION__ , ret, rtw_get_passing_time_ms(start_time)); - return ret; } diff --git a/os_dep/linux/recv_linux.c b/os_dep/linux/recv_linux.c index a534c4b..fa84bcb 100644 --- a/os_dep/linux/recv_linux.c +++ b/os_dep/linux/recv_linux.c @@ -73,7 +73,6 @@ int rtw_os_alloc_recvframe(_adapter *padapter, union recv_frame *precvframe, u8 return res; } - /* Modified by Albert 20101213 */ /* For 8 bytes IP header alignment. */ shift_sz = pattrib->qos ? 6 : 0; /* Qos data, wireless lan header length is 26 */ @@ -398,7 +397,6 @@ void rtw_os_recv_indicate_pkt(_adapter *padapter, _pkt *pkt, struct rx_pkt_attri rcu_read_unlock(); #endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */ - if (br_port && (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE) == _TRUE)) { int nat25_handle_frame(_adapter *priv, struct sk_buff *skb); if (nat25_handle_frame(padapter, pkt) == -1) { @@ -511,7 +509,6 @@ void rtw_hostapd_mlme_rx(_adapter *padapter, union recv_frame *precv_frame) struct hostapd_priv *phostapdpriv = padapter->phostapdpriv; struct net_device *pmgnt_netdev = phostapdpriv->pmgnt_netdev; - skb = precv_frame->u.hdr.pkt; if (skb == NULL) @@ -667,7 +664,6 @@ int rtw_recv_indicatepkt(_adapter *padapter, union recv_frame *precv_frame) goto _recv_indicatepkt_drop; } - skb->data = precv_frame->u.hdr.rx_data; skb_set_tail_pointer(skb, precv_frame->u.hdr.len); @@ -750,8 +746,6 @@ int rtw_recv_indicatepkt(_adapter *padapter, union recv_frame *precv_frame) rtw_free_recvframe(precv_frame, pfree_recv_queue); - - return _SUCCESS; _recv_indicatepkt_drop: @@ -789,10 +783,18 @@ void rtw_os_read_port(_adapter *padapter, struct recv_buf *precvbuf) #endif } -void _rtw_reordering_ctrl_timeout_handler(void *FunctionContext); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void _rtw_reordering_ctrl_timeout_handler(struct timer_list *t) +#else void _rtw_reordering_ctrl_timeout_handler(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + struct recv_reorder_ctrl *preorder_ctrl = from_timer(preorder_ctrl, t, reordering_ctrl_timer); +#else struct recv_reorder_ctrl *preorder_ctrl = (struct recv_reorder_ctrl *)FunctionContext; +#endif rtw_reordering_ctrl_timeout_handler(preorder_ctrl); } @@ -800,6 +802,9 @@ void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl) { _adapter *padapter = preorder_ctrl->padapter; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&preorder_ctrl->reordering_ctrl_timer, _rtw_reordering_ctrl_timeout_handler, 0); +#else _init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, _rtw_reordering_ctrl_timeout_handler, preorder_ctrl); - +#endif } diff --git a/os_dep/linux/usb_intf.c b/os_dep/linux/usb_intf.c index 752043a..6ed4e72 100644 --- a/os_dep/linux/usb_intf.c +++ b/os_dep/linux/usb_intf.c @@ -42,12 +42,10 @@ extern int rtw_ampdu_enable;/* for enable tx_ampdu */ int ui_pid[3] = {0, 0, 0}; #endif - extern int pm_netdev_open(struct net_device *pnetdev, u8 bnormal); static int rtw_suspend(struct usb_interface *intf, pm_message_t message); static int rtw_resume(struct usb_interface *intf); - static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid); static void rtw_dev_remove(struct usb_interface *pusb_intf); @@ -85,13 +83,11 @@ static void rtw_dev_shutdown(struct device *dev) #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 #define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400 - #define USB_DEVICE_ID_MATCH_INT_INFO \ (USB_DEVICE_ID_MATCH_INT_CLASS | \ USB_DEVICE_ID_MATCH_INT_SUBCLASS | \ USB_DEVICE_ID_MATCH_INT_PROTOCOL) - #define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ | USB_DEVICE_ID_MATCH_DEVICE, \ @@ -125,10 +121,8 @@ static void rtw_dev_shutdown(struct device *dev) /* ----------------------------------------------------------------------- */ #endif - #define USB_VENDER_ID_REALTEK 0x0BDA - /* DID_USB_v916_20130116 */ static struct usb_device_id rtw_usb_id_tbl[] = { #ifdef CONFIG_RTL8188E @@ -227,6 +221,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = { {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8813), .driver_info = RTL8814A}, {USB_DEVICE(0x2001, 0x331A), .driver_info = RTL8814A}, /* D-Link - D-Link */ {USB_DEVICE(0x0B05, 0x1817), .driver_info = RTL8814A}, /* ASUS - ASUSTeK */ + {USB_DEVICE(0x0B05, 0x1852), .driver_info = RTL8814A}, /* ASUS - ASUSTeK */ {USB_DEVICE(0x056E, 0x400B), .driver_info = RTL8814A}, /* ELECOM - ELECOM */ {USB_DEVICE(0x056E, 0x400D), .driver_info = RTL8814A}, /* ELECOM - ELECOM */ {USB_DEVICE(0x7392, 0xA834), .driver_info = RTL8814A}, /* Edimax - Edimax */ @@ -355,7 +350,6 @@ static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj) _rtw_mutex_init(&dvobj->usb_vendor_req_mutex); #endif - #ifdef CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC dvobj->usb_alloc_vendor_req_buf = rtw_zmalloc(MAX_USB_IO_CTL_SIZE); if (dvobj->usb_alloc_vendor_req_buf == NULL) { @@ -457,13 +451,10 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf, const s struct usb_endpoint_descriptor *pendp_desc; struct usb_device *pusbd; - - pdvobjpriv = devobj_init(); if (pdvobjpriv == NULL) goto exit; - pdvobjpriv->pusbintf = usb_intf ; pusbd = pdvobjpriv->pusbdev = interface_to_usbdev(usb_intf); usb_set_intfdata(usb_intf, pdvobjpriv); @@ -721,7 +712,6 @@ u8 rtw_set_hal_ops(_adapter *padapter) rtl8723du_set_hal_ops(padapter); #endif /* CONFIG_RTL8723D */ - #ifdef CONFIG_RTL8821C if (rtw_get_chip_type(padapter) == RTL8821C) { if (rtl8821cu_set_hal_ops(padapter) == _FAIL) @@ -903,7 +893,6 @@ int rtw_hw_resume(_adapter *padapter) pwrpriv->bips_processing = _FALSE; _exit_pwrlock(&pwrpriv->lock); - return 0; error_exit: RTW_INFO("%s, Open net dev failed\n", __FUNCTION__); @@ -919,7 +908,6 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) PADAPTER padapter; int ret = 0; - dvobj = usb_get_intfdata(pusb_intf); pwrpriv = dvobj_to_pwrctl(dvobj); pdbgpriv = &dvobj->drv_dbg; @@ -959,7 +947,6 @@ int rtw_resume_process(_adapter *padapter) struct dvobj_priv *pdvobj = padapter->dvobj; struct debug_priv *pdbgpriv = &pdvobj->drv_dbg; - if (pwrpriv->bInSuspend == _FALSE) { pdbgpriv->dbg_resume_error_cnt++; RTW_INFO("%s bInSuspend = %d\n", __FUNCTION__, pwrpriv->bInSuspend); @@ -1019,7 +1006,6 @@ int rtw_resume_process(_adapter *padapter) } #endif/* CONFIG_AUTOSUSPEND */ - return ret; } @@ -1032,7 +1018,6 @@ static int rtw_resume(struct usb_interface *pusb_intf) struct mlme_ext_priv *pmlmeext; int ret = 0; - dvobj = usb_get_intfdata(pusb_intf); pwrpriv = dvobj_to_pwrctl(dvobj); pdbgpriv = &dvobj->drv_dbg; @@ -1071,8 +1056,6 @@ static int rtw_resume(struct usb_interface *pusb_intf) return ret; } - - #ifdef CONFIG_AUTOSUSPEND void autosuspend_enter(_adapter *padapter) { @@ -1218,7 +1201,6 @@ _adapter *rtw_usb_primary_adapter_init(struct dvobj_priv *dvobj, padapter->dvobj = dvobj; - rtw_set_drv_stopped(padapter);/*init*/ dvobj->padapters[dvobj->iface_nums++] = padapter; @@ -1241,7 +1223,6 @@ _adapter *rtw_usb_primary_adapter_init(struct dvobj_priv *dvobj, if (rtw_set_hal_ops(padapter) == _FAIL) goto free_hal_data; - padapter->intf_start = &usb_intf_start; padapter->intf_stop = &usb_intf_stop; @@ -1465,7 +1446,6 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device rtd2885_wlan_netlink_sendMsg("linkup", "8712"); #endif - status = _SUCCESS; #if 0 /* not used now */ @@ -1504,7 +1484,6 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf) struct net_device *pnetdev = padapter->pnetdev; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - RTW_INFO("+rtw_dev_remove\n"); dvobj->processing_dev_remove = _TRUE; @@ -1557,12 +1536,10 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf) RTW_INFO("-r871xu_dev_remove, done\n"); - #ifdef CONFIG_INTEL_PROXIM rtw_sw_export = NULL; #endif - return; } @@ -1629,7 +1606,6 @@ static void __exit rtw_drv_halt(void) rtw_mstat_dump(RTW_DBGDUMP); } - module_init(rtw_drv_entry); module_exit(rtw_drv_halt); diff --git a/os_dep/linux/wifi_regd.c b/os_dep/linux/wifi_regd.c index b2c6052..fa8ba7b 100644 --- a/os_dep/linux/wifi_regd.c +++ b/os_dep/linux/wifi_regd.c @@ -10,519 +10,13 @@ #include -static struct country_code_to_enum_rd allCountries[] = { - {COUNTRY_CODE_USER, "RD"}, -}; - -/* - * REG_RULE(freq start, freq end, bandwidth, max gain, eirp, reg_flags) - */ - -/* - *Only these channels all allow active - *scan on all world regulatory domains - */ - -/* 2G chan 01 - chan 11 */ -#define RTW_2GHZ_CH01_11 \ - REG_RULE(2412-10, 2462+10, 40, 0, 20, 0) - -/* - *We enable active scan on these a case - *by case basis by regulatory domain - */ - -/* 2G chan 12 - chan 13, PASSIV SCAN */ -#define RTW_2GHZ_CH12_13 \ - REG_RULE(2467-10, 2472+10, 40, 0, 20, \ - NL80211_RRF_PASSIVE_SCAN) - -/* 2G chan 14, PASSIVS SCAN, NO OFDM (B only) */ -#define RTW_2GHZ_CH14 \ - REG_RULE(2484-10, 2484+10, 40, 0, 20, \ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_OFDM) - -/* 5G chan 36 - chan 64 */ -#define RTW_5GHZ_5150_5350 \ - REG_RULE(5150-10, 5350+10, 80, 0, 30, \ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) - -/* 5G chan 100 - chan 165 */ -#define RTW_5GHZ_5470_5850 \ - REG_RULE(5470-10, 5850+10, 80, 0, 30, \ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) - -/* 5G chan 149 - chan 165 */ -#define RTW_5GHZ_5725_5850 \ - REG_RULE(5725-10, 5850+10, 80, 0, 30, \ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) - -/* 5G chan 36 - chan 165 */ -#define RTW_5GHZ_5150_5850 \ - REG_RULE(5150-10, 5850+10, 80, 0, 30, \ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) - -static const struct ieee80211_regdomain rtw_regdom_rd = { - .n_reg_rules = 4, - .alpha2 = "99", - .reg_rules = { - RTW_2GHZ_CH01_11, - RTW_2GHZ_CH12_13, - RTW_2GHZ_CH14, - RTW_5GHZ_5150_5850, - } -}; -#if 0 -static const struct ieee80211_regdomain rtw_regdom_11 = { - .n_reg_rules = 1, - .alpha2 = "99", - .reg_rules = { - RTW_2GHZ_CH01_11, - } -}; - -static const struct ieee80211_regdomain rtw_regdom_12_13 = { - .n_reg_rules = 2, - .alpha2 = "99", - .reg_rules = { - RTW_2GHZ_CH01_11, - RTW_2GHZ_CH12_13, - } -}; - -static const struct ieee80211_regdomain rtw_regdom_no_midband = { - .n_reg_rules = 3, - .alpha2 = "99", - .reg_rules = { - RTW_2GHZ_CH01_11, - RTW_5GHZ_5150_5350, - RTW_5GHZ_5725_5850, - } -}; - -static const struct ieee80211_regdomain rtw_regdom_60_64 = { - .n_reg_rules = 3, - .alpha2 = "99", - .reg_rules = { - RTW_2GHZ_CH01_11, - RTW_2GHZ_CH12_13, - RTW_5GHZ_5725_5850, - } -}; - -static const struct ieee80211_regdomain rtw_regdom_14_60_64 = { - .n_reg_rules = 4, - .alpha2 = "99", - .reg_rules = { - RTW_2GHZ_CH01_11, - RTW_2GHZ_CH12_13, - RTW_2GHZ_CH14, - RTW_5GHZ_5725_5850, - } -}; - -static const struct ieee80211_regdomain rtw_regdom_14 = { - .n_reg_rules = 3, - .alpha2 = "99", - .reg_rules = { - RTW_2GHZ_CH01_11, - RTW_2GHZ_CH12_13, - RTW_2GHZ_CH14, - } -}; -#endif -#if 0 -static struct rtw_regulatory *rtw_regd; -#endif - -static bool _rtw_is_radar_freq(u16 center_freq) -{ - return center_freq >= 5260 && center_freq <= 5700; -} - -#if 0 /* not_yet */ -static void _rtw_reg_apply_beaconing_flags(struct wiphy *wiphy, - enum nl80211_reg_initiator initiator) -{ - enum ieee80211_band band; - struct ieee80211_supported_band *sband; - const struct ieee80211_reg_rule *reg_rule; - struct ieee80211_channel *ch; - unsigned int i; - u32 bandwidth = 0; - int r; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - - if (!wiphy->bands[band]) - continue; - - sband = wiphy->bands[band]; - - for (i = 0; i < sband->n_channels; i++) { - ch = &sband->channels[i]; - if (_rtw_is_radar_freq(ch->center_freq) || - (ch->flags & IEEE80211_CHAN_RADAR)) - continue; - if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) { - r = freq_reg_info(wiphy, ch->center_freq, - bandwidth, ®_rule); - if (r) - continue; - - /* - *If 11d had a rule for this channel ensure - *we enable adhoc/beaconing if it allows us to - *use it. Note that we would have disabled it - *by applying our static world regdomain by - *default during init, prior to calling our - *regulatory_hint(). - */ - - if (!(reg_rule->flags & NL80211_RRF_NO_IBSS)) - ch->flags &= ~IEEE80211_CHAN_NO_IBSS; - if (! - (reg_rule->flags & - NL80211_RRF_PASSIVE_SCAN)) - ch->flags &= - ~IEEE80211_CHAN_PASSIVE_SCAN; - } else { - if (ch->beacon_found) - ch->flags &= ~(IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN); - } - } - } -} - -/* Allows active scan scan on Ch 12 and 13 */ -static void _rtw_reg_apply_active_scan_flags(struct wiphy *wiphy, - enum nl80211_reg_initiator - initiator) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - const struct ieee80211_reg_rule *reg_rule; - u32 bandwidth = 0; - int r; - - if (!wiphy->bands[IEEE80211_BAND_2GHZ]) - return; - sband = wiphy->bands[IEEE80211_BAND_2GHZ]; - - /* - * If no country IE has been received always enable active scan - * on these channels. This is only done for specific regulatory SKUs - */ - if (initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE) { - ch = &sband->channels[11]; /* CH 12 */ - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - ch = &sband->channels[12]; /* CH 13 */ - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - return; - } - - /* - * If a country IE has been received check its rule for this - * channel first before enabling active scan. The passive scan - * would have been enforced by the initial processing of our - * custom regulatory domain. - */ - - ch = &sband->channels[11]; /* CH 12 */ - r = freq_reg_info(wiphy, ch->center_freq, bandwidth, ®_rule); - if (!r) { - if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - } - - ch = &sband->channels[12]; /* CH 13 */ - r = freq_reg_info(wiphy, ch->center_freq, bandwidth, ®_rule); - if (!r) { - if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - } -} -#endif - -/* - * Always apply Radar/DFS rules on - * freq range 5260 MHz - 5700 MHz - */ -static void _rtw_reg_apply_radar_flags(struct wiphy *wiphy) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - unsigned int i; - - if (!wiphy->bands[IEEE80211_BAND_5GHZ]) - return; - - sband = wiphy->bands[IEEE80211_BAND_5GHZ]; - - for (i = 0; i < sband->n_channels; i++) { - ch = &sband->channels[i]; - if (!_rtw_is_radar_freq(ch->center_freq)) - continue; -#ifdef CONFIG_DFS - #if !defined(CONFIG_DFS_MASTER) - if (!(ch->flags & IEEE80211_CHAN_DISABLED)) { - ch->flags |= IEEE80211_CHAN_RADAR; - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)) - ch->flags |= (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN); - #else - ch->flags |= IEEE80211_CHAN_NO_IR; - #endif - } - #endif -#endif /* CONFIG_DFS */ - -#if 0 - /* - * We always enable radar detection/DFS on this - * frequency range. Additionally we also apply on - * this frequency range: - * - If STA mode does not yet have DFS supports disable - * active scanning - * - If adhoc mode does not support DFS yet then disable - * adhoc in the frequency. - * - If AP mode does not yet support radar detection/DFS - * do not allow AP mode - */ - if (!(ch->flags & IEEE80211_CHAN_DISABLED)) - ch->flags |= IEEE80211_CHAN_RADAR | - IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN; -#endif - } -} - -static void _rtw_reg_apply_flags(struct wiphy *wiphy) -{ -#if 1 /* by channel plan */ - _adapter *padapter = wiphy_to_adapter(wiphy); - - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - unsigned int i, j; - u16 channel; - - /* all channels disable */ - for (i = 0; i < IEEE80211_NUM_BANDS; i++) { - sband = wiphy->bands[i]; - - if (sband) { - for (j = 0; j < sband->n_channels; j++) { - ch = &sband->channels[j]; - - if (ch) - ch->flags &= ~(IEEE80211_CHAN_DISABLED|IEEE80211_CHAN_NO_HT40PLUS| - IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_80MHZ| - IEEE80211_CHAN_NO_160MHZ| -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)) - IEEE80211_CHAN_NO_IBSS|IEEE80211_CHAN_PASSIVE_SCAN); -#else - IEEE80211_CHAN_NO_IR); -#endif - } - } - } - -#else - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - unsigned int i, j; - u16 channels[37] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, - 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, - 149, 153, - 157, 161, 165 - }; - u16 channel; - u32 freq; - - for (i = 0; i < IEEE80211_NUM_BANDS; i++) { - sband = wiphy->bands[i]; - - if (sband) - for (j = 0; j < sband->n_channels; j++) { - ch = &sband->channels[j]; - - if (ch) - ch->flags = IEEE80211_CHAN_DISABLED; - } - } - - for (i = 0; i < 37; i++) { - channel = channels[i]; - freq = rtw_ch2freq(channel); - - ch = ieee80211_get_channel(wiphy, freq); - if (ch) { - if (channel <= 11) - ch->flags = 0; - else - ch->flags = 0; /* IEEE80211_CHAN_PASSIVE_SCAN; */ - } - /* printk("%s: freq %d(%d) flag 0x%02X\n", __func__, freq, channel, ch->flags); */ - } -#endif -} - -static void _rtw_reg_apply_world_flags(struct wiphy *wiphy, - enum nl80211_reg_initiator initiator, - struct rtw_regulatory *reg) -{ - /* _rtw_reg_apply_beaconing_flags(wiphy, initiator); */ - /* _rtw_reg_apply_active_scan_flags(wiphy, initiator); */ - return; -} - -static int _rtw_reg_notifier_apply(struct wiphy *wiphy, - struct regulatory_request *request, - struct rtw_regulatory *reg) -{ - - /* Hard code flags */ - _rtw_reg_apply_flags(wiphy); - - /* We always apply this */ - _rtw_reg_apply_radar_flags(wiphy); - - switch (request->initiator) { - case NL80211_REGDOM_SET_BY_DRIVER: - RTW_INFO("%s: %s\n", __func__, "NL80211_REGDOM_SET_BY_DRIVER"); - _rtw_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, - reg); - break; - case NL80211_REGDOM_SET_BY_CORE: - RTW_INFO("%s: %s\n", __func__, - "NL80211_REGDOM_SET_BY_CORE to DRV"); - _rtw_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, - reg); - break; - case NL80211_REGDOM_SET_BY_USER: - RTW_INFO("%s: %s\n", __func__, - "NL80211_REGDOM_SET_BY_USER to DRV"); - _rtw_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, - reg); - break; - case NL80211_REGDOM_SET_BY_COUNTRY_IE: - RTW_INFO("%s: %s\n", __func__, - "NL80211_REGDOM_SET_BY_COUNTRY_IE"); - _rtw_reg_apply_world_flags(wiphy, request->initiator, reg); - break; - } - - return 0; -} - -static const struct ieee80211_regdomain *_rtw_regdomain_select(struct - rtw_regulatory - *reg) -{ -#if 0 - switch (reg->country_code) { - case COUNTRY_CODE_USER: - default: - return &rtw_regdom_rd; - } -#else - return &rtw_regdom_rd; -#endif -} - -void _rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) -{ - struct rtw_regulatory *reg = NULL; - - RTW_INFO("%s\n", __func__); - - _rtw_reg_notifier_apply(wiphy, request, reg); -} - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)) -int rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) -#else -void rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) -#endif -{ - _rtw_reg_notifier(wiphy, request); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)) - return 0; -#endif -} - void rtw_reg_notify_by_driver(_adapter *adapter) { - if ((adapter->rtw_wdev != NULL) && (adapter->rtw_wdev->wiphy)) { - struct regulatory_request request; - request.initiator = NL80211_REGDOM_SET_BY_DRIVER; - rtw_reg_notifier(adapter->rtw_wdev->wiphy, &request); - } -} - -static void _rtw_regd_init_wiphy(struct rtw_regulatory *reg, struct wiphy *wiphy) -{ - const struct ieee80211_regdomain *regd; - - wiphy->reg_notifier = rtw_reg_notifier; - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)) - wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; - wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY; - wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS; -#else - wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; - wiphy->regulatory_flags &= ~REGULATORY_STRICT_REG; - wiphy->regulatory_flags &= ~REGULATORY_DISABLE_BEACON_HINTS; -#endif - - regd = _rtw_regdomain_select(reg); - wiphy_apply_custom_regulatory(wiphy, regd); - - /* Hard code flags */ - _rtw_reg_apply_flags(wiphy); - _rtw_reg_apply_radar_flags(wiphy); - _rtw_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); -} - -static struct country_code_to_enum_rd *_rtw_regd_find_country(u16 countrycode) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(allCountries); i++) { - if (allCountries[i].countrycode == countrycode) - return &allCountries[i]; - } - return NULL; + return; } int rtw_regd_init(_adapter *padapter) { - struct wiphy *wiphy = padapter->rtw_wdev->wiphy; - -#if 0 - if (rtw_regd == NULL) { - rtw_regd = (struct rtw_regulatory *) - rtw_malloc(sizeof(struct rtw_regulatory)); - - rtw_regd->alpha2[0] = '9'; - rtw_regd->alpha2[1] = '9'; - - rtw_regd->country_code = COUNTRY_CODE_USER; - } - - RTW_INFO("%s: Country alpha2 being used: %c%c\n", - __func__, rtw_regd->alpha2[0], rtw_regd->alpha2[1]); -#endif - - _rtw_regd_init_wiphy(NULL, wiphy); - return 0; } #endif /* CONFIG_IOCTL_CFG80211 */ diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index 7a3f777..6fa4e82 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -18,7 +18,6 @@ * ******************************************************************************/ - #define _OSDEP_SERVICE_C_ #include @@ -32,7 +31,6 @@ atomic_t _malloc_size = ATOMIC_INIT(0); #endif #endif /* DBG_MEMORY_LEAK */ - #if defined(PLATFORM_LINUX) /* * Translate the OS dependent @param error_code to OS independent RTW_STATUS_CODE @@ -998,20 +996,15 @@ void rtw_list_insert_tail(_list *plist, _list *phead) } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) void rtw_init_timer(_timer *ptimer, void *padapter, void *pfunc) { _adapter *adapter = (_adapter *)padapter; -#ifdef PLATFORM_LINUX _init_timer(ptimer, adapter->pnetdev, pfunc, adapter); -#endif -#ifdef PLATFORM_FREEBSD - _init_timer(ptimer, adapter->pifp, pfunc, adapter->mlmepriv.nic_hdl); -#endif -#ifdef PLATFORM_WINDOWS - _init_timer(ptimer, adapter->hndis_adapter, pfunc, adapter->mlmepriv.nic_hdl); -#endif + } +#endif /* @@ -1019,7 +1012,6 @@ Caller must check if the list is empty before calling rtw_list_delete */ - void _rtw_init_sema(_sema *sema, int init_val) { @@ -1212,7 +1204,6 @@ void rtw_mtx_unlock(_lock *plock) } #endif /* PLATFORM_FREEBSD */ - void _rtw_spinlock(_lock *plock) { @@ -1288,8 +1279,6 @@ void _rtw_spinunlock_ex(_lock *plock) #endif } - - void _rtw_init_queue(_queue *pqueue) { _rtw_init_listhead(&(pqueue->queue)); @@ -1389,7 +1378,6 @@ inline s32 rtw_get_time_interval_ms(u32 start, u32 end) #endif } - void rtw_sleep_schedulable(int ms) { @@ -1420,7 +1408,6 @@ void rtw_sleep_schedulable(int ms) } - void rtw_msleep_os(int ms) { @@ -1445,7 +1432,6 @@ void rtw_msleep_os(int ms) #endif - } void rtw_usleep_os(int us) { @@ -1474,10 +1460,8 @@ void rtw_usleep_os(int us) #endif - } - #ifdef DBG_DELAY_OS void _rtw_mdelay_os(int ms, const char *func, const int line) { @@ -1488,7 +1472,6 @@ void _rtw_mdelay_os(int ms, const char *func, const int line) return; #endif - RTW_INFO("%s:%d %s(%d)\n", func, line, __FUNCTION__, ms); #if defined(PLATFORM_LINUX) @@ -1501,7 +1484,6 @@ void _rtw_mdelay_os(int ms, const char *func, const int line) #endif - } void _rtw_udelay_os(int us, const char *func, const int line) { @@ -1517,7 +1499,6 @@ void _rtw_udelay_os(int us, const char *func, const int line) RTW_INFO("%s:%d %s(%d)\n", func, line, __FUNCTION__, us); - #if defined(PLATFORM_LINUX) udelay((unsigned long)us); @@ -1548,7 +1529,6 @@ void rtw_mdelay_os(int ms) #endif - } void rtw_udelay_os(int us) { @@ -1872,7 +1852,6 @@ inline int ATOMIC_DEC_RETURN(ATOMIC_T *v) #endif } - #ifdef PLATFORM_LINUX /* * Open a file with the specific @param path, @param flag, @param mode @@ -2280,7 +2259,6 @@ copy_to_user(void *to, const void *from, unsigned long n) return 0; } - /* * The usb_register and usb_deregister functions are used to register * usb drivers with the usb subsystem. In this compatibility layer @@ -2296,7 +2274,6 @@ usb_register(struct usb_driver *driver) return 0; } - int usb_deregister(struct usb_driver *driver) { @@ -2412,7 +2389,6 @@ void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len) rtw_mfree(ori, ori_len); } - /** * rtw_cbuf_full - test if cbuf is full * @cbuf: pointer of struct rtw_cbuf