qcacmn: Skip init/deinit/config if Spectral is disabled

If Spectral scan is disabled(agile and normal mode disabled)
skip init/deinit of Spectral module. Also avoid user requests
to configure/start/stop scan. If either agile or normal mode
is disabled block user requests for that mode alone.

CRs-Fixed: 2840335
Change-Id: I81148e5580fe4bf991b97cd086c8e3a9ca78e77d
This commit is contained in:
Edayilliam Jayadev
2020-12-17 12:26:28 +05:30
committed by snandini
parent b3affda43a
commit 80a12b81ed
5 changed files with 86 additions and 44 deletions

View File

@@ -496,16 +496,21 @@ QDF_STATUS
wlan_spectral_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg) wlan_spectral_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg)
{ {
struct spectral_context *sc = NULL; struct spectral_context *sc = NULL;
QDF_STATUS status;
if (!psoc) { if (!psoc) {
spectral_err("PSOC is NULL"); spectral_err("PSOC is NULL");
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
if (cfg_get(psoc, CFG_SPECTRAL_DISABLE)) { status = wlan_spectral_init_psoc_feature_cap(psoc);
wlan_psoc_nif_feat_cap_set(psoc, if (QDF_IS_STATUS_ERROR(status)) {
WLAN_SOC_F_SPECTRAL_INI_DISABLE); spectral_err("Failed to intitialize spectral pdev feature caps");
spectral_info("Spectral is disabled"); return QDF_STATUS_E_FAILURE;
}
if (wlan_spectral_is_feature_disabled_psoc(psoc)) {
spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED; return QDF_STATUS_COMP_DISABLED;
} }
@@ -535,8 +540,8 @@ wlan_spectral_psoc_obj_destroy_handler(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
if (wlan_spectral_is_feature_disabled(psoc)) { if (wlan_spectral_is_feature_disabled_psoc(psoc)) {
spectral_info("Spectral is disabled"); spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED; return QDF_STATUS_COMP_DISABLED;
} }
@@ -560,14 +565,21 @@ wlan_spectral_pdev_obj_create_handler(struct wlan_objmgr_pdev *pdev, void *arg)
struct pdev_spectral *ps = NULL; struct pdev_spectral *ps = NULL;
struct spectral_context *sc = NULL; struct spectral_context *sc = NULL;
void *target_handle = NULL; void *target_handle = NULL;
QDF_STATUS status;
if (!pdev) { if (!pdev) {
spectral_err("PDEV is NULL"); spectral_err("PDEV is NULL");
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
if (wlan_spectral_is_feature_disabled(wlan_pdev_get_psoc(pdev))) { status = wlan_spectral_init_pdev_feature_caps(pdev);
spectral_info("Spectral is disabled"); if (QDF_IS_STATUS_ERROR(status)) {
spectral_err("Failed to intitialize spectral pdev feature caps");
return QDF_STATUS_E_FAILURE;
}
if (wlan_spectral_is_feature_disabled_pdev(pdev)) {
spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED; return QDF_STATUS_COMP_DISABLED;
} }
@@ -615,8 +627,8 @@ wlan_spectral_pdev_obj_destroy_handler(struct wlan_objmgr_pdev *pdev,
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
if (wlan_spectral_is_feature_disabled(wlan_pdev_get_psoc(pdev))) { if (wlan_spectral_is_feature_disabled_pdev(pdev)) {
spectral_info("Spectral is disabled"); spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED; return QDF_STATUS_COMP_DISABLED;
} }

View File

@@ -23,6 +23,37 @@
#include <qdf_module.h> #include <qdf_module.h>
#include <cfg_ucfg_api.h> #include <cfg_ucfg_api.h>
static bool
ucfg_spectral_is_mode_specific_request(uint8_t spectral_cp_request_id)
{
bool mode_specific_request;
switch (spectral_cp_request_id) {
case SPECTRAL_SET_CONFIG:
case SPECTRAL_GET_CONFIG:
case SPECTRAL_IS_ACTIVE:
case SPECTRAL_IS_ENABLED:
case SPECTRAL_ACTIVATE_SCAN:
case SPECTRAL_STOP_SCAN:
mode_specific_request = true;
break;
case SPECTRAL_SET_DEBUG_LEVEL:
case SPECTRAL_GET_DEBUG_LEVEL:
case SPECTRAL_GET_CAPABILITY_INFO:
case SPECTRAL_GET_DIAG_STATS:
case SPECTRAL_GET_CHAN_WIDTH:
case SPECTRAL_SET_DMA_DEBUG:
mode_specific_request = false;
break;
default:
spectral_err("Invalid spectral cp request id %u",
spectral_cp_request_id);
mode_specific_request = false;
}
return mode_specific_request;
}
QDF_STATUS QDF_STATUS
ucfg_spectral_control(struct wlan_objmgr_pdev *pdev, ucfg_spectral_control(struct wlan_objmgr_pdev *pdev,
struct spectral_cp_request *sscan_req) struct spectral_cp_request *sscan_req)
@@ -34,11 +65,21 @@ ucfg_spectral_control(struct wlan_objmgr_pdev *pdev,
return -EPERM; return -EPERM;
} }
if (wlan_spectral_is_feature_disabled(wlan_pdev_get_psoc(pdev))) { if (wlan_spectral_is_feature_disabled_pdev(pdev)) {
spectral_info("Spectral is disabled"); spectral_info("Spectral feature is disabled");
return -EPERM; return -EPERM;
} }
/* For mode specific requests, check whether
* Spectral mode in the cp request is disabaled
*/
if (ucfg_spectral_is_mode_specific_request(sscan_req->req_id) &&
wlan_spectral_is_mode_disabled_pdev(pdev, sscan_req->ss_mode)) {
spectral_info("Spectral mode %d is disabled",
sscan_req->ss_mode);
return -ENOTSUPP;
}
sc = spectral_get_spectral_ctx_from_pdev(pdev); sc = spectral_get_spectral_ctx_from_pdev(pdev);
if (!sc) { if (!sc) {
spectral_err("spectral context is NULL!"); spectral_err("spectral context is NULL!");

View File

@@ -461,8 +461,8 @@ QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev)
psoc = wlan_pdev_get_psoc(pdev); psoc = wlan_pdev_get_psoc(pdev);
if (wlan_spectral_is_feature_disabled(psoc)) { if (wlan_spectral_is_feature_disabled_pdev(pdev)) {
spectral_info("Spectral is disabled"); spectral_err("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED; return QDF_STATUS_COMP_DISABLED;
} }
@@ -498,8 +498,8 @@ QDF_STATUS wlan_spectral_psoc_open(struct wlan_objmgr_psoc *psoc)
return QDF_STATUS_E_INVAL; return QDF_STATUS_E_INVAL;
} }
if (wlan_spectral_is_feature_disabled(psoc)) { if (wlan_spectral_is_feature_disabled_psoc(psoc)) {
spectral_info("Spectral is disabled"); spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED; return QDF_STATUS_COMP_DISABLED;
} }
@@ -513,8 +513,8 @@ QDF_STATUS wlan_spectral_psoc_close(struct wlan_objmgr_psoc *psoc)
return QDF_STATUS_E_INVAL; return QDF_STATUS_E_INVAL;
} }
if (wlan_spectral_is_feature_disabled(psoc)) { if (wlan_spectral_is_feature_disabled_psoc(psoc)) {
spectral_info("Spectral is disabled"); spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED; return QDF_STATUS_COMP_DISABLED;
} }
@@ -528,8 +528,8 @@ QDF_STATUS wlan_spectral_psoc_enable(struct wlan_objmgr_psoc *psoc)
return QDF_STATUS_E_INVAL; return QDF_STATUS_E_INVAL;
} }
if (wlan_spectral_is_feature_disabled(psoc)) { if (wlan_spectral_is_feature_disabled_psoc(psoc)) {
spectral_info("Spectral is disabled"); spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED; return QDF_STATUS_COMP_DISABLED;
} }
@@ -543,8 +543,8 @@ QDF_STATUS wlan_spectral_psoc_disable(struct wlan_objmgr_psoc *psoc)
return QDF_STATUS_E_INVAL; return QDF_STATUS_E_INVAL;
} }
if (wlan_spectral_is_feature_disabled(psoc)) { if (wlan_spectral_is_feature_disabled_psoc(psoc)) {
spectral_info("Spectral is disabled"); spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED; return QDF_STATUS_COMP_DISABLED;
} }

View File

@@ -1849,28 +1849,17 @@ target_if_init_spectral_capability(struct target_if_spectral *spectral,
pcap = &spectral->capability; pcap = &spectral->capability;
pcap->phydiag_cap = 1; pcap->phydiag_cap = 1;
pcap->radar_cap = 1; pcap->radar_cap = 1;
pcap->spectral_cap = 1; pcap->spectral_cap = wlan_pdev_nif_feat_ext_cap_get(
pcap->advncd_spectral_cap = 1; pdev, WLAN_PDEV_FEXT_NORMAL_SPECTRAL_SCAN_DIS);
pcap->advncd_spectral_cap = pcap->spectral_cap;
pcap->hw_gen = spectral->spectral_gen; pcap->hw_gen = spectral->spectral_gen;
if (spectral->spectral_gen >= SPECTRAL_GEN3) {
QDF_STATUS status;
struct target_if_spectral_agile_mode_cap agile_cap = { 0 };
status = target_if_spectral_get_agile_mode_cap(pdev, pcap->agile_spectral_cap = !wlan_pdev_nif_feat_ext_cap_get(
&agile_cap); pdev, WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_DIS);
if (QDF_IS_STATUS_ERROR(status)) { pcap->agile_spectral_cap_160 = !wlan_pdev_nif_feat_ext_cap_get(
spectral_err("Failed to get agile mode capability"); pdev, WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_160_DIS);
return QDF_STATUS_E_FAILURE; pcap->agile_spectral_cap_80p80 = !wlan_pdev_nif_feat_ext_cap_get(
} pdev, WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_80P80_DIS);
pcap->agile_spectral_cap = agile_cap.agile_spectral_cap;
pcap->agile_spectral_cap_160 = agile_cap.agile_spectral_cap_160;
pcap->agile_spectral_cap_80p80 =
agile_cap.agile_spectral_cap_80p80;
} else {
pcap->agile_spectral_cap = false;
pcap->agile_spectral_cap_160 = false;
pcap->agile_spectral_cap_80p80 = false;
}
if (scaling_params) { if (scaling_params) {
for (param_idx = 0; param_idx < num_bin_scaling_params; for (param_idx = 0; param_idx < num_bin_scaling_params;

View File

@@ -1722,8 +1722,8 @@ void target_if_spectral_set_rxchainmask(struct wlan_objmgr_pdev *pdev,
} }
if (rx_ops->sptrl_rx_ops. if (rx_ops->sptrl_rx_ops.
sptrlro_spectral_is_feature_disabled(psoc)) { sptrlro_spectral_is_feature_disabled_pdev(pdev)) {
spectral_info("Spectral is disabled"); spectral_info("Spectral feature is disabled");
return; return;
} }