From 42bc1a9d685fb47f5b28e2884c909e6e32c262d6 Mon Sep 17 00:00:00 2001 From: Vignesh Mohan Date: Thu, 31 Oct 2019 19:36:33 +0530 Subject: [PATCH] qcacmn: Reset dfs_precac_active flag only for the calling pdev When tgt_dfs_set_precac_state API is called, the dfs_precac_active boolean is set to false for all pdevs. This results in preCAC being stopped for all pdevs in DBS_SBS mode when one of the pdev becomes inactive. Reset dfs_precac_active flag only for the calling pdev and set the global boolean 'precac_state_started' to false only if all the individual pdev flags are inactive. Change-Id: I73fcacb911a5eb9028b03aa1c86775a66f2a7fc9 CRs-Fixed: 2556734 --- umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c | 58 ++++++++++++++++++---- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c b/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c index e4f66c891b5c..83f301d78369 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c @@ -425,6 +425,8 @@ QDF_STATUS tgt_dfs_set_agile_precac_state(struct wlan_objmgr_pdev *pdev, int agile_precac_state) { struct wlan_dfs *dfs; + struct dfs_soc_priv_obj *dfs_soc; + bool is_precac_running_on_given_pdev = false; int i; if (!tgt_dfs_is_pdev_5ghz(pdev)) @@ -436,13 +438,30 @@ QDF_STATUS tgt_dfs_set_agile_precac_state(struct wlan_objmgr_pdev *pdev, return QDF_STATUS_E_FAILURE; } - dfs->dfs_soc_obj->precac_state_started = agile_precac_state; - if (!dfs->dfs_soc_obj->precac_state_started) { - for (i = 0; i < dfs->dfs_soc_obj->num_dfs_privs; i++) - dfs->dfs_soc_obj->dfs_priv[i].agile_precac_active = 0; - dfs->dfs_agile_precac_freq_mhz = 0; + dfs_soc = dfs->dfs_soc_obj; + for (i = 0; i < dfs_soc->num_dfs_privs; i++) { + if (dfs_soc->dfs_priv[i].dfs == dfs) { + /* Set the pdev state to given value. */ + dfs_soc->dfs_priv[i].agile_precac_active = + agile_precac_state; + /* If the pdev state is changed to inactive, + * reset the agile channel. + */ + if (!agile_precac_state) + dfs->dfs_agile_precac_freq_mhz = 0; + if (dfs_soc->cur_precac_dfs_index == i) + is_precac_running_on_given_pdev = true; + } } + /* If preCAC is running on this pdev and the agile_precac_state + * is set to false, set the global state in dfs_soc_obj to false. + * If this global state is not set to false, then preCAC will not be + * started the next time this pdev becomes active. + */ + if (is_precac_running_on_given_pdev && !agile_precac_state) + dfs_soc->precac_state_started = PRECAC_NOT_STARTED; + return QDF_STATUS_SUCCESS; } #else @@ -451,6 +470,8 @@ QDF_STATUS tgt_dfs_set_agile_precac_state(struct wlan_objmgr_pdev *pdev, int agile_precac_state) { struct wlan_dfs *dfs; + struct dfs_soc_priv_obj *dfs_soc; + bool is_precac_running_on_given_pdev = false; int i; if (!tgt_dfs_is_pdev_5ghz(pdev)) @@ -462,13 +483,30 @@ QDF_STATUS tgt_dfs_set_agile_precac_state(struct wlan_objmgr_pdev *pdev, return QDF_STATUS_E_FAILURE; } - dfs->dfs_soc_obj->precac_state_started = agile_precac_state; - if (!dfs->dfs_soc_obj->precac_state_started) { - for (i = 0; i < dfs->dfs_soc_obj->num_dfs_privs; i++) - dfs->dfs_soc_obj->dfs_priv[i].agile_precac_active = 0; - dfs->dfs_agile_precac_freq = 0; + dfs_soc = dfs->dfs_soc_obj; + for (i = 0; i < dfs_soc->num_dfs_privs; i++) { + if (dfs_soc->dfs_priv[i].dfs == dfs) { + /* Set the pdev state to given value. */ + dfs_soc->dfs_priv[i].agile_precac_active = + agile_precac_state; + /* If the pdev state is changed to inactive, + * reset the agile channel. + */ + if (!agile_precac_state) + dfs->dfs_agile_precac_freq = 0; + if (dfs_soc->cur_precac_dfs_index == i) + is_precac_running_on_given_pdev = true; + } } + /* If preCAC is running on this pdev and the agile_precac_state + * is set to false, set the global state in dfs_soc_obj to false. + * If this global state is not set to false, then preCAC will not be + * started the next time this pdev becomes active. + */ + if (is_precac_running_on_given_pdev && !agile_precac_state) + dfs_soc->precac_state_started = PRECAC_NOT_STARTED; + return QDF_STATUS_SUCCESS; } #endif