Fix kernel v4.12 support

* Fixed kernel v4.12 support
This commit is contained in:
Christian kimocoder 2017-08-27 11:30:16 +02:00 committed by GitHub
parent bcdaa3d214
commit 11cc9318ce

View File

@ -747,12 +747,28 @@ 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
freq = rtw_ch2freq(channel);
notify_channel = ieee80211_get_channel(wiphy, freq);
#endif
RTW_INFO(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
@ -763,6 +779,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 {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE)
RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state);
@ -3643,7 +3660,12 @@ static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name, struct ne
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;
@ -4284,8 +4306,8 @@ static int cfg80211_rtw_get_channel(struct wiphy *wiphy, struct wireless_dev *wd
int channel;
int control_freq;
int center_freq;
int center_freq2 = 0;
int width = NL80211_CHAN_WIDTH_20;
int center_freq2=0;
int width;
int band;
int bandWidth;
int offset;
@ -4297,7 +4319,7 @@ static int cfg80211_rtw_get_channel(struct wiphy *wiphy, struct wireless_dev *wd
return -ENODEV;
offset = rtw_get_oper_choffset(padapter);
center_freq = channel = adapter_to_dvobj(padapter)->oper_channel;
channel = adapter_to_dvobj(padapter)->oper_channel;
if(channel >= 1){
switch(pHalData->CurrentBandType){
@ -6341,7 +6363,11 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy)
#endif
#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
#else // kernel >= 4.12
wiphy->max_sched_scan_reqs = 1;
#endif
#ifdef CONFIG_PNO_SUPPORT
wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT;
#endif