From 7eb2d08e3b64726b2ffc194f5c7834f1596eb6dc Mon Sep 17 00:00:00 2001 From: Shashikala Prabhu Date: Thu, 20 Dec 2018 10:11:56 +0530 Subject: [PATCH] qcacmn: Add INI support to disable spectral feature Add INI support to disable spectral feature and do not process the spectral user commands if spectral feature is disabled. Change-Id: Id353131675454652d59fd5d5f8fd3d732a07b777 Acked-by: Shashikala Prabhu CRs-Fixed: 2343947 --- cfg/inc/cfg_converged.h | 4 +- .../dispatcher/src/dispatcher_init_deinit.c | 15 +++--- spectral/Kbuild | 2 + spectral/core/spectral_common.c | 26 ++++++++++ spectral/dispatcher/inc/cfg_spectral.h | 49 +++++++++++++++++++ .../dispatcher/inc/wlan_spectral_utils_api.h | 8 +++ .../dispatcher/src/wlan_spectral_tgt_api.c | 2 +- .../dispatcher/src/wlan_spectral_ucfg_api.c | 7 +++ .../dispatcher/src/wlan_spectral_utils_api.c | 20 +++++++- .../obj_mgr/inc/wlan_objmgr_psoc_obj.h | 2 + 10 files changed, 126 insertions(+), 9 deletions(-) create mode 100644 spectral/dispatcher/inc/cfg_spectral.h diff --git a/cfg/inc/cfg_converged.h b/cfg/inc/cfg_converged.h index 58b5bc272b..a3381776ac 100644 --- a/cfg/inc/cfg_converged.h +++ b/cfg/inc/cfg_converged.h @@ -27,12 +27,14 @@ #include "cfg_dp.h" #include #include "cfg_green_ap_params.h" +#include #define CFG_CONVERGED_ALL \ CFG_SCAN_ALL \ CFG_DP \ CFG_EXTSCAN_ALL \ - CFG_GREEN_AP_ALL + CFG_GREEN_AP_ALL \ + CFG_SPECTRAL_ALL #endif /* __CFG_CONVERGED_H */ diff --git a/init_deinit/dispatcher/src/dispatcher_init_deinit.c b/init_deinit/dispatcher/src/dispatcher_init_deinit.c index 69e4cb8060..2dfecda216 100644 --- a/init_deinit/dispatcher/src/dispatcher_init_deinit.c +++ b/init_deinit/dispatcher/src/dispatcher_init_deinit.c @@ -706,9 +706,6 @@ QDF_STATUS dispatcher_init(void) if (QDF_STATUS_SUCCESS != dispatcher_splitmac_init()) goto splitmac_init_fail; - if (QDF_STATUS_SUCCESS != dispatcher_spectral_init()) - goto spectral_init_fail; - if (QDF_STATUS_SUCCESS != dispatcher_fd_init()) goto fd_init_fail; @@ -721,6 +718,9 @@ QDF_STATUS dispatcher_init(void) if (QDF_IS_STATUS_ERROR(cfg_dispatcher_init())) goto cfg_init_fail; + if (QDF_STATUS_SUCCESS != dispatcher_spectral_init()) + goto spectral_init_fail; + if (QDF_STATUS_SUCCESS != wlan_vdev_mlme_init()) goto vdev_mlme_init_fail; @@ -737,6 +737,8 @@ QDF_STATUS dispatcher_init(void) scheduler_init_fail: wlan_vdev_mlme_deinit(); vdev_mlme_init_fail: + dispatcher_spectral_deinit(); +spectral_init_fail: cfg_dispatcher_deinit(); cfg_init_fail: dispatcher_ftm_deinit(); @@ -745,8 +747,6 @@ ftm_init_fail: green_ap_init_fail: dispatcher_fd_deinit(); fd_init_fail: - dispatcher_spectral_deinit(); -spectral_init_fail: dispatcher_splitmac_deinit(); splitmac_init_fail: dispatcher_deinit_son(); @@ -991,10 +991,13 @@ qdf_export_symbol(dispatcher_psoc_disable); QDF_STATUS dispatcher_pdev_open(struct wlan_objmgr_pdev *pdev) { + QDF_STATUS status; + if (QDF_STATUS_SUCCESS != dispatcher_regulatory_pdev_open(pdev)) goto out; - if (QDF_STATUS_SUCCESS != dispatcher_spectral_pdev_open(pdev)) + status = dispatcher_spectral_pdev_open(pdev); + if (status != QDF_STATUS_SUCCESS && status != QDF_STATUS_COMP_DISABLED) goto spectral_pdev_open_fail; if (QDF_STATUS_SUCCESS != wlan_mgmt_txrx_pdev_open(pdev)) diff --git a/spectral/Kbuild b/spectral/Kbuild index db104d86b3..728d8d49d1 100644 --- a/spectral/Kbuild +++ b/spectral/Kbuild @@ -30,6 +30,8 @@ INCS += -I$(obj)/$(DEPTH)/cmn_dev/spectral/core INCS += -I$(obj)/$(DEPTH)/component_dev/direct_attach/spectral/core INCS += -I$(obj)/$(DEPTH)/cmn_dev/target_if/direct_buf_rx/inc INCS += -I$(obj)/$(DEPTH)/cmn_dev/wbuff/inc +INCS += -I$(obj)/$(DEPTH)/cmn_dev/cfg/inc +INCS += -I$(obj)/$(DEPTH)/ini_cfg/inc/ ifeq ($(WLAN_CONV_CRYPTO_SUPPORTED), 1) INCS += -I$(obj)/$(DEPTH)/cmn_dev/umac/cmn_services/crypto/inc diff --git a/spectral/core/spectral_common.c b/spectral/core/spectral_common.c index 9efc462f57..b7a86b1d6a 100644 --- a/spectral/core/spectral_common.c +++ b/spectral/core/spectral_common.c @@ -26,6 +26,7 @@ #endif #include #include +#include /** * spectral_get_vdev() - Get pointer to vdev to be used for Spectral @@ -550,6 +551,13 @@ wlan_spectral_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg) spectral_err("PSOC is NULL"); return QDF_STATUS_E_FAILURE; } + + if (cfg_get(psoc, CFG_SPECTRAL_DISABLE)) { + wlan_psoc_nif_feat_cap_set(psoc, WLAN_SOC_F_SPECTRAL_DISABLE); + spectral_info("Spectral is disabled"); + return QDF_STATUS_COMP_DISABLED; + } + sc = (struct spectral_context *) qdf_mem_malloc(sizeof(struct spectral_context)); if (!sc) { @@ -578,6 +586,12 @@ wlan_spectral_psoc_obj_destroy_handler(struct wlan_objmgr_psoc *psoc, spectral_err("PSOC is NULL"); return QDF_STATUS_E_FAILURE; } + + if (wlan_spectral_is_feature_disabled(psoc)) { + spectral_info("Spectral is disabled"); + return QDF_STATUS_COMP_DISABLED; + } + sc = wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_SPECTRAL); if (sc) { @@ -603,6 +617,12 @@ wlan_spectral_pdev_obj_create_handler(struct wlan_objmgr_pdev *pdev, void *arg) spectral_err("PDEV is NULL"); return QDF_STATUS_E_FAILURE; } + + if (wlan_spectral_is_feature_disabled(wlan_pdev_get_psoc(pdev))) { + spectral_info("Spectral is disabled"); + return QDF_STATUS_COMP_DISABLED; + } + ps = (struct pdev_spectral *) qdf_mem_malloc(sizeof(struct pdev_spectral)); if (!ps) { @@ -647,6 +667,12 @@ wlan_spectral_pdev_obj_destroy_handler(struct wlan_objmgr_pdev *pdev, spectral_err("PDEV is NULL"); return QDF_STATUS_E_FAILURE; } + + if (wlan_spectral_is_feature_disabled(wlan_pdev_get_psoc(pdev))) { + spectral_info("Spectral is disabled"); + return QDF_STATUS_COMP_DISABLED; + } + sc = spectral_get_spectral_ctx_from_pdev(pdev); if (!sc) { spectral_err("Spectral context is NULL!"); diff --git a/spectral/dispatcher/inc/cfg_spectral.h b/spectral/dispatcher/inc/cfg_spectral.h new file mode 100644 index 0000000000..b997cd9641 --- /dev/null +++ b/spectral/dispatcher/inc/cfg_spectral.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 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 cfg definitions of Spectral component + */ +#ifndef __CONFIG_SPECTRAL_H +#define __CONFIG_SPECTRAL_H + +/* + * + * spectral_disable - disable spectral feature + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This ini is used to disable spectral feature. + * + * Related: None + * + * Supported Feature: Spectral + * + * Usage: External + * + * + */ +#define CFG_SPECTRAL_DISABLE \ + CFG_INI_BOOL("spectral_disable", false, \ + "Spectral disable") + +#define CFG_SPECTRAL_ALL \ + CFG(CFG_SPECTRAL_DISABLE) + +#endif diff --git a/spectral/dispatcher/inc/wlan_spectral_utils_api.h b/spectral/dispatcher/inc/wlan_spectral_utils_api.h index fcc72520a1..5878b9ae15 100644 --- a/spectral/dispatcher/inc/wlan_spectral_utils_api.h +++ b/spectral/dispatcher/inc/wlan_spectral_utils_api.h @@ -27,6 +27,14 @@ struct direct_buf_rx_data; struct wmi_spectral_cmd_ops; +/** + * wlan_spectral_is_feature_disabled() - Check if spectral feature is disabled + * @psoc - the physical device object. + * + * Return : true if spectral is disabled, else false. + */ +bool wlan_spectral_is_feature_disabled(struct wlan_objmgr_psoc *psoc); + /** * wlan_spectral_init() - API to init spectral component * diff --git a/spectral/dispatcher/src/wlan_spectral_tgt_api.c b/spectral/dispatcher/src/wlan_spectral_tgt_api.c index b2344af7f5..bd3252873c 100644 --- a/spectral/dispatcher/src/wlan_spectral_tgt_api.c +++ b/spectral/dispatcher/src/wlan_spectral_tgt_api.c @@ -294,7 +294,7 @@ tgt_spectral_register_to_dbr(struct wlan_objmgr_pdev *pdev) (pdev, 0, spectral_dbr_event_handler); - return QDF_STATUS_E_FAILURE; + return QDF_STATUS_SUCCESS; } #else QDF_STATUS diff --git a/spectral/dispatcher/src/wlan_spectral_ucfg_api.c b/spectral/dispatcher/src/wlan_spectral_ucfg_api.c index 0dce01fdf0..017e433140 100644 --- a/spectral/dispatcher/src/wlan_spectral_ucfg_api.c +++ b/spectral/dispatcher/src/wlan_spectral_ucfg_api.c @@ -21,6 +21,7 @@ #include "../../core/spectral_cmn_api_i.h" #include #include +#include int ucfg_spectral_control(struct wlan_objmgr_pdev *pdev, @@ -34,6 +35,12 @@ ucfg_spectral_control(struct wlan_objmgr_pdev *pdev, spectral_err("PDEV is NULL!"); return -EPERM; } + + if (wlan_spectral_is_feature_disabled(wlan_pdev_get_psoc(pdev))) { + spectral_info("Spectral is disabled"); + return -EPERM; + } + sc = spectral_get_spectral_ctx_from_pdev(pdev); if (!sc) { spectral_err("spectral context is NULL!"); diff --git a/spectral/dispatcher/src/wlan_spectral_utils_api.c b/spectral/dispatcher/src/wlan_spectral_utils_api.c index 406b427bf1..46fd1b57e3 100644 --- a/spectral/dispatcher/src/wlan_spectral_utils_api.c +++ b/spectral/dispatcher/src/wlan_spectral_utils_api.c @@ -21,6 +21,20 @@ #include #include "../../core/spectral_cmn_api_i.h" #include +#include + +bool wlan_spectral_is_feature_disabled(struct wlan_objmgr_psoc *psoc) +{ + if (!psoc) { + spectral_err("PSOC is NULL!"); + return true; + } + + if (wlan_psoc_nif_feat_cap_get(psoc, WLAN_SOC_F_SPECTRAL_DISABLE)) + return true; + + return false; +} QDF_STATUS wlan_spectral_init(void) @@ -215,7 +229,11 @@ QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev) { QDF_STATUS status; - status = tgt_spectral_register_to_dbr(pdev); + if (wlan_spectral_is_feature_disabled(wlan_pdev_get_psoc(pdev))) { + spectral_info("Spectral is disabled"); + return QDF_STATUS_COMP_DISABLED; + } + status = tgt_spectral_register_to_dbr(pdev); return QDF_STATUS_SUCCESS; } diff --git a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h index c4ee836b8b..cb99ceb726 100644 --- a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h +++ b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h @@ -181,6 +181,8 @@ #define WLAN_SOC_F_HOST_80211_ENABLE 0x00400000 /* MBSS IE enable */ #define WLAN_SOC_F_MBSS_IE_ENABLE 0x00800000 + /* Spectral disable */ +#define WLAN_SOC_F_SPECTRAL_DISABLE 0x01000000 /* PSOC op flags */