From d017eff1822e8c355e85896c725f3cc1292d7b32 Mon Sep 17 00:00:00 2001 From: Tarun Karela Date: Wed, 30 May 2018 14:54:15 +0100 Subject: [PATCH] [961] wlbt: Fix to cfg80211_ops.c from Mohit (Android P) Linux 4.14 kernal patch for android p Change-Id: I55280a92d4001cb1b621e72b592f3d08803e645e SCSC-Bug-Id: SSB-40175 Signed-off-by: Tarun Karela --- drivers/net/wireless/scsc/cfg80211_ops.c | 42 +++++++++++++++++------- drivers/net/wireless/scsc/mgt.c | 6 +++- drivers/net/wireless/scsc/rx.c | 30 +++++++++++------ 3 files changed, 55 insertions(+), 23 deletions(-) diff --git a/drivers/net/wireless/scsc/cfg80211_ops.c b/drivers/net/wireless/scsc/cfg80211_ops.c index ef58ed83086a..e36a1e93416c 100755 --- a/drivers/net/wireless/scsc/cfg80211_ops.c +++ b/drivers/net/wireless/scsc/cfg80211_ops.c @@ -24,16 +24,14 @@ static uint keep_alive_period = SLSI_P2PGO_KEEP_ALIVE_PERIOD_SEC; module_param(keep_alive_period, uint, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(keep_alive_period, "default is 10 seconds"); - +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) struct wireless_dev *slsi_add_virtual_intf(struct wiphy *wiphy, const char *name, unsigned char name_assign_type, enum nl80211_iftype type, struct vif_params *params) { -#if 0 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 9)) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) struct wireless_dev *slsi_add_virtual_intf(struct wiphy *wiphy, const char *name, unsigned char name_assign_type, @@ -41,14 +39,13 @@ struct wireless_dev *slsi_add_virtual_intf(struct wiphy *wiphy, u32 *flags, struct vif_params *params) { -#else +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 9)) struct wireless_dev *slsi_add_virtual_intf(struct wiphy *wiphy, const char *name, enum nl80211_iftype type, u32 *flags, struct vif_params *params) { -#endif #else struct net_device *slsi_add_ virtual_intf(struct wiphy *wiphy, char *name, @@ -56,12 +53,14 @@ struct net_device *slsi_add_ virtual_intf(struct wiphy *wiphy, u32 *flags, struct vif_params *params) { -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 9)) */ #endif + struct net_device *dev = NULL; struct netdev_vif *ndev_vif = NULL; - /* SLSI_UNUSED_PARAMETER(flags); */ +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 11, 0)) + SLSI_UNUSED_PARAMETER(flags); +#endif SLSI_NET_DBG1(dev, SLSI_CFG80211, "Intf name:%d, type:%d, macaddr:%pM\n", name, type, params->macaddr); dev = slsi_new_interface_create(wiphy, name, type, params); if (!dev) @@ -100,16 +99,27 @@ int slsi_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev) return 0; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) int slsi_change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, - enum nl80211_iftype type, - /* u32 *flags, */ + enum nl80211_iftype type, struct vif_params *params) { +#else +int slsi_change_virtual_intf(struct wiphy *wiphy, + struct net_device *dev, + enum nl80211_iftype type, + u32 *flags, + struct vif_params *params) +{ +#endif + struct netdev_vif *ndev_vif = netdev_priv(dev); int r = 0; - /* SLSI_UNUSED_PARAMETER(flags); */ +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 11, 0)) + SLSI_UNUSED_PARAMETER(flags); +#endif SLSI_MUTEX_LOCK(ndev_vif->vif_mutex); @@ -661,8 +671,13 @@ exit: return r; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) int slsi_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev, u64 reqid) { +#else +int slsi_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev) +{ +#endif struct netdev_vif *ndev_vif = netdev_priv(dev); struct slsi_dev *sdev = SDEV_FROM_WIPHY(wiphy); int r = 0; @@ -3186,8 +3201,11 @@ struct slsi_dev *slsi_cfg80211_new(struct device *dev) wiphy->max_scan_ssids = 10; wiphy->max_scan_ie_len = 2048; +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 11, 0)) /* Scheduled scanning support */ - /* wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; */ + wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; +#endif + /* Match the maximum number of SSIDs that could be requested from wpa_supplicant */ wiphy->max_sched_scan_ssids = 16; diff --git a/drivers/net/wireless/scsc/mgt.c b/drivers/net/wireless/scsc/mgt.c index 9f01140d98b3..b8d624c661d7 100755 --- a/drivers/net/wireless/scsc/mgt.c +++ b/drivers/net/wireless/scsc/mgt.c @@ -627,7 +627,11 @@ void slsi_scan_cleanup(struct slsi_dev *sdev, struct net_device *dev) #endif if (ndev_vif->scan[i].sched_req && i == SLSI_SCAN_SCHED_ID) - cfg80211_sched_scan_stopped(sdev->wiphy, 0); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) + cfg80211_sched_scan_stopped(sdev->wiphy, SLSI_SCAN_SCHED_ID); +#else + cfg80211_sched_scan_stopped(sdev->wiphy); +#endif ndev_vif->scan[i].scan_req = NULL; ndev_vif->scan[i].sched_req = NULL; diff --git a/drivers/net/wireless/scsc/rx.c b/drivers/net/wireless/scsc/rx.c index 1996d91c79a6..8d436f3405ea 100755 --- a/drivers/net/wireless/scsc/rx.c +++ b/drivers/net/wireless/scsc/rx.c @@ -521,7 +521,11 @@ void slsi_scan_complete(struct slsi_dev *sdev, struct net_device *dev, u16 scan_ } if (scan_id == SLSI_SCAN_SCHED_ID) - cfg80211_sched_scan_results(sdev->wiphy, 0); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) + cfg80211_sched_scan_results(sdev->wiphy, SLSI_SCAN_SCHED_ID); +#else + cfg80211_sched_scan_results(sdev->wiphy); +#endif SLSI_MUTEX_UNLOCK(ndev_vif->scan_result_mutex); } @@ -822,7 +826,10 @@ void slsi_rx_roamed_ind(struct slsi_dev *sdev, struct net_device *dev, struct sk #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) enum ieee80211_privacy bss_privacy; #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) struct cfg80211_roam_info roam_info = {}; +#endif + SLSI_MUTEX_LOCK(ndev_vif->vif_mutex); SLSI_NET_DBG1(dev, SLSI_MLME, "mlme_roamed_ind(vif:%d) Roaming to %pM\n", @@ -922,15 +929,16 @@ void slsi_rx_roamed_ind(struct slsi_dev *sdev, struct net_device *dev, struct sk SLSI_NET_DBG3(dev, SLSI_MLME, "cfg80211_roamed()\n"); - /* TODO: add proper parameters */ - /*roam_info.channel = */ - /*roam_info.bssid = */ - roam_info.req_ie = assoc_ie; - roam_info.req_ie_len = assoc_ie_len; - roam_info.resp_ie = assoc_rsp_ie; - roam_info.resp_ie_len = assoc_rsp_ie_len; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) + roam_info.channel = ndev_vif->sta.sta_bss->channel; + roam_info.bss = ndev_vif->sta.sta_bss; + roam_info.bssid = peer->address; + roam_info.req_ie = assoc_ie; + roam_info.req_ie_len = assoc_ie_len; + roam_info.resp_ie = assoc_rsp_ie; + roam_info.resp_ie_len = assoc_rsp_ie_len; cfg80211_roamed(dev, &roam_info, GFP_KERNEL); -#if 0 +#else cfg80211_roamed(dev, ndev_vif->sta.sta_bss->channel, peer->address, @@ -1931,7 +1939,9 @@ void slsi_rx_received_frame_ind(struct slsi_dev *sdev, struct net_device *dev, s ndev_vif->stats.rx_packets++; ndev_vif->stats.rx_bytes += skb->len; - /* dev->last_rx = jiffies; */ +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 10, 0)) + dev->last_rx = jiffies; +#endif skb->protocol = eth_type_trans(skb, dev); slsi_dbg_untrack_skb(skb); -- 2.20.1