rtl8188eu: Fix build for kernels through 5.15

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2021-11-12 16:42:02 -06:00
parent 4a9ce5af3f
commit 65bb1fa9d4
17 changed files with 204 additions and 3 deletions

View file

@ -19,9 +19,12 @@
******************************************************************************/ ******************************************************************************/
#define _RTW_BR_EXT_C_ #define _RTW_BR_EXT_C_
#include <linux/version.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <net/ip.h> #include <net/ip.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
#include <net/ipx.h> #include <net/ipx.h>
#endif
#include <linux/atalk.h> #include <linux/atalk.h>
#include <linux/udp.h> #include <linux/udp.h>
#include <linux/if_pppox.h> #include <linux/if_pppox.h>
@ -663,7 +666,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
} else { } else {
return -1; return -1;
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
/* IPX */ /* IPX */
if (ipx != NULL) { if (ipx != NULL) {
switch (method) { switch (method) {
@ -795,6 +798,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
return -1; return -1;
} }
} }
#endif
return -1; return -1;
} else if ((protocol == ETH_P_PPP_DISC) || } else if ((protocol == ETH_P_PPP_DISC) ||

View file

@ -26,9 +26,17 @@
/* Callback function of LED BlinkTimer, */ /* Callback function of LED BlinkTimer, */
/* it just schedules to corresponding BlinkWorkItem/led_blink_hdl */ /* 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) void BlinkTimerCallback(void *data)
#endif
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct LED_871x *pLed = from_timer(pLed, t, BlinkTimer);
#else
struct LED_871x *pLed = (struct LED_871x *)data; struct LED_871x *pLed = (struct LED_871x *)data;
#endif
struct adapter *padapter = pLed->padapter; struct adapter *padapter = pLed->padapter;
if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped)) if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped))
@ -78,7 +86,11 @@ void InitLed871x(struct adapter *padapter, struct LED_871x *pLed, enum LED_PIN_8
ResetLedStatus(pLed); ResetLedStatus(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); _init_timer(&(pLed->BlinkTimer), padapter->pnetdev, BlinkTimerCallback, pLed);
#endif
_init_workitem(&(pLed->BlinkWorkItem), BlinkWorkItemCallback, pLed); _init_workitem(&(pLed->BlinkWorkItem), BlinkWorkItemCallback, pLed);
} }

View file

@ -1744,9 +1744,17 @@ exit:
return res; return res;
} }
#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) static void reset_ch_sitesurvey_timer_process (void *FunctionContext)
#endif
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct adapter *adapter = from_timer(adapter, t, pwrctrlpriv.pwr_state_check_timer);
#else
struct adapter *adapter = (struct adapter *)FunctionContext; struct adapter *adapter = (struct adapter *)FunctionContext;
#endif
struct wifidirect_info *pwdinfo = &adapter->wdinfo; struct wifidirect_info *pwdinfo = &adapter->wdinfo;
if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
@ -1758,9 +1766,17 @@ static void reset_ch_sitesurvey_timer_process (void *FunctionContext)
pwdinfo->rx_invitereq_info.scan_op_ch_only = 0; 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) static void reset_ch_sitesurvey_timer_process2 (void *FunctionContext)
#endif
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct adapter *adapter = from_timer(adapter, t, pwrctrlpriv.pwr_state_check_timer);
#else
struct adapter *adapter = (struct adapter *)FunctionContext; struct adapter *adapter = (struct adapter *)FunctionContext;
#endif
struct wifidirect_info *pwdinfo = &adapter->wdinfo; struct wifidirect_info *pwdinfo = &adapter->wdinfo;
if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
@ -1772,9 +1788,17 @@ static void reset_ch_sitesurvey_timer_process2 (void *FunctionContext)
pwdinfo->p2p_info.scan_op_ch_only = 0; 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) static void restore_p2p_state_timer_process (void *FunctionContext)
#endif
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct adapter *adapter = from_timer(adapter, t, wdinfo.restore_p2p_state_timer);
#else
struct adapter *adapter = (struct adapter *)FunctionContext; struct adapter *adapter = (struct adapter *)FunctionContext;
#endif
struct wifidirect_info *pwdinfo = &adapter->wdinfo; struct wifidirect_info *pwdinfo = &adapter->wdinfo;
if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
@ -1783,9 +1807,17 @@ static void restore_p2p_state_timer_process (void *FunctionContext)
p2p_protocol_wk_cmd(adapter, P2P_RESTORE_STATE_WK); 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) static void pre_tx_scan_timer_process(void *FunctionContext)
#endif
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct adapter *adapter = from_timer(adapter, t, wdinfo.pre_tx_scan_timer);
#else
struct adapter *adapter = (struct adapter *)FunctionContext; struct adapter *adapter = (struct adapter *)FunctionContext;
#endif
struct wifidirect_info *pwdinfo = &adapter->wdinfo; struct wifidirect_info *pwdinfo = &adapter->wdinfo;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
@ -1813,9 +1845,17 @@ static void pre_tx_scan_timer_process(void *FunctionContext)
spin_unlock_bh(&pmlmepriv->lock); spin_unlock_bh(&pmlmepriv->lock);
} }
#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) static void find_phase_timer_process(void *FunctionContext)
#endif
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct adapter *adapter = from_timer(adapter, t, wdinfo.find_phase_timer);
#else
struct adapter *adapter = (struct adapter *)FunctionContext; struct adapter *adapter = (struct adapter *)FunctionContext;
#endif
struct wifidirect_info *pwdinfo = &adapter->wdinfo; struct wifidirect_info *pwdinfo = &adapter->wdinfo;
if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
@ -1841,11 +1881,19 @@ void rtw_init_wifidirect_timers(struct adapter *padapter)
{ {
struct wifidirect_info *pwdinfo = &padapter->wdinfo; 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);
#else
_init_timer(&pwdinfo->find_phase_timer, padapter->pnetdev, find_phase_timer_process, padapter); _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->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); _init_timer(&pwdinfo->pre_tx_scan_timer, padapter->pnetdev, pre_tx_scan_timer_process, padapter);
_init_timer(&pwdinfo->reset_ch_sitesurvey, padapter->pnetdev, reset_ch_sitesurvey_timer_process, padapter); _init_timer(&pwdinfo->reset_ch_sitesurvey, padapter->pnetdev, reset_ch_sitesurvey_timer_process, padapter);
_init_timer(&pwdinfo->reset_ch_sitesurvey2, padapter->pnetdev, reset_ch_sitesurvey_timer_process2, padapter); _init_timer(&pwdinfo->reset_ch_sitesurvey2, padapter->pnetdev, reset_ch_sitesurvey_timer_process2, padapter);
#endif
} }
void rtw_init_wifidirect_addrs(struct adapter *padapter, u8 *dev_addr, u8 *iface_addr) void rtw_init_wifidirect_addrs(struct adapter *padapter, u8 *dev_addr, u8 *iface_addr)
@ -1987,8 +2035,10 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role)
_cancel_timer_ex(&pwdinfo->pre_tx_scan_timer); _cancel_timer_ex(&pwdinfo->pre_tx_scan_timer);
_cancel_timer_ex(&pwdinfo->reset_ch_sitesurvey); _cancel_timer_ex(&pwdinfo->reset_ch_sitesurvey);
_cancel_timer_ex(&pwdinfo->reset_ch_sitesurvey2); _cancel_timer_ex(&pwdinfo->reset_ch_sitesurvey2);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
reset_ch_sitesurvey_timer_process(padapter); reset_ch_sitesurvey_timer_process(padapter);
reset_ch_sitesurvey_timer_process2(padapter); reset_ch_sitesurvey_timer_process2(padapter);
#endif
rtw_p2p_set_state(pwdinfo, P2P_STATE_NONE); rtw_p2p_set_state(pwdinfo, P2P_STATE_NONE);
rtw_p2p_set_role(pwdinfo, P2P_ROLE_DISABLE); rtw_p2p_set_role(pwdinfo, P2P_ROLE_DISABLE);
memset(&pwdinfo->rx_prov_disc_info, 0x00, sizeof(struct rx_provdisc_req_info)); memset(&pwdinfo->rx_prov_disc_info, 0x00, sizeof(struct rx_provdisc_req_info));

View file

@ -208,9 +208,19 @@ exit:
return; return;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
static void pwr_state_check_handler(struct timer_list *t)
#else
static void pwr_state_check_handler(void *FunctionContext) static void pwr_state_check_handler(void *FunctionContext)
#endif
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct adapter *padapter =
from_timer(padapter, t,
pwrctrlpriv.pwr_state_check_timer);
#else
struct adapter *padapter = (struct adapter *)FunctionContext; struct adapter *padapter = (struct adapter *)FunctionContext;
#endif
rtw_ps_cmd(padapter); rtw_ps_cmd(padapter);
} }
@ -498,7 +508,11 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
pwrctrlpriv->btcoex_rfon = false; pwrctrlpriv->btcoex_rfon = false;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
timer_setup(&pwrctrlpriv->pwr_state_check_timer, pwr_state_check_handler, 0);
#else
_init_timer(&(pwrctrlpriv->pwr_state_check_timer), padapter->pnetdev, pwr_state_check_handler, (u8 *)padapter); _init_timer(&(pwrctrlpriv->pwr_state_check_timer), padapter->pnetdev, pwr_state_check_handler, (u8 *)padapter);
#endif
} }

View file

@ -41,7 +41,11 @@ static u8 rtw_rfc1042_header[] = {
0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00
}; };
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
void rtw_signal_stat_timer_hdl(struct timer_list *);
#else
void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS); void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS);
#endif
void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv) void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)
{ {
@ -103,7 +107,11 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
res = rtw_hal_init_recv_priv(padapter); res = rtw_hal_init_recv_priv(padapter);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
timer_setup(&precvpriv->signal_stat_timer, rtw_signal_stat_timer_hdl, 0);
#else
_init_timer(&precvpriv->signal_stat_timer, padapter->pnetdev, RTW_TIMER_HDL_NAME(signal_stat), padapter); _init_timer(&precvpriv->signal_stat_timer, padapter->pnetdev, RTW_TIMER_HDL_NAME(signal_stat), padapter);
#endif
precvpriv->signal_stat_sampling_interval = 1000; /* ms */ precvpriv->signal_stat_sampling_interval = 1000; /* ms */
@ -2183,9 +2191,17 @@ _recv_entry_drop:
return ret; return ret;
} }
#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) void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS)
#endif
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct adapter *adapter = from_timer(adapter, t, recvpriv.signal_stat_timer);
#else
struct adapter *adapter = (struct adapter *)FunctionContext; struct adapter *adapter = (struct adapter *)FunctionContext;
#endif
struct recv_priv *recvpriv = &adapter->recvpriv; struct recv_priv *recvpriv = &adapter->recvpriv;
u32 tmp_s, tmp_q; u32 tmp_s, tmp_q;

View file

@ -1580,8 +1580,10 @@ void odm_RSSIMonitorCheckAP(struct odm_dm_struct *pDM_Odm)
void ODM_InitAllTimers(struct odm_dm_struct *pDM_Odm) void ODM_InitAllTimers(struct odm_dm_struct *pDM_Odm)
{ {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
ODM_InitializeTimer(pDM_Odm, &pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer, ODM_InitializeTimer(pDM_Odm, &pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer,
(void *)odm_SwAntDivChkAntSwitchCallback, NULL, "SwAntennaSwitchTimer"); (void *)odm_SwAntDivChkAntSwitchCallback, NULL, "SwAntennaSwitchTimer");
#endif
} }
void ODM_CancelAllTimers(struct odm_dm_struct *pDM_Odm) void ODM_CancelAllTimers(struct odm_dm_struct *pDM_Odm)

View file

@ -177,6 +177,7 @@ void ODM_SetTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer, u32
_set_timer(pTimer, msDelay); /* ms */ _set_timer(pTimer, msDelay); /* ms */
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
void ODM_InitializeTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer, void ODM_InitializeTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer,
void *CallBackFunc, void *pContext, void *CallBackFunc, void *pContext,
const char *szID) const char *szID)
@ -184,6 +185,7 @@ void ODM_InitializeTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTime
struct adapter *Adapter = pDM_Odm->Adapter; struct adapter *Adapter = pDM_Odm->Adapter;
_init_timer(pTimer, Adapter->pnetdev, CallBackFunc, pDM_Odm); _init_timer(pTimer, Adapter->pnetdev, CallBackFunc, pDM_Odm);
} }
#endif
void ODM_CancelTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer) void ODM_CancelTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer)
{ {

BIN
hostapd-0.8/hostapd/hostapd Executable file

Binary file not shown.

BIN
hostapd-0.8/hostapd/hostapd_cli Executable file

Binary file not shown.

View file

@ -20,6 +20,7 @@
#ifndef __OSDEP_SERVICE_H_ #ifndef __OSDEP_SERVICE_H_
#define __OSDEP_SERVICE_H_ #define __OSDEP_SERVICE_H_
#include <linux/version.h>
#include <basic_types.h> #include <basic_types.h>
#define _FAIL 0 #define _FAIL 0
@ -88,12 +89,14 @@ static inline void rtw_list_delete(struct list_head *plist)
list_del_init(plist); list_del_init(plist);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
static inline void _init_timer(struct timer_list *ptimer,struct net_device *nic_hdl,void *pfunc,void* cntx) static inline void _init_timer(struct timer_list *ptimer,struct net_device *nic_hdl,void *pfunc,void* cntx)
{ {
ptimer->function = pfunc; ptimer->function = pfunc;
ptimer->data = (unsigned long)cntx; ptimer->data = (unsigned long)cntx;
init_timer(ptimer); init_timer(ptimer);
} }
#endif
static inline void _set_timer(struct timer_list *ptimer,u32 delay_time) static inline void _set_timer(struct timer_list *ptimer,u32 delay_time)
{ {

View file

@ -179,7 +179,11 @@ struct led_priv{
(adapt)->ledpriv.LedControlHandler((adapt), (action)); \ (adapt)->ledpriv.LedControlHandler((adapt), (action)); \
} while (0) } while (0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
void BlinkTimerCallback(struct timer_list *t);
#else
void BlinkTimerCallback(void *data); void BlinkTimerCallback(void *data);
#endif
void BlinkWorkItemCallback(struct work_struct *work); void BlinkWorkItemCallback(struct work_struct *work);
void ResetLedStatus(struct LED_871x * pLed); void ResetLedStatus(struct LED_871x * pLed);

View file

@ -469,8 +469,13 @@ void indicate_wx_scan_complete_event(struct adapter *padapter);
void rtw_indicate_wx_assoc_event(struct adapter *padapter); void rtw_indicate_wx_assoc_event(struct adapter *padapter);
void rtw_indicate_wx_disassoc_event(struct adapter *padapter); void rtw_indicate_wx_disassoc_event(struct adapter *padapter);
int event_thread(void *context); int event_thread(void *context);
void rtw_join_timeout_handler(void *FunctionContext); #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
void rtw_join_timeout_handler (void *FunctionContext);
void _rtw_scan_timeout_handler(void *FunctionContext); void _rtw_scan_timeout_handler(void *FunctionContext);
#else
void rtw_join_timeout_handler (struct timer_list *t);
void _rtw_scan_timeout_handler (struct timer_list *t);
#endif
void rtw_free_network_queue(struct adapter *adapter, u8 isfreeall); void rtw_free_network_queue(struct adapter *adapter, u8 isfreeall);
int rtw_init_mlme_priv(struct adapter *adapter); int rtw_init_mlme_priv(struct adapter *adapter);
void rtw_free_mlme_priv (struct mlme_priv *pmlmepriv); void rtw_free_mlme_priv (struct mlme_priv *pmlmepriv);

View file

@ -730,7 +730,9 @@ enum ht_cap_ampdu_factor {
* According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
*/ */
#define IEEE80211_MIN_AMPDU_BUF 0x8 #define IEEE80211_MIN_AMPDU_BUF 0x8
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0))
#define IEEE80211_MAX_AMPDU_BUF 0x40 #define IEEE80211_MAX_AMPDU_BUF 0x40
#endif
/* Spatial Multiplexing Power Save Modes */ /* Spatial Multiplexing Power Save Modes */
#define WLAN_HT_CAP_SM_PS_STATIC 0 #define WLAN_HT_CAP_SM_PS_STATIC 0

View file

@ -24,23 +24,47 @@
#include <drv_types.h> #include <drv_types.h>
#include <mlme_osdep.h> #include <mlme_osdep.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
void rtw_join_timeout_handler (void *FunctionContext) void rtw_join_timeout_handler (void *FunctionContext)
#else
void rtw_join_timeout_handler (struct timer_list *t)
#endif
{ {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
struct adapter *adapter = (struct adapter *)FunctionContext; struct adapter *adapter = (struct adapter *)FunctionContext;
#else
struct adapter *adapter = from_timer(adapter, t, mlmepriv.assoc_timer);
#endif
_rtw_join_timeout_handler(adapter); _rtw_join_timeout_handler(adapter);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
void _rtw_scan_timeout_handler (void *FunctionContext) void _rtw_scan_timeout_handler (void *FunctionContext)
#else
void _rtw_scan_timeout_handler (struct timer_list *t)
#endif
{ {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
struct adapter *adapter = (struct adapter *)FunctionContext; struct adapter *adapter = (struct adapter *)FunctionContext;
#else
struct adapter *adapter = from_timer(adapter, t, mlmepriv.scan_to_timer);
#endif
rtw_scan_timeout_handler(adapter); rtw_scan_timeout_handler(adapter);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
static void _dynamic_check_timer_handlder(void *FunctionContext) static void _dynamic_check_timer_handlder(void *FunctionContext)
#else
static void _dynamic_check_timer_handlder(struct timer_list *t)
#endif
{ {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
struct adapter *adapter = (struct adapter *)FunctionContext; struct adapter *adapter = (struct adapter *)FunctionContext;
#else
struct adapter *adapter = from_timer(adapter, t, mlmepriv.dynamic_chk_timer);
#endif
if (adapter->registrypriv.mp_mode == 1) if (adapter->registrypriv.mp_mode == 1)
return; return;
@ -52,9 +76,15 @@ void rtw_init_mlme_timer(struct adapter *padapter)
{ {
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
_init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev, rtw_join_timeout_handler, padapter); _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); _init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev, _rtw_scan_timeout_handler, padapter);
_init_timer(&(pmlmepriv->dynamic_chk_timer), padapter->pnetdev, _dynamic_check_timer_handlder, padapter); _init_timer(&(pmlmepriv->dynamic_chk_timer), padapter->pnetdev, _dynamic_check_timer_handlder, padapter);
#else
timer_setup(&pmlmepriv->assoc_timer, rtw_join_timeout_handler, 0);
timer_setup(&pmlmepriv->scan_to_timer, _rtw_scan_timeout_handler, 0);
timer_setup(&pmlmepriv->dynamic_chk_timer, _dynamic_check_timer_handlder, 0);
#endif
} }
void rtw_os_indicate_connect(struct adapter *adapter) void rtw_os_indicate_connect(struct adapter *adapter)
@ -156,36 +186,71 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie)
} }
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
static void _survey_timer_hdl(void *FunctionContext) static void _survey_timer_hdl(void *FunctionContext)
#else
static void _survey_timer_hdl(struct timer_list *t)
#endif
{ {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
struct adapter *padapter = (struct adapter *)FunctionContext; struct adapter *padapter = (struct adapter *)FunctionContext;
#else
struct adapter *padapter = from_timer(padapter, t, mlmeextpriv.survey_timer);
#endif
survey_timer_hdl(padapter); survey_timer_hdl(padapter);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
static void _link_timer_hdl(void *FunctionContext) static void _link_timer_hdl(void *FunctionContext)
#else
static void _link_timer_hdl(struct timer_list *t)
#endif
{ {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
struct adapter *padapter = (struct adapter *)FunctionContext; struct adapter *padapter = (struct adapter *)FunctionContext;
#else
struct adapter *padapter = from_timer(padapter, t, mlmeextpriv.link_timer);
#endif
link_timer_hdl(padapter); link_timer_hdl(padapter);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
static void _addba_timer_hdl(void *FunctionContext) static void _addba_timer_hdl(void *FunctionContext)
#else
static void _addba_timer_hdl(struct timer_list *t)
#endif
{ {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
struct sta_info *psta = (struct sta_info *)FunctionContext; struct sta_info *psta = (struct sta_info *)FunctionContext;
#else
struct sta_info *psta = from_timer(psta, t, addba_retry_timer);
#endif
addba_timer_hdl(psta); addba_timer_hdl(psta);
} }
void init_addba_retry_timer(struct adapter *padapter, struct sta_info *psta) void init_addba_retry_timer(struct adapter *padapter, struct sta_info *psta)
{ {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
_init_timer(&psta->addba_retry_timer, padapter->pnetdev, _addba_timer_hdl, psta); _init_timer(&psta->addba_retry_timer, padapter->pnetdev, _addba_timer_hdl, psta);
#else
timer_setup(&psta->addba_retry_timer, _addba_timer_hdl, 0);
#endif
} }
void init_mlme_ext_timer(struct adapter *padapter) void init_mlme_ext_timer(struct adapter *padapter)
{ {
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
_init_timer(&pmlmeext->survey_timer, padapter->pnetdev, _survey_timer_hdl, padapter); _init_timer(&pmlmeext->survey_timer, padapter->pnetdev, _survey_timer_hdl, padapter);
_init_timer(&pmlmeext->link_timer, padapter->pnetdev, _link_timer_hdl, padapter); _init_timer(&pmlmeext->link_timer, padapter->pnetdev, _link_timer_hdl, padapter);
#else
timer_setup(&pmlmeext->survey_timer, _survey_timer_hdl, 0);
timer_setup(&pmlmeext->link_timer, _link_timer_hdl, 0);
#endif
} }
#ifdef CONFIG_88EU_AP_MODE #ifdef CONFIG_88EU_AP_MODE

View file

@ -652,7 +652,12 @@ static unsigned int rtw_classify8021d(struct sk_buff *skb)
} }
static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0))
,struct net_device *sb_dev
#elif (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 ,void *unused
,select_queue_fallback_t fallback ,select_queue_fallback_t fallback
#elif (LINUX_VERSION_CODE == KERNEL_VERSION(3, 13, 0)) #elif (LINUX_VERSION_CODE == KERNEL_VERSION(3, 13, 0))

View file

@ -242,11 +242,20 @@ void rtw_os_read_port(struct adapter *padapter, struct recv_buf *precvbuf)
(unsigned char *)precvbuf); (unsigned char *)precvbuf);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
static void _rtw_reordering_ctrl_timeout_handler(void *func_context) static void _rtw_reordering_ctrl_timeout_handler(void *func_context)
#else
static void _rtw_reordering_ctrl_timeout_handler(struct timer_list *t)
#endif
{ {
struct recv_reorder_ctrl *preorder_ctrl; struct recv_reorder_ctrl *preorder_ctrl;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
preorder_ctrl = (struct recv_reorder_ctrl *)func_context; preorder_ctrl = (struct recv_reorder_ctrl *)func_context;
#else
preorder_ctrl = from_timer(preorder_ctrl, t, reordering_ctrl_timer);
#endif
rtw_reordering_ctrl_timeout_handler(preorder_ctrl); rtw_reordering_ctrl_timeout_handler(preorder_ctrl);
} }
@ -254,5 +263,9 @@ void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
{ {
struct adapter *padapter = preorder_ctrl->padapter; struct adapter *padapter = preorder_ctrl->padapter;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
_init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, _rtw_reordering_ctrl_timeout_handler, preorder_ctrl); _init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, _rtw_reordering_ctrl_timeout_handler, preorder_ctrl);
#else
timer_setup(&preorder_ctrl->reordering_ctrl_timer, _rtw_reordering_ctrl_timeout_handler, 0);
#endif
} }

View file

@ -181,7 +181,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
ret = -ENOMEM; ret = -ENOMEM;
goto exit; goto exit;
} }
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0))
if (!access_ok(priv_cmd.buf, priv_cmd.total_len)) {
#else
if (!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)) { if (!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)) {
#endif
DBG_88E("%s: failed to access memory\n", __func__); DBG_88E("%s: failed to access memory\n", __func__);
ret = -EFAULT; ret = -EFAULT;
goto exit; goto exit;