rtl8188eu: Fix builds for branch v4.1.8_9499 for newer kernels

These changes allow builds up through kernel 4.16.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2018-04-11 10:19:48 -05:00
parent 10737c73b1
commit 594a5a050d
13 changed files with 235 additions and 10 deletions

View file

@ -674,6 +674,9 @@ check_bss:
struct ieee80211_channel *notify_channel;
u32 freq;
u16 channel = cur_network->network.Configuration.DSConfig;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
struct cfg80211_roam_info roam_info = {};
#endif
if (channel <= RTW_CH_MAX_2G_CHANNEL)
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
@ -684,6 +687,19 @@ check_bss:
#endif
DBG_88E(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter));
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
roam_info.channel = notify_channel;
roam_info.bssid = cur_network->network.MacAddress;
roam_info.req_ie =
pmlmepriv->assoc_req+sizeof(struct rtw_ieee80211_hdr_3addr)+2;
roam_info.req_ie_len =
pmlmepriv->assoc_req_len-sizeof(struct rtw_ieee80211_hdr_3addr)-2;
roam_info.resp_ie =
pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6;
roam_info.resp_ie_len =
pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6;
cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC);
#else
cfg80211_roamed(padapter->pnetdev
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE)
, notify_channel
@ -694,6 +710,7 @@ check_bss:
, pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6
, pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6
, GFP_ATOMIC);
#endif
} else {
cfg80211_connect_result(padapter->pnetdev, cur_network->network.MacAddress
, pmlmepriv->assoc_req+sizeof(struct rtw_ieee80211_hdr_3addr)+2
@ -1643,7 +1660,11 @@ extern int netdev_open(struct net_device *pnetdev);
static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
struct net_device *ndev,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0))
enum nl80211_iftype type, u32 *flags,
#else
enum nl80211_iftype type,
#endif
struct vif_params *params)
{
enum nl80211_iftype old_type;
@ -3189,7 +3210,12 @@ static int rtw_cfg80211_add_monitor_if (struct adapter *padapter, char *name, st
mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP;
strncpy(mon_ndev->name, name, IFNAMSIZ);
mon_ndev->name[IFNAMSIZ - 1] = 0;
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(4,11,9))
mon_ndev->needs_free_netdev = false;
mon_ndev->priv_destructor = rtw_ndev_destructor;
#else
mon_ndev->destructor = rtw_ndev_destructor;
#endif
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops;
@ -3256,7 +3282,11 @@ static int
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
unsigned char name_assign_type,
#endif
enum nl80211_iftype type, u32 *flags, struct vif_params *params)
enum nl80211_iftype type,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0))
u32 *flags,
#endif
struct vif_params *params)
{
int ret = 0;
struct net_device* ndev = NULL;

View file

@ -26,31 +26,63 @@
#include <drv_types.h>
#include <mlme_osdep.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
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;
#else
struct adapter *adapter = from_timer(adapter, t, mlmepriv.assoc_timer);
#endif
_rtw_join_timeout_handler(adapter);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
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;
#else
struct adapter *adapter = from_timer(adapter, t, mlmepriv.scan_to_timer);
#endif
rtw_scan_timeout_handler(adapter);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
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;
#else
struct adapter *adapter = from_timer(adapter, t, mlmepriv.dynamic_chk_timer);
#endif
rtw_dynamic_check_timer_handlder(adapter);
_set_timer(&adapter->mlmepriv.dynamic_chk_timer, 2000);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
static void _rtw_set_scan_deny_timer_hdl(void *FunctionContext)
#else
static void _rtw_set_scan_deny_timer_hdl(struct timer_list *t)
#endif
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
struct adapter *adapter = (struct adapter *)FunctionContext;
#else
struct adapter *adapter = from_timer(adapter, t, mlmepriv.set_scan_deny_timer);
#endif
rtw_set_scan_deny_timer_hdl(adapter);
}
@ -58,12 +90,19 @@ void rtw_init_mlme_timer(struct adapter *padapter)
{
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->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->set_scan_deny_timer), padapter->pnetdev, _rtw_set_scan_deny_timer_hdl, 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);
timer_setup(&pmlmepriv->set_scan_deny_timer, _rtw_set_scan_deny_timer_hdl, 0);
#endif
#if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST)
if (padapter->HalFunc.hal_init_checkbthang_workqueue)
@ -211,22 +250,46 @@ 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)
#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;
#else
struct adapter *padapter = from_timer(padapter, t, mlmeextpriv.survey_timer);
#endif
survey_timer_hdl(padapter);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
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;
#else
struct adapter *padapter = from_timer(padapter, t, mlmeextpriv.link_timer);
#endif
link_timer_hdl(padapter);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
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;
#else
struct sta_info *psta = from_timer(psta, t, addba_retry_timer);
#endif
addba_timer_hdl(psta);
}
@ -241,18 +304,30 @@ void _sa_query_timer_hdl (void *FunctionContext)
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);
#else
timer_setup(&psta->addba_retry_timer, _addba_timer_hdl, 0);
#endif
}
void init_mlme_ext_timer(struct adapter *padapter)
{
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->link_timer, padapter->pnetdev, _link_timer_hdl, padapter);
#ifdef CONFIG_IEEE80211W
_init_timer(&pmlmeext->sa_query_timer, padapter->pnetdev, _sa_query_timer_hdl, padapter);
#endif /* CONFIG_IEEE80211W */
#else
timer_setup(&pmlmeext->survey_timer, _survey_timer_hdl, 0);
timer_setup(&pmlmeext->link_timer, _link_timer_hdl, 0);
#ifdef CONFIG_IEEE80211W
timer_setup(&pmlmeext->sa_query_timer, _sa_query_timer_hdl, 0);
#endif /* CONFIG_IEEE80211W */
#endif
}
#ifdef CONFIG_AP_MODE

View file

@ -396,16 +396,29 @@ void rtw_os_read_port(struct adapter *padapter, struct recv_buf *precvbuf)
}
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
static void _rtw_reordering_ctrl_timeout_handler (void *FunctionContext)
#else
static void _rtw_reordering_ctrl_timeout_handler(struct timer_list *t)
#endif
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
struct recv_reorder_ctrl *preorder_ctrl = (struct recv_reorder_ctrl *)FunctionContext;
#else
struct recv_reorder_ctrl *preorder_ctrl = from_timer(preorder_ctrl, t, reordering_ctrl_timer);
#endif
rtw_reordering_ctrl_timeout_handler(preorder_ctrl);
}
void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
struct adapter *padapter = preorder_ctrl->padapter;
_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
}