From d109f767f61355b69d4e10502ed01aaedfe931d1 Mon Sep 17 00:00:00 2001 From: hqu Date: Wed, 18 Dec 2019 14:26:17 +0800 Subject: [PATCH] qcacld-3.0: Remove enable_snr_monitoring from hdd_config struct Currently, enable_snr_monitoring doesn't be initialized properly, in some acs scenario, hostapd will dump survey(NL80211_CMD_GET_SURVEY), driver return error due to uninitialized enable_snr_monitoring, this will result in acs won't be started and sap fail to start. Fix is to remove enable_snr_monitoring from hdd_config struct, calling ucfg_scan_is_snr_monitor_enabled() everywhere that enable_snr_monitoring is being used. Change-Id: I8784867683b21d9441e980a1215b2db712db381a CRs-Fixed: 2585661 --- core/hdd/inc/wlan_hdd_cfg.h | 1 - core/hdd/src/wlan_hdd_cfg80211.c | 2 +- core/hdd/src/wlan_hdd_stats.c | 2 +- core/hdd/src/wlan_hdd_wext.c | 9 ++++++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index cb9c7cfcaa28..1ae6718f8b10 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -110,7 +110,6 @@ struct hdd_config { #ifdef ENABLE_MTRACE_LOG bool enable_mtrace; #endif - bool enable_snr_monitoring; bool advertise_concurrent_operation; #ifdef DHCP_SERVER_OFFLOAD struct dhcp_server dhcp_server_ip; diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index ee960f7fc2f3..626ed54ffab4 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -23697,7 +23697,7 @@ void wlan_hdd_init_chan_info(struct hdd_context *hdd_ctx) mac_handle_t mac_handle; hdd_ctx->chan_info = NULL; - if (!hdd_ctx->config->enable_snr_monitoring) { + if (!ucfg_scan_is_snr_monitor_enabled(hdd_ctx->psoc)) { hdd_debug("SNR monitoring is disabled"); return; } diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 05f103bbd206..8ca1aa6cb1da 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -5021,7 +5021,7 @@ static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); - if (!hdd_ctx->config->enable_snr_monitoring) + if (!ucfg_scan_is_snr_monitor_enabled(hdd_ctx->psoc)) return -ENONET; if (sta_ctx->hdd_reassoc_scenario) { diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 5d5f98baf052..44018b93ec4e 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -7313,6 +7313,7 @@ static int __iw_get_char_setnone(struct net_device *dev, { int8_t s7snr = 0; int status = 0; + bool enable_snr_monitoring; struct hdd_context *hdd_ctx; struct hdd_station_ctx *sta_ctx; @@ -7322,12 +7323,14 @@ static int __iw_get_char_setnone(struct net_device *dev, return status; sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); - if (!hdd_ctx->config->enable_snr_monitoring || + enable_snr_monitoring = + ucfg_scan_is_snr_monitor_enabled(hdd_ctx->psoc); + if (!enable_snr_monitoring || eConnectionState_Associated != sta_ctx->conn_info.conn_state) { hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d", - hdd_ctx->config->enable_snr_monitoring, - sta_ctx->conn_info.conn_state); + enable_snr_monitoring, + sta_ctx->conn_info.conn_state); return -ENONET; } wlan_hdd_get_snr(adapter, &s7snr);