diff --git a/os_if/linux/scan/inc/wlan_cfg80211_scan.h b/os_if/linux/scan/inc/wlan_cfg80211_scan.h index 62be6bc6f0..73a8c5a0e1 100644 --- a/os_if/linux/scan/inc/wlan_cfg80211_scan.h +++ b/os_if/linux/scan/inc/wlan_cfg80211_scan.h @@ -316,5 +316,43 @@ QDF_STATUS wlan_abort_scan(struct wlan_objmgr_pdev *pdev, void wlan_cfg80211_cleanup_scan_queue(struct wlan_objmgr_pdev *pdev, struct net_device *dev); +/** + * wlan_hdd_cfg80211_add_connected_pno_support() - Set connected PNO support + * @wiphy: Pointer to wireless phy + * + * This function is used to set connected PNO support to kernel + * + * Return: None + */ +#if defined(CFG80211_REPORT_BETTER_BSS_IN_SCHED_SCAN) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)) +void wlan_scan_cfg80211_add_connected_pno_support(struct wiphy *wiphy); + +#else +static inline +void wlan_scan_cfg80211_add_connected_pno_support(struct wiphy *wiphy) +{ +} +#endif + +#if ((LINUX_VERSION_CODE > KERNEL_VERSION(4, 4, 0)) || \ + defined(CFG80211_MULTI_SCAN_PLAN_BACKPORT)) && \ + defined(FEATURE_WLAN_SCAN_PNO) +/** + * hdd_config_sched_scan_plans_to_wiphy() - configure sched scan plans to wiphy + * @wiphy: pointer to wiphy + * @config: pointer to config + * + * Return: None + */ +void wlan_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy, + struct wlan_objmgr_psoc *psoc); +#else +static inline +void wlan_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy, + struct wlan_objmgr_psoc *psoc) +{ +} +#endif /* FEATURE_WLAN_SCAN_PNO */ #endif diff --git a/os_if/linux/scan/src/wlan_cfg80211_scan.c b/os_if/linux/scan/src/wlan_cfg80211_scan.c index b4231ec72a..260e245cf1 100644 --- a/os_if/linux/scan/src/wlan_cfg80211_scan.c +++ b/os_if/linux/scan/src/wlan_cfg80211_scan.c @@ -34,6 +34,7 @@ #include #include #include +#include "cfg_ucfg_api.h" #ifdef WLAN_POLICY_MGR_ENABLE #include #endif @@ -49,20 +50,6 @@ struct nla_policy scan_policy[QCA_WLAN_VENDOR_ATTR_SCAN_MAX + 1] = { [QCA_WLAN_VENDOR_ATTR_SCAN_COOKIE] = {.type = NLA_U64}, }; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) -static uint32_t hdd_config_sched_scan_start_delay( - struct cfg80211_sched_scan_request *request) -{ - return request->delay; -} -#else -static uint32_t hdd_config_sched_scan_start_delay( - struct cfg80211_sched_scan_request *request) -{ - return 0; -} -#endif - #if defined(CFG80211_SCAN_RANDOM_MAC_ADDR) || \ (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) /** @@ -161,8 +148,9 @@ static void wlan_scan_rand_attrs(struct wlan_objmgr_vdev *vdev, * * Return: None */ -static void wlan_config_sched_scan_plan(struct pno_scan_req_params *pno_req, - struct cfg80211_sched_scan_request *request) +static void +wlan_config_sched_scan_plan(struct pno_scan_req_params *pno_req, + struct cfg80211_sched_scan_request *request) { /* * As of now max 2 scan plans were supported by firmware @@ -193,14 +181,25 @@ static void wlan_config_sched_scan_plan(struct pno_scan_req_params *pno_req, } } #else -static void wlan_config_sched_scan_plan(struct pno_scan_req_params *pno_req, - struct cfg80211_sched_scan_request *request) +#define wlan_config_sched_scan_plan(pno_req, request) \ + __wlan_config_sched_scan_plan(pno_req, request, psoc) + +static void +__wlan_config_sched_scan_plan(struct pno_scan_req_params *pno_req, + struct cfg80211_sched_scan_request *request, + struct wlan_objmgr_psoc *psoc) { + uint32_t scan_timer_repeat_value, slow_scan_multiplier; + + scan_timer_repeat_value = ucfg_scan_get_scan_timer_repeat_value(psoc); + slow_scan_multiplier = ucfg_scan_get_slow_scan_multiplier(psoc); + pno_req->fast_scan_period = request->interval; - pno_req->fast_scan_max_cycles = SCAN_PNO_DEF_SCAN_TIMER_REPEAT; + pno_req->fast_scan_max_cycles = scan_timer_repeat_value; pno_req->slow_scan_period = - SCAN_PNO_DEF_SLOW_SCAN_MULTIPLIER * - pno_req->fast_scan_period; + (slow_scan_multiplier * pno_req->fast_scan_period); + cfg80211_debug("Base scan interval: %d sec PNO Scan Timer Repeat Value: %d", + (request->interval / 1000), scan_timer_repeat_value); } #endif @@ -373,6 +372,22 @@ static inline void wlan_hdd_sched_scan_update_relative_rssi( } #endif +#ifdef FEATURE_WLAN_SCAN_PNO +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) +static uint32_t wlan_config_sched_scan_start_delay( + struct cfg80211_sched_scan_request *request) +{ + return request->delay; +} +#else +static uint32_t wlan_config_sched_scan_start_delay( + struct cfg80211_sched_scan_request *request) +{ + return 0; +} +#endif /*(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) */ +#endif /* FEATURE_WLAN_SCAN_PNO */ + int wlan_cfg80211_sched_scan_start(struct wlan_objmgr_vdev *vdev, struct cfg80211_sched_scan_request *request, uint8_t scan_backoff_multiplier) @@ -384,6 +399,7 @@ int wlan_cfg80211_sched_scan_start(struct wlan_objmgr_vdev *vdev, struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev); struct wlan_objmgr_psoc *psoc; uint32_t valid_ch[SCAN_PNO_MAX_NETW_CHANNELS_EX] = {0}; + bool enable_dfs_pno_chnl_scan; if (ucfg_scan_get_pno_in_progress(vdev)) { cfg80211_debug("pno is already in progress"); @@ -429,6 +445,7 @@ int wlan_cfg80211_sched_scan_start(struct wlan_objmgr_vdev *vdev, goto error; } + enable_dfs_pno_chnl_scan = ucfg_scan_is_dfs_chnl_scan_enabled(psoc); if (request->n_channels) { char chl[(request->n_channels * 5) + 1]; int len = 0; @@ -436,6 +453,12 @@ int wlan_cfg80211_sched_scan_start(struct wlan_objmgr_vdev *vdev, for (i = 0; i < request->n_channels; i++) { channel = request->channels[i]->hw_value; + if ((!enable_dfs_pno_chnl_scan) && + (wlan_reg_is_dfs_ch(pdev, channel))) { + cfg80211_debug("Dropping DFS channel :%d", + channel); + continue; + } if (wlan_reg_is_dsrc_chan(pdev, channel)) continue; @@ -543,7 +566,7 @@ int wlan_cfg80211_sched_scan_start(struct wlan_objmgr_vdev *vdev, * shall be in slow_scan_period mode until next PNO Start. */ wlan_config_sched_scan_plan(req, request); - req->delay_start_time = hdd_config_sched_scan_start_delay(request); + req->delay_start_time = wlan_config_sched_scan_start_delay(request); req->scan_backoff_multiplier = scan_backoff_multiplier; cfg80211_notice("Base scan interval: %d sec, scan cycles: %d, slow scan interval %d", req->fast_scan_period, req->fast_scan_max_cycles, @@ -1868,3 +1891,63 @@ void wlan_cfg80211_inform_bss_frame(struct wlan_objmgr_pdev *pdev, qdf_mem_free(bss_data.mgmt); } + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) +/* + * wlan_scan_wiphy_set_max_sched_scans() - set maximum number of scheduled scans to + * wiphy. + * @wiphy: pointer to wiphy + * @max_scans: max num scans to be configured + * + */ +static inline void +wlan_scan_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 +wlan_scan_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 defined(CFG80211_REPORT_BETTER_BSS_IN_SCHED_SCAN) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)) +void wlan_scan_cfg80211_add_connected_pno_support(struct wiphy *wiphy) +{ + wiphy_ext_feature_set(wiphy, + NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI); +} +#endif + +#if ((LINUX_VERSION_CODE > KERNEL_VERSION(4, 4, 0)) || \ + defined(CFG80211_MULTI_SCAN_PLAN_BACKPORT)) && \ + defined(FEATURE_WLAN_SCAN_PNO) +void wlan_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy, + struct wlan_objmgr_psoc *psoc) +{ + if (ucfg_scan_get_pno_scan_support(psoc)) { + wlan_scan_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 = SCAN_MAX_IE_LENGTH; + wiphy->max_sched_scan_plans = SCAN_PNO_MAX_PLAN_REQUEST; + + /* + * Exception: Using cfg_get() here because these two + * schedule scan params are used only at this place + * to copy to wiphy structure + */ + wiphy->max_sched_scan_plan_interval = + cfg_get(psoc, CFG_MAX_SCHED_SCAN_PLAN_INTERVAL); + + wiphy->max_sched_scan_plan_iterations = + cfg_get(psoc, CFG_MAX_SCHED_SCAN_PLAN_ITERATIONS); + } +} +#endif diff --git a/umac/scan/core/src/wlan_scan_main.h b/umac/scan/core/src/wlan_scan_main.h index 6a74eb3098..955e0b9595 100644 --- a/umac/scan/core/src/wlan_scan_main.h +++ b/umac/scan/core/src/wlan_scan_main.h @@ -236,6 +236,7 @@ struct scan_vdev_obj { /** * struct pno_def_config - def configuration for PNO + * @pno_offload_enabled: flag to check if PNO offload is enabled/disabled * @channel_prediction: config PNO channel prediction feature status * @top_k_num_of_channels: def top K number of channels are used for tanimoto * distance calculation. @@ -243,16 +244,27 @@ struct scan_vdev_obj { * @pnoscan_adaptive_dwell_mode: def adaptive dwelltime mode for pno scan * @channel_prediction_full_scan: def periodic timer upon which full scan needs * to be triggered. + * @dfs_chnl_scan_enable: Enable dfs channel PNO scan + * @scan_support_enabled: PNO scan support enabled/disabled + * @scan_timer_repeat_value: PNO scan timer repeat value + * @slow_scan_multiplier: PNO slow scan timer multiplier + * @scan_backoff_multiplier: Scan banckoff multiplier * @pno_wake_lock: pno wake lock * @pno_cb: callback to call on PNO completion * @mawc_params: Configuration parameters for NLO MAWC. */ struct pno_def_config { + bool pno_offload_enabled; bool channel_prediction; uint8_t top_k_num_of_channels; uint8_t stationary_thresh; enum scan_dwelltime_adaptive_mode adaptive_dwell_mode; uint32_t channel_prediction_full_scan; + bool dfs_chnl_scan_enabled; + bool scan_support_enabled; + uint32_t scan_timer_repeat_value; + uint32_t slow_scan_multiplier; + uint8_t scan_backoff_multiplier; qdf_wake_lock_t pno_wake_lock; struct cb_handler pno_cb; struct nlo_mawc_params mawc_params; diff --git a/umac/scan/dispatcher/inc/wlan_scan_cfg.h b/umac/scan/dispatcher/inc/wlan_scan_cfg.h index 3c22b13356..1f5d00b6aa 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_cfg.h +++ b/umac/scan/dispatcher/inc/wlan_scan_cfg.h @@ -330,13 +330,387 @@ 1, 7200, 3600, \ CFG_VALUE_OR_DEFAULT, \ "Max sched scan plan interval") +#endif + +/* + * + * gEnableDFSPnoChnlScan - enable dfs channels in PNO scan + * @Min: 0 + * @Max: 1 + * @Default: 1 + * + * This ini is used to enable/disable dfs channels in PNO scan request, + * enabling this ini enables driver to include dfs channels in its + * PNO scan request + * Related: NA + * + * Supported Feature: DFS, PNO + * + * Usage: Internal/External + * + * + */ +#define CFG_ENABLE_DFS_PNO_CHNL_SCAN CFG_INI_BOOL( \ + "gEnableDFSPnoChnlScan", \ + true, \ + "Enable dfs channels in PNO Scan") + +#ifdef FEATURE_WLAN_SCAN_PNO +/* + * + * gPNOScanSupport - Enable or Disable PNO scan + * @Min: 0 + * @Max: 1 + * @Default: 1 + * + * This ini is used to Enable or Disable PNO scan + * + * Related: None + * + * Supported Feature: Scan + * + * Usage: External + * + * + */ +#define CFG_PNO_SCAN_SUPPORT CFG_INI_BOOL( \ + "gPNOScanSupport", \ + true, \ + "Enable/Disable PNO scan") + +/* + * + * gPNOScanTimerRepeatValue - Set PNO scan timer repeat value + * @Min: 0 + * @Max: 0xffffffff + * @Default: 30 + * + * This ini is used by firmware to set fast scan max cycles + * equal to gPNOScanTimerRepeatValue. Taking power consumption + * into account firmware after gPNOScanTimerRepeatValue times + * fast_scan_period switches to slow_scan_period. + * + * Usage: External + * + * + */ +#define CFG_PNO_SCAN_TIMER_REPEAT_VALUE CFG_INI_UINT( \ + "gPNOScanTimerRepeatValue", \ + 0, \ + 0xffffffff, \ + 30, \ + CFG_VALUE_OR_DEFAULT, \ + "PNO scan timer repeat value") + +/* + * + * gPNOSlowScanMultiplier - Set PNO slow scan multiplier + * @Min: 0 + * @Max: 30 + * @Default: 6 + * + * This ini is used by firmware to set slow scan period + * as gPNOSlowScanMultiplier times fast_scan_period. + * + * Related: None + * + * Supported Feature: Scan + * + * Usage: External + * + * + */ +#define CFG_PNO_SLOW_SCAN_MULTIPLIER CFG_INI_UINT( \ + "gPNOSlowScanMultiplier", \ + 0, \ + 30, \ + 6, \ + CFG_VALUE_OR_DEFAULT, \ + "PNO slow scan multiplier") +#endif + +/* + * + * gPNOChannelPrediction - Enable/disable the PNO channel + * prediction feature. + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * In current PNO implementation, scan is always done until all configured + * channels are scanned. If we can determine DUT is stationary based on + * scanning a subset of channels, we may cancel the remaining channels. + * Hence, we can save additional power consumption. + * + * Related: None + * + * Supported Feature: Scan + * + * Usage: External + * + * + */ +#define CFG_PNO_CHANNEL_PREDICTION CFG_INI_BOOL( \ + "gPNOChannelPrediction", \ + false, \ + "enable/disable PNO channel prediction feature") + +/* + * + * gTopKNumOfChannels - top K number of channels are used for tanimoto distance + * @Min: 1 + * @Max: 5 + * @Default: 3 + * + * These are the top channels on which the probability of finding the AP's is + * extremely high. This number is intended for tweaking the internal algorithm + * for experiments. This should not be changed externally. + * + * Related: None + * + * Supported Feature: Scan + * + * Usage: External + * + */ +#define CFG_TOP_K_NUM_OF_CHANNELS CFG_INI_UINT( \ + "gTopKNumOfChannels", \ + 1, \ + 5, \ + 3, \ + CFG_VALUE_OR_DEFAULT, \ + "Top K number of channels") +/* + * + * gStationaryThreshold - STA threshold value to determine if it is stationary + * @Min: 0 + * @Max: 100 + * @Default: 10 + * + * This is the threshold value to determine that the STA is + * stationary. If the tanimoto distance is less than this + * value, then the device is considered to be stationary. + * This parameter is intended to tweak the internal algorithm + * for experiments. This should not be changed externally. + * + * + * Related: None + * + * Supported Feature: Scan + * + * Usage: External + * + * + */ +#define CFG_STATIONARY_THRESHOLD CFG_INI_UINT( \ + "gStationaryThreshold", \ + 0, \ + 100, \ + 10, \ + CFG_VALUE_OR_DEFAULT, \ + "Threshold to determine if sta is stationary") + +/* + * + * gChPredictionFullScanMs - Set periodic timer for channel prediction + * @Min: 3000 + * @Max: 0x7fffffff + * @Default: 60000 + * + * This ini is used to set the periodic timer upon which + * a full scan needs to be triggered when PNO channel + * prediction feature is enabled. This parameter is intended + * to tweak the internal algortihm for experiments. + * + * Related: None + * + * Supported Feature: Scan + * + * Usage: Internal + * + * + */ +#define CFG_CHANNEL_PREDICTION_SCAN_TIMER CFG_INI_UINT( \ + "gChPredictionFullScanMs", \ + 3000, \ + 0x7fffffff, \ + 60000, \ + CFG_VALUE_OR_DEFAULT, \ + "Timer value for channel prediction") + +/* + * + * pnoscan_adaptive_dwell_mode - Enable adaptive dwell mode + * during pno scan + * @Min: 0 + * @Max: 4 + * @Default: 1 + * + * This ini will set the algo used in dwell time optimization + * during pno scan. see enum scan_dwelltime_adaptive_mode. + * Acceptable values for this: + * 0: Default (Use firmware default mode) + * 1: Conservative optimization + * 2: Moderate optimization + * 3: Aggressive optimization + * 4: Static + * + * Related: None + * + * Supported Feature: Scan + * + * Usage: External + * + * + */ +#define CFG_ADAPTIVE_PNOSCAN_DWELL_MODE CFG_INI_UINT( \ + "pnoscan_adaptive_dwell_mode", \ + 0, \ + 4, \ + 1, \ + CFG_VALUE_OR_DEFAULT, \ + "Algorithm used in dwell time optimization") + +/* + * + * gScanBackoffMultiplier - For NLO/PNO, multiply fast scan period by this every + * max cycles + * @Min: 0 + * @Max: 255 + * @Default: 0 + * + * For Network Listen Offload and Perfered Network Offload, multiply the fast + * scan period by this value after max cycles have occurred. Setting this to 0 + * disables the feature. + * + * @E.g. + * # Disable scan backoff multiplier + * gScanBackoffMultiplier=0 + * # Effectively the same + * gScanBackoffMultiplier=1 + * # Double the scan period after each max cycles have occurred + * gScanBackoffMultiplier=2 + * + * Related: NLO, PNO + * + * Usage: Internal/External + * + * + */ +#define CFG_SCAN_BACKOFF_MULTIPLIER CFG_INI_UINT( \ + "gScanBackoffMultiplier", \ + 0, \ + 255, \ + 0, \ + CFG_VALUE_OR_DEFAULT, \ + "Scan backoff multiplier") + +/* + * + * mawc_nlo_enabled - For NLO/PNO, enable MAWC based scan + * @Min: 0 + * @Max: 1 + * @Default: 1 + * + * Enable/Disable the Motion Aided Wireless Connectivity + * based NLO using this parameter + * + * Related: NLO, PNO + * + * Usage: Internal/External + * + * + */ +#define CFG_MAWC_NLO_ENABLED CFG_INI_BOOL( \ + "mawc_nlo_enabled", \ + 1, \ + "Enable MAWC based scan") + +/* + * + * mawc_nlo_exp_backoff_ratio - Exponential back off ratio + * @Min: 0 + * @Max: 300 + * @Default: 3 + * + * Configure the exponential back off ratio using this + * parameter for MAWC based NLO + * ratio of exponential backoff, next = current + current*ratio/100 + * + * Related: NLO, PNO + * + * Usage: Internal/External + * + * + */ +#define CFG_MAWC_NLO_EXP_BACKOFF_RATIO CFG_INI_UINT( \ + "mawc_nlo_exp_backoff_ratio", \ + 0, \ + 300, \ + 3, \ + CFG_VALUE_OR_DEFAULT, \ + "MWAC based NLO exponential ratio") + +/* + * + * mawc_nlo_init_scan_interval - Initial Scan Interval + * @Min: 1000 + * @Max: 0xFFFFFFFF + * @Default: 10000 + * + * Configure the initial scan interval using this + * parameter for MAWC based NLO (Units in Milliseconds) + * + * Related: NLO, PNO + * + * Usage: Internal/External + * + * + */ +#define CFG_MAWC_NLO_INIT_SCAN_INTERVAL CFG_INI_UINT( \ + "mawc_nlo_init_scan_interval", \ + 1000, \ + 0xFFFFFFFF, \ + 10000, \ + CFG_VALUE_OR_DEFAULT, \ + "Initial Scan Interval") + +/* + * + * mawc_nlo_max_scan_interval - Maximum Scan Interval + * @Min: 1000 + * @Max: 0xFFFFFFFF + * @Default: 60000 + * + * Configure the maximum scan interval using this + * parameter for MAWC based NLO (Units in Milliseconds) + * + * Related: NLO, PNO + * + * Usage: Internal/External + * + * + */ +#define CFG_MAWC_NLO_MAX_SCAN_INTERVAL CFG_INI_UINT( \ + "mawc_nlo_max_scan_interval", \ + 1000, \ + 0xFFFFFFFF, \ + 60000, \ + CFG_VALUE_OR_DEFAULT, \ + "Maximum Scan Interval") + +#ifdef FEATURE_WLAN_SCAN_PNO #define CFG_SCAN_PNO \ CFG(CFG_MAX_SCHED_SCAN_PLAN_ITERATIONS) \ - CFG(CFG_MAX_SCHED_SCAN_PLAN_INTERVAL) + CFG(CFG_MAX_SCHED_SCAN_PLAN_INTERVAL) \ + CFG(CFG_PNO_SCAN_SUPPORT) \ + CFG(CFG_PNO_SCAN_TIMER_REPEAT_VALUE) \ + CFG(CFG_PNO_SLOW_SCAN_MULTIPLIER) + #else #define CFG_SCAN_PNO -#endif +#endif /* FEATURE_WLAN_SCAN_PNO */ /* * @@ -495,11 +869,21 @@ CFG(CFG_ADAPTIVE_SCAN_DWELL_MODE) \ CFG(CFG_ADAPTIVE_SCAN_DWELL_MODE_NC) \ CFG(CFG_IS_BSSID_HINT_PRIORITY) \ - CFG_SCAN_PNO \ CFG(CFG_PASSIVE_MAX_CHANNEL_TIME_CONC) \ CFG(CFG_ACTIVE_MAX_CHANNEL_TIME_CONC) \ CFG(CFG_MAX_REST_TIME_CONC) \ CFG(CFG_MIN_REST_TIME_CONC) \ - CFG(CFG_IDLE_TIME_CONC) - -#endif + CFG(CFG_IDLE_TIME_CONC) \ + CFG(CFG_ENABLE_DFS_PNO_CHNL_SCAN) \ + CFG(CFG_PNO_CHANNEL_PREDICTION) \ + CFG(CFG_TOP_K_NUM_OF_CHANNELS) \ + CFG(CFG_STATIONARY_THRESHOLD) \ + CFG(CFG_CHANNEL_PREDICTION_SCAN_TIMER) \ + CFG(CFG_ADAPTIVE_PNOSCAN_DWELL_MODE) \ + CFG(CFG_SCAN_BACKOFF_MULTIPLIER) \ + CFG(CFG_MAWC_NLO_ENABLED) \ + CFG(CFG_MAWC_NLO_EXP_BACKOFF_RATIO) \ + CFG(CFG_MAWC_NLO_INIT_SCAN_INTERVAL) \ + CFG(CFG_MAWC_NLO_MAX_SCAN_INTERVAL) \ + CFG_SCAN_PNO +#endif /* __CONFIG_SCAN_H */ diff --git a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h index b8da3115d2..26f0d23c99 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h +++ b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h @@ -1154,23 +1154,13 @@ enum scan_cb_type { #define SCAN_PNO_DEF_SLOW_SCAN_MULTIPLIER 6 #define SCAN_PNO_DEF_SCAN_TIMER_REPEAT 20 #define SCAN_PNO_MATCH_WAKE_LOCK_TIMEOUT (5 * 1000) /* in msec */ +#define SCAN_MAX_IE_LENGTH 255 #ifdef CONFIG_SLUB_DEBUG_ON #define SCAN_PNO_SCAN_COMPLETE_WAKE_LOCK_TIMEOUT (2 * 1000) /* in msec */ #else #define SCAN_PNO_SCAN_COMPLETE_WAKE_LOCK_TIMEOUT (1 * 1000) /* in msec */ #endif /* CONFIG_SLUB_DEBUG_ON */ -#define SCAN_PNO_CHANNEL_PREDICTION 0 -#define SCAN_TOP_K_NUM_OF_CHANNELS 3 -#define SCAN_STATIONARY_THRESHOLD 10 -#define SCAN_CHANNEL_PREDICTION_FULL_SCAN_MS 60000 -#define SCAN_ADAPTIVE_PNOSCAN_DWELL_MODE 0 -#define SCAN_MAWC_NLO_ENABLED 1 -#define SCAN_MAWC_NLO_EXP_BACKOFF_RATIO 3 -#define SCAN_MAWC_NLO_INIT_SCAN_INTERVAL 10000 -#define SCAN_MAWC_NLO_MAX_SCAN_INTERVAL 60000 - - /** * enum ssid_bc_type - SSID broadcast type * @SSID_BC_TYPE_UNKNOWN: Broadcast unknown @@ -1289,31 +1279,10 @@ struct pno_scan_req_params { struct nlo_mawc_params mawc_params; }; -/** - * struct pno_user_cfg - user configuration required for PNO - * @channel_prediction: config PNO channel prediction feature status - * @top_k_num_of_channels: def top K number of channels are used for tanimoto - * distance calculation. - * @stationary_thresh: def threshold val to determine that STA is stationary. - * @pnoscan_adaptive_dwell_mode: def adaptive dwelltime mode for pno scan - * @channel_prediction_full_scan: def periodic timer upon which full scan needs - * to be triggered. - * @mawc_params: Configuration parameters for NLO MAWC. - */ -struct pno_user_cfg { - bool channel_prediction; - uint8_t top_k_num_of_channels; - uint8_t stationary_thresh; - enum scan_dwelltime_adaptive_mode adaptive_dwell_mode; - uint32_t channel_prediction_full_scan; - struct nlo_mawc_params mawc_params; -}; - /** * struct scan_user_cfg - user configuration required for for scan * @scan_cache_aging_time: default scan cache aging time * @is_snr_monitoring_enabled: whether snr monitoring enabled or not - * @pno_cfg: Pno related config params * @ie_whitelist: probe req IE whitelist attrs * @enable_mac_spoofing: enable mac address spoof in scan * @sta_miracast_mcc_rest_time: sta miracast mcc rest time @@ -1322,7 +1291,6 @@ struct pno_user_cfg { struct scan_user_cfg { uint32_t scan_cache_aging_time; bool is_snr_monitoring_enabled; - struct pno_user_cfg pno_cfg; struct probe_req_whitelist_attr ie_whitelist; bool enable_mac_spoofing; uint32_t sta_miracast_mcc_rest_time; diff --git a/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h b/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h index d997d248fd..0c170e0ae4 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h +++ b/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h @@ -815,4 +815,107 @@ void ucfg_scan_cfg_get_conc_min_resttime(struct wlan_objmgr_psoc *psoc, return wlan_scan_cfg_get_conc_min_resttime(psoc, rest_time); } +#ifdef FEATURE_WLAN_SCAN_PNO +/** + * ucfg_scan_is_pno_offload_enabled() - Check if pno offload is enabled + * @psoc: pointer to psoc object + * + * Return: pno_offload_enabled flag + */ +bool ucfg_scan_is_pno_offload_enabled(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_scan_set_pno_offload() - API to set pno offload flag based on the + * capability received from the firmware. + * @psoc: pointer to psoc object + * @rest_time: scan concurrent min rest time + * + * Return: scan concurrent min rest time + */ +void ucfg_scan_set_pno_offload(struct wlan_objmgr_psoc *psoc, bool value); + +/** + * ucfg_scan_get_pno_scan_support() - Check if pno scan support is enabled + * @psoc: pointer to psoc object + * + * Return: scan_support_enabled flag + */ +bool ucfg_scan_get_pno_scan_support(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_get_scan_backoff_multiplier() - get scan backoff multiplier value + * @psoc: pointer to psoc object + * + * Return: scan_support_enabled flag + */ +uint8_t ucfg_get_scan_backoff_multiplier(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_scan_is_dfs_chnl_scan_enabled() - Check if PNO dfs channel scan support + * is enabled + * @psoc: pointer to psoc object + * + * Return: dfs_chnl_scan_enabled flag + */ +bool ucfg_scan_is_dfs_chnl_scan_enabled(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_scan_get_scan_timer_repeat_value() - API to get PNO scan timer repeat + * value + * @psoc: pointer to psoc object + * + * Return: scan_timer_repeat_value + */ +uint32_t ucfg_scan_get_scan_timer_repeat_value(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_scan_get_slow_scan_multiplier() - API to get PNO slow scan multiplier + * value + * @psoc: pointer to psoc object + * + * Return: slow_scan_multiplier value + */ +uint32_t ucfg_scan_get_slow_scan_multiplier(struct wlan_objmgr_psoc *psoc); +#else +static inline +bool ucfg_scan_is_pno_offload_enabled(struct wlan_objmgr_psoc *psoc) +{ + return 0; +} + +static inline +void ucfg_scan_set_pno_offload(struct wlan_objmgr_psoc *psoc, bool value) +{ +} + +static inline +bool ucfg_scan_get_pno_scan_support(struct wlan_objmgr_psoc *psoc) +{ + return 0; +} + +static inline +uint8_t ucfg_get_scan_backoff_multiplier(struct wlan_objmgr_psoc *psoc) +{ + return 0; +} + +static inline +bool ucfg_scan_is_dfs_chnl_scan_enabled(struct wlan_objmgr_psoc *psoc) +{ + return 0; +} + +static inline +uint32_t ucfg_scan_get_scan_timer_repeat_value(struct wlan_objmgr_psoc *psoc) +{ + return 0; +} + +static inline +uint32_t ucfg_scan_get_slow_scan_multiplier(struct wlan_objmgr_psoc *psoc) +{ + return 0; +} +#endif /* FEATURE_WLAN_SCAN_PNO */ #endif diff --git a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c index 1fb7384c18..60848ddd05 100644 --- a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c @@ -232,22 +232,39 @@ bool ucfg_scan_get_pno_match(struct wlan_objmgr_vdev *vdev) } static QDF_STATUS -wlan_pno_global_init(struct pno_def_config *pno_def) +wlan_pno_global_init(struct wlan_objmgr_psoc *psoc, + struct pno_def_config *pno_def) { struct nlo_mawc_params *mawc_cfg; qdf_wake_lock_create(&pno_def->pno_wake_lock, "wlan_pno_wl"); mawc_cfg = &pno_def->mawc_params; - pno_def->channel_prediction = SCAN_PNO_CHANNEL_PREDICTION; - pno_def->top_k_num_of_channels = SCAN_TOP_K_NUM_OF_CHANNELS; - pno_def->stationary_thresh = SCAN_STATIONARY_THRESHOLD; + pno_def->channel_prediction = cfg_get(psoc, CFG_PNO_CHANNEL_PREDICTION); + pno_def->top_k_num_of_channels = + cfg_get(psoc, CFG_TOP_K_NUM_OF_CHANNELS); + pno_def->stationary_thresh = cfg_get(psoc, CFG_STATIONARY_THRESHOLD); pno_def->channel_prediction_full_scan = - SCAN_CHANNEL_PREDICTION_FULL_SCAN_MS; - pno_def->adaptive_dwell_mode = SCAN_ADAPTIVE_PNOSCAN_DWELL_MODE; - mawc_cfg->enable = SCAN_MAWC_NLO_ENABLED; - mawc_cfg->exp_backoff_ratio = SCAN_MAWC_NLO_EXP_BACKOFF_RATIO; - mawc_cfg->init_scan_interval = SCAN_MAWC_NLO_INIT_SCAN_INTERVAL; - mawc_cfg->max_scan_interval = SCAN_MAWC_NLO_MAX_SCAN_INTERVAL; + cfg_get(psoc, CFG_CHANNEL_PREDICTION_SCAN_TIMER); + pno_def->adaptive_dwell_mode = + cfg_get(psoc, CFG_ADAPTIVE_PNOSCAN_DWELL_MODE); + pno_def->dfs_chnl_scan_enabled = + cfg_get(psoc, CFG_ENABLE_DFS_PNO_CHNL_SCAN); + pno_def->scan_support_enabled = + cfg_get(psoc, CFG_PNO_SCAN_SUPPORT); + pno_def->scan_timer_repeat_value = + cfg_get(psoc, CFG_PNO_SCAN_TIMER_REPEAT_VALUE); + pno_def->slow_scan_multiplier = + cfg_get(psoc, CFG_PNO_SLOW_SCAN_MULTIPLIER); + pno_def->scan_backoff_multiplier = + cfg_get(psoc, CFG_SCAN_BACKOFF_MULTIPLIER); + + mawc_cfg->enable = cfg_get(psoc, CFG_MAWC_NLO_ENABLED); + mawc_cfg->exp_backoff_ratio = + cfg_get(psoc, CFG_MAWC_NLO_EXP_BACKOFF_RATIO); + mawc_cfg->init_scan_interval = + cfg_get(psoc, CFG_MAWC_NLO_INIT_SCAN_INTERVAL); + mawc_cfg->max_scan_interval = + cfg_get(psoc, CFG_MAWC_NLO_MAX_SCAN_INTERVAL); return QDF_STATUS_SUCCESS; } @@ -346,21 +363,6 @@ ucfg_scan_get_pno_def_params(struct wlan_objmgr_vdev *vdev, return QDF_STATUS_SUCCESS; } -static QDF_STATUS ucfg_scan_update_pno_config(struct pno_def_config *pno, - struct pno_user_cfg *pno_cfg) -{ - pno->channel_prediction = pno_cfg->channel_prediction; - pno->top_k_num_of_channels = pno_cfg->top_k_num_of_channels; - pno->stationary_thresh = pno_cfg->stationary_thresh; - pno->adaptive_dwell_mode = pno_cfg->adaptive_dwell_mode; - pno->channel_prediction_full_scan = - pno_cfg->channel_prediction_full_scan; - qdf_mem_copy(&pno->mawc_params, &pno_cfg->mawc_params, - sizeof(pno->mawc_params)); - - return QDF_STATUS_SUCCESS; -} - QDF_STATUS ucfg_scan_register_pno_cb(struct wlan_objmgr_psoc *psoc, scan_event_handler event_cb, void *arg) @@ -384,7 +386,8 @@ ucfg_scan_register_pno_cb(struct wlan_objmgr_psoc *psoc, #else static inline QDF_STATUS -wlan_pno_global_init(struct pno_def_config *pno_def) +wlan_pno_global_init(struct wlan_objmgr_psoc *psoc, + struct pno_def_config *pno_def) { return QDF_STATUS_SUCCESS; } @@ -394,13 +397,6 @@ wlan_pno_global_deinit(struct pno_def_config *pno_def) return QDF_STATUS_SUCCESS; } -static inline QDF_STATUS -ucfg_scan_update_pno_config(struct pno_def_config *pno, - struct pno_user_cfg *pno_cfg) -{ - return QDF_STATUS_SUCCESS; -} - #endif #ifdef WLAN_POLICY_MGR_ENABLE @@ -1535,7 +1531,7 @@ wlan_scan_global_init(struct wlan_objmgr_psoc *psoc, /* init extscan */ wlan_extscan_global_init(psoc, scan_obj); - return wlan_pno_global_init(&scan_obj->pno_cfg); + return wlan_pno_global_init(psoc, &scan_obj->pno_cfg); } static void @@ -2002,9 +1998,6 @@ QDF_STATUS ucfg_scan_update_user_config(struct wlan_objmgr_psoc *psoc, scan_def->sta_miracast_mcc_rest_time = scan_cfg->sta_miracast_mcc_rest_time; - ucfg_scan_update_pno_config(&scan_obj->pno_cfg, - &scan_cfg->pno_cfg); - qdf_mem_copy(&scan_def->score_config, &scan_cfg->score_config, sizeof(struct scoring_config)); scm_validate_scoring_config(&scan_def->score_config); @@ -2400,3 +2393,92 @@ ucfg_scan_get_global_config(struct wlan_objmgr_psoc *psoc, return status; } + +#ifdef FEATURE_WLAN_SCAN_PNO +bool ucfg_scan_is_pno_offload_enabled(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_scan_obj *scan_obj; + + scan_obj = wlan_psoc_get_scan_obj(psoc); + if (!scan_obj) { + scm_err("NULL scan obj"); + return false; + } + + return scan_obj->pno_cfg.pno_offload_enabled; +} + +void ucfg_scan_set_pno_offload(struct wlan_objmgr_psoc *psoc, bool value) +{ + struct wlan_scan_obj *scan_obj; + + scan_obj = wlan_psoc_get_scan_obj(psoc); + if (!scan_obj) { + scm_err("NULL scan obj"); + return; + } + + scan_obj->pno_cfg.pno_offload_enabled = value; +} + +bool ucfg_scan_get_pno_scan_support(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_scan_obj *scan_obj; + + scan_obj = wlan_psoc_get_scan_obj(psoc); + if (!scan_obj) { + scm_err("NULL scan obj"); + return cfg_default(CFG_PNO_SCAN_SUPPORT); + } + + return scan_obj->pno_cfg.scan_support_enabled; +} + +uint8_t ucfg_get_scan_backoff_multiplier(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_scan_obj *scan_obj; + + scan_obj = wlan_psoc_get_scan_obj(psoc); + if (!scan_obj) { + scm_err("NULL scan obj"); + return cfg_default(CFG_SCAN_BACKOFF_MULTIPLIER); + } + return scan_obj->pno_cfg.scan_backoff_multiplier; +} + +bool ucfg_scan_is_dfs_chnl_scan_enabled(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_scan_obj *scan_obj; + + scan_obj = wlan_psoc_get_scan_obj(psoc); + if (!scan_obj) { + scm_err("NULL scan obj"); + return cfg_default(CFG_ENABLE_DFS_PNO_CHNL_SCAN); + } + return scan_obj->pno_cfg.dfs_chnl_scan_enabled; +} + +uint32_t ucfg_scan_get_scan_timer_repeat_value(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_scan_obj *scan_obj; + + scan_obj = wlan_psoc_get_scan_obj(psoc); + if (!scan_obj) { + scm_err("NULL scan obj"); + return cfg_default(CFG_PNO_SCAN_TIMER_REPEAT_VALUE); + } + return scan_obj->pno_cfg.scan_timer_repeat_value; +} + +uint32_t ucfg_scan_get_slow_scan_multiplier(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_scan_obj *scan_obj; + + scan_obj = wlan_psoc_get_scan_obj(psoc); + if (!scan_obj) { + scm_err("NULL scan obj"); + return cfg_default(CFG_PNO_SLOW_SCAN_MULTIPLIER); + } + return scan_obj->pno_cfg.slow_scan_multiplier; +} +#endif