wifi: Add for kernel-4.14 support Update driver for kernel-4.14 support Test: Build pass and test OK Change-Id: I748b378bb8246d126b2a375629a98a3a453582f0 CR-Id: AUTO00014958 Signed-off-by: Shengxi Xu <shengxi.xu@mediatek.com> Reviewed-on: http://gerrit.mediatek.inc:8080/1655166 CheckPatch: Check Patch <srv_checkpatch@mediatek.com> Reviewed-by: Jiehang Zheng <jiehang.zheng@mediatek.com> Tested-by: Jiehang Zheng <jiehang.zheng@mediatek.com>
diff --git a/os/linux/gl_cfg80211.c b/os/linux/gl_cfg80211.c index 8636a9c..71f56ce 100644 --- a/os/linux/gl_cfg80211.c +++ b/os/linux/gl_cfg80211.c
@@ -127,9 +127,15 @@ * others: failure */ /*----------------------------------------------------------------------------*/ +#if KERNEL_VERSION(4, 14, 0) <= CFG80211_VERSION_CODE +int +mtk_cfg80211_change_iface(struct wiphy *wiphy, + struct net_device *ndev, enum nl80211_iftype type, struct vif_params *params) +#else int mtk_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, enum nl80211_iftype type, u32 *flags, struct vif_params *params) +#endif { P_GLUE_INFO_T prGlueInfo = NULL; WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
diff --git a/os/linux/gl_init.c b/os/linux/gl_init.c index 45ad6a2..59182a5 100644 --- a/os/linux/gl_init.c +++ b/os/linux/gl_init.c
@@ -955,7 +955,12 @@ /* 2. indication to cfg80211 */ /* 20150205 change cfg80211_sched_scan_stopped to work queue due to sched_scan_mtx dead lock issue */ + #if KERNEL_VERSION(4, 14, 0) <= CFG80211_VERSION_CODE + /*We not support sched scan on 7668, so just change reqid to 0*/ + cfg80211_sched_scan_stopped(priv_to_wiphy(prGlueInfo), 0); + #else cfg80211_sched_scan_stopped(priv_to_wiphy(prGlueInfo)); + #endif DBGLOG(SCN, INFO, "cfg80211_sched_scan_stopped event send done WorkQueue thread return from wlanSchedScanStoppedWorkQueue\n"); return; @@ -2402,6 +2407,7 @@ /* TODO the change schedule API shall be provided by OS glue layer */ /* Switch the Wi-Fi task priority to higher priority and change the scheduling method */ + #if KERNEL_VERSION(4, 14, 0) > CFG80211_VERSION_CODE if (prGlueInfo->prAdapter->rWifiVar.ucThreadPriority > 0) { struct sched_param param = {.sched_priority = prGlueInfo->prAdapter->rWifiVar.ucThreadPriority }; @@ -2418,6 +2424,7 @@ prGlueInfo->prAdapter->rWifiVar.ucThreadPriority, prGlueInfo->prAdapter->rWifiVar.ucThreadScheduling); } + #endif g_u4HaltFlag = 0;
diff --git a/os/linux/gl_kal.c b/os/linux/gl_kal.c index 5eb45f5..7b502d5 100644 --- a/os/linux/gl_kal.c +++ b/os/linux/gl_kal.c
@@ -880,7 +880,9 @@ } #endif +#if KERNEL_VERSION(4, 14, 0) > CFG80211_VERSION_CODE prNetDev->last_rx = jiffies; +#endif #if CFG_SUPPORT_SNIFFER if (prGlueInfo->fgIsEnableMon) { skb_reset_mac_header(prSkb); @@ -965,6 +967,9 @@ struct cfg80211_bss *bss; UINT_8 ucChannelNum; P_BSS_DESC_T prBssDesc = NULL; + #if KERNEL_VERSION(4, 14, 0) <= CFG80211_VERSION_CODE + struct cfg80211_roam_info roam_info; + #endif GLUE_SPIN_LOCK_DECLARATION(); @@ -1063,12 +1068,25 @@ (ucChannelNum, KAL_BAND_5GHZ)); } + #if KERNEL_VERSION(4, 14, 0) <= CFG80211_VERSION_CODE + memset(&roam_info, 0, sizeof(struct cfg80211_roam_info)); + roam_info.channel = prChannel; + roam_info.bssid = arBssid; + roam_info.req_ie = prGlueInfo->aucReqIe; + roam_info.req_ie_len = prGlueInfo->u4ReqIeLength; + roam_info.resp_ie = prGlueInfo->aucRspIe; + roam_info.resp_ie_len = prGlueInfo->u4RspIeLength; + cfg80211_roamed(prGlueInfo->prDevHandler, + &roam_info, + GFP_KERNEL); + #else cfg80211_roamed(prGlueInfo->prDevHandler, prChannel, arBssid, prGlueInfo->aucReqIe, prGlueInfo->u4ReqIeLength, prGlueInfo->aucRspIe, prGlueInfo->u4RspIeLength, GFP_KERNEL); + #endif } else { cfg80211_connect_result(prGlueInfo->prDevHandler, arBssid, prGlueInfo->aucReqIe, @@ -4503,9 +4521,13 @@ VOID kalSchedScanResults(IN P_GLUE_INFO_T prGlueInfo) { ASSERT(prGlueInfo); - + + #if KERNEL_VERSION(4, 14, 0) <= CFG80211_VERSION_CODE + /*We not support sched scan on 7668, so just set reqid to 0*/ + cfg80211_sched_scan_results(priv_to_wiphy(prGlueInfo), 0); + #else cfg80211_sched_scan_results(priv_to_wiphy(prGlueInfo)); - + #endif } /*----------------------------------------------------------------------------*/
diff --git a/os/linux/gl_p2p_cfg80211.c b/os/linux/gl_p2p_cfg80211.c index 3c4b025..1277f75 100644 --- a/os/linux/gl_p2p_cfg80211.c +++ b/os/linux/gl_p2p_cfg80211.c
@@ -283,10 +283,15 @@ } } -#if KERNEL_VERSION(4, 1, 0) <= CFG80211_VERSION_CODE +#if KERNEL_VERSION(4, 14, 0) <= CFG80211_VERSION_CODE struct wireless_dev *mtk_p2p_cfg80211_add_iface(struct wiphy *wiphy, const char *name, unsigned char name_assign_type, - enum nl80211_iftype type, u32 *flags, struct vif_params *params) + enum nl80211_iftype type, struct vif_params *params) +#elif KERNEL_VERSION(4, 1, 0) <= CFG80211_VERSION_CODE + struct wireless_dev *mtk_p2p_cfg80211_add_iface(struct wiphy *wiphy, + const char *name, unsigned char name_assign_type, + enum nl80211_iftype type, u32 *flags, struct vif_params *params) + #else struct wireless_dev *mtk_p2p_cfg80211_add_iface(struct wiphy *wiphy, const char *name, @@ -379,7 +384,11 @@ if (prNewNetDevice->ieee80211_ptr) prNewNetDevice->ieee80211_ptr->iftype = type; /* register destructor function for virtual interface */ +#if KERNEL_VERSION(4, 14, 0) <= CFG80211_VERSION_CODE + prNewNetDevice->priv_destructor = mtk_vif_destructor; +#else prNewNetDevice->destructor = mtk_vif_destructor; +#endif gprP2pRoleWdev[u4Idx] = prWdev; /*prP2pInfo->prRoleWdev[0] = prWdev;*//* TH3 multiple P2P */ @@ -2612,10 +2621,17 @@ return i4Rslt; } /* mtk_p2p_cfg80211_disconnect */ +#if KERNEL_VERSION(4, 14, 0) <= CFG80211_VERSION_CODE +int +mtk_p2p_cfg80211_change_iface(IN struct wiphy *wiphy, + IN struct net_device *ndev, + IN enum nl80211_iftype type, IN struct vif_params *params) +#else int mtk_p2p_cfg80211_change_iface(IN struct wiphy *wiphy, IN struct net_device *ndev, IN enum nl80211_iftype type, IN u32 *flags, IN struct vif_params *params) +#endif { P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T) NULL; INT_32 i4Rslt = -EINVAL;
diff --git a/os/linux/include/gl_cfg80211.h b/os/linux/include/gl_cfg80211.h index 097a6fe..5c2d926 100644 --- a/os/linux/include/gl_cfg80211.h +++ b/os/linux/include/gl_cfg80211.h
@@ -162,9 +162,15 @@ ******************************************************************************** */ /* cfg80211 hooks */ +#if KERNEL_VERSION(4, 14, 0) <= CFG80211_VERSION_CODE +int +mtk_cfg80211_change_iface(struct wiphy *wiphy, + struct net_device *ndev, enum nl80211_iftype type, struct vif_params *params); +#else int mtk_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, enum nl80211_iftype type, u32 *flags, struct vif_params *params); +#endif int mtk_cfg80211_add_key(struct wiphy *wiphy,
diff --git a/os/linux/include/gl_p2p_ioctl.h b/os/linux/include/gl_p2p_ioctl.h index 414f383..c42e660 100644 --- a/os/linux/include/gl_p2p_ioctl.h +++ b/os/linux/include/gl_p2p_ioctl.h
@@ -369,7 +369,11 @@ #if (CFG_ENABLE_WIFI_DIRECT_CFG_80211 != 0) -#if KERNEL_VERSION(4, 1, 0) <= CFG80211_VERSION_CODE +#if KERNEL_VERSION(4, 14, 0) <= CFG80211_VERSION_CODE +struct wireless_dev *mtk_p2p_cfg80211_add_iface(struct wiphy *wiphy, + const char *name, unsigned char name_assign_type, + enum nl80211_iftype type, struct vif_params *params); +#elif KERNEL_VERSION(4, 1, 0) <= CFG80211_VERSION_CODE struct wireless_dev *mtk_p2p_cfg80211_add_iface(struct wiphy *wiphy, const char *name, unsigned char name_assign_type, enum nl80211_iftype type, u32 *flags, struct vif_params *params); @@ -379,10 +383,17 @@ enum nl80211_iftype type, u32 *flags, struct vif_params *params); #endif +#if KERNEL_VERSION(4, 14, 0) <= CFG80211_VERSION_CODE +int +mtk_p2p_cfg80211_change_iface(struct wiphy *wiphy, + struct net_device *ndev, + enum nl80211_iftype type, struct vif_params *params); +#else int mtk_p2p_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, enum nl80211_iftype type, u32 *flags, struct vif_params *params); +#endif int mtk_p2p_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev);