From 52ba1ce2d1b053ee679ff9a658ddf30f3f604063 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Wed, 16 Aug 2017 12:10:55 -0700 Subject: [PATCH] qcacld-3.0: Add a wrapper for WIPHY_FLAG_SUPPORTS_SCHED_SCAN WIPHY_FLAG_SUPPORTS_SCHED_SCAN is removed in Linux kernel versions 4.12+ in favor of proper multiple scheduled scan support. Add conditional compilation to set the appropriate wiphy state based on which kernel version is being compiled against. Change-Id: I5e688f085b1c13fec0b4f42c5da82411eae08c03 CRs-Fixed: 2093945 --- core/hdd/src/wlan_hdd_cfg80211.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 53393e0135..8a13846d01 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -11861,6 +11861,23 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = { }, }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) +static inline void +hdd_wiphy_set_max_sched_scans(struct wiphy *wiphy, uint8_t max_scans) +{ + if (max_scans == 0) + wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_SCHED_SCAN; + else + wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; +} +#else +static inline void +hdd_wiphy_set_max_sched_scans(struct wiphy *wiphy, uint8_t max_scans) +{ + wiphy->max_sched_scan_reqs = max_scans; +} +#endif /* KERNEL_VERSION(4, 12, 0) */ + #if ((LINUX_VERSION_CODE > KERNEL_VERSION(4, 4, 0)) || \ defined(CFG80211_MULTI_SCAN_PLAN_BACKPORT)) && \ defined(FEATURE_WLAN_SCAN_PNO) @@ -11875,7 +11892,7 @@ static void hdd_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy, struct hdd_config *config) { if (config->configPNOScanSupport) { - wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; + hdd_wiphy_set_max_sched_scans(wiphy, 1); wiphy->max_sched_scan_ssids = SCAN_PNO_MAX_SUPP_NETWORKS; wiphy->max_match_sets = SCAN_PNO_MAX_SUPP_NETWORKS; wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; @@ -12374,7 +12391,7 @@ void wlan_hdd_cfg80211_update_wiphy_caps(struct wiphy *wiphy) * have PNO support. */ if (!pCfg->PnoOffload) { - wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_SCHED_SCAN; + hdd_wiphy_set_max_sched_scans(wiphy, 0); wiphy->max_sched_scan_ssids = 0; wiphy->max_match_sets = 0; wiphy->max_sched_scan_ie_len = 0;