From 172e344ac271a2350ab74d481105f24e3a7077b3 Mon Sep 17 00:00:00 2001 From: procount Date: Tue, 27 Feb 2018 13:58:15 +0000 Subject: [PATCH] Fix build for kernel 4.13 and later from quickreflex patch --- core/rtw_cmd.c | 2 +- core/rtw_iol.c | 3 +- core/rtw_pwrctrl.c | 4 +-- core/rtw_wlan_util.c | 2 +- hal/HalPhyRf_8188e.c | 2 +- hal/rtl8188e_hal_init.c | 4 ++- include/osdep_service.h | 4 +++ os_dep/ioctl_cfg80211.c | 62 +++++++++++++++++++++++++++++++---------- 8 files changed, 62 insertions(+), 21 deletions(-) diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 21bc1eb..13e51e0 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -1830,7 +1830,7 @@ static void traffic_status_watchdog(struct adapter *padapter) pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8 ) || (pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) bEnterPS = false; - else + else bEnterPS = true; /* LeisurePS only work in infra mode. */ diff --git a/core/rtw_iol.c b/core/rtw_iol.c index 261a7dc..b978587 100644 --- a/core/rtw_iol.c +++ b/core/rtw_iol.c @@ -236,7 +236,8 @@ void rtw_IOL_cmd_buf_dump(struct adapter *Adapter, int buf_len, u8 *pbuf) for (i =0;i< buf_len;i++) { printk("%02x-",*(pbuf+i)); - if (j%32 == 0) printk("\n");j++; + if (j%32 == 0) printk("\n"); + j++; } printk("\n"); printk("============= ioreg_cmd len = %d ===============\n", buf_len); diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index a884edc..b7b96b3 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -52,7 +52,7 @@ void _ips_enter(struct adapter * padapter) if (rf_off == pwrpriv->change_rfpwrstate ) { pwrpriv->bpower_saving = true; - DBG_88E_LEVEL(_drv_always_, "nolinked power save enter\n"); + DBG_88E_LEVEL(_drv_info_, "nolinked power save enter\n"); if (pwrpriv->ips_mode == IPS_LEVEL_2) pwrpriv->bkeepfwalive = true; @@ -88,7 +88,7 @@ int _ips_leave(struct adapter * padapter) if ((result = rtw_ips_pwr_up(padapter)) == _SUCCESS) { pwrpriv->rf_pwrstate = rf_on; } - DBG_88E_LEVEL(_drv_always_, "nolinked power save leave\n"); + DBG_88E_LEVEL(_drv_info_, "nolinked power save leave\n"); DBG_88E("==> ips_leave.....LED(0x%08x)...\n", rtw_read32(padapter, 0x4c)); pwrpriv->bips_processing = false; diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index fe9372b..e97b694 100644 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -2003,7 +2003,7 @@ void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id) } else { - memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates), rtw_basic_rate_ofdm, 4); + memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates), rtw_basic_rate_ofdm, 3); } } diff --git a/hal/HalPhyRf_8188e.c b/hal/HalPhyRf_8188e.c index 8d06b1f..71ac55c 100644 --- a/hal/HalPhyRf_8188e.c +++ b/hal/HalPhyRf_8188e.c @@ -1251,7 +1251,7 @@ phy_IQCalibrate_8188E( #endif if ( *(pDM_Odm->mp_mode) == 1) retryCount = 9; -else + else retryCount = 2; /* Note: IQ calibration must be performed after loading */ /* PHY_REG.txt , and radio_a, radio_b.txt */ diff --git a/hal/rtl8188e_hal_init.c b/hal/rtl8188e_hal_init.c index 6eb14e5..9f9f1cb 100644 --- a/hal/rtl8188e_hal_init.c +++ b/hal/rtl8188e_hal_init.c @@ -406,7 +406,9 @@ static s32 iol_read_efuse( s32 rtl8188e_iol_efuse_patch(struct adapter *padapter) { s32 result = _SUCCESS; - printk("==> %s\n",__FUNCTION__); + + /* deleted because it prints every 7s when not associated */ + /* printk("==> %s\n",__FUNCTION__); */ if (rtw_IOL_applied(padapter)) { iol_mode_enable(padapter, 1); diff --git a/include/osdep_service.h b/include/osdep_service.h index 158f9de..3ed75e7 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -22,6 +22,10 @@ #include #include +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + #include +#endif #define _FAIL 0 #define _SUCCESS 1 diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c index 5fe3060..4768d38 100644 --- a/os_dep/ioctl_cfg80211.c +++ b/os_dep/ioctl_cfg80211.c @@ -335,7 +335,8 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl u8 *notify_ie; size_t notify_ielen; s32 notify_signal; - u8 buf[MAX_BSSINFO_LEN], *pbuf; + //u8 buf[MAX_BSSINFO_LEN], *pbuf; + u8 *buf=NULL, *pbuf=NULL; size_t len,bssinf_len=0; struct rtw_ieee80211_hdr *pwlanhdr; __le16 *fctrl; @@ -416,6 +417,8 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl } else { notify_signal = 100*translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength);/* dbm */ } + if (!(buf=(u8 *)kzalloc(MAX_BSSINFO_LEN, GFP_KERNEL))) + goto exit; pbuf = buf; pwlanhdr = (struct rtw_ieee80211_hdr *)pbuf; @@ -497,6 +500,8 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl #endif exit: + if (buf) + kfree(buf); return bss; } @@ -674,6 +679,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,16 +692,27 @@ 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 ieee80211_hdr_3addr)+2; + roam_info.req_ie_len = pmlmepriv->assoc_req_len-sizeof(struct ieee80211_hdr_3addr)-2; + roam_info.resp_ie = pmlmepriv->assoc_rsp+sizeof(struct ieee80211_hdr_3addr)+6; + roam_info.resp_ie_len = pmlmepriv->assoc_rsp_len-sizeof(struct 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 #endif - , cur_network->network.MacAddress - , pmlmepriv->assoc_req+sizeof(struct rtw_ieee80211_hdr_3addr)+2 - , pmlmepriv->assoc_req_len-sizeof(struct rtw_ieee80211_hdr_3addr)-2 - , pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6 - , pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6 - , GFP_ATOMIC); + , cur_network->network.MacAddress + , pmlmepriv->assoc_req+sizeof(struct rtw_ieee80211_hdr_3addr)+2 + , pmlmepriv->assoc_req_len-sizeof(struct rtw_ieee80211_hdr_3addr)-2 + , 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 @@ -851,7 +870,6 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) res = rtw_enqueue_cmd(pcmdpriv, pcmd); exit: - return res; @@ -1641,13 +1659,20 @@ exit: extern int netdev_open(struct net_device *pnetdev); -static int cfg80211_rtw_change_iface(struct wiphy *wiphy, - struct net_device *ndev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + static int cfg80211_rtw_change_iface(struct wiphy *wiphy, + struct net_device *ndev, + enum nl80211_iftype type, + struct vif_params *params) +#else + static int cfg80211_rtw_change_iface(struct wiphy *wiphy, + struct net_device *ndev, + enum nl80211_iftype type, u32 *flags, + struct vif_params *params) +#endif { enum nl80211_iftype old_type; - enum NDIS_802_11_NETWORK_INFRASTRUCTURE networkType ; + enum NDIS_802_11_NETWORK_INFRASTRUCTURE networkType; struct adapter *padapter = wiphy_to_adapter(wiphy); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct wireless_dev *rtw_wdev = wiphy_to_wdev(wiphy); @@ -3189,7 +3214,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; - mon_ndev->destructor = rtw_ndev_destructor; + #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 +3286,11 @@ static int #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) unsigned char name_assign_type, #endif + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) + enum nl80211_iftype type, struct vif_params *params) + #else enum nl80211_iftype type, u32 *flags, struct vif_params *params) + #endif { int ret = 0; struct net_device* ndev = NULL;