From 9fee518fe315abf3abcaae98ec2f6ca48563c534 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Fri, 1 Nov 2019 11:39:38 +0530 Subject: [PATCH] qcacld-3.0: Avoid calling wlan_hdd_set_mon_chan for STA mode As part of Ie9ffc701d93ed1c050375dd56151b7a0da69cdce the STA mode channel change was added in disconnected state for spectral scan test at CV2X platform. Now with iwpriv wlan0 setMonChan on STA mode, a monitor mode pe_session is created in PE/LIM which take ref count with WLAN_LEGACY_MAC_ID. As the interface is STA type this session is not deleted when vdev is deleted. This lead to vdev ref leak. This code is broken and is no longer in use and cause vdev ref leak when executed. Thus revert Ie9ffc701d93ed1c050375dd56151b7a0da69cdce. Also move the lim session create to hdd_set_mon_rx_cb during vdev create, as it is deleted during vdev delete. Change-Id: Ib60aa2bd2746a8cd17f20efa7506c18784a42630 CRs-Fixed: 2557160 --- components/mlme/core/src/wlan_mlme_main.c | 2 -- .../mlme/dispatcher/inc/cfg_mlme_generic.h | 31 ------------------- .../mlme/dispatcher/inc/wlan_mlme_api.h | 10 ------ .../dispatcher/inc/wlan_mlme_public_struct.h | 1 - .../mlme/dispatcher/inc/wlan_mlme_ucfg_api.h | 13 -------- .../mlme/dispatcher/src/wlan_mlme_api.c | 12 ------- core/hdd/src/wlan_hdd_cfg80211.c | 15 +-------- core/hdd/src/wlan_hdd_main.c | 27 ++-------------- core/hdd/src/wlan_hdd_tx_rx.c | 9 ++++++ core/sme/inc/csr_internal.h | 1 - core/sme/inc/sme_api.h | 10 ------ core/sme/src/common/sme_api.c | 10 ------ core/sme/src/csr/csr_api_roam.c | 20 ------------ 13 files changed, 13 insertions(+), 148 deletions(-) diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index c86244bbadb8..735a473b8832 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -352,8 +352,6 @@ static void mlme_init_generic_cfg(struct wlan_objmgr_psoc *psoc, cfg_get(psoc, CFG_ENABLE_BEACON_RECEPTION_STATS); gen->enable_remove_time_stamp_sync_cmd = cfg_get(psoc, CFG_REMOVE_TIME_STAMP_SYNC_CMD); - gen->enable_change_channel_bandwidth = - cfg_get(psoc, CFG_CHANGE_CHANNEL_BANDWIDTH); gen->disable_4way_hs_offload = cfg_get(psoc, CFG_DISABLE_4WAY_HS_OFFLOAD); } diff --git a/components/mlme/dispatcher/inc/cfg_mlme_generic.h b/components/mlme/dispatcher/inc/cfg_mlme_generic.h index 2adc345ff263..9fdcbbe3c912 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme_generic.h +++ b/components/mlme/dispatcher/inc/cfg_mlme_generic.h @@ -595,36 +595,6 @@ 1, \ "Enable to remove time stamp sync cmd") -/* - * - * gEnableChangeChannelBandWidth Enable/Disable change - * channel&bandwidth in the mission mode - * @Min: 0 - * @Max: 1 - * @Default: 0 - * - * 0 not allow change channel&bandwidth by setMonChan - * 1 allow change channel&bandwidth by setMonChan - * - * Related: None - * - * Supported Feature: STA - * - * Usage: External - * - * - */ -#ifdef FEATURE_MONITOR_MODE_SUPPORT -#define CFG_CHANGE_CHANNEL_BANDWIDTH_DEFAULT true -#else -#define CFG_CHANGE_CHANNEL_BANDWIDTH_DEFAULT false -#endif - -#define CFG_CHANGE_CHANNEL_BANDWIDTH CFG_INI_BOOL( \ - "gEnableChangeChannelBandWidth", \ - CFG_CHANGE_CHANNEL_BANDWIDTH_DEFAULT, \ - "enable change channel bw") - /* * * disable_4way_hs_offload - Enable/Disable 4 way handshake offload to firmware @@ -674,6 +644,5 @@ CFG(CFG_ITO_REPEAT_COUNT) \ CFG(CFG_ENABLE_BEACON_RECEPTION_STATS) \ CFG(CFG_REMOVE_TIME_STAMP_SYNC_CMD) \ - CFG(CFG_CHANGE_CHANNEL_BANDWIDTH) #endif /* __CFG_MLME_GENERIC_H */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index 6baab17d9f5b..1edb89386883 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -2036,16 +2036,6 @@ QDF_STATUS wlan_mlme_ibss_power_save_setup(struct wlan_objmgr_psoc *psoc, QDF_STATUS wlan_mlme_set_11d_enabled(struct wlan_objmgr_psoc *psoc, bool value); -/** - * wlan_mlme_is_change_channel_bandwidth_enabled() - get the - * enable_change_channel_bandwidth flag - * @psoc: psoc context - * - * Return: true if enabled - */ -bool -wlan_mlme_is_change_channel_bandwidth_enabled(struct wlan_objmgr_psoc *psoc); - /** * wlan_mlme_get_sta_miracast_mcc_rest_time() - Get STA/MIRACAST MCC rest time * diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index a34aa65dbc23..f05b23ef3754 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -1140,7 +1140,6 @@ struct wlan_mlme_generic { bool enable_beacon_reception_stats; bool enable_remove_time_stamp_sync_cmd; bool data_stall_recovery_fw_support; - bool enable_change_channel_bandwidth; bool disable_4way_hs_offload; bool as_enabled; }; diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h index 0ed24805f3a1..401633fd7f94 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h @@ -2609,19 +2609,6 @@ ucfg_mlme_set_11d_enabled(struct wlan_objmgr_psoc *psoc, bool value) return wlan_mlme_set_11d_enabled(psoc, value); } -/** - * ucfg_mlme_is_change_channel_bandwidth_enabled() - ucfg api to get the - * enable_change_channel_bandwidth flag - * @psoc: psoc context - * - * Return: true if enabled - */ -static inline bool -ucfg_mlme_is_change_channel_bandwidth_enabled(struct wlan_objmgr_psoc *psoc) -{ - return wlan_mlme_is_change_channel_bandwidth_enabled(psoc); -} - /** * ucfg_mlme_get_opr_rate_set() - Get operational rate set * @psoc: pointer to psoc object diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index 4a9c6c7e8401..f447f7296010 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -2618,18 +2618,6 @@ wlan_mlme_set_11d_enabled(struct wlan_objmgr_psoc *psoc, bool value) return QDF_STATUS_SUCCESS; } -bool -wlan_mlme_is_change_channel_bandwidth_enabled(struct wlan_objmgr_psoc *psoc) -{ - struct wlan_mlme_psoc_ext_obj *mlme_obj; - - mlme_obj = mlme_get_psoc_ext_obj(psoc); - if (!mlme_obj) - return cfg_default(CFG_CHANGE_CHANNEL_BANDWIDTH); - - return mlme_obj->cfg.gen.enable_change_channel_bandwidth; -} - QDF_STATUS wlan_mlme_cfg_set_vht_chan_width(struct wlan_objmgr_psoc *psoc, uint8_t value) { diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 4735f2d354e2..0367a3aff5e3 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -17524,10 +17524,6 @@ void hdd_select_cbmode(struct hdd_adapter *adapter, uint32_t oper_freq, { uint32_t sec_ch_freq = 0; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - struct hdd_station_ctx *station_ctx = - WLAN_HDD_GET_STATION_CTX_PTR(adapter); - eConnectionState connstate; - bool cbmode_select = false; /* * CDS api expects secondary channel for calculating @@ -17545,16 +17541,7 @@ void hdd_select_cbmode(struct hdd_adapter *adapter, uint32_t oper_freq, wlan_reg_set_channel_params_for_freq(hdd_ctx->pdev, oper_freq, sec_ch_freq, ch_params); - if (adapter->device_mode == QDF_STA_MODE && - ucfg_mlme_is_change_channel_bandwidth_enabled(hdd_ctx->psoc)) { - connstate = station_ctx->conn_info.conn_state; - if (!(eConnectionState_Associated == connstate || - eConnectionState_Connecting == connstate)) { - cbmode_select = true; - } - } - - if (cds_get_conparam() == QDF_GLOBAL_MONITOR_MODE || cbmode_select) + if (cds_get_conparam() == QDF_GLOBAL_MONITOR_MODE) hdd_mon_select_cbmode(adapter, oper_freq, ch_params); } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 1fe3be531845..686b7fd28ed7 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -6847,25 +6847,14 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan, struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); struct hdd_mon_set_ch_info *ch_info = &sta_ctx->ch_info; QDF_STATUS status; - mac_handle_t mac_handle = hdd_ctx->mac_handle; struct qdf_mac_addr bssid; struct csr_roam_profile roam_profile; struct ch_params ch_params; - eConnectionState connstate; - if (hdd_get_conparam() != QDF_GLOBAL_MONITOR_MODE && - adapter->device_mode != QDF_STA_MODE) { - hdd_err("Not supported, device is not in monitor mode or sta mission mode"); + if (hdd_get_conparam() != QDF_GLOBAL_MONITOR_MODE) { + hdd_err("Not supported, device is not in monitor mode"); return -EINVAL; } - if (adapter->device_mode == QDF_STA_MODE && - ucfg_mlme_is_change_channel_bandwidth_enabled(hdd_ctx->psoc)) { - connstate = sta_ctx->conn_info.conn_state; - if (eConnectionState_Associated == connstate || - eConnectionState_Connecting == connstate) { - return -EINVAL; - } - } /* Validate Channel */ if (!WLAN_REG_IS_24GHZ_CH(chan) && !WLAN_REG_IS_5GHZ_CH(chan)) { @@ -6901,17 +6890,7 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan, roam_profile.ch_params.ch_width = bandwidth; hdd_select_cbmode(adapter, wlan_chan_to_freq(chan), &roam_profile.ch_params); - if (ucfg_mlme_is_change_channel_bandwidth_enabled(hdd_ctx->psoc) && - (!sme_find_session_by_bssid(mac_handle, adapter->mac_addr.bytes))) { - status = sme_create_mon_session(mac_handle, - adapter->mac_addr.bytes, - adapter->vdev_id); - if (status != QDF_STATUS_SUCCESS) { - hdd_err("Status: %d Failed to create session.", - status); - return qdf_status_to_os_return(status); - } - } + qdf_mem_copy(bssid.bytes, adapter->mac_addr.bytes, QDF_MAC_ADDR_SIZE); diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c index 2a6b9e8d3b1d..0d8b76abf0ef 100644 --- a/core/hdd/src/wlan_hdd_tx_rx.c +++ b/core/hdd/src/wlan_hdd_tx_rx.c @@ -2709,6 +2709,7 @@ void hdd_print_netdev_txq_status(struct net_device *dev) int hdd_set_mon_rx_cb(struct net_device *dev) { struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); int ret; QDF_STATUS qdf_status; struct ol_txrx_desc_type sta_desc = {0}; @@ -2734,6 +2735,14 @@ int hdd_set_mon_rx_cb(struct net_device *dev) goto exit; } + qdf_status = sme_create_mon_session(hdd_ctx->mac_handle, + adapter->mac_addr.bytes, + adapter->vdev_id); + if (QDF_STATUS_SUCCESS != qdf_status) { + hdd_err("sme_create_mon_session() failed to register. Status= %d [0x%08X]", + qdf_status, qdf_status); + } + exit: ret = qdf_status_to_os_return(qdf_status); return ret; diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h index de07fe8bc07f..96a168e45781 100644 --- a/core/sme/inc/csr_internal.h +++ b/core/sme/inc/csr_internal.h @@ -1103,7 +1103,6 @@ static inline void csr_roaming_report_diag_event( {} #endif -bool csr_find_session_by_bssid(struct mac_context *mac_ctx, uint8_t *bssid); QDF_STATUS csr_get_channels_and_power(struct mac_context *mac); bool csr_nonscan_active_ll_is_list_empty( diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 05a6ed03672f..f2e698a25b09 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -3536,16 +3536,6 @@ static inline int sme_add_key_krk(mac_handle_t mac_handle, uint8_t session_id, } #endif -/** - * sme_find_session_by_bssid() - checks whether has session - * with given bssid - * @mac_handle: Opaque handle to the global MAC context - * @bssid: bssid - * Return: true - if has the session - * false - if not has the session - */ -bool sme_find_session_by_bssid(mac_handle_t mac_handle, uint8_t *bssid); - /** * sme_get_roam_scan_stats() - Send roam scan stats cmd to wma * @mac_handle: handle returned by mac_open diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 1a3642d0aa7f..c09add45dd11 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -15324,16 +15324,6 @@ uint8_t sme_get_mcs_idx(uint16_t raw_rate, enum tx_rate_info rate_flags, nss, dcm, guard_interval, mcs_rate_flags); } -bool sme_find_session_by_bssid(mac_handle_t mac_handle, uint8_t *bssid) -{ - struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle); - bool ret; - - ret = csr_find_session_by_bssid(mac_ctx, bssid); - - return ret; -} - #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR QDF_STATUS sme_get_sta_cxn_info(mac_handle_t mac_handle, uint32_t session_id, char *buf, uint32_t buf_sz) diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 82e5eb759ade..83bee95ca49e 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -20903,26 +20903,6 @@ csr_find_session_by_type(struct mac_context *mac_ctx, enum QDF_OPMODE type) } return session_id; } -/** - * csr_find_session_by_bssid() - This function will find given bssid from - * all sessions. - * @mac_ctx: pointer to mac context. - * @bssid: session bssid - * Return: false or true. - **/ -bool -csr_find_session_by_bssid(struct mac_context *mac_ctx, uint8_t *bssid) -{ - struct pe_session *session_entry; - uint8_t session_id; /* PE session_id */ - - session_entry = pe_find_session_by_bssid(mac_ctx, - bssid, &session_id); - if (session_entry) - return true; - else - return false; -} /** * csr_is_conn_allow_2g_band() - This function will check if station's conn