Browse Source

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 <[email protected]>
CRs-Fixed: 2343947
Shashikala Prabhu 6 years ago
parent
commit
7eb2d08e3b

+ 3 - 1
cfg/inc/cfg_converged.h

@@ -27,12 +27,14 @@
 #include "cfg_dp.h"
 #include <wlan_extscan_cfg.h>
 #include "cfg_green_ap_params.h"
+#include <cfg_spectral.h>
 
 #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 */
 

+ 9 - 6
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))

+ 2 - 0
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

+ 26 - 0
spectral/core/spectral_common.c

@@ -26,6 +26,7 @@
 #endif
 #include <wlan_spectral_public_structs.h>
 #include <wlan_cfg80211_spectral.h>
+#include <cfg_ucfg_api.h>
 
 /**
  * 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!");

+ 49 - 0
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
+
+/*
+ * <ini>
+ * 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
+ *
+ * </ini>
+ */
+#define CFG_SPECTRAL_DISABLE \
+	CFG_INI_BOOL("spectral_disable", false, \
+			"Spectral disable")
+
+#define CFG_SPECTRAL_ALL \
+	CFG(CFG_SPECTRAL_DISABLE)
+
+#endif

+ 8 - 0
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
  *

+ 1 - 1
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

+ 7 - 0
spectral/dispatcher/src/wlan_spectral_ucfg_api.c

@@ -21,6 +21,7 @@
 #include "../../core/spectral_cmn_api_i.h"
 #include <wlan_spectral_utils_api.h>
 #include <qdf_module.h>
+#include <cfg_ucfg_api.h>
 
 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!");

+ 19 - 1
spectral/dispatcher/src/wlan_spectral_utils_api.c

@@ -21,6 +21,20 @@
 #include <qdf_module.h>
 #include "../../core/spectral_cmn_api_i.h"
 #include <wlan_spectral_tgt_api.h>
+#include <cfg_ucfg_api.h>
+
+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;
 }

+ 2 - 0
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 */