From bedc2973c8315c2b36467c2b778010036f19d17e Mon Sep 17 00:00:00 2001 From: hqu Date: Thu, 23 Jul 2020 21:40:15 +0800 Subject: [PATCH] qcacld-3.0: Reset im stats and freq ctrl params when stop ap When dcs happened for three times in five minutes, then do restart(start/stop) SAP operation, when SAP is started again, dcs may happen again quickly, if total four times dcs happened in five minutes, dcs_disable_timer will be started due to dcs happened frequency control policy, it will disable wlan interference detection for 30 minutes and dcs interference detection won't work for 30 minutes, it's unreasonable. After SAP restart, dcs happened times should be calculated from zero. Fix is to reset im stats and freq ctrl params when stop ap. Change-Id: I0322a268a031b677a4e263cd6c5c6c0627315719 CRs-Fixed: 2738099 --- core/hdd/src/wlan_hdd_dcs.c | 35 +++++++++++++++++++++++++++++++++ core/hdd/src/wlan_hdd_dcs.h | 15 ++++++++++++++ core/hdd/src/wlan_hdd_hostapd.c | 5 +---- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/core/hdd/src/wlan_hdd_dcs.c b/core/hdd/src/wlan_hdd_dcs.c index 9738e699543f..28257be1bd18 100644 --- a/core/hdd/src/wlan_hdd_dcs.c +++ b/core/hdd/src/wlan_hdd_dcs.c @@ -205,3 +205,38 @@ void hdd_dcs_chan_select_complete(struct hdd_adapter *adapter) hdd_ctx, adapter->vdev_id); } + +void hdd_dcs_clear(struct hdd_adapter *adapter) +{ + QDF_STATUS status; + uint8_t mac_id; + struct hdd_context *hdd_ctx; + struct wlan_objmgr_psoc *psoc; + uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS]; + + hdd_ctx = WLAN_HDD_GET_CTX(adapter); + if (!hdd_ctx) { + hdd_err("Invalid HDD context pointer"); + return; + } + + psoc = hdd_ctx->psoc; + + if (wlansap_dcs_is_wlan_interference_mitigation_enabled( + WLAN_HDD_GET_SAP_CTX_PTR(adapter))) { + status = policy_mgr_get_mac_id_by_session_id(psoc, + adapter->vdev_id, + &mac_id); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("get mac id failed"); + return; + } + if (policy_mgr_get_sap_go_count_on_mac(psoc, list, mac_id) <= 1) + ucfg_dcs_clear(psoc, mac_id); + } + + wlansap_dcs_set_vdev_wlan_interference_mitigation( + WLAN_HDD_GET_SAP_CTX_PTR(adapter), false); + wlansap_dcs_set_vdev_starting( + WLAN_HDD_GET_SAP_CTX_PTR(adapter), false); +} diff --git a/core/hdd/src/wlan_hdd_dcs.h b/core/hdd/src/wlan_hdd_dcs.h index 59741dd256cf..404e05976f61 100644 --- a/core/hdd/src/wlan_hdd_dcs.h +++ b/core/hdd/src/wlan_hdd_dcs.h @@ -62,6 +62,17 @@ void hdd_dcs_hostapd_set_chan(struct hdd_context *hdd_ctx, * Return: None */ void hdd_dcs_chan_select_complete(struct hdd_adapter *adapter); + +/** + * hdd_dcs_clear() - clear dcs information + * @adapter: hdd adapter pointer + * + * This function is used to clear sap dcs related information such as + * im stats and freq ctrl params + * + * Return: None + */ +void hdd_dcs_clear(struct hdd_adapter *adapter); #else static inline void hdd_dcs_register_cb(struct hdd_context *hdd_ctx) { @@ -76,6 +87,10 @@ static inline void hdd_dcs_hostapd_set_chan(struct hdd_context *hdd_ctx, static inline void hdd_dcs_chan_select_complete(struct hdd_adapter *adapter) { } + +static inline void hdd_dcs_clear(struct hdd_adapter *adapter) +{ +} #endif #endif /* end #if !defined(WLAN_HDD_DCS_H) */ diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index d84668320ed5..5fe8ab607bd4 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -5849,7 +5849,6 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, tSirUpdateIE update_ie; int ret; mac_handle_t mac_handle; - struct sap_context *sap_ctx; hdd_enter(); @@ -5915,9 +5914,7 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, cds_flush_work(&adapter->sap_stop_bss_work); adapter->session.ap.sap_config.acs_cfg.acs_mode = false; - sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter); - wlansap_dcs_set_vdev_wlan_interference_mitigation(sap_ctx, false); - wlansap_dcs_set_vdev_starting(sap_ctx, false); + hdd_dcs_clear(adapter); qdf_atomic_set(&adapter->session.ap.acs_in_progress, 0); hdd_debug("Disabling queues"); wlan_hdd_netif_queue_control(adapter,