diff --git a/cfg/inc/cfg_converged.h b/cfg/inc/cfg_converged.h index cc61bcf4ba..56593dce70 100644 --- a/cfg/inc/cfg_converged.h +++ b/cfg/inc/cfg_converged.h @@ -25,10 +25,12 @@ #include #include "cfg_dp.h" +#include #define CFG_CONVERGED_ALL \ CFG_SCAN_ALL \ - CFG_DP + CFG_DP \ + CFG_EXTSCAN_ALL #endif /* __CFG_CONVERGED_H */ diff --git a/umac/scan/core/src/wlan_scan_main.h b/umac/scan/core/src/wlan_scan_main.h index 3feb984f1f..320bcc0566 100644 --- a/umac/scan/core/src/wlan_scan_main.h +++ b/umac/scan/core/src/wlan_scan_main.h @@ -269,6 +269,21 @@ struct pno_def_config { struct nlo_mawc_params mawc_params; }; +/** + * struct extscan_def_config - def configuration for EXTSCAN + * @extscan_enabled: enable extscan + * @extscan_passive_max_chn_time: max passive channel time + * @extscan_passive_min_chn_time: min passive channel time + * @extscan_active_max_chn_time: max active channel time + * @extscan_active_min_chn_time: min active channel time + */ +struct extscan_def_config { + bool extscan_enabled; + uint32_t extscan_passive_max_chn_time; + uint32_t extscan_passive_min_chn_time; + uint32_t extscan_active_max_chn_time; + uint32_t extscan_active_min_chn_time; +}; /** * struct scan_default_params - default scan parameters to be used @@ -456,6 +471,7 @@ struct scan_cb { * @global_evhandlers: registered scan event handlers * @pdev_info: pointer to pdev info * @pno_cfg: default pno configuration + * @extscan_cfg: default extscan configuration * @ie_whitelist: default ie whitelist attrs * @bt_a2dp_enabled: if bt a2dp is enabled * @miracast_enabled: miracast enabled @@ -476,6 +492,9 @@ struct wlan_scan_obj { struct global_scan_ev_handlers global_evhandlers; struct pdev_scan_info pdev_info[WLAN_UMAC_MAX_PDEVS]; struct pno_def_config pno_cfg; +#ifdef FEATURE_WLAN_EXTSCAN + struct extscan_def_config extscan_cfg; +#endif struct probe_req_whitelist_attr ie_whitelist; bool bt_a2dp_enabled; bool miracast_enabled; diff --git a/umac/scan/dispatcher/inc/wlan_extscan_api.h b/umac/scan/dispatcher/inc/wlan_extscan_api.h new file mode 100644 index 0000000000..5d69e1acff --- /dev/null +++ b/umac/scan/dispatcher/inc/wlan_extscan_api.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: This file contains APIs of EXTSCAN component + */ + +#ifndef _WLAN_EXTSCAN_API_H_ +#define _WLAN_EXTSCAN_API_H_ + +#include +#include +#include +#include "../../core/src/wlan_scan_main.h" + +#ifdef FEATURE_WLAN_EXTSCAN + +/** + * extscan_get_enable() - API to get extscan enable value + * @psoc: pointer to psoc object + * + * Return: true if enabled else false. + */ +bool extscan_get_enable(struct wlan_objmgr_psoc *psoc); + +/** + * extscan_get_passive_max_time() - API to get passive + * max channel time + * @psoc: pointer to psoc object + * @passive_max_chn_time: extscan passive max channel time + * + * Return: none + */ +void extscan_get_passive_max_time(struct wlan_objmgr_psoc *psoc, + uint32_t *passive_max_chn_time); + +/** + * extscan_get_active_max_time() - API to get active + * max channel time + * @psoc: pointer to psoc object + * @active_max_chn_time: extscan active max channel time + * + * Return: none + */ +void extscan_get_active_max_time(struct wlan_objmgr_psoc *psoc, + uint32_t *active_max_chn_time); + +/** + * extscan_get_active_min_time() - API to set active + * min channel time + * @psoc: pointer to psoc object + * @active_min_chn_time: extscan active min channel time + * + * Return: none + */ +void extscan_get_active_min_time(struct wlan_objmgr_psoc *psoc, + uint32_t *active_min_chn_time); + +/** + * wlan_extscan_global_init() - Initialize extscan + * @psoc: pointer to psoc object + * @scan_obj: pointer to scan object + * + * Return: QDF_STATUS + */ +QDF_STATUS +wlan_extscan_global_init(struct wlan_objmgr_psoc *psoc, + struct wlan_scan_obj *scan_obj); + +/** + * wlan_extscan_global_deinit() - Deinitialize extscan + * @psoc: pointer to psoc object + * @scan_obj: pointer to scan object + * + * Return: QDF_STATUS + */ +QDF_STATUS +wlan_extscan_global_deinit(void); + +#else + +static inline +bool cfg_extscan_get_enable(struct wlan_objmgr_psoc *psoc) +{ + return false; +} + +static inline +void cfg_extscan_get_passive_max_time(struct wlan_objmgr_psoc *psoc, + uint32_t *passive_max_chn_time) +{ +} + +static inline +void cfg_extscan_get_active_max_time(struct wlan_objmgr_psoc *psoc, + uint32_t *active_max_chn_time) +{ +} + +static inline +void cfg_extscan_get_active_min_time(struct wlan_objmgr_psoc *psoc, + uint32_t *active_min_chn_time) +{ +} + +static inline QDF_STATUS +wlan_extscan_global_init(struct wlan_objmgr_psoc *psoc, + struct wlan_scan_obj *scan_obj) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS wlan_extscan_global_deinit(void) +{ + return QDF_STATUS_SUCCESS; +} + +#endif +#endif diff --git a/umac/scan/dispatcher/inc/wlan_extscan_cfg.h b/umac/scan/dispatcher/inc/wlan_extscan_cfg.h new file mode 100644 index 0000000000..c10dd95954 --- /dev/null +++ b/umac/scan/dispatcher/inc/wlan_extscan_cfg.h @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: This file contains centralized definitions of EXTSCAN component + */ +#ifndef _WLAN_EXTSCAN_CONFIG_H_ +#define _WLAN_EXTSCAN_CONFIG_H_ + +#include "cfg_define.h" + +#ifdef FEATURE_WLAN_EXTSCAN + +/* + * + * gExtScanPassiveMaxChannelTime - Set max channel time for external + * passive scan + * @Min: 0 + * @Max: 500 + * @Default: 110 + * + * This ini is used to set maximum channel time in secs spent in + * external passive scan + * + * Related: None + * + * Supported Feature: Scan + * + * Usage: External + * + * + */ +#define CFG_EXTSCAN_PASSIVE_MAX_CHANNEL_TIME CFG_INI_UINT(\ + "gExtScanPassiveMaxChannelTime",\ + 0, 500, 110, CFG_VALUE_OR_DEFAULT,\ + "ext scan passive max channel time") + +/* + * + * gExtScanPassiveMinChannelTime - Set min channel time for external + * passive scan + * @Min: 0 + * @Max: 500 + * @Default: 60 + * + * This ini is used to set minimum channel time in secs spent in + * external passive scan + * + * Related: None + * + * Supported Feature: Scan + * + * Usage: External + * + * + */ +#define CFG_EXTSCAN_PASSIVE_MIN_CHANNEL_TIME CFG_INI_UINT(\ + "gExtScanPassiveMinChannelTime",\ + 0, 500, 60, CFG_VALUE_OR_DEFAULT,\ + "ext scan passive min channel time") + +/* + * + * gExtScanActiveMaxChannelTime - Set min channel time for external + * active scan + * @Min: 0 + * @Max: 110 + * @Default: 40 + * + * This ini is used to set maximum channel time in secs spent in + * external active scan + * + * Related: None + * + * Supported Feature: Scan + * + * Usage: External + * + * + */ + +#define CFG_EXTSCAN_ACTIVE_MAX_CHANNEL_TIME CFG_INI_UINT(\ + "gExtScanActiveMaxChannelTime",\ + 0, 110, 40, CFG_VALUE_OR_DEFAULT,\ + "ext scan active max channel time") + +/* + * + * gExtScanActiveMinChannelTime - Set min channel time for external + * active scan + * @Min: 0 + * @Max: 110 + * @Default: 20 + * + * This ini is used to set minimum channel time in secs spent in + * external active scan + * + * Related: None + * + * Supported Feature: Scan + * + * Usage: External + * + * + */ +#define CFG_EXTSCAN_ACTIVE_MIN_CHANNEL_TIME CFG_INI_UINT(\ + "gExtScanActiveMinChannelTime",\ + 0, 110, 20, CFG_VALUE_OR_DEFAULT,\ + "ext scan active min channel time") + +/* + * + * gExtScanEnable - Enable external scan + * @Min: 0 + * @Max: 1 + * @Default: 1 + * + * This ini is used to control enabling of external scan + * feature. + * + * Related: None + * + * Supported Feature: Scan + * + * Usage: External + * + * + */ +#define CFG_EXTSCAN_ALLOWED CFG_INI_BOOL(\ + "gExtScanEnable",\ + 1,\ + "ext scan enable") + +#define CFG_EXTSCAN_ALL \ + CFG(CFG_EXTSCAN_PASSIVE_MAX_CHANNEL_TIME) \ + CFG(CFG_EXTSCAN_PASSIVE_MIN_CHANNEL_TIME) \ + CFG(CFG_EXTSCAN_ACTIVE_MAX_CHANNEL_TIME) \ + CFG(CFG_EXTSCAN_ACTIVE_MIN_CHANNEL_TIME) \ + CFG(CFG_EXTSCAN_ALLOWED) + +#else +#define CFG_EXTSCAN_ALL +#endif +#endif diff --git a/umac/scan/dispatcher/inc/wlan_extscan_ucfg_api.h b/umac/scan/dispatcher/inc/wlan_extscan_ucfg_api.h new file mode 100644 index 0000000000..dae25f32d6 --- /dev/null +++ b/umac/scan/dispatcher/inc/wlan_extscan_ucfg_api.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: This file contains UCFG APIs of EXTSCAN component + */ + +#ifndef _WLAN_EXTSCAN_UCFG_API_H_ +#define _WLAN_EXTSCAN_UCFG_API_H_ + +#include "wlan_extscan_api.h" +#include +#include +#include + +#ifdef FEATURE_WLAN_EXTSCAN + +/** + * ucfg_extscan_get_enable() - API to get extscan enable value + * @psoc: pointer to psoc object + * + * Return: true if enabled else false. + */ +static inline +bool ucfg_extscan_get_enable(struct wlan_objmgr_psoc *psoc) +{ + return extscan_get_enable(psoc); +} + +/** + * ucfg_extscan_get_passive_max_time() - API to get passive + * max channel time + * @psoc: pointer to psoc object + * @passive_max_chn_time: extscan passive max channel time + * + * Return: none + */ +static inline +void ucfg_extscan_get_passive_max_time(struct wlan_objmgr_psoc *psoc, + uint32_t *passive_max_chn_time) +{ + extscan_get_passive_max_time(psoc, + passive_max_chn_time); +} + +/** + * ucfg_extscan_get_active_max_time() - API to get active + * max channel time + * @psoc: pointer to psoc object + * @active_max_chn_time: extscan active max channel time + * + * Return: none + */ +static inline +void ucfg_extscan_get_active_max_time(struct wlan_objmgr_psoc *psoc, + uint32_t *active_max_chn_time) +{ + extscan_get_active_max_time(psoc, + active_max_chn_time); +} + +/** + * ucfg_extscan_get_active_min_time() - API to set active + * min channel time + * @psoc: pointer to psoc object + * @active_min_chn_time: extscan active min channel time + * + * Return: none + */ +static inline +void ucfg_extscan_get_active_min_time(struct wlan_objmgr_psoc *psoc, + uint32_t *active_min_chn_time) +{ + extscan_get_active_min_time(psoc, + active_min_chn_time); +} + +#else + +static inline +bool ucfg_extscan_get_enable(struct wlan_objmgr_psoc *psoc) +{ + return false; +} + +#endif +#endif diff --git a/umac/scan/dispatcher/src/wlan_extscan_api.c b/umac/scan/dispatcher/src/wlan_extscan_api.c new file mode 100644 index 0000000000..9bfacca330 --- /dev/null +++ b/umac/scan/dispatcher/src/wlan_extscan_api.c @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * DOC: This file contains all EXTSSCAN component's APIs + */ + +#include "wlan_extscan_api.h" +#include "cfg_ucfg_api.h" + +bool extscan_get_enable(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 false; + } + + return scan_obj->extscan_cfg.extscan_enabled; +} + +void extscan_get_passive_max_time(struct wlan_objmgr_psoc *psoc, + uint32_t *passive_max_chn_time) +{ + 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; + } + + *passive_max_chn_time = + scan_obj->extscan_cfg.extscan_passive_max_chn_time; +} + +void extscan_get_active_max_time(struct wlan_objmgr_psoc *psoc, + uint32_t *active_max_chn_time) +{ + 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; + } + + *active_max_chn_time = + scan_obj->extscan_cfg.extscan_active_max_chn_time; +} + +void extscan_get_active_min_time(struct wlan_objmgr_psoc *psoc, + uint32_t *active_min_chn_time) +{ + 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; + } + + *active_min_chn_time = + scan_obj->extscan_cfg.extscan_active_min_chn_time; +} + +QDF_STATUS +wlan_extscan_global_init(struct wlan_objmgr_psoc *psoc, + struct wlan_scan_obj *scan_obj) +{ + struct extscan_def_config *extscan_def = &scan_obj->extscan_cfg; + + extscan_def->extscan_enabled = true; + extscan_def->extscan_passive_max_chn_time = + cfg_get(psoc, CFG_EXTSCAN_PASSIVE_MAX_CHANNEL_TIME); + extscan_def->extscan_passive_min_chn_time = + cfg_get(psoc, CFG_EXTSCAN_PASSIVE_MIN_CHANNEL_TIME); + extscan_def->extscan_active_max_chn_time = + cfg_get(psoc, CFG_EXTSCAN_ACTIVE_MAX_CHANNEL_TIME); + extscan_def->extscan_active_min_chn_time = + cfg_get(psoc, CFG_EXTSCAN_ACTIVE_MIN_CHANNEL_TIME); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +wlan_extscan_global_deinit() +{ + return QDF_STATUS_SUCCESS; +} diff --git a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c index 47ce7ec832..f155d1ed0b 100644 --- a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c @@ -41,6 +41,7 @@ #include #endif #include "cfg_ucfg_api.h" +#include "wlan_extscan_api.h" QDF_STATUS ucfg_scan_register_bcn_cb(struct wlan_objmgr_psoc *psoc, update_beacon_cb cb, enum scan_cb_type type) @@ -1476,9 +1477,22 @@ wlan_scan_global_init(struct wlan_objmgr_psoc *psoc, /* init scan id seed */ qdf_atomic_init(&scan_obj->scan_ids); + /* init extscan */ + wlan_extscan_global_init(psoc, scan_obj); + return wlan_pno_global_init(&scan_obj->pno_cfg); } +static void +wlan_scan_global_deinit(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_scan_obj *scan_obj; + + scan_obj = wlan_psoc_get_scan_obj(psoc); + wlan_pno_global_deinit(&scan_obj->pno_cfg); + wlan_extscan_global_deinit(); +} + static QDF_STATUS scm_remove_scan_event_handler(struct pdev_scan_ev_handler *pdev_ev_handler, struct cb_handler *entry) @@ -2119,7 +2133,7 @@ ucfg_scan_psoc_close(struct wlan_objmgr_psoc *psoc) } ucfg_scan_unregister_pmo_handler(); qdf_spinlock_destroy(&scan_obj->lock); - wlan_pno_global_deinit(&scan_obj->pno_cfg); + wlan_scan_global_deinit(psoc); return QDF_STATUS_SUCCESS; }