From 3030a734d794bdb709f6c0b835801ee7cb42e1be Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Thu, 29 Nov 2018 11:43:26 -0600 Subject: [PATCH] rtl8723ds: Update source for recent API changes The source will now compile on kernels up to 4.20. Signed-off-by: Larry Finger --- core/rtw_p2p.c | 90 ++++++++++++++++++++++-- core/rtw_pwrctrl.c | 42 +++++++++--- core/rtw_recv.c | 17 ++++- hal/hal_btcoex.c | 8 +++ hal/led/hal_sdio_led.c | 15 +++- hal/phydm/phydm_antdiv.c | 4 ++ hal/phydm/phydm_interface.c | 13 +--- include/hal_com_led.h | 1 - include/osdep_service.h | 3 +- include/osdep_service_linux.h | 2 + include/rtw_mlme.h | 18 +++-- include/rtw_pwrctrl.h | 1 + include/wifi.h | 2 + os_dep/linux/ioctl_cfg80211.c | 10 ++- os_dep/linux/ioctl_mp.c | 92 +++++++++++++++++++------ os_dep/linux/mlme_linux.c | 125 ++++++++++++++++++++++++++++++---- os_dep/linux/os_intfs.c | 35 ++++++++-- os_dep/linux/recv_linux.c | 16 ++++- os_dep/osdep_service.c | 2 + 19 files changed, 410 insertions(+), 86 deletions(-) diff --git a/core/rtw_p2p.c b/core/rtw_p2p.c index fa91366..7d9667b 100644 --- a/core/rtw_p2p.c +++ b/core/rtw_p2p.c @@ -3370,9 +3370,17 @@ exit: return ret; } +#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, wdinfo.reset_ch_sitesurvey); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif p2p_cancel_roch_cmd(adapter, 0, NULL, 0); } @@ -4203,7 +4211,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) _init_timer(&pcfg80211_wdinfo->remain_on_ch_timer, padapter->pnetdev, ro_ch_timer_process, padapter); +#else + timer_setup(&pcfg80211_wdinfo->remain_on_ch_timer, ro_ch_timer_process, 0); +#endif } #endif /* CONFIG_IOCTL_CFG80211 */ @@ -4515,9 +4527,17 @@ exit: } #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_sitesurvey2); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -4534,9 +4554,17 @@ static void reset_ch_sitesurvey_timer_process(void *FunctionContext) pwdinfo->rx_invitereq_info.scan_op_ch_only = 0; } -static void reset_ch_sitesurvey_timer_process2(void *FunctionContext) +#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)) @@ -4553,9 +4581,17 @@ static void reset_ch_sitesurvey_timer_process2(void *FunctionContext) pwdinfo->p2p_info.scan_op_ch_only = 0; } -static void restore_p2p_state_timer_process(void *FunctionContext) +#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)) @@ -4564,9 +4600,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; @@ -4596,9 +4640,17 @@ static void pre_tx_scan_timer_process(void *FunctionContext) _exit_critical_bh(&pmlmepriv->lock, &irqL); } -static void find_phase_timer_process(void *FunctionContext) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) +static void find_phase_timer_process (void *FunctionContext) +#else +static void find_phase_timer_process(struct timer_list *t) +#endif { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) _adapter *adapter = (_adapter *)FunctionContext; +#else + _adapter *adapter = from_timer(adapter, t, wdinfo.find_phase_timer); +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -4610,9 +4662,17 @@ static void find_phase_timer_process(void *FunctionContext) } #ifdef CONFIG_CONCURRENT_MODE -void ap_p2p_switch_timer_process(void *FunctionContext) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void ap_p2p_switch_timer_process(struct timer_list *t) +#else +void ap_p2p_switch_timer_process (void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, wdinfo.ap_p2p_switch_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; #ifdef CONFIG_IOCTL_CFG80211 struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter); @@ -4855,6 +4915,7 @@ void rtw_init_wifidirect_timers(_adapter *padapter) { struct wifidirect_info *pwdinfo = &padapter->wdinfo; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) _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); @@ -4863,6 +4924,16 @@ 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 +#else + 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 +#endif } void rtw_init_wifidirect_addrs(_adapter *padapter, u8 *dev_addr, u8 *iface_addr) @@ -5244,8 +5315,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); - reset_ch_sitesurvey_timer_process(padapter); - reset_ch_sitesurvey_timer_process2(padapter); +#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 03c8a37..2141d29 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -393,10 +393,18 @@ exit: return; } -void pwr_state_check_handler(RTW_TIMER_HDL_ARGS); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) void pwr_state_check_handler(RTW_TIMER_HDL_ARGS) +#else +void pwr_state_check_handler(struct timer_list *t) +#endif { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) _adapter *padapter = (_adapter *)FunctionContext; +#else + struct pwrctrl_priv *pwrpriv = from_timer(pwrpriv, t, pwr_state_check_timer); + _adapter *padapter = pwrpriv->padapter; +#endif rtw_ps_cmd(padapter); } @@ -1438,14 +1446,18 @@ exit: /* * This function is a timer handler, can't do any IO in it. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) static void pwr_rpwm_timeout_handler(void *FunctionContext) +#else +static void pwr_rpwm_timeout_handler(struct timer_list *t) +#endif { - PADAPTER padapter; - struct pwrctrl_priv *pwrpriv; - - - padapter = (PADAPTER)FunctionContext; - pwrpriv = adapter_to_pwrctl(padapter); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) + PADAPTER padapter = (PADAPTER)FunctionContext; + struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); +#else + struct pwrctrl_priv *pwrpriv = from_timer(pwrpriv, t, pwr_rpwm_timer); +#endif RTW_INFO("+%s: rpwm=0x%02X cpwm=0x%02X\n", __func__, pwrpriv->rpwm, pwrpriv->cpwm); if ((pwrpriv->rpwm == pwrpriv->cpwm) || (pwrpriv->cpwm >= PS_STATE_S2)) { @@ -1934,7 +1946,7 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter) pwrctrlpriv->smart_ps = padapter->registrypriv.smart_ps; pwrctrlpriv->bcn_ant_mode = 0; pwrctrlpriv->dtim = 0; - + pwrctrlpriv->padapter = padapter; pwrctrlpriv->tog = 0x80; #ifdef CONFIG_LPS_LCLK @@ -1945,11 +1957,21 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter) #ifdef CONFIG_LPS_RPWM_TIMER pwrctrlpriv->brpwmtimeout = _FALSE; _init_workitem(&pwrctrlpriv->rpwmtimeoutwi, rpwmtimeout_workitem_callback, NULL); - _init_timer(&pwrctrlpriv->pwr_rpwm_timer, padapter->pnetdev, pwr_rpwm_timeout_handler, padapter); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) + _init_timer(&pwrctrlpriv->pwr_rpwm_timer, padapter->pnetdev, + pwr_rpwm_timeout_handler, padapter); +#else + timer_setup(&pwrctrlpriv->pwr_rpwm_timer, pwr_rpwm_timeout_handler, 0); +#endif #endif /* CONFIG_LPS_RPWM_TIMER */ #endif /* CONFIG_LPS_LCLK */ - rtw_init_timer(&pwrctrlpriv->pwr_state_check_timer, padapter, pwr_state_check_handler); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) + rtw_init_timer(&pwrctrlpriv->pwr_state_check_timer, padapter, + pwr_state_check_handler); +#else + timer_setup(&pwrctrlpriv->pwr_state_check_timer, pwr_state_check_handler, 0); +#endif pwrctrlpriv->wowlan_mode = _FALSE; pwrctrlpriv->wowlan_ap_mode = _FALSE; diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 49b792d..87a6b2a 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -23,7 +23,11 @@ #include #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)) void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS); +#else +void rtw_signal_stat_timer_hdl(struct timer_list *t); +#endif enum { SIGNAL_STAT_CALC_PROFILE_0 = 0, @@ -132,8 +136,11 @@ 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)) rtw_init_timer(&precvpriv->signal_stat_timer, padapter, RTW_TIMER_HDL_NAME(signal_stat)); - +#else + timer_setup(&precvpriv->signal_stat_timer, rtw_signal_stat_timer_hdl, 0); +#endif precvpriv->signal_stat_sampling_interval = 2000; /* ms */ /* precvpriv->signal_stat_converging_constant = 5000; */ /* ms */ @@ -4184,9 +4191,17 @@ _recv_entry_drop: } #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)) void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS) +#else +void rtw_signal_stat_timer_hdl(struct timer_list *t) +#endif { +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)) _adapter *adapter = (_adapter *)FunctionContext; +#else + _adapter *adapter = from_timer(adapter, t, recvpriv.signal_stat_timer); +#endif struct recv_priv *recvpriv = &adapter->recvpriv; u32 tmp_s, tmp_q; diff --git a/hal/hal_btcoex.c b/hal/hal_btcoex.c index 1cc85e5..8d7df3d 100644 --- a/hal/hal_btcoex.c +++ b/hal/hal_btcoex.c @@ -542,7 +542,11 @@ u32 halbtcoutsrc_GetWifiLinkStatus(PBTC_COEXIST pBtCoexist) return retVal; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void _btmpoper_timer_hdl(struct timer_list *t) +#else static void _btmpoper_timer_hdl(void *p) +#endif { if (GLBtcBtMpRptWait) { GLBtcBtMpRptWait = 0; @@ -2411,7 +2415,11 @@ u8 EXhalbtcoutsrc_InitlizeVariables(void *padapter) /* BT Control H2C/C2H*/ GLBtcBtMpOperSeq = 0; _rtw_mutex_init(&GLBtcBtMpOperLock); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&GLBtcBtMpOperTimer, _btmpoper_timer_hdl, 0); +#else _init_timer(&GLBtcBtMpOperTimer, ((PADAPTER)padapter)->pnetdev, _btmpoper_timer_hdl, pBtCoexist); +#endif _rtw_init_sema(&GLBtcBtMpRptSema, 0); GLBtcBtMpRptSeq = 0; GLBtcBtMpRptStatus = 0; diff --git a/hal/led/hal_sdio_led.c b/hal/led/hal_sdio_led.c index 8465602..ec84d5e 100644 --- a/hal/led/hal_sdio_led.c +++ b/hal/led/hal_sdio_led.c @@ -823,9 +823,17 @@ void BlinkHandler(PLED_SDIO 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_SDIO pLed = from_timer(pLed, t, BlinkTimer); +#else PLED_SDIO pLed = (PLED_SDIO)data; +#endif _adapter *padapter = pLed->padapter; /* RTW_INFO("%s\n", __FUNCTION__); */ @@ -1994,8 +2002,11 @@ InitLed( 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, linkTimerCallback, pLed); +#endif _init_workitem(&(pLed->BlinkWorkItem), BlinkWorkItemCallback, pLed); } diff --git a/hal/phydm/phydm_antdiv.c b/hal/phydm/phydm_antdiv.c index dcd0c5f..0c603d6 100644 --- a/hal/phydm/phydm_antdiv.c +++ b/hal/phydm/phydm_antdiv.c @@ -5306,8 +5306,12 @@ ODM_AntDivTimers( if(state==INIT_ANTDIV_TIMMER) { #ifdef CONFIG_S0S1_SW_ANTENNA_DIVERSITY +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + setup_timer(&pDM_Odm->DM_SWAT_Table.phydm_SwAntennaSwitchTimer, ODM_SW_AntDiv_Callback, 0) +#else ODM_InitializeTimer(pDM_Odm, &(pDM_Odm->DM_SWAT_Table.phydm_SwAntennaSwitchTimer), (RT_TIMER_CALL_BACK)ODM_SW_AntDiv_Callback, NULL, "phydm_SwAntennaSwitchTimer"); +#endif #elif ( defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY) ) ||( defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY) ) ODM_InitializeTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer, (RT_TIMER_CALL_BACK)odm_FastAntTrainingCallback, NULL, "FastAntTrainingTimer"); diff --git a/hal/phydm/phydm_interface.c b/hal/phydm/phydm_interface.c index d72002f..0cdb456 100644 --- a/hal/phydm/phydm_interface.c +++ b/hal/phydm/phydm_interface.c @@ -561,6 +561,7 @@ ODM_SetTimer( } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) VOID ODM_InitializeTimer( IN PDM_ODM_T pDM_Odm, @@ -570,20 +571,10 @@ ODM_InitializeTimer( IN const char* szID ) { -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - init_timer(pTimer); - pTimer->function = CallBackFunc; - pTimer->data = (unsigned long)pDM_Odm; - /*mod_timer(pTimer, jiffies+RTL_MILISECONDS_TO_JIFFIES(10)); */ -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) PADAPTER Adapter = pDM_Odm->Adapter; _init_timer(pTimer,Adapter->pnetdev,CallBackFunc,pDM_Odm); -#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN) - PADAPTER Adapter = pDM_Odm->Adapter; - PlatformInitializeTimer(Adapter, pTimer, CallBackFunc,pContext,szID); -#endif } - +#endif VOID ODM_CancelTimer( diff --git a/include/hal_com_led.h b/include/hal_com_led.h index 01dbb9c..d30b06a 100644 --- a/include/hal_com_led.h +++ b/include/hal_com_led.h @@ -373,7 +373,6 @@ struct led_priv { (adapter)->ledpriv.SwLedOff((adapter), (pLed)); \ } while (0) -void BlinkTimerCallback(void *data); void BlinkWorkItemCallback(_workitem *work); void ResetLedStatus(PLED_DATA pLed); diff --git a/include/osdep_service.h b/include/osdep_service.h index 5986475..d01f4ad 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -320,8 +320,9 @@ extern void rtw_udelay_os(int us); extern void rtw_yield_os(void); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)) extern void rtw_init_timer(_timer *ptimer, void *padapter, void *pfunc); - +#endif __inline static unsigned char _cancel_timer_ex(_timer *ptimer) { diff --git a/include/osdep_service_linux.h b/include/osdep_service_linux.h index 296d979..e86d1ab 100644 --- a/include/osdep_service_linux.h +++ b/include/osdep_service_linux.h @@ -283,6 +283,7 @@ __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); */ @@ -290,6 +291,7 @@ __inline static void _init_timer(_timer *ptimer, _nic_hdl nic_hdl, void *pfunc, ptimer->data = (unsigned long)cntx; init_timer(ptimer); } +#endif __inline static void _set_timer(_timer *ptimer, u32 delay_time) { diff --git a/include/rtw_mlme.h b/include/rtw_mlme.h index 6fc7e80..61d01d0 100644 --- a/include/rtw_mlme.h +++ b/include/rtw_mlme.h @@ -903,8 +903,6 @@ void rtw_sta_timeout_event_callback(_adapter *adapter, u8 *pbuf); void rtw_update_ft_stainfo(_adapter *padapter, WLAN_BSSID_EX *pnetwork); void rtw_ft_reassoc_event_callback(_adapter *padapter, u8 *pbuf); #endif -extern void rtw_join_timeout_handler(RTW_TIMER_HDL_ARGS); -extern void _rtw_scan_timeout_handler(RTW_TIMER_HDL_ARGS); thread_return event_thread(thread_context context); @@ -1052,10 +1050,22 @@ extern void rtw_update_registrypriv_dev_network(_adapter *adapter); extern void rtw_get_encrypt_decrypt_from_registrypriv(_adapter *adapter); -extern void _rtw_join_timeout_handler(_adapter *adapter); -extern void rtw_scan_timeout_handler(_adapter *adapter); +void _rtw_join_timeout_handler(_adapter *adapter); +void rtw_scan_timeout_handler(_adapter *adapter); +#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 +void _rtw_scan_timeout_handler(RTW_TIMER_HDL_ARGS); +void rtw_join_timeout_handler(RTW_TIMER_HDL_ARGS); +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) extern void _dynamic_check_timer_handlder(void *FunctionContext); +#else +void _dynamic_check_timer_handlder(struct timer_list *t); +#endif extern void rtw_dynamic_check_timer_handlder(_adapter *adapter); extern void rtw_iface_dynamic_check_timer_handlder(_adapter *adapter); diff --git a/include/rtw_pwrctrl.h b/include/rtw_pwrctrl.h index 5511c2a..0f52734 100644 --- a/include/rtw_pwrctrl.h +++ b/include/rtw_pwrctrl.h @@ -306,6 +306,7 @@ typedef struct lps_poff_info { #endif /*CONFIG_LPS_POFF*/ struct pwrctrl_priv { + _adapter *padapter; _pwrlock lock; _pwrlock check_32k_lock; volatile u8 rpwm; /* requested power state for fw */ diff --git a/include/wifi.h b/include/wifi.h index b40e365..ce78bf6 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -925,7 +925,9 @@ typedef enum _HT_CAP_AMPDU_DENSITY { * 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 +#endif /* Spatial Multiplexing Power Save Modes */ diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 82762d2..cd1bfe7 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -339,14 +339,18 @@ static const struct ieee80211_txrx_stypes static u64 rtw_get_systime_us(void) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)) + ktime_t ts; + ts = ktime_get_boottime(); + return do_div(ts, 1000); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) struct timespec ts; get_monotonic_boottime(&ts); - return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000; + return ((u64)ts.tv_sec*1000000) + ts.tv_nsec / 1000; #else struct timeval tv; do_gettimeofday(&tv); - return ((u64)tv.tv_sec * 1000000) + tv.tv_usec; + return ((u64)tv.tv_sec*1000000) + tv.tv_usec; #endif } diff --git a/os_dep/linux/ioctl_mp.c b/os_dep/linux/ioctl_mp.c index 9ced137..362d088 100644 --- a/os_dep/linux/ioctl_mp.c +++ b/os_dep/linux/ioctl_mp.c @@ -48,7 +48,10 @@ int rtw_mp_write_reg(struct net_device *dev, u32 addr, data; int ret; PADAPTER padapter = rtw_netdev_priv(dev); - char input[wrqu->length]; + char input[128]; + + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -130,7 +133,7 @@ int rtw_mp_read_reg(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrqu, char *extra) { - char input[wrqu->length]; + char input[128]; char *pch, *pnext, *ptmp; char *width_str; char width; @@ -139,7 +142,6 @@ int rtw_mp_read_reg(struct net_device *dev, u32 i = 0, j = 0, ret = 0, data32 = 0; PADAPTER padapter = rtw_netdev_priv(dev); - if (wrqu->length > 128) return -EFAULT; @@ -262,8 +264,10 @@ int rtw_mp_write_rf(struct net_device *dev, u32 path, addr, data; int ret; PADAPTER padapter = rtw_netdev_priv(dev); - char input[wrqu->length]; + char input[128]; + if (wrqu->length > 128) + return -EFAULT; _rtw_memset(input, 0, wrqu->length); if (copy_from_user(input, wrqu->pointer, wrqu->length)) @@ -304,7 +308,7 @@ int rtw_mp_read_rf(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrqu, char *extra) { - char input[wrqu->length]; + char input[128]; char *pch, *pnext, *ptmp; char data[20], tmp[20], buf[3]; u32 path, addr, strtou; @@ -455,10 +459,13 @@ int rtw_mp_rate(struct net_device *dev, struct iw_point *wrqu, char *extra) { u32 rate = MPT_RATE_1M; - u8 input[wrqu->length]; + u8 input[128]; PADAPTER padapter = rtw_netdev_priv(dev); PMPT_CONTEXT pMptCtx = &(padapter->mppriv.MptCtx); + if (wrqu->length > 128) + return -EFAULT; + if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -503,10 +510,13 @@ int rtw_mp_channel(struct net_device *dev, PADAPTER padapter = rtw_netdev_priv(dev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - u8 input[wrqu->length]; + u8 input[128]; u32 channel = 1; int cur_ch_offset; + if (wrqu->length > 128) + return -EFAULT; + if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -531,7 +541,10 @@ int rtw_mp_bandwidth(struct net_device *dev, int cur_ch_offset; PADAPTER padapter = rtw_netdev_priv(dev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - u8 input[wrqu->length]; + u8 input[128]; + + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -564,7 +577,7 @@ int rtw_mp_txpower_index(struct net_device *dev, struct iw_point *wrqu, char *extra) { PADAPTER padapter = rtw_netdev_priv(dev); - char input[wrqu->length]; + char input[128]; u32 rfpath; u32 txpower_inx; @@ -589,11 +602,14 @@ int rtw_mp_txpower(struct net_device *dev, { u32 idx_a = 0, idx_b = 0, idx_c = 0, idx_d = 0, status = 0; int MsetPower = 1; - u8 input[wrqu->length]; + u8 input[128]; PADAPTER padapter = rtw_netdev_priv(dev); PMPT_CONTEXT pMptCtx = &(padapter->mppriv.MptCtx); + if (wrqu->length > 128) + return -EFAULT; + if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -627,11 +643,14 @@ int rtw_mp_ant_tx(struct net_device *dev, struct iw_point *wrqu, char *extra) { u8 i; - u8 input[wrqu->length]; + u8 input[128]; u16 antenna = 0; PADAPTER padapter = rtw_netdev_priv(dev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + if (wrqu->length > 128) + return -EFAULT; + if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -673,10 +692,13 @@ int rtw_mp_ant_rx(struct net_device *dev, { u8 i; u16 antenna = 0; - u8 input[wrqu->length]; + u8 input[128]; PADAPTER padapter = rtw_netdev_priv(dev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + if (wrqu->length > 128) + return -EFAULT; + if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; /*RTW_INFO("%s: input=%s\n", __func__, input);*/ @@ -849,9 +871,12 @@ int rtw_mp_disable_bt_coexist(struct net_device *dev, HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); struct hal_ops *pHalFunc = &padapter->HalFunc; - u8 input[wrqu->data.length]; + u8 input[128]; u32 bt_coexist; + if (wrqu->data.length > 128) + return -EFAULT; + if (copy_from_user(input, wrqu->data.pointer, wrqu->data.length)) return -EFAULT; @@ -883,13 +908,16 @@ int rtw_mp_arx(struct net_device *dev, { int bStartRx = 0, bStopRx = 0, bQueryPhy = 0, bQueryMac = 0, bSetBssid = 0; int bmac_filter = 0, bfilter_init = 0, bmon = 0, bSmpCfg = 0, bloopbk = 0; - u8 input[wrqu->length]; + u8 input[128]; char *pch, *ptmp, *token, *tmp[2] = {NULL, NULL}; u32 i = 0, ii = 0, jj = 0, kk = 0, cnts = 0, ret; PADAPTER padapter = rtw_netdev_priv(dev); struct mp_priv *pmppriv = &padapter->mppriv; struct dbg_rx_counter rx_counter; + if (wrqu->length > 128) + return -EFAULT; + if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -1062,7 +1090,10 @@ int rtw_mp_pwrtrk(struct net_device *dev, s32 ret; PADAPTER padapter = rtw_netdev_priv(dev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - u8 input[wrqu->length]; + u8 input[128]; + + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -1100,7 +1131,10 @@ int rtw_mp_psd(struct net_device *dev, struct iw_point *wrqu, char *extra) { PADAPTER padapter = rtw_netdev_priv(dev); - u8 input[wrqu->length]; + u8 input[128]; + + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -1213,11 +1247,14 @@ int rtw_mp_dump(struct net_device *dev, struct mp_priv *pmp_priv; struct pkt_attrib *pattrib; u32 value; - u8 input[wrqu->length]; + u8 input[128]; u8 rf_type, path_nums = 0; u32 i, j = 1, path; PADAPTER padapter = rtw_netdev_priv(dev); + if (wrqu->length > 128) + return -EFAULT; + pmp_priv = &padapter->mppriv; if (copy_from_user(input, wrqu->pointer, wrqu->length)) @@ -1239,9 +1276,12 @@ int rtw_mp_phypara(struct net_device *dev, PADAPTER padapter = rtw_netdev_priv(dev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - char input[wrqu->length]; + char input[128]; u32 valxcap, ret; + if (wrqu->length > 128) + return -EFAULT; + if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -1265,9 +1305,12 @@ int rtw_mp_SetRFPath(struct net_device *dev, struct iw_point *wrqu, char *extra) { PADAPTER padapter = rtw_netdev_priv(dev); - char input[wrqu->length]; + char input[128]; int bMain = 1, bTurnoff = 1; + if (wrqu->length > 128) + return -EFAULT; + RTW_INFO("%s:iwpriv in=%s\n", __func__, input); if (copy_from_user(input, wrqu->pointer, wrqu->length)) @@ -1300,11 +1343,13 @@ int rtw_mp_QueryDrv(struct net_device *dev, union iwreq_data *wrqu, char *extra) { PADAPTER padapter = rtw_netdev_priv(dev); - char input[wrqu->data.length]; + char input[128]; int qAutoLoad = 1; - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); + if (wrqu->data.length > 128) + return -EFAULT; + if (copy_from_user(input, wrqu->data.pointer, wrqu->data.length)) return -EFAULT; RTW_INFO("%s:iwpriv in=%s\n", __func__, input); @@ -1329,9 +1374,12 @@ int rtw_mp_PwrCtlDM(struct net_device *dev, struct iw_point *wrqu, char *extra) { PADAPTER padapter = rtw_netdev_priv(dev); - u8 input[wrqu->length]; + u8 input[128]; int bstart = 1; + if (wrqu->length > 128) + return -EFAULT; + if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; diff --git a/os_dep/linux/mlme_linux.c b/os_dep/linux/mlme_linux.c index eef8f5f..6509df0 100644 --- a/os_dep/linux/mlme_linux.c +++ b/os_dep/linux/mlme_linux.c @@ -68,23 +68,47 @@ void sitesurvey_ctrl_handler(void *FunctionContext) } */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void rtw_join_timeout_handler(struct timer_list *t) +#else void rtw_join_timeout_handler(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, mlmepriv.assoc_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif _rtw_join_timeout_handler(adapter); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + void _rtw_scan_timeout_handler(struct timer_list *t) +#else void _rtw_scan_timeout_handler(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, mlmepriv.scan_to_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif rtw_scan_timeout_handler(adapter); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void _dynamic_check_timer_handlder(struct timer_list *t) +#else void _dynamic_check_timer_handlder(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + struct dvobj_priv *pdvobj = from_timer(pdvobj, t, dynamic_chk_timer); +#else struct dvobj_priv *pdvobj = (struct dvobj_priv *)FunctionContext; +#endif _adapter *adapter = dvobj_get_primary_adapter(pdvobj); #if (MP_DRIVER == 1) @@ -101,9 +125,17 @@ void _dynamic_check_timer_handlder(void *FunctionContext) } #ifdef CONFIG_SET_SCAN_DENY_TIMER +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void _rtw_set_scan_deny_timer_hdl(struct timer_list *t) +#else void _rtw_set_scan_deny_timer_hdl(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, mlmepriv.set_scan_deny_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif rtw_set_scan_deny_timer_hdl(adapter); } #endif @@ -113,17 +145,31 @@ void rtw_init_mlme_timer(_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - _init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev, rtw_join_timeout_handler, padapter); - /* _init_timer(&(pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer), padapter->pnetdev, sitesurvey_ctrl_handler, padapter); */ - _init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev, _rtw_scan_timeout_handler, padapter); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&pmlmepriv->assoc_timer, rtw_join_timeout_handler, 0); + timer_setup(&pmlmepriv->scan_to_timer, _rtw_scan_timeout_handler, 0); +#ifdef CONFIG_DFS_MASTER + timer_setup(&pmlmepriv->dfs_master_timer, rtw_dfs_master_timer_hdl, 0); +#endif +#ifdef CONFIG_SET_SCAN_DENY_TIMER + timer_setup(&pmlmepriv->set_scan_deny_timer, + _rtw_set_scan_deny_timer_hdl, 0); +#endif +#else + _init_timer(&pmlmepriv->assoc_timer, padapter->pnetdev, + rtw_join_timeout_handler, padapter); + _init_timer(&pmlmepriv->scan_to_timer, padapter->pnetdev, + _rtw_scan_timeout_handler, padapter); #ifdef CONFIG_DFS_MASTER - _init_timer(&(pmlmepriv->dfs_master_timer), padapter->pnetdev, rtw_dfs_master_timer_hdl, padapter); + _init_timer(&(pmlmepriv->dfs_master_timer), padapter->pnetdev, + rtw_dfs_master_timer_hdl, padapter); #endif #ifdef CONFIG_SET_SCAN_DENY_TIMER _init_timer(&(pmlmepriv->set_scan_deny_timer), padapter->pnetdev, _rtw_set_scan_deny_timer_hdl, padapter); #endif +#endif #ifdef RTK_DMP_PLATFORM _init_workitem(&(pmlmepriv->Linkup_workitem), Linkup_workitem_callback, padapter); @@ -156,8 +202,6 @@ void rtw_os_indicate_connect(_adapter *adapter) #ifdef RTK_DMP_PLATFORM _set_workitem(&adapter->mlmepriv.Linkup_workitem); #endif - - } extern void indicate_wx_scan_complete_event(_adapter *padapter); @@ -199,7 +243,6 @@ void rtw_reset_securitypriv(_adapter *adapter) pmlmeext->mgnt_80211w_IPN_rx = 0; #endif /* CONFIG_IEEE80211W */ _rtw_memset((unsigned char *)&adapter->securitypriv, 0, sizeof(struct security_priv)); - /* _init_timer(&(adapter->securitypriv.tkip_timer),adapter->pnetdev, rtw_use_tkipkey_handler, adapter); */ /* Added by Albert 2009/02/18 */ /* Restore the PMK information to securitypriv structure for the following connection. */ @@ -300,38 +343,78 @@ void rtw_report_sec_ie(_adapter *adapter, u8 authmode, u8 *sec_ie) } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void _survey_timer_hdl(struct timer_list *t) +#else void _survey_timer_hdl(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *padapter = from_timer(padapter, t, mlmeextpriv.survey_timer); +#else _adapter *padapter = (_adapter *)FunctionContext; +#endif survey_timer_hdl(padapter); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void _link_timer_hdl(struct timer_list *t) +#else void _link_timer_hdl(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *padapter = from_timer(padapter, t, mlmeextpriv.link_timer); +#else _adapter *padapter = (_adapter *)FunctionContext; +#endif link_timer_hdl(padapter); } #ifdef CONFIG_RTW_80211R +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void _ft_link_timer_hdl(struct timer_list *t) +#else void _ft_link_timer_hdl(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *padapter = from_timer(padapter, t, mlmeextpriv.ft_link_timer); +#else _adapter *padapter = (_adapter *)FunctionContext; +#endif ft_link_timer_hdl(padapter); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void _ft_roam_timer_hdl(struct timer_list *t) +#else void _ft_roam_timer_hdl(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *padapter = from_timer(padapter, t, mlmeextpriv.ft_roam_timer); +#else _adapter *padapter = (_adapter *)FunctionContext; +#endif ft_roam_timer_hdl(padapter); } #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void _addba_timer_hdl(struct timer_list *t) +#else void _addba_timer_hdl(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + struct sta_info *psta = from_timer(psta, t, addba_retry_timer); +#else struct sta_info *psta = (struct sta_info *)FunctionContext; +#endif addba_timer_hdl(psta); } @@ -346,7 +429,12 @@ void _sa_query_timer_hdl(void *FunctionContext) void init_dot11w_expire_timer(_adapter *padapter, struct sta_info *psta) { - _init_timer(&psta->dot11w_expire_timer, padapter->pnetdev, _sa_query_timer_hdl, psta); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&psta->dot11w_expire_timer, _sa_query_timer_hdl, psta, 0); +#else + _init_timer(&psta->dot11w_expire_timer, padapter->pnetdev, + _sa_query_timer_hdl, psta); +#endif } #endif /* CONFIG_IEEE80211W */ @@ -354,7 +442,12 @@ void init_dot11w_expire_timer(_adapter *padapter, struct sta_info *psta) void init_addba_retry_timer(_adapter *padapter, struct sta_info *psta) { - _init_timer(&psta->addba_retry_timer, padapter->pnetdev, _addba_timer_hdl, psta); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&psta->addba_retry_timer, _addba_timer_hdl, 0); +#else + _init_timer(&psta->addba_retry_timer, padapter->pnetdev, _addba_timer_hdl, + psta); +#endif } /* @@ -375,17 +468,21 @@ void init_mlme_ext_timer(_adapter *padapter) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&pmlmeext->survey_timer, _survey_timer_hdl, 0); + timer_setup(&pmlmeext->link_timer, _link_timer_hdl, 0); +#ifdef CONFIG_RTW_80211R + timer_setup(&pmlmeext->ft_link_timer, _ft_link_timer_hdl, 0); + timer_setup(&pmlmeext->ft_roam_timer, _ft_roam_timer_hdl, 0); +#endif +#else _init_timer(&pmlmeext->survey_timer, padapter->pnetdev, _survey_timer_hdl, padapter); _init_timer(&pmlmeext->link_timer, padapter->pnetdev, _link_timer_hdl, padapter); #ifdef CONFIG_RTW_80211R _init_timer(&pmlmeext->ft_link_timer, padapter->pnetdev, _ft_link_timer_hdl, padapter); _init_timer(&pmlmeext->ft_roam_timer, padapter->pnetdev, _ft_roam_timer_hdl, padapter); #endif - - /* _init_timer(&pmlmeext->ADDBA_timer, padapter->pnetdev, _addba_timer_hdl, padapter); */ - - /* _init_timer(&pmlmeext->reauth_timer, padapter->pnetdev, _reauth_timer_hdl, padapter); */ - /* _init_timer(&pmlmeext->reassoc_timer, padapter->pnetdev, _reassoc_timer_hdl, padapter); */ +#endif } #ifdef CONFIG_AP_MODE diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 341986e..43bfc39 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1069,11 +1069,14 @@ 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(3, 13, 0) - , void *accel_priv - #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - , select_queue_fallback_t fallback - #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) + ,struct net_device *sb_dev + ,select_queue_fallback_t fallback +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) + ,void *unused + ,select_queue_fallback_t fallback +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) + , void *accel_priv #endif ) { @@ -1732,9 +1735,17 @@ u8 rtw_init_default_value(_adapter *padapter) } #ifdef CONFIG_SWTIMER_BASED_TXBCN +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) void _tx_beacon_timer_handlder(void *FunctionContext) +#else +void _tx_beacon_timer_handlder(struct timer_list *t) +#endif { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) struct dvobj_priv *pdvobj = (struct dvobj_priv *)FunctionContext; +#else + struct dvobj_priv *pdvobj = from_timer(pdvobj, t, ro_ch_timer_process); +#endif tx_beacon_timer_handlder(pdvobj); } @@ -1778,11 +1789,21 @@ struct dvobj_priv *devobj_init(void) pdvobj->inter_bcn_space = DEFAULT_BCN_INTERVAL; /* default value is equal to the default beacon_interval (100ms) */ _rtw_init_queue(&pdvobj->ap_if_q); #ifdef CONFIG_SWTIMER_BASED_TXBCN - _init_timer(&(pdvobj->txbcn_timer), NULL, _tx_beacon_timer_handlder, pdvobj); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) + _init_timer(&pdvobj->txbcn_timer, NULL, _tx_beacon_timer_handlder, + pdvobj); +#else + timer_setup(&pdvobj->txbcn_timer, _tx_beacon_timer_handlder, 0); +#endif #endif #endif - _init_timer(&(pdvobj->dynamic_chk_timer), NULL, _dynamic_check_timer_handlder, pdvobj); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) + _init_timer(&(pdvobj->dynamic_chk_timer), NULL, + _dynamic_check_timer_handlder, pdvobj); +#else + timer_setup(&pdvobj->dynamic_chk_timer, _dynamic_check_timer_handlder, 0); +#endif #ifdef CONFIG_MCC_MODE _rtw_mutex_init(&(pdvobj->mcc_objpriv.mcc_mutex)); diff --git a/os_dep/linux/recv_linux.c b/os_dep/linux/recv_linux.c index a6945ea..2902fab 100644 --- a/os_dep/linux/recv_linux.c +++ b/os_dep/linux/recv_linux.c @@ -867,10 +867,17 @@ 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); } @@ -878,6 +885,9 @@ void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl) { _adapter *padapter = preorder_ctrl->padapter; - _init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, _rtw_reordering_ctrl_timeout_handler, preorder_ctrl); - +#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/osdep_service.c b/os_dep/osdep_service.c index 3415e3c..a7a1ef0 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -757,12 +757,14 @@ void rtw_list_insert_tail(_list *plist, _list *phead) list_add_tail(plist, phead); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) void rtw_init_timer(_timer *ptimer, void *padapter, void *pfunc) { _adapter *adapter = (_adapter *)padapter; _init_timer(ptimer, adapter->pnetdev, pfunc, adapter); } +#endif /*