qcacmn: Refactor scan related ini items

Refactor the following scan related ini items to scan module:
CFG_ENABLE_MAC_ADDR_SPOOFING - ini to enable/disable scan mac
randomization
CFG_SCAN_AGING_TIME - configure scan entries aging time.

Previously these values are populated in hdd and passed to
scan module through ucfg_scan_update_user_config() function.
With new cfg infra, the scan module can directly get these
values from cfg component.

Change-Id: I0dcbd8253ae46387dd44e68c86f0622f279ba501
CRs-Fixed: 2378985
This commit is contained in:
Pragaspathi Thilagaraj
2019-02-01 11:53:59 +05:30
committed by nshrivas
parent 8f1ded29ed
commit 9d9a3c492c
6 changed files with 155 additions and 22 deletions

View File

@@ -1984,16 +1984,11 @@ void wlan_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy,
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);
ucfg_scan_get_max_sched_scan_plan_interval(psoc);
wiphy->max_sched_scan_plan_iterations =
cfg_get(psoc, CFG_MAX_SCHED_SCAN_PLAN_ITERATIONS);
ucfg_scan_get_max_sched_scan_plan_iterations(psoc);
}
}
#endif

View File

@@ -137,12 +137,6 @@ struct probe_time_dwell_time {
#endif
#define SCAN_TIMEOUT_GRACE_PERIOD 10
/* scan age time in millisec */
#ifdef QCA_WIFI_NAPIER_EMULATION
#define SCAN_CACHE_AGING_TIME (90 * 1000)
#else
#define SCAN_CACHE_AGING_TIME (30 * 1000)
#endif
#define SCAN_MAX_BSS_PDEV 100
#define SCAN_PRIORITY SCAN_PRIORITY_LOW
@@ -248,6 +242,8 @@ struct scan_vdev_obj {
* @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
* @max_sched_scan_plan_interval: PNO scan interval
* @max_sched_scan_plan_iterations: PNO scan number of iterations
* @scan_backoff_multiplier: Scan banckoff multiplier
* @pno_wake_lock: pno wake lock
* @pno_cb: callback to call on PNO completion
@@ -264,6 +260,8 @@ struct pno_def_config {
bool scan_support_enabled;
uint32_t scan_timer_repeat_value;
uint32_t slow_scan_multiplier;
uint32_t max_sched_scan_plan_interval;
uint32_t max_sched_scan_plan_iterations;
uint8_t scan_backoff_multiplier;
qdf_wake_lock_t pno_wake_lock;
struct cb_handler pno_cb;

View File

@@ -856,6 +856,60 @@
CFG_VALUE_OR_DEFAULT, \
"data inactivity time on bss channel")
/*
* <ini>
* gEnableMacAddrSpoof - Enable mac address randomization feature.
* @Min: 0
* @Max: 1
* @Default: 1
*
* This ini is used to enable/disable mac address randomization for scan.
*
* Supported Feature: SCAN
*
*
* Usage: Internal/External
*
* </ini>
*/
#define CFG_ENABLE_MAC_ADDR_SPOOFING CFG_INI_BOOL( \
"gEnableMacAddrSpoof", \
true, \
"Enable mac spoofing")
/*
* <ini>
* gScanAgingTime - Set scan aging time
* @Min: 0
* @Max: 200
* @Default: 30
*
* This ini is used to set scan aging timeout value
* in secs. For example after 30 secs the bss results
* greater than 30secs age will be flushed.
*
* Related: None
*
* Supported Feature: Scan
*
* Usage: External
*
* </ini>
*/
#ifdef QCA_WIFI_NAPIER_EMULATION
#define CFG_SCAN_AGING_TIME_DEFAULT (90)
#else
#define CFG_SCAN_AGING_TIME_DEFAULT (30)
#endif
#define CFG_SCAN_AGING_TIME CFG_INI_UINT( \
"gScanAgingTime", \
0, \
200, \
CFG_SCAN_AGING_TIME_DEFAULT, \
CFG_VALUE_OR_DEFAULT, \
"scan aging time")
#define CFG_SCAN_ALL \
CFG(CFG_DROP_BCN_ON_CHANNEL_MISMATCH) \
CFG(CFG_ENABLE_WAKE_LOCK_IN_SCAN) \
@@ -885,5 +939,7 @@
CFG(CFG_MAWC_NLO_EXP_BACKOFF_RATIO) \
CFG(CFG_MAWC_NLO_INIT_SCAN_INTERVAL) \
CFG(CFG_MAWC_NLO_MAX_SCAN_INTERVAL) \
CFG(CFG_ENABLE_MAC_ADDR_SPOOFING) \
CFG(CFG_SCAN_AGING_TIME) \
CFG_SCAN_PNO
#endif /* __CONFIG_SCAN_H */

View File

@@ -1281,18 +1281,14 @@ struct pno_scan_req_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
* @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
* @score_config: scoring logic configuration
*/
struct scan_user_cfg {
uint32_t scan_cache_aging_time;
bool is_snr_monitoring_enabled;
struct probe_req_whitelist_attr ie_whitelist;
bool enable_mac_spoofing;
uint32_t sta_miracast_mcc_rest_time;
struct scoring_config score_config;
};

View File

@@ -639,6 +639,14 @@ void ucfg_scan_set_bt_activity(struct wlan_objmgr_psoc *psoc,
*/
bool ucfg_scan_get_bt_activity(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_scan_is_mac_spoofing_enabled() - API to check if mac spoofing is enabled
* @psoc: pointer to psoc object
*
* Return: true if enabled else false.
*/
bool ucfg_scan_is_mac_spoofing_enabled(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_scan_cfg_set_active_dwelltime() - API to set scan active dwelltime
* @psoc: pointer to psoc object
@@ -876,6 +884,27 @@ uint32_t ucfg_scan_get_scan_timer_repeat_value(struct wlan_objmgr_psoc *psoc);
* Return: slow_scan_multiplier value
*/
uint32_t ucfg_scan_get_slow_scan_multiplier(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_scan_get_max_sched_scan_plan_interval() - API to get maximum scheduled
* scan plan interval
* @psoc: pointer to psoc object
*
* Return: max_sched_scan_plan_interval value.
*/
uint32_t
ucfg_scan_get_max_sched_scan_plan_interval(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_scan_get_max_sched_scan_plan_iterations() - API to get maximum scheduled
* scan plan iterations
* @psoc: pointer to psoc object
*
* Return: value.
*/
uint32_t
ucfg_scan_get_max_sched_scan_plan_iterations(struct wlan_objmgr_psoc *psoc);
#else
static inline
bool ucfg_scan_is_pno_offload_enabled(struct wlan_objmgr_psoc *psoc)
@@ -917,5 +946,18 @@ uint32_t ucfg_scan_get_slow_scan_multiplier(struct wlan_objmgr_psoc *psoc)
{
return 0;
}
static inline uint32_t
ucfg_scan_get_max_sched_scan_plan_interval(struct wlan_objmgr_psoc *psoc)
{
return 0;
}
static inline uint32_t
ucfg_scan_get_max_sched_scan_plan_iterations(struct wlan_objmgr_psoc *psoc)
{
return 0;
}
#endif /* FEATURE_WLAN_SCAN_PNO */
#endif

View File

@@ -255,6 +255,10 @@ wlan_pno_global_init(struct wlan_objmgr_psoc *psoc,
cfg_get(psoc, CFG_PNO_SLOW_SCAN_MULTIPLIER);
pno_def->scan_backoff_multiplier =
cfg_get(psoc, CFG_SCAN_BACKOFF_MULTIPLIER);
pno_def->max_sched_scan_plan_interval =
cfg_get(psoc, CFG_MAX_SCHED_SCAN_PLAN_INTERVAL);
pno_def->max_sched_scan_plan_iterations =
cfg_get(psoc, CFG_MAX_SCHED_SCAN_PLAN_ITERATIONS);
mawc_cfg->enable = cfg_get(psoc, CFG_MAWC_NLO_ENABLED);
mawc_cfg->exp_backoff_ratio =
@@ -1505,7 +1509,8 @@ wlan_scan_global_init(struct wlan_objmgr_psoc *psoc,
scan_obj->scan_def.burst_duration = SCAN_BURST_DURATION;
scan_obj->scan_def.max_scan_time = SCAN_MAX_SCAN_TIME;
scan_obj->scan_def.num_probes = cfg_get(psoc, CFG_SCAN_NUM_PROBES);
scan_obj->scan_def.scan_cache_aging_time = SCAN_CACHE_AGING_TIME;
scan_obj->scan_def.scan_cache_aging_time =
(cfg_get(psoc, CFG_SCAN_AGING_TIME) * 1000);
scan_obj->scan_def.max_bss_per_pdev = SCAN_MAX_BSS_PDEV;
scan_obj->scan_def.scan_priority = SCAN_PRIORITY;
scan_obj->scan_def.idle_time = SCAN_NETWORK_IDLE_TIMEOUT;
@@ -1513,8 +1518,9 @@ wlan_scan_global_init(struct wlan_objmgr_psoc *psoc,
cfg_get(psoc, CFG_ADAPTIVE_SCAN_DWELL_MODE);
scan_obj->scan_def.adaptive_dwell_time_mode_nc =
cfg_get(psoc, CFG_ADAPTIVE_SCAN_DWELL_MODE_NC);
scan_obj->scan_def.is_bssid_hint_priority =
cfg_get(psoc, CFG_IS_BSSID_HINT_PRIORITY);
scan_obj->scan_def.enable_mac_spoofing =
cfg_get(psoc, CFG_ENABLE_MAC_ADDR_SPOOFING);
/* scan contrl flags */
scan_obj->scan_def.scan_f_passive = true;
scan_obj->scan_def.scan_f_ofdm_rates = true;
@@ -1997,10 +2003,8 @@ QDF_STATUS ucfg_scan_update_user_config(struct wlan_objmgr_psoc *psoc,
}
scan_def = &scan_obj->scan_def;
scan_def->scan_cache_aging_time = scan_cfg->scan_cache_aging_time;
scan_def->scan_f_chan_stat_evnt = scan_cfg->is_snr_monitoring_enabled;
scan_obj->ie_whitelist = scan_cfg->ie_whitelist;
scan_def->enable_mac_spoofing = scan_cfg->enable_mac_spoofing;
scan_def->sta_miracast_mcc_rest_time =
scan_cfg->sta_miracast_mcc_rest_time;
@@ -2338,6 +2342,19 @@ bool ucfg_scan_wake_lock_in_user_scan(struct wlan_objmgr_psoc *psoc)
return scan_obj->scan_def.use_wake_lock_in_user_scan;
}
bool ucfg_scan_is_mac_spoofing_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("Failed to get scan object");
return cfg_default(CFG_ENABLE_MAC_ADDR_SPOOFING);
}
return scan_obj->scan_def.enable_mac_spoofing;
}
QDF_STATUS
ucfg_scan_set_global_config(struct wlan_objmgr_psoc *psoc,
enum scan_config config, uint32_t val)
@@ -2493,4 +2510,33 @@ uint32_t ucfg_scan_get_slow_scan_multiplier(struct wlan_objmgr_psoc *psoc)
}
return scan_obj->pno_cfg.slow_scan_multiplier;
}
uint32_t
ucfg_scan_get_max_sched_scan_plan_interval(struct wlan_objmgr_psoc *psoc)
{
struct wlan_scan_obj *scan_obj;
scan_obj = wlan_psoc_get_scan_obj(psoc);
if (!scan_obj) {
scm_err("Failed to get scan object");
return cfg_default(CFG_MAX_SCHED_SCAN_PLAN_INTERVAL);
}
return scan_obj->pno_cfg.max_sched_scan_plan_interval;
}
uint32_t
ucfg_scan_get_max_sched_scan_plan_iterations(struct wlan_objmgr_psoc *psoc)
{
struct wlan_scan_obj *scan_obj;
scan_obj = wlan_psoc_get_scan_obj(psoc);
if (!scan_obj) {
scm_err("Failed to get scan object");
return cfg_default(CFG_MAX_SCHED_SCAN_PLAN_ITERATIONS);
}
return scan_obj->pno_cfg.max_sched_scan_plan_iterations;
}
#endif