qcacmn: Add Spectral disabled checks in some APIs

Add Spectral feature disable checks in some APIs
used by other modules.

CRs-Fixed: 2845252
Change-Id: I74d66da2aa85ab0f116ad1a6d2e859f3ee8eeeb9
This commit is contained in:
Edayilliam Jayadev 2020-12-27 22:04:20 +05:30 committed by snandini
parent c89f5e524d
commit 9b98e19b51
4 changed files with 100 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2017-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2011, 2017-2020 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
@ -579,6 +579,11 @@ os_if_spectral_netlink_init(struct wlan_objmgr_pdev *pdev)
return;
}
if (wlan_spectral_is_feature_disabled_pdev(pdev)) {
osif_err("Spectral feature is disabled");
return;
}
sptrl_ctx = spectral_get_spectral_ctx_from_pdev(pdev);
if (!sptrl_ctx) {
@ -609,6 +614,11 @@ void os_if_spectral_netlink_deinit(struct wlan_objmgr_pdev *pdev)
return;
}
if (wlan_spectral_is_feature_disabled_pdev(pdev)) {
osif_err("Spectral feature is disabled");
return;
}
sptrl_ctx = spectral_get_spectral_ctx_from_pdev(pdev);
if (!sptrl_ctx) {

View File

@ -197,6 +197,16 @@ spectral_register_legacy_cb(struct wlan_objmgr_psoc *psoc,
{
struct spectral_context *sc;
if (!psoc) {
spectral_err("psoc is null");
return QDF_STATUS_E_INVAL;
}
if (wlan_spectral_is_feature_disabled_psoc(psoc)) {
spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED;
}
sc = spectral_get_spectral_ctx_from_psoc(psoc);
if (!sc) {
spectral_err("Invalid Context");
@ -326,6 +336,11 @@ wlan_register_spectral_wmi_ops(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_INVAL;
}
if (wlan_spectral_is_feature_disabled_psoc(psoc)) {
spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED;
}
sc = spectral_get_spectral_ctx_from_psoc(psoc);
if (!sc) {
spectral_err("spectral context is NULL!");
@ -348,6 +363,11 @@ wlan_register_spectral_tgt_ops(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_INVAL;
}
if (wlan_spectral_is_feature_disabled_psoc(psoc)) {
spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED;
}
sc = spectral_get_spectral_ctx_from_psoc(psoc);
if (!sc) {
spectral_err("spectral context is NULL!");
@ -462,19 +482,24 @@ QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev)
psoc = wlan_pdev_get_psoc(pdev);
if (wlan_spectral_is_feature_disabled_pdev(pdev)) {
spectral_err("Spectral feature is disabled");
spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED;
}
if (cfg_get(psoc, CFG_SPECTRAL_POISON_BUFS))
tgt_set_spectral_dma_debug(pdev, SPECTRAL_DMA_BUFFER_DEBUG, 1);
status = tgt_spectral_register_to_dbr(pdev);
status = spectral_register_dbr(pdev);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS spectral_register_dbr(struct wlan_objmgr_pdev *pdev)
{
if (wlan_spectral_is_feature_disabled_pdev(pdev)) {
spectral_info("spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED;
}
return tgt_spectral_register_to_dbr(pdev);
}
@ -484,6 +509,10 @@ QDF_STATUS spectral_unregister_dbr(struct wlan_objmgr_pdev *pdev)
{
QDF_STATUS status;
if (wlan_spectral_is_feature_disabled_pdev(pdev)) {
spectral_info("spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED;
}
status = tgt_spectral_unregister_to_dbr(pdev);
return status;

View File

@ -4813,6 +4813,16 @@ target_if_stop_spectral_scan(struct wlan_objmgr_pdev *pdev,
struct target_if_spectral_ops *p_sops;
struct target_if_spectral *spectral;
if (!pdev) {
spectral_err("pdev object is NULL");
return QDF_STATUS_E_INVAL;
}
if (target_if_spectral_is_feature_disabled_pdev(pdev)) {
spectral_info("Spectral feature is disabled");
return QDF_STATUS_COMP_DISABLED;
}
if (!err) {
spectral_err("Error code argument is null");
QDF_ASSERT(0);
@ -4826,10 +4836,6 @@ target_if_stop_spectral_scan(struct wlan_objmgr_pdev *pdev,
return QDF_STATUS_E_FAILURE;
}
if (!pdev) {
spectral_err("pdev object is NUll ");
return QDF_STATUS_E_FAILURE;
}
spectral = get_target_if_spectral_handle_from_pdev(pdev);
if (!spectral) {
spectral_err("Spectral LMAC object is NUll ");
@ -4872,6 +4878,16 @@ target_if_is_spectral_active(struct wlan_objmgr_pdev *pdev,
struct target_if_spectral *spectral = NULL;
struct target_if_spectral_ops *p_sops = NULL;
if (!pdev) {
spectral_err("pdev is null");
return false;
}
if (target_if_spectral_is_feature_disabled_pdev(pdev)) {
spectral_info("Spectral feature is disabled");
return false;
}
spectral = get_target_if_spectral_handle_from_pdev(pdev);
if (!spectral) {

View File

@ -1688,6 +1688,44 @@ bool target_if_spectral_is_feature_disabled_psoc(struct wlan_objmgr_psoc *psoc)
return true;
}
/**
* target_if_spectral_is_feature_disabled_pdev() - Check if Spectral feature is
* disabled for a given pdev
* @pdev: Pointer to pdev
*
* Return: true or false
*/
static inline
bool target_if_spectral_is_feature_disabled_pdev(struct wlan_objmgr_pdev *pdev)
{
struct wlan_lmac_if_rx_ops *rx_ops;
struct wlan_objmgr_psoc *psoc;
if (!pdev) {
spectral_err("pdev is NULL");
return true;
}
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc) {
spectral_err("psoc is NULL");
return true;
}
rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
if (!rx_ops) {
spectral_err("rx_ops is null");
return true;
}
if (rx_ops->sptrl_rx_ops.
sptrlro_spectral_is_feature_disabled_pdev)
return rx_ops->sptrl_rx_ops.
sptrlro_spectral_is_feature_disabled_pdev(pdev);
return true;
}
/**
* target_if_spectral_set_rxchainmask() - Set Spectral Rx chainmask
* @pdev: Pointer to pdev