Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Amar Singhal | 4c3fbb4 | 2018-01-02 13:20:28 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | /** |
| 20 | * DOC: wma_main.c |
| 21 | * |
| 22 | * This file contains wma initialization and FW exchange |
| 23 | * related functions. |
| 24 | */ |
| 25 | |
| 26 | /* Header files */ |
| 27 | |
| 28 | #include "wma.h" |
| 29 | #include "wma_api.h" |
| 30 | #include "cds_api.h" |
| 31 | #include "wmi_unified_api.h" |
| 32 | #include "wlan_qct_sys.h" |
| 33 | #include "wni_api.h" |
| 34 | #include "ani_global.h" |
| 35 | #include "wmi_unified.h" |
| 36 | #include "wni_cfg.h" |
| 37 | #include "cfg_api.h" |
Poddar, Siddarth | 5a91f5b | 2016-04-28 12:24:10 +0530 | [diff] [blame] | 38 | #if defined(CONFIG_HL_SUPPORT) |
| 39 | #include "wlan_tgt_def_config_hl.h" |
| 40 | #else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 41 | #include "wlan_tgt_def_config.h" |
Poddar, Siddarth | 5a91f5b | 2016-04-28 12:24:10 +0530 | [diff] [blame] | 42 | #endif |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 43 | #include "qdf_nbuf.h" |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 44 | #include "qdf_types.h" |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 45 | #include "qdf_mem.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | #include "wma_types.h" |
| 47 | #include "lim_api.h" |
| 48 | #include "lim_session_utils.h" |
| 49 | |
| 50 | #include "cds_utils.h" |
| 51 | |
| 52 | #if !defined(REMOVE_PKT_LOG) |
| 53 | #include "pktlog_ac.h" |
| 54 | #endif /* REMOVE_PKT_LOG */ |
| 55 | |
| 56 | #include "dbglog_host.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 57 | #include "csr_api.h" |
| 58 | #include "ol_fw.h" |
| 59 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 60 | #include "wma_internal.h" |
| 61 | |
| 62 | #include "wma_ocb.h" |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 63 | #include "wlan_policy_mgr_api.h" |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 64 | #include "cdp_txrx_cfg.h" |
| 65 | #include "cdp_txrx_flow_ctrl_legacy.h" |
| 66 | #include "cdp_txrx_flow_ctrl_v2.h" |
| 67 | #include "cdp_txrx_ipa.h" |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 68 | #include "cdp_txrx_misc.h" |
Jeff Johnson | 6136fb9 | 2017-03-30 15:21:49 -0700 | [diff] [blame] | 69 | #include "wma_fips_api.h" |
Deepak Dhamdhere | 13230d3 | 2016-05-26 00:46:53 -0700 | [diff] [blame] | 70 | #include "wma_nan_datapath.h" |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 71 | #include "wlan_lmac_if_def.h" |
| 72 | #include "wlan_lmac_if_api.h" |
Mukul Sharma | c3e7a78 | 2017-02-03 12:16:11 +0530 | [diff] [blame] | 73 | #include "target_if.h" |
Mukul Sharma | dad267e | 2017-02-04 13:25:34 +0530 | [diff] [blame] | 74 | #include "wlan_global_lmac_if_api.h" |
Mukul Sharma | 3d36c39 | 2017-01-18 18:39:12 +0530 | [diff] [blame] | 75 | #include "target_if_pmo.h" |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 76 | #include "wma_he.h" |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 77 | #include "wlan_pmo_obj_mgmt_api.h" |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 78 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 79 | #include "wlan_reg_tgt_api.h" |
| 80 | #include "wlan_reg_services_api.h" |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 81 | #include <cdp_txrx_handle.h> |
Tushnim Bhattacharyya | 45ed04f | 2017-03-15 10:15:05 -0700 | [diff] [blame] | 82 | #include <wlan_pmo_ucfg_api.h> |
Naveen Rawat | 4efe41b | 2017-04-29 16:23:14 -0700 | [diff] [blame] | 83 | #include "wifi_pos_api.h" |
| 84 | #include "hif_main.h" |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 85 | #include <target_if_spectral.h> |
| 86 | #include <wlan_spectral_utils_api.h> |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 87 | #include "init_event_handler.h" |
Sourav Mohapatra | cf63257 | 2018-04-02 11:01:35 +0530 | [diff] [blame] | 88 | #include "init_deinit_lmac.h" |
Himanshu Agarwal | ceb9faa | 2018-01-24 22:30:05 +0530 | [diff] [blame] | 89 | #include "target_if_green_ap.h" |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 90 | #include "service_ready_param.h" |
Naveen Rawat | 3ff5cff | 2018-01-29 14:31:16 -0800 | [diff] [blame] | 91 | #include "wlan_cp_stats_mc_ucfg_api.h" |
Tushnim Bhattacharyya | 45ed04f | 2017-03-15 10:15:05 -0700 | [diff] [blame] | 92 | |
Agrawal Ashish | b0aa075 | 2017-04-21 19:31:10 +0530 | [diff] [blame] | 93 | #define WMA_LOG_COMPLETION_TIMER 3000 /* 3 seconds */ |
Rajeev Kumar Sirasanagandla | 4787300 | 2016-09-09 13:46:09 +0530 | [diff] [blame] | 94 | #define WMI_TLV_HEADROOM 128 |
gaurank kathpalia | 85f8a61 | 2018-02-21 18:55:24 +0530 | [diff] [blame] | 95 | |
| 96 | #define WMA_FW_TIME_SYNC_TIMER 60000 /* 1 min */ |
| 97 | |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 98 | uint8_t *mac_trace_get_wma_msg_string(uint16_t wmaMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 99 | static uint32_t g_fw_wlan_feat_caps; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 100 | /** |
| 101 | * wma_get_fw_wlan_feat_caps() - get fw feature capablity |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 102 | * @feature: feature enum value |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 103 | * |
| 104 | * Return: true/false |
| 105 | */ |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 106 | bool wma_get_fw_wlan_feat_caps(enum cap_bitmap feature) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 107 | { |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 108 | return (g_fw_wlan_feat_caps & (1 << feature)) ? true : false; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * wma_set_fw_wlan_feat_caps() - set fw feature capablity |
| 113 | * @feature: feature enum value |
| 114 | * |
| 115 | * Return: None |
| 116 | */ |
| 117 | void wma_set_fw_wlan_feat_caps(enum cap_bitmap feature) |
| 118 | { |
| 119 | g_fw_wlan_feat_caps |= (1 << feature); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | /** |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 123 | * wma_service_ready_ext_evt_timeout() - Service ready extended event timeout |
| 124 | * @data: Timeout handler data |
| 125 | * |
| 126 | * This function is called when the FW fails to send WMI_SERVICE_READY_EXT_EVENT |
| 127 | * message |
| 128 | * |
| 129 | * Return: None |
| 130 | */ |
| 131 | static void wma_service_ready_ext_evt_timeout(void *data) |
| 132 | { |
| 133 | tp_wma_handle wma_handle; |
| 134 | |
| 135 | WMA_LOGA("%s: Timeout waiting for WMI_SERVICE_READY_EXT_EVENT", |
| 136 | __func__); |
| 137 | |
| 138 | wma_handle = (tp_wma_handle) data; |
| 139 | |
| 140 | if (!wma_handle) { |
| 141 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 142 | goto end; |
| 143 | } |
| 144 | |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 145 | end: |
Naveen Rawat | ac39a10 | 2016-10-07 10:58:29 -0700 | [diff] [blame] | 146 | /* Assert here. Panic is being called in insmod thread */ |
| 147 | QDF_ASSERT(0); |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | /** |
Komal Seelam | 02d0934 | 2016-02-23 18:03:19 +0530 | [diff] [blame] | 151 | * wma_get_ini_handle() - API to get WMA ini info handle |
| 152 | * @wma: WMA Handle |
| 153 | * |
| 154 | * Returns the pointer to WMA ini structure. |
| 155 | * Return: struct wma_ini_config |
| 156 | */ |
| 157 | struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma) |
| 158 | { |
| 159 | if (!wma) { |
| 160 | WMA_LOGE("%s: Invalid WMA context\n", __func__); |
| 161 | return NULL; |
| 162 | } |
| 163 | |
| 164 | return &wma->ini_config; |
| 165 | } |
| 166 | |
| 167 | #define MAX_SUPPORTED_PEERS_REV1_1 14 |
| 168 | #define MAX_SUPPORTED_PEERS_REV1_3 32 |
| 169 | #define MIN_NO_OF_PEERS 1 |
| 170 | |
| 171 | /** |
| 172 | * wma_get_number_of_peers_supported - API to query for number of peers |
| 173 | * supported |
| 174 | * @wma: WMA Handle |
| 175 | * |
| 176 | * Return: Max Number of Peers Supported |
| 177 | */ |
| 178 | static uint8_t wma_get_number_of_peers_supported(tp_wma_handle wma) |
| 179 | { |
| 180 | struct hif_target_info *tgt_info; |
| 181 | struct wma_ini_config *cfg = wma_get_ini_handle(wma); |
| 182 | uint8_t max_no_of_peers = cfg ? cfg->max_no_of_peers : MIN_NO_OF_PEERS; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 183 | struct hif_opaque_softc *scn = cds_get_context(QDF_MODULE_ID_HIF); |
Komal Seelam | 02d0934 | 2016-02-23 18:03:19 +0530 | [diff] [blame] | 184 | |
| 185 | if (!scn) { |
| 186 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 187 | return 0; |
| 188 | } |
| 189 | |
| 190 | tgt_info = hif_get_target_info_handle(scn); |
| 191 | |
| 192 | switch (tgt_info->target_version) { |
| 193 | case AR6320_REV1_1_VERSION: |
| 194 | if (max_no_of_peers > MAX_SUPPORTED_PEERS_REV1_1) |
| 195 | max_no_of_peers = MAX_SUPPORTED_PEERS_REV1_1; |
| 196 | break; |
| 197 | default: |
| 198 | if (max_no_of_peers > MAX_SUPPORTED_PEERS_REV1_3) |
| 199 | max_no_of_peers = MAX_SUPPORTED_PEERS_REV1_3; |
| 200 | break; |
| 201 | } |
| 202 | |
| 203 | return max_no_of_peers; |
| 204 | } |
| 205 | |
| 206 | /** |
bings | 6b3614e | 2017-02-21 10:18:36 +0800 | [diff] [blame] | 207 | * wma_get_number_of_tids_supported - API to query for number of tids supported |
| 208 | * @no_of_peers_supported: Number of peer supported |
| 209 | * |
| 210 | * Return: Max number of tids supported |
| 211 | */ |
| 212 | #if defined(CONFIG_HL_SUPPORT) |
| 213 | static uint32_t wma_get_number_of_tids_supported(uint8_t no_of_peers_supported) |
| 214 | { |
| 215 | return 4 * no_of_peers_supported; |
| 216 | } |
| 217 | #else |
| 218 | static uint32_t wma_get_number_of_tids_supported(uint8_t no_of_peers_supported) |
| 219 | { |
| 220 | return 2 * (no_of_peers_supported + CFG_TGT_NUM_VDEV + 2); |
| 221 | } |
| 222 | #endif |
| 223 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 224 | #ifdef PERE_IP_HDR_ALIGNMENT_WAR |
| 225 | static void wma_reset_rx_decap_mode(target_resource_config *tgt_cfg) |
| 226 | { |
| 227 | /* |
| 228 | * To make the IP header begins at dword aligned address, |
| 229 | * we make the decapsulation mode as Native Wifi. |
| 230 | */ |
| 231 | tgt_cfg->rx_decap_mode = CFG_TGT_RX_DECAP_MODE_NWIFI; |
| 232 | } |
| 233 | #else |
| 234 | static void wma_reset_rx_decap_mode(target_resource_config *tgt_cfg) |
| 235 | { |
| 236 | } |
| 237 | |
| 238 | #endif |
bings | 6b3614e | 2017-02-21 10:18:36 +0800 | [diff] [blame] | 239 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 240 | * wma_set_default_tgt_config() - set default tgt config |
| 241 | * @wma_handle: wma handle |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 242 | * @tgt_cfg: Resource config given to target |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 243 | * |
| 244 | * Return: none |
| 245 | */ |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 246 | static void wma_set_default_tgt_config(tp_wma_handle wma_handle, |
| 247 | target_resource_config *tgt_cfg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 248 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 249 | uint8_t no_of_peers_supported; |
Mukul Sharma | b10c8c7 | 2017-11-02 17:25:59 +0530 | [diff] [blame] | 250 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 251 | qdf_mem_zero(tgt_cfg, sizeof(target_resource_config)); |
| 252 | tgt_cfg->num_vdevs = CFG_TGT_NUM_VDEV; |
| 253 | tgt_cfg->num_peers = CFG_TGT_NUM_PEERS + CFG_TGT_NUM_VDEV + 2; |
| 254 | tgt_cfg->num_offload_peers = CFG_TGT_NUM_OFFLOAD_PEERS; |
| 255 | tgt_cfg->num_offload_reorder_buffs = CFG_TGT_NUM_OFFLOAD_REORDER_BUFFS; |
| 256 | tgt_cfg->num_peer_keys = CFG_TGT_NUM_PEER_KEYS; |
| 257 | tgt_cfg->num_tids = CFG_TGT_NUM_TIDS; |
| 258 | tgt_cfg->ast_skid_limit = CFG_TGT_AST_SKID_LIMIT; |
| 259 | tgt_cfg->tx_chain_mask = CFG_TGT_DEFAULT_TX_CHAIN_MASK; |
| 260 | tgt_cfg->rx_chain_mask = CFG_TGT_DEFAULT_RX_CHAIN_MASK; |
| 261 | tgt_cfg->rx_timeout_pri[0] = CFG_TGT_RX_TIMEOUT_LO_PRI; |
| 262 | tgt_cfg->rx_timeout_pri[1] = CFG_TGT_RX_TIMEOUT_LO_PRI; |
| 263 | tgt_cfg->rx_timeout_pri[2] = CFG_TGT_RX_TIMEOUT_LO_PRI; |
| 264 | tgt_cfg->rx_timeout_pri[3] = CFG_TGT_RX_TIMEOUT_HI_PRI; |
| 265 | tgt_cfg->rx_decap_mode = CFG_TGT_RX_DECAP_MODE; |
| 266 | tgt_cfg->scan_max_pending_req = CFG_TGT_DEFAULT_SCAN_MAX_REQS; |
| 267 | tgt_cfg->bmiss_offload_max_vdev = |
| 268 | CFG_TGT_DEFAULT_BMISS_OFFLOAD_MAX_VDEV; |
| 269 | tgt_cfg->roam_offload_max_vdev = CFG_TGT_DEFAULT_ROAM_OFFLOAD_MAX_VDEV; |
| 270 | tgt_cfg->roam_offload_max_ap_profiles = |
Mukul Sharma | b10c8c7 | 2017-11-02 17:25:59 +0530 | [diff] [blame] | 271 | CFG_TGT_DEFAULT_ROAM_OFFLOAD_MAX_PROFILES; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 272 | tgt_cfg->num_mcast_groups = CFG_TGT_DEFAULT_NUM_MCAST_GROUPS; |
| 273 | tgt_cfg->num_mcast_table_elems = CFG_TGT_DEFAULT_NUM_MCAST_TABLE_ELEMS; |
| 274 | tgt_cfg->mcast2ucast_mode = CFG_TGT_DEFAULT_MCAST2UCAST_MODE; |
| 275 | tgt_cfg->tx_dbg_log_size = CFG_TGT_DEFAULT_TX_DBG_LOG_SIZE; |
| 276 | tgt_cfg->num_wds_entries = CFG_TGT_WDS_ENTRIES; |
| 277 | tgt_cfg->dma_burst_size = CFG_TGT_DEFAULT_DMA_BURST_SIZE; |
| 278 | tgt_cfg->mac_aggr_delim = CFG_TGT_DEFAULT_MAC_AGGR_DELIM; |
| 279 | tgt_cfg->rx_skip_defrag_timeout_dup_detection_check = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 280 | CFG_TGT_DEFAULT_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK, |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 281 | tgt_cfg->vow_config = CFG_TGT_DEFAULT_VOW_CONFIG; |
| 282 | tgt_cfg->gtk_offload_max_vdev = CFG_TGT_DEFAULT_GTK_OFFLOAD_MAX_VDEV; |
| 283 | tgt_cfg->num_msdu_desc = CFG_TGT_NUM_MSDU_DESC; |
| 284 | tgt_cfg->max_frag_entries = CFG_TGT_MAX_FRAG_TABLE_ENTRIES; |
| 285 | tgt_cfg->num_tdls_vdevs = CFG_TGT_NUM_TDLS_VDEVS; |
| 286 | tgt_cfg->num_tdls_conn_table_entries = |
Mukul Sharma | b10c8c7 | 2017-11-02 17:25:59 +0530 | [diff] [blame] | 287 | CFG_TGT_NUM_TDLS_CONN_TABLE_ENTRIES; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 288 | tgt_cfg->beacon_tx_offload_max_vdev = |
Mukul Sharma | b10c8c7 | 2017-11-02 17:25:59 +0530 | [diff] [blame] | 289 | CFG_TGT_DEFAULT_BEACON_TX_OFFLOAD_MAX_VDEV; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 290 | tgt_cfg->num_multicast_filter_entries = |
Mukul Sharma | b10c8c7 | 2017-11-02 17:25:59 +0530 | [diff] [blame] | 291 | CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 292 | tgt_cfg->num_wow_filters = 0; |
| 293 | tgt_cfg->num_keep_alive_pattern = 0; |
| 294 | tgt_cfg->keep_alive_pattern_size = 0; |
| 295 | tgt_cfg->max_tdls_concurrent_sleep_sta = |
Mukul Sharma | b10c8c7 | 2017-11-02 17:25:59 +0530 | [diff] [blame] | 296 | CFG_TGT_NUM_TDLS_CONC_SLEEP_STAS; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 297 | tgt_cfg->max_tdls_concurrent_buffer_sta = |
Mukul Sharma | b10c8c7 | 2017-11-02 17:25:59 +0530 | [diff] [blame] | 298 | CFG_TGT_NUM_TDLS_CONC_BUFFER_STAS; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 299 | tgt_cfg->wmi_send_separate = 0; |
| 300 | tgt_cfg->num_ocb_vdevs = CFG_TGT_NUM_OCB_VDEVS; |
| 301 | tgt_cfg->num_ocb_channels = CFG_TGT_NUM_OCB_CHANNELS; |
| 302 | tgt_cfg->num_ocb_schedules = CFG_TGT_NUM_OCB_SCHEDULES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 303 | |
Komal Seelam | 02d0934 | 2016-02-23 18:03:19 +0530 | [diff] [blame] | 304 | no_of_peers_supported = wma_get_number_of_peers_supported(wma_handle); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 305 | tgt_cfg->num_peers = no_of_peers_supported + CFG_TGT_NUM_VDEV + 2; |
| 306 | tgt_cfg->num_tids = wma_get_number_of_tids_supported( |
| 307 | no_of_peers_supported); |
| 308 | tgt_cfg->scan_max_pending_req = wma_handle->max_scan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 309 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 310 | tgt_cfg->mgmt_comp_evt_bundle_support = true; |
| 311 | tgt_cfg->tx_msdu_new_partition_id_support = true; |
Nirav Shah | 2048997 | 2016-06-16 19:20:28 +0530 | [diff] [blame] | 312 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 313 | /* reduce the peer/vdev if CFG_TGT_NUM_MSDU_DESC exceeds 1000 */ |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 314 | wma_reset_rx_decap_mode(tgt_cfg); |
Manjunathappa Prakash | 0e6e6b5 | 2016-04-21 11:48:48 -0700 | [diff] [blame] | 315 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 316 | if (cds_get_conparam() == QDF_GLOBAL_MONITOR_MODE) |
| 317 | tgt_cfg->rx_decap_mode = CFG_TGT_RX_DECAP_MODE_RAW; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | /** |
| 321 | * wma_cli_get_command() - WMA "get" command processor |
| 322 | * @vdev_id: virtual device for the command |
| 323 | * @param_id: parameter id |
| 324 | * @vpdev: parameter category |
| 325 | * |
| 326 | * Return: parameter value on success, -EINVAL on failure |
| 327 | */ |
| 328 | int wma_cli_get_command(int vdev_id, int param_id, int vpdev) |
| 329 | { |
| 330 | int ret = 0; |
| 331 | tp_wma_handle wma; |
| 332 | struct wma_txrx_node *intr = NULL; |
| 333 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 334 | wma = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 335 | |
| 336 | if (NULL == wma) { |
| 337 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 338 | return -EINVAL; |
| 339 | } |
| 340 | |
| 341 | intr = wma->interfaces; |
| 342 | |
| 343 | if (VDEV_CMD == vpdev) { |
| 344 | switch (param_id) { |
| 345 | case WMI_VDEV_PARAM_NSS: |
| 346 | ret = intr[vdev_id].config.nss; |
| 347 | break; |
| 348 | #ifdef QCA_SUPPORT_GTX |
| 349 | case WMI_VDEV_PARAM_GTX_HT_MCS: |
| 350 | ret = intr[vdev_id].config.gtx_info.gtxRTMask[0]; |
| 351 | break; |
| 352 | case WMI_VDEV_PARAM_GTX_VHT_MCS: |
| 353 | ret = intr[vdev_id].config.gtx_info.gtxRTMask[1]; |
| 354 | break; |
| 355 | case WMI_VDEV_PARAM_GTX_USR_CFG: |
| 356 | ret = intr[vdev_id].config.gtx_info.gtxUsrcfg; |
| 357 | break; |
| 358 | case WMI_VDEV_PARAM_GTX_THRE: |
| 359 | ret = intr[vdev_id].config.gtx_info.gtxPERThreshold; |
| 360 | break; |
| 361 | case WMI_VDEV_PARAM_GTX_MARGIN: |
| 362 | ret = intr[vdev_id].config.gtx_info.gtxPERMargin; |
| 363 | break; |
| 364 | case WMI_VDEV_PARAM_GTX_STEP: |
| 365 | ret = intr[vdev_id].config.gtx_info.gtxTPCstep; |
| 366 | break; |
| 367 | case WMI_VDEV_PARAM_GTX_MINTPC: |
| 368 | ret = intr[vdev_id].config.gtx_info.gtxTPCMin; |
| 369 | break; |
| 370 | case WMI_VDEV_PARAM_GTX_BW_MASK: |
| 371 | ret = intr[vdev_id].config.gtx_info.gtxBWMask; |
| 372 | break; |
| 373 | #endif /* QCA_SUPPORT_GTX */ |
| 374 | case WMI_VDEV_PARAM_LDPC: |
| 375 | ret = intr[vdev_id].config.ldpc; |
| 376 | break; |
| 377 | case WMI_VDEV_PARAM_TX_STBC: |
| 378 | ret = intr[vdev_id].config.tx_stbc; |
| 379 | break; |
| 380 | case WMI_VDEV_PARAM_RX_STBC: |
| 381 | ret = intr[vdev_id].config.rx_stbc; |
| 382 | break; |
| 383 | case WMI_VDEV_PARAM_SGI: |
| 384 | ret = intr[vdev_id].config.shortgi; |
| 385 | break; |
| 386 | case WMI_VDEV_PARAM_ENABLE_RTSCTS: |
| 387 | ret = intr[vdev_id].config.rtscts_en; |
| 388 | break; |
| 389 | case WMI_VDEV_PARAM_CHWIDTH: |
| 390 | ret = intr[vdev_id].config.chwidth; |
| 391 | break; |
| 392 | case WMI_VDEV_PARAM_FIXED_RATE: |
| 393 | ret = intr[vdev_id].config.tx_rate; |
| 394 | break; |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 395 | case WMI_VDEV_PARAM_HE_DCM: |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 396 | case WMI_VDEV_PARAM_HE_RANGE_EXT: |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 397 | ret = wma_get_he_vdev_param(&intr[vdev_id], param_id); |
| 398 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 399 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 400 | WMA_LOGE("Invalid cli_get vdev command/Not yet implemented 0x%x", |
| 401 | param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 402 | return -EINVAL; |
| 403 | } |
| 404 | } else if (PDEV_CMD == vpdev) { |
| 405 | switch (param_id) { |
| 406 | case WMI_PDEV_PARAM_ANI_ENABLE: |
| 407 | ret = wma->pdevconfig.ani_enable; |
| 408 | break; |
| 409 | case WMI_PDEV_PARAM_ANI_POLL_PERIOD: |
| 410 | ret = wma->pdevconfig.ani_poll_len; |
| 411 | break; |
| 412 | case WMI_PDEV_PARAM_ANI_LISTEN_PERIOD: |
| 413 | ret = wma->pdevconfig.ani_listen_len; |
| 414 | break; |
| 415 | case WMI_PDEV_PARAM_ANI_OFDM_LEVEL: |
| 416 | ret = wma->pdevconfig.ani_ofdm_level; |
| 417 | break; |
| 418 | case WMI_PDEV_PARAM_ANI_CCK_LEVEL: |
| 419 | ret = wma->pdevconfig.ani_cck_level; |
| 420 | break; |
| 421 | case WMI_PDEV_PARAM_DYNAMIC_BW: |
| 422 | ret = wma->pdevconfig.cwmenable; |
| 423 | break; |
| 424 | case WMI_PDEV_PARAM_CTS_CBW: |
| 425 | ret = wma->pdevconfig.cts_cbw; |
| 426 | break; |
| 427 | case WMI_PDEV_PARAM_TX_CHAIN_MASK: |
| 428 | ret = wma->pdevconfig.txchainmask; |
| 429 | break; |
| 430 | case WMI_PDEV_PARAM_RX_CHAIN_MASK: |
| 431 | ret = wma->pdevconfig.rxchainmask; |
| 432 | break; |
| 433 | case WMI_PDEV_PARAM_TXPOWER_LIMIT2G: |
| 434 | ret = wma->pdevconfig.txpow2g; |
| 435 | break; |
| 436 | case WMI_PDEV_PARAM_TXPOWER_LIMIT5G: |
| 437 | ret = wma->pdevconfig.txpow5g; |
| 438 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 439 | case WMI_PDEV_PARAM_BURST_ENABLE: |
| 440 | ret = wma->pdevconfig.burst_enable; |
| 441 | break; |
| 442 | case WMI_PDEV_PARAM_BURST_DUR: |
| 443 | ret = wma->pdevconfig.burst_dur; |
| 444 | break; |
| 445 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 446 | WMA_LOGE("Invalid cli_get pdev command/Not yet implemented 0x%x", |
| 447 | param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 448 | return -EINVAL; |
| 449 | } |
| 450 | } else if (GEN_CMD == vpdev) { |
| 451 | switch (param_id) { |
| 452 | case GEN_VDEV_PARAM_AMPDU: |
| 453 | ret = intr[vdev_id].config.ampdu; |
| 454 | break; |
| 455 | case GEN_VDEV_PARAM_AMSDU: |
| 456 | ret = intr[vdev_id].config.amsdu; |
| 457 | break; |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 458 | case GEN_VDEV_ROAM_SYNCH_DELAY: |
| 459 | ret = intr[vdev_id].roam_synch_delay; |
| 460 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 461 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 462 | WMA_LOGE("Invalid generic vdev command/Not yet implemented 0x%x", |
| 463 | param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 464 | return -EINVAL; |
| 465 | } |
| 466 | } else if (PPS_CMD == vpdev) { |
| 467 | switch (param_id) { |
| 468 | case WMI_VDEV_PPS_PAID_MATCH: |
| 469 | ret = intr[vdev_id].config.pps_params.paid_match_enable; |
| 470 | break; |
| 471 | case WMI_VDEV_PPS_GID_MATCH: |
| 472 | ret = intr[vdev_id].config.pps_params.gid_match_enable; |
| 473 | break; |
| 474 | case WMI_VDEV_PPS_EARLY_TIM_CLEAR: |
| 475 | ret = intr[vdev_id].config.pps_params.tim_clear; |
| 476 | break; |
| 477 | case WMI_VDEV_PPS_EARLY_DTIM_CLEAR: |
| 478 | ret = intr[vdev_id].config.pps_params.dtim_clear; |
| 479 | break; |
| 480 | case WMI_VDEV_PPS_EOF_PAD_DELIM: |
| 481 | ret = intr[vdev_id].config.pps_params.eof_delim; |
| 482 | break; |
| 483 | case WMI_VDEV_PPS_MACADDR_MISMATCH: |
| 484 | ret = intr[vdev_id].config.pps_params.mac_match; |
| 485 | break; |
| 486 | case WMI_VDEV_PPS_DELIM_CRC_FAIL: |
| 487 | ret = intr[vdev_id].config.pps_params.delim_fail; |
| 488 | break; |
| 489 | case WMI_VDEV_PPS_GID_NSTS_ZERO: |
| 490 | ret = intr[vdev_id].config.pps_params.nsts_zero; |
| 491 | break; |
| 492 | case WMI_VDEV_PPS_RSSI_CHECK: |
| 493 | ret = intr[vdev_id].config.pps_params.rssi_chk; |
| 494 | break; |
| 495 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 496 | WMA_LOGE("Invalid pps vdev command/Not yet implemented 0x%x", |
| 497 | param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 498 | return -EINVAL; |
| 499 | } |
| 500 | } else if (QPOWER_CMD == vpdev) { |
| 501 | switch (param_id) { |
| 502 | case WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT: |
| 503 | ret = intr[vdev_id].config.qpower_params. |
| 504 | max_ps_poll_cnt; |
| 505 | break; |
| 506 | case WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE: |
| 507 | ret = intr[vdev_id].config.qpower_params. |
| 508 | max_tx_before_wake; |
| 509 | break; |
| 510 | case WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL: |
| 511 | ret = intr[vdev_id].config.qpower_params. |
| 512 | spec_ps_poll_wake_interval; |
| 513 | break; |
| 514 | case WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL: |
| 515 | ret = intr[vdev_id].config.qpower_params. |
| 516 | max_spec_nodata_ps_poll; |
| 517 | break; |
| 518 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 519 | WMA_LOGE("Invalid generic vdev command/Not yet implemented 0x%x", |
| 520 | param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 521 | return -EINVAL; |
| 522 | } |
| 523 | } else if (GTX_CMD == vpdev) { |
| 524 | switch (param_id) { |
| 525 | case WMI_VDEV_PARAM_GTX_HT_MCS: |
| 526 | ret = intr[vdev_id].config.gtx_info.gtxRTMask[0]; |
| 527 | break; |
| 528 | case WMI_VDEV_PARAM_GTX_VHT_MCS: |
| 529 | ret = intr[vdev_id].config.gtx_info.gtxRTMask[1]; |
| 530 | break; |
| 531 | case WMI_VDEV_PARAM_GTX_USR_CFG: |
| 532 | ret = intr[vdev_id].config.gtx_info.gtxUsrcfg; |
| 533 | break; |
| 534 | case WMI_VDEV_PARAM_GTX_THRE: |
| 535 | ret = intr[vdev_id].config.gtx_info.gtxPERThreshold; |
| 536 | break; |
| 537 | case WMI_VDEV_PARAM_GTX_MARGIN: |
| 538 | ret = intr[vdev_id].config.gtx_info.gtxPERMargin; |
| 539 | break; |
| 540 | case WMI_VDEV_PARAM_GTX_STEP: |
| 541 | ret = intr[vdev_id].config.gtx_info.gtxTPCstep; |
| 542 | break; |
| 543 | case WMI_VDEV_PARAM_GTX_MINTPC: |
| 544 | ret = intr[vdev_id].config.gtx_info.gtxTPCMin; |
| 545 | break; |
| 546 | case WMI_VDEV_PARAM_GTX_BW_MASK: |
| 547 | ret = intr[vdev_id].config.gtx_info.gtxBWMask; |
| 548 | break; |
| 549 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 550 | WMA_LOGE("Invalid generic vdev command/Not yet implemented 0x%x", |
| 551 | param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 552 | return -EINVAL; |
| 553 | } |
| 554 | } |
| 555 | return ret; |
| 556 | } |
| 557 | |
| 558 | /** |
| 559 | * wma_cli_set2_command() - WMA "set 2 params" command processor |
| 560 | * @vdev_id: virtual device for the command |
| 561 | * @param_id: parameter id |
| 562 | * @sval1: first parameter value |
| 563 | * @sval2: second parameter value |
| 564 | * @vpdev: parameter category |
| 565 | * |
| 566 | * Command handler for set operations which require 2 parameters |
| 567 | * |
| 568 | * Return: 0 on success, errno on failure |
| 569 | */ |
| 570 | int wma_cli_set2_command(int vdev_id, int param_id, int sval1, |
| 571 | int sval2, int vpdev) |
| 572 | { |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 573 | struct scheduler_msg msg = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 574 | wma_cli_set_cmd_t *iwcmd; |
| 575 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 576 | iwcmd = qdf_mem_malloc(sizeof(*iwcmd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 577 | if (!iwcmd) { |
| 578 | WMA_LOGE("%s: Failed alloc memory for iwcmd", __func__); |
| 579 | return -ENOMEM; |
| 580 | } |
| 581 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 582 | qdf_mem_zero(iwcmd, sizeof(*iwcmd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 583 | iwcmd->param_value = sval1; |
| 584 | iwcmd->param_sec_value = sval2; |
| 585 | iwcmd->param_vdev_id = vdev_id; |
| 586 | iwcmd->param_id = param_id; |
| 587 | iwcmd->param_vp_dev = vpdev; |
| 588 | msg.type = WMA_CLI_SET_CMD; |
| 589 | msg.reserved = 0; |
| 590 | msg.bodyptr = iwcmd; |
| 591 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 592 | if (QDF_STATUS_SUCCESS != |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 593 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 594 | WMA_LOGE("%s: Failed to post WMA_CLI_SET_CMD msg", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 595 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 596 | qdf_mem_free(iwcmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 597 | return -EIO; |
| 598 | } |
| 599 | return 0; |
| 600 | } |
| 601 | |
| 602 | /** |
| 603 | * wma_cli_set_command() - WMA "set" command processor |
| 604 | * @vdev_id: virtual device for the command |
| 605 | * @param_id: parameter id |
| 606 | * @sval: parameter value |
| 607 | * @vpdev: parameter category |
| 608 | * |
| 609 | * Command handler for set operations |
| 610 | * |
| 611 | * Return: 0 on success, errno on failure |
| 612 | */ |
| 613 | int wma_cli_set_command(int vdev_id, int param_id, int sval, int vpdev) |
| 614 | { |
| 615 | return wma_cli_set2_command(vdev_id, param_id, sval, 0, vpdev); |
| 616 | |
| 617 | } |
| 618 | |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 619 | QDF_STATUS wma_form_unit_test_cmd_and_send(uint32_t vdev_id, |
| 620 | uint32_t module_id, uint32_t arg_count, uint32_t *arg) |
| 621 | { |
| 622 | struct wmi_unit_test_cmd *unit_test_args; |
| 623 | tp_wma_handle wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 624 | uint32_t i; |
| 625 | QDF_STATUS status; |
| 626 | |
| 627 | WMA_LOGD(FL("enter")); |
| 628 | if (arg_count >= WMA_MAX_NUM_ARGS) { |
| 629 | WMA_LOGE(FL("arg_count is crossed the boundary")); |
| 630 | return QDF_STATUS_E_FAILURE; |
| 631 | } |
| 632 | if (!wma_handle || !wma_handle->wmi_handle) { |
| 633 | WMA_LOGE(FL("Invalid WMA/WMI handle")); |
| 634 | return QDF_STATUS_E_FAILURE; |
| 635 | } |
| 636 | unit_test_args = qdf_mem_malloc(sizeof(*unit_test_args)); |
| 637 | if (NULL == unit_test_args) { |
| 638 | WMA_LOGE(FL("qdf_mem_malloc failed for unit_test_args")); |
| 639 | return QDF_STATUS_E_NOMEM; |
| 640 | } |
| 641 | unit_test_args->vdev_id = vdev_id; |
| 642 | unit_test_args->module_id = module_id; |
| 643 | unit_test_args->num_args = arg_count; |
| 644 | for (i = 0; i < arg_count; i++) |
| 645 | unit_test_args->args[i] = arg[i]; |
| 646 | |
| 647 | status = wmi_unified_unit_test_cmd(wma_handle->wmi_handle, |
| 648 | unit_test_args); |
| 649 | qdf_mem_free(unit_test_args); |
| 650 | WMA_LOGD(FL("exit")); |
| 651 | |
| 652 | return status; |
| 653 | } |
| 654 | |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 655 | static void wma_process_send_addba_req(tp_wma_handle wma_handle, |
| 656 | struct send_add_ba_req *send_addba) |
| 657 | { |
| 658 | QDF_STATUS status; |
| 659 | |
| 660 | if (!wma_handle || !wma_handle->wmi_handle) { |
| 661 | WMA_LOGE(FL("Invalid WMA/WMI handle")); |
| 662 | qdf_mem_free(send_addba); |
| 663 | return; |
| 664 | } |
| 665 | |
| 666 | status = wmi_unified_addba_send_cmd_send(wma_handle->wmi_handle, |
| 667 | send_addba->mac_addr, |
| 668 | &send_addba->param); |
| 669 | if (QDF_STATUS_SUCCESS != status) { |
| 670 | WMA_LOGE(FL("Failed to process WMA_SEND_ADDBA_REQ")); |
| 671 | } |
| 672 | WMA_LOGD(FL("sent ADDBA req to" MAC_ADDRESS_STR "tid %d buff_size %d"), |
| 673 | MAC_ADDR_ARRAY(send_addba->mac_addr), |
| 674 | send_addba->param.tidno, |
| 675 | send_addba->param.buffersize); |
| 676 | |
| 677 | qdf_mem_free(send_addba); |
| 678 | } |
| 679 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 680 | /** |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame] | 681 | * wma_ipa_get_stat() - get IPA data path stats from FW |
| 682 | * |
| 683 | * Return: 0 on success, errno on failure |
| 684 | */ |
| 685 | #ifdef IPA_OFFLOAD |
| 686 | static int wma_ipa_get_stat(void) |
| 687 | { |
| 688 | struct cdp_pdev *pdev; |
| 689 | |
| 690 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 691 | if (!pdev) { |
| 692 | WMA_LOGE("pdev NULL for uc stat"); |
| 693 | return -EINVAL; |
| 694 | } |
| 695 | cdp_ipa_get_stat(cds_get_context(QDF_MODULE_ID_SOC), pdev); |
| 696 | |
| 697 | return 0; |
| 698 | } |
| 699 | #else |
| 700 | static int wma_ipa_get_stat(void) |
| 701 | { |
| 702 | return 0; |
| 703 | } |
| 704 | #endif |
| 705 | |
| 706 | /** |
| 707 | * wma_ipa_uc_get_share_stats() - get Tx/Rx byte stats from FW |
| 708 | * @privcmd: private command |
| 709 | * |
| 710 | * Return: 0 on success, errno on failure |
| 711 | */ |
| 712 | #if defined(IPA_OFFLOAD) && defined(FEATURE_METERING) |
| 713 | static int wma_ipa_uc_get_share_stats(wma_cli_set_cmd_t *privcmd) |
| 714 | { |
| 715 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 716 | struct cdp_pdev *pdev; |
| 717 | uint8_t reset_stats = privcmd->param_value; |
| 718 | |
| 719 | WMA_LOGD("%s: reset_stats=%d", |
| 720 | "WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID", |
| 721 | reset_stats); |
| 722 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 723 | if (!pdev) { |
| 724 | WMA_LOGE("pdev NULL for uc get share stats"); |
| 725 | return -EINVAL; |
| 726 | } |
| 727 | cdp_ipa_uc_get_share_stats(soc, pdev, reset_stats); |
| 728 | |
| 729 | return 0; |
| 730 | } |
| 731 | #else |
| 732 | static int wma_ipa_uc_get_share_stats(wma_cli_set_cmd_t *privcmd) |
| 733 | { |
| 734 | return 0; |
| 735 | } |
| 736 | #endif |
| 737 | |
| 738 | /** |
| 739 | * wma_ipa_uc_set_quota() - set quota limit to FW |
| 740 | * @privcmd: private command |
| 741 | * |
| 742 | * Return: 0 on success, errno on failure |
| 743 | */ |
| 744 | #if defined(IPA_OFFLOAD) && defined(FEATURE_METERING) |
| 745 | static int wma_ipa_uc_set_quota(wma_cli_set_cmd_t *privcmd) |
| 746 | { |
| 747 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 748 | struct cdp_pdev *pdev; |
| 749 | uint64_t quota_bytes = privcmd->param_sec_value; |
| 750 | |
| 751 | quota_bytes <<= 32; |
| 752 | quota_bytes |= privcmd->param_value; |
| 753 | |
| 754 | WMA_LOGD("%s: quota_bytes=%llu", |
| 755 | "WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID", |
| 756 | quota_bytes); |
| 757 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 758 | if (!pdev) { |
| 759 | WMA_LOGE("pdev NULL for uc set quota"); |
| 760 | return -EINVAL; |
| 761 | } |
| 762 | cdp_ipa_uc_set_quota(soc, pdev, quota_bytes); |
| 763 | |
| 764 | return 0; |
| 765 | } |
| 766 | #else |
| 767 | static int wma_ipa_uc_set_quota(wma_cli_set_cmd_t *privcmd) |
| 768 | { |
| 769 | return 0; |
| 770 | } |
| 771 | #endif |
| 772 | |
| 773 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 774 | * wma_set_priv_cfg() - set private config parameters |
| 775 | * @wma_handle: wma handle |
| 776 | * @privcmd: private command |
| 777 | * |
| 778 | * Return: 0 for success or error code |
| 779 | */ |
| 780 | static int32_t wma_set_priv_cfg(tp_wma_handle wma_handle, |
| 781 | wma_cli_set_cmd_t *privcmd) |
| 782 | { |
| 783 | int32_t ret = 0; |
| 784 | |
| 785 | switch (privcmd->param_id) { |
| 786 | case WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID: |
| 787 | ret = wma_set_txrx_fw_stats_level(wma_handle, |
| 788 | privcmd->param_vdev_id, |
| 789 | privcmd->param_value); |
| 790 | break; |
| 791 | case WMA_VDEV_TXRX_FWSTATS_RESET_CMDID: |
| 792 | ret = wma_txrx_fw_stats_reset(wma_handle, |
| 793 | privcmd->param_vdev_id, |
| 794 | privcmd->param_value); |
| 795 | break; |
| 796 | case WMI_STA_SMPS_FORCE_MODE_CMDID: |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 797 | ret = wma_set_mimops(wma_handle, |
| 798 | privcmd->param_vdev_id, |
| 799 | privcmd->param_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 800 | break; |
| 801 | case WMI_STA_SMPS_PARAM_CMDID: |
| 802 | wma_set_smps_params(wma_handle, privcmd->param_vdev_id, |
| 803 | privcmd->param_value); |
| 804 | break; |
| 805 | case WMA_VDEV_MCC_SET_TIME_LATENCY: |
| 806 | { |
| 807 | /* Extract first MCC adapter/vdev channel number and latency */ |
| 808 | uint8_t mcc_channel = privcmd->param_value & 0x000000FF; |
| 809 | uint8_t mcc_channel_latency = |
| 810 | (privcmd->param_value & 0x0000FF00) >> 8; |
| 811 | int ret = -1; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 812 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 813 | WMA_LOGD("%s: Parsed input: Channel #1:%d, latency:%dms", |
| 814 | __func__, mcc_channel, mcc_channel_latency); |
| 815 | ret = wma_set_mcc_channel_time_latency(wma_handle, |
| 816 | mcc_channel, |
| 817 | mcc_channel_latency); |
| 818 | } |
| 819 | break; |
| 820 | case WMA_VDEV_MCC_SET_TIME_QUOTA: |
| 821 | { |
| 822 | /* Extract the MCC 2 adapters/vdevs channel numbers and time |
| 823 | * quota value for the first adapter only (which is specified |
| 824 | * in iwpriv command. |
| 825 | */ |
| 826 | uint8_t adapter_2_chan_number = |
| 827 | privcmd->param_value & 0x000000FF; |
| 828 | uint8_t adapter_1_chan_number = |
| 829 | (privcmd->param_value & 0x0000FF00) >> 8; |
| 830 | uint8_t adapter_1_quota = |
| 831 | (privcmd->param_value & 0x00FF0000) >> 16; |
| 832 | int ret = -1; |
| 833 | |
| 834 | WMA_LOGD("%s: Parsed input: Channel #1:%d, Channel #2:%d, quota 1:%dms", |
| 835 | __func__, adapter_1_chan_number, |
| 836 | adapter_2_chan_number, adapter_1_quota); |
| 837 | |
| 838 | ret = wma_set_mcc_channel_time_quota(wma_handle, |
| 839 | adapter_1_chan_number, |
| 840 | adapter_1_quota, |
| 841 | adapter_2_chan_number); |
| 842 | } |
| 843 | break; |
| 844 | case WMA_VDEV_IBSS_SET_ATIM_WINDOW_SIZE: |
| 845 | { |
| 846 | wma_handle->wma_ibss_power_save_params.atimWindowLength = |
| 847 | privcmd->param_value; |
| 848 | WMA_LOGD("%s: IBSS power save ATIM Window = %d", |
| 849 | __func__, wma_handle->wma_ibss_power_save_params. |
| 850 | atimWindowLength); |
| 851 | } |
| 852 | break; |
| 853 | case WMA_VDEV_IBSS_SET_POWER_SAVE_ALLOWED: |
| 854 | { |
| 855 | wma_handle->wma_ibss_power_save_params.isPowerSaveAllowed = |
| 856 | privcmd->param_value; |
| 857 | WMA_LOGD("%s: IBSS is Power Save Allowed = %d", |
| 858 | __func__, wma_handle->wma_ibss_power_save_params. |
| 859 | isPowerSaveAllowed); |
| 860 | } |
| 861 | break; |
| 862 | case WMA_VDEV_IBSS_SET_POWER_COLLAPSE_ALLOWED: |
| 863 | { |
| 864 | wma_handle->wma_ibss_power_save_params. isPowerCollapseAllowed = |
| 865 | privcmd->param_value; |
| 866 | WMA_LOGD("%s: IBSS is Power Collapse Allowed = %d", |
| 867 | __func__, wma_handle->wma_ibss_power_save_params. |
| 868 | isPowerCollapseAllowed); |
| 869 | } |
| 870 | break; |
| 871 | case WMA_VDEV_IBSS_SET_AWAKE_ON_TX_RX: |
| 872 | { |
| 873 | wma_handle->wma_ibss_power_save_params.isAwakeonTxRxEnabled = |
| 874 | privcmd->param_value; |
| 875 | WMA_LOGD("%s: IBSS Power Save Awake on Tx/Rx Enabled = %d", |
| 876 | __func__, wma_handle->wma_ibss_power_save_params. |
| 877 | isAwakeonTxRxEnabled); |
| 878 | } |
| 879 | break; |
| 880 | case WMA_VDEV_IBSS_SET_INACTIVITY_TIME: |
| 881 | { |
| 882 | wma_handle->wma_ibss_power_save_params.inactivityCount = |
| 883 | privcmd->param_value; |
| 884 | WMA_LOGD("%s: IBSS Power Save Data Inactivity Count = %d", |
| 885 | __func__, wma_handle->wma_ibss_power_save_params. |
| 886 | inactivityCount); |
| 887 | } |
| 888 | break; |
| 889 | case WMA_VDEV_IBSS_SET_TXSP_END_INACTIVITY_TIME: |
| 890 | { |
| 891 | wma_handle->wma_ibss_power_save_params.txSPEndInactivityTime = |
| 892 | privcmd->param_value; |
| 893 | WMA_LOGD("%s: IBSS Power Save Transmit EOSP inactivity time out = %d", |
| 894 | __func__, wma_handle->wma_ibss_power_save_params. |
| 895 | txSPEndInactivityTime); |
| 896 | } |
| 897 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 898 | case WMA_VDEV_IBSS_PS_SET_WARMUP_TIME_SECS: |
| 899 | { |
| 900 | wma_handle->wma_ibss_power_save_params.ibssPsWarmupTime = |
| 901 | privcmd->param_value; |
| 902 | WMA_LOGD("%s: IBSS Power Save Warm Up Time in Seconds = %d", |
| 903 | __func__, wma_handle->wma_ibss_power_save_params. |
| 904 | ibssPsWarmupTime); |
| 905 | } |
| 906 | break; |
| 907 | case WMA_VDEV_IBSS_PS_SET_1RX_CHAIN_IN_ATIM_WINDOW: |
| 908 | { |
| 909 | wma_handle->wma_ibss_power_save_params.ibssPs1RxChainInAtimEnable |
| 910 | = privcmd->param_value; |
| 911 | WMA_LOGD("%s: IBSS Power Save single RX Chain Enable In ATIM = %d", |
| 912 | __func__, wma_handle->wma_ibss_power_save_params. |
| 913 | ibssPs1RxChainInAtimEnable); |
| 914 | } |
| 915 | break; |
| 916 | |
| 917 | case WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID: |
| 918 | { |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame] | 919 | wma_ipa_get_stat(); |
Yun Park | 637d648 | 2016-10-05 10:51:33 -0700 | [diff] [blame] | 920 | } |
| 921 | break; |
| 922 | |
| 923 | case WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID: |
| 924 | { |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame] | 925 | wma_ipa_uc_get_share_stats(privcmd); |
Yun Park | 637d648 | 2016-10-05 10:51:33 -0700 | [diff] [blame] | 926 | } |
| 927 | break; |
| 928 | |
| 929 | case WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID: |
| 930 | { |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame] | 931 | wma_ipa_uc_set_quota(privcmd); |
Yun Park | 327e781 | 2017-02-14 15:18:10 -0800 | [diff] [blame] | 932 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 933 | } |
| 934 | break; |
| 935 | |
| 936 | default: |
| 937 | WMA_LOGE("Invalid wma config command id:%d", privcmd->param_id); |
| 938 | ret = -EINVAL; |
| 939 | } |
| 940 | return ret; |
| 941 | } |
| 942 | |
| 943 | /** |
Kiran Kumar Lokere | 6d3a30d | 2018-01-15 18:18:29 -0800 | [diff] [blame] | 944 | * wma_set_dtim_period() - set dtim period to FW |
| 945 | * @wma: wma handle |
| 946 | * @dtim_params: dtim params |
| 947 | * |
| 948 | * Return: none |
| 949 | */ |
| 950 | static void wma_set_dtim_period(tp_wma_handle wma, |
| 951 | struct set_dtim_params *dtim_params) |
| 952 | { |
| 953 | struct wma_txrx_node *iface = |
| 954 | &wma->interfaces[dtim_params->session_id]; |
| 955 | if (!wma_is_vdev_valid(dtim_params->session_id)) { |
| 956 | WMA_LOGE("%s: invalid VDEV", __func__); |
| 957 | return; |
| 958 | } |
| 959 | WMA_LOGD("%s: set dtim_period %d", __func__, |
| 960 | dtim_params->dtim_period); |
| 961 | iface->dtimPeriod = dtim_params->dtim_period; |
| 962 | |
| 963 | } |
| 964 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 965 | * wma_set_modulated_dtim() - function to configure modulated dtim |
| 966 | * @wma: wma handle |
| 967 | * @privcmd: structure containing parameters |
| 968 | * |
| 969 | * This function configures the modulated dtim in firmware |
| 970 | * |
| 971 | * Return: none |
| 972 | */ |
| 973 | static void wma_set_modulated_dtim(tp_wma_handle wma, |
| 974 | wma_cli_set_cmd_t *privcmd) |
| 975 | { |
| 976 | uint8_t vdev_id = privcmd->param_vdev_id; |
| 977 | struct wma_txrx_node *iface = |
| 978 | &wma->interfaces[vdev_id]; |
| 979 | bool prev_dtim_enabled; |
| 980 | uint32_t listen_interval; |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 981 | QDF_STATUS ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 982 | |
| 983 | iface->alt_modulated_dtim = privcmd->param_value; |
| 984 | |
| 985 | prev_dtim_enabled = iface->alt_modulated_dtim_enabled; |
| 986 | |
| 987 | if (1 != privcmd->param_value) |
| 988 | iface->alt_modulated_dtim_enabled = true; |
| 989 | else |
| 990 | iface->alt_modulated_dtim_enabled = false; |
| 991 | |
| 992 | if ((true == iface->alt_modulated_dtim_enabled) || |
| 993 | (true == prev_dtim_enabled)) { |
| 994 | |
| 995 | listen_interval = iface->alt_modulated_dtim |
| 996 | * iface->dtimPeriod; |
| 997 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 998 | ret = wma_vdev_set_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 999 | privcmd->param_vdev_id, |
| 1000 | WMI_VDEV_PARAM_LISTEN_INTERVAL, |
| 1001 | listen_interval); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1002 | if (QDF_IS_STATUS_ERROR(ret)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1003 | /* Even if it fails, continue */ |
| 1004 | WMA_LOGW("Failed to set listen interval %d", |
| 1005 | listen_interval); |
| 1006 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1007 | ret = wma_vdev_set_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1008 | privcmd->param_vdev_id, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 1009 | WMI_VDEV_PARAM_DTIM_POLICY, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1010 | NORMAL_DTIM); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1011 | if (QDF_IS_STATUS_ERROR(ret)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1012 | WMA_LOGE("Failed to Set to Normal DTIM policy"); |
| 1013 | } |
| 1014 | } |
| 1015 | |
Mukul Sharma | 6398b25 | 2017-05-01 17:58:12 +0530 | [diff] [blame] | 1016 | /** |
| 1017 | * wma_override_listen_interval() - function to override static/ini based LI |
| 1018 | * @wma: wma handle |
| 1019 | * @privcmd: structure containing parameters |
| 1020 | * |
| 1021 | * This function override static/ini based LI in firmware |
| 1022 | * |
| 1023 | * Return: none |
| 1024 | */ |
| 1025 | static void wma_override_listen_interval(tp_wma_handle wma, |
| 1026 | wma_cli_set_cmd_t *privcmd) |
| 1027 | { |
| 1028 | uint8_t vdev_id = privcmd->param_vdev_id; |
| 1029 | struct wma_txrx_node *iface = |
| 1030 | &wma->interfaces[vdev_id]; |
| 1031 | u32 old_override_li, new_override_li, listen_interval; |
| 1032 | struct sAniSirGlobal *mac; |
| 1033 | QDF_STATUS ret; |
| 1034 | |
| 1035 | mac = cds_get_context(QDF_MODULE_ID_PE); |
| 1036 | if (!mac) { |
| 1037 | WMA_LOGE(FL("Failed to get mac context")); |
| 1038 | return; |
| 1039 | } |
| 1040 | |
| 1041 | old_override_li = iface->override_li; |
| 1042 | new_override_li = privcmd->param_value; |
| 1043 | iface->override_li = new_override_li; |
| 1044 | |
| 1045 | if (new_override_li && |
| 1046 | (new_override_li != old_override_li)) { |
| 1047 | listen_interval = new_override_li; |
| 1048 | } else if (!new_override_li && |
| 1049 | (new_override_li != old_override_li)) { |
| 1050 | /* Configure default LI as we do on resume */ |
| 1051 | if ((wlan_cfg_get_int(mac, WNI_CFG_LISTEN_INTERVAL, |
| 1052 | &listen_interval) != eSIR_SUCCESS)) { |
| 1053 | QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_ERROR, |
| 1054 | "Failed to get value for listen interval"); |
| 1055 | listen_interval = POWERSAVE_DEFAULT_LISTEN_INTERVAL; |
| 1056 | } |
| 1057 | } else { |
| 1058 | return; |
| 1059 | } |
| 1060 | |
| 1061 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 1062 | WMI_VDEV_PARAM_LISTEN_INTERVAL, |
| 1063 | listen_interval); |
| 1064 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 1065 | /* Even it fails continue Fw will take default LI */ |
| 1066 | WMA_LOGE("Failed to Set Listen Interval vdevId %d", |
| 1067 | vdev_id); |
| 1068 | } |
| 1069 | WMA_LOGD("%s: Set Listen Interval vdevId %d Listen Intv %d", |
| 1070 | __func__, vdev_id, listen_interval); |
| 1071 | ret = wma_vdev_set_param(wma->wmi_handle, |
| 1072 | privcmd->param_vdev_id, |
| 1073 | WMI_VDEV_PARAM_DTIM_POLICY, |
| 1074 | NORMAL_DTIM); |
| 1075 | if (QDF_IS_STATUS_ERROR(ret)) |
| 1076 | WMA_LOGE("Failed to Set to Normal DTIM policy"); |
| 1077 | |
| 1078 | } |
| 1079 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1080 | |
| 1081 | /** |
| 1082 | * wma_process_cli_set_cmd() - set parameters to fw |
| 1083 | * @wma: wma handle |
| 1084 | * @privcmd: command |
| 1085 | * |
| 1086 | * Return: none |
| 1087 | */ |
| 1088 | static void wma_process_cli_set_cmd(tp_wma_handle wma, |
| 1089 | wma_cli_set_cmd_t *privcmd) |
| 1090 | { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1091 | int vid = privcmd->param_vdev_id, pps_val = 0; |
| 1092 | QDF_STATUS ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1093 | struct wma_txrx_node *intr = wma->interfaces; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1094 | tpAniSirGlobal pMac = cds_get_context(QDF_MODULE_ID_PE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1095 | struct qpower_params *qparams = &intr[vid].config.qpower_params; |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1096 | struct pdev_params pdev_param; |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 1097 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 1098 | struct target_psoc_info *tgt_hdl; |
Kiran Kumar Lokere | 9f881ae | 2018-03-07 18:59:30 -0800 | [diff] [blame] | 1099 | struct sir_set_tx_rx_aggregation_size aggr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1100 | |
Jeff Johnson | adba396 | 2017-09-18 08:12:35 -0700 | [diff] [blame] | 1101 | WMA_LOGD("wmihandle %pK", wma->wmi_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1102 | |
| 1103 | if (NULL == pMac) { |
| 1104 | WMA_LOGE("%s: Failed to get pMac", __func__); |
| 1105 | return; |
| 1106 | } |
| 1107 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 1108 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma->psoc); |
| 1109 | if (!tgt_hdl) { |
| 1110 | WMA_LOGE("%s: target psoc info is NULL", __func__); |
| 1111 | return; |
| 1112 | } |
| 1113 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1114 | if (privcmd->param_id >= WMI_CMDID_MAX) { |
| 1115 | /* |
| 1116 | * This configuration setting is not done using any wmi |
| 1117 | * command, call appropriate handler. |
| 1118 | */ |
| 1119 | if (wma_set_priv_cfg(wma, privcmd)) |
| 1120 | WMA_LOGE("Failed to set wma priv congiuration"); |
| 1121 | return; |
| 1122 | } |
| 1123 | |
| 1124 | switch (privcmd->param_vp_dev) { |
| 1125 | case VDEV_CMD: |
Bhargav Shah | a89d3b4 | 2016-04-20 13:04:56 +0530 | [diff] [blame] | 1126 | if (!wma->interfaces[privcmd->param_vdev_id].is_vdev_valid) { |
| 1127 | WMA_LOGE("%s Vdev id is not valid", __func__); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 1128 | return; |
Bhargav Shah | a89d3b4 | 2016-04-20 13:04:56 +0530 | [diff] [blame] | 1129 | } |
| 1130 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1131 | WMA_LOGD("vdev id %d pid %d pval %d", privcmd->param_vdev_id, |
| 1132 | privcmd->param_id, privcmd->param_value); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1133 | ret = wma_vdev_set_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1134 | privcmd->param_vdev_id, |
| 1135 | privcmd->param_id, |
| 1136 | privcmd->param_value); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1137 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 1138 | WMA_LOGE("wma_vdev_set_param failed ret %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1139 | ret); |
| 1140 | return; |
| 1141 | } |
| 1142 | break; |
| 1143 | case PDEV_CMD: |
| 1144 | WMA_LOGD("pdev pid %d pval %d", privcmd->param_id, |
| 1145 | privcmd->param_value); |
| 1146 | if ((privcmd->param_id == WMI_PDEV_PARAM_RX_CHAIN_MASK) || |
| 1147 | (privcmd->param_id == WMI_PDEV_PARAM_TX_CHAIN_MASK)) { |
Jiachao Wu | 08719b0 | 2017-07-05 13:05:34 +0800 | [diff] [blame] | 1148 | if (QDF_STATUS_SUCCESS != |
| 1149 | wma_check_txrx_chainmask( |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 1150 | target_if_get_num_rf_chains(tgt_hdl), |
Jiachao Wu | 08719b0 | 2017-07-05 13:05:34 +0800 | [diff] [blame] | 1151 | privcmd->param_value)) { |
| 1152 | WMA_LOGD("Chainmask value is invalid"); |
| 1153 | return; |
| 1154 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1155 | } |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1156 | pdev_param.param_id = privcmd->param_id; |
| 1157 | pdev_param.param_value = privcmd->param_value; |
| 1158 | ret = wmi_unified_pdev_param_send(wma->wmi_handle, |
| 1159 | &pdev_param, |
| 1160 | WMA_WILDCARD_PDEV_ID); |
| 1161 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 1162 | WMA_LOGE("wma_vdev_set_param failed ret %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1163 | ret); |
| 1164 | return; |
| 1165 | } |
| 1166 | break; |
| 1167 | case GEN_CMD: |
| 1168 | { |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1169 | struct cdp_vdev *vdev = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1170 | struct wma_txrx_node *intr = wma->interfaces; |
| 1171 | |
| 1172 | vdev = wma_find_vdev_by_id(wma, privcmd->param_vdev_id); |
| 1173 | if (!vdev) { |
| 1174 | WMA_LOGE("%s:Invalid vdev handle", __func__); |
| 1175 | return; |
| 1176 | } |
| 1177 | |
| 1178 | WMA_LOGD("gen pid %d pval %d", privcmd->param_id, |
| 1179 | privcmd->param_value); |
| 1180 | |
| 1181 | switch (privcmd->param_id) { |
| 1182 | case GEN_VDEV_PARAM_AMPDU: |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 1183 | if (soc) { |
| 1184 | ret = cdp_aggr_cfg(soc, vdev, |
| 1185 | privcmd->param_value, 0); |
| 1186 | if (ret) |
| 1187 | WMA_LOGE("cdp_aggr_cfg set ampdu failed ret %d", |
| 1188 | ret); |
| 1189 | else |
| 1190 | intr[privcmd->param_vdev_id].config. |
| 1191 | ampdu = privcmd->param_value; |
Kiran Kumar Lokere | 9f881ae | 2018-03-07 18:59:30 -0800 | [diff] [blame] | 1192 | aggr.vdev_id = vid; |
| 1193 | aggr.tx_aggregation_size = |
| 1194 | privcmd->param_value; |
| 1195 | aggr.rx_aggregation_size = |
| 1196 | privcmd->param_value; |
| 1197 | ret = wma_set_tx_rx_aggregation_size(&aggr); |
| 1198 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 1199 | WMA_LOGE("set_aggr_size failed ret %d", |
| 1200 | ret); |
| 1201 | return; |
| 1202 | } |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 1203 | } else { |
| 1204 | WMA_LOGE("%s:SOC context is NULL", __func__); |
| 1205 | return; |
| 1206 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1207 | break; |
| 1208 | case GEN_VDEV_PARAM_AMSDU: |
Deepak Dhamdhere | 612392c | 2016-08-28 02:56:51 -0700 | [diff] [blame] | 1209 | /* |
| 1210 | * Firmware currently does not support set operation |
| 1211 | * for AMSDU. It may cause crash if the configuration |
| 1212 | * is sent to firmware. |
| 1213 | * Firmware enhancement will advertise a service bit |
| 1214 | * to enable AMSDU configuration through WMI. Then |
| 1215 | * add the WMI command to configure AMSDU parameter. |
| 1216 | * For the older chipset that does not advertise the |
| 1217 | * service bit, enable the following legacy code: |
| 1218 | * ol_txrx_aggr_cfg(vdev, 0, privcmd->param_value); |
| 1219 | * intr[privcmd->param_vdev_id].config.amsdu = |
| 1220 | * privcmd->param_value; |
| 1221 | */ |
| 1222 | WMA_LOGE("SET GEN_VDEV_PARAM_AMSDU command is currently not supported"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1223 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1224 | case GEN_PARAM_CRASH_INJECT: |
Rajeev Kumar | 0a9901b | 2015-12-15 15:59:19 -0800 | [diff] [blame] | 1225 | if (QDF_GLOBAL_FTM_MODE == cds_get_conparam()) |
| 1226 | WMA_LOGE("Crash inject not allowed in FTM mode"); |
| 1227 | else |
| 1228 | ret = wma_crash_inject(wma, |
| 1229 | privcmd->param_value, |
| 1230 | privcmd->param_sec_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1231 | break; |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 1232 | case GEN_PARAM_CAPTURE_TSF: |
| 1233 | ret = wma_capture_tsf(wma, privcmd->param_value); |
| 1234 | break; |
| 1235 | case GEN_PARAM_RESET_TSF_GPIO: |
| 1236 | ret = wma_reset_tsf_gpio(wma, privcmd->param_value); |
| 1237 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1238 | case GEN_PARAM_MODULATED_DTIM: |
| 1239 | wma_set_modulated_dtim(wma, privcmd); |
| 1240 | break; |
Mukul Sharma | 6398b25 | 2017-05-01 17:58:12 +0530 | [diff] [blame] | 1241 | case GEN_PARAM_LISTEN_INTERVAL: |
| 1242 | wma_override_listen_interval(wma, privcmd); |
| 1243 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1244 | default: |
| 1245 | WMA_LOGE("Invalid param id 0x%x", |
| 1246 | privcmd->param_id); |
| 1247 | break; |
| 1248 | } |
| 1249 | break; |
| 1250 | } |
| 1251 | case DBG_CMD: |
| 1252 | WMA_LOGD("dbg pid %d pval %d", privcmd->param_id, |
| 1253 | privcmd->param_value); |
| 1254 | switch (privcmd->param_id) { |
| 1255 | case WMI_DBGLOG_LOG_LEVEL: |
| 1256 | ret = dbglog_set_log_lvl(wma->wmi_handle, |
| 1257 | privcmd->param_value); |
| 1258 | if (ret) |
| 1259 | WMA_LOGE("dbglog_set_log_lvl failed ret %d", |
| 1260 | ret); |
| 1261 | break; |
| 1262 | case WMI_DBGLOG_VAP_ENABLE: |
| 1263 | ret = dbglog_vap_log_enable(wma->wmi_handle, |
| 1264 | privcmd->param_value, true); |
| 1265 | if (ret) |
| 1266 | WMA_LOGE("dbglog_vap_log_enable failed ret %d", |
| 1267 | ret); |
| 1268 | break; |
| 1269 | case WMI_DBGLOG_VAP_DISABLE: |
| 1270 | ret = dbglog_vap_log_enable(wma->wmi_handle, |
| 1271 | privcmd->param_value, false); |
| 1272 | if (ret) |
| 1273 | WMA_LOGE("dbglog_vap_log_enable failed ret %d", |
| 1274 | ret); |
| 1275 | break; |
| 1276 | case WMI_DBGLOG_MODULE_ENABLE: |
| 1277 | ret = dbglog_module_log_enable(wma->wmi_handle, |
| 1278 | privcmd->param_value, true); |
| 1279 | if (ret) |
| 1280 | WMA_LOGE("dbglog_module_log_enable failed ret %d", |
| 1281 | ret); |
| 1282 | break; |
| 1283 | case WMI_DBGLOG_MODULE_DISABLE: |
| 1284 | ret = dbglog_module_log_enable(wma->wmi_handle, |
| 1285 | privcmd->param_value, false); |
| 1286 | if (ret) |
| 1287 | WMA_LOGE("dbglog_module_log_enable failed ret %d", |
| 1288 | ret); |
| 1289 | break; |
| 1290 | case WMI_DBGLOG_MOD_LOG_LEVEL: |
| 1291 | ret = dbglog_set_mod_log_lvl(wma->wmi_handle, |
| 1292 | privcmd->param_value); |
| 1293 | if (ret) |
| 1294 | WMA_LOGE("dbglog_module_log_enable failed ret %d", |
| 1295 | ret); |
| 1296 | break; |
| 1297 | case WMI_DBGLOG_TYPE: |
| 1298 | ret = dbglog_parser_type_init(wma->wmi_handle, |
| 1299 | privcmd->param_value); |
| 1300 | if (ret) |
| 1301 | WMA_LOGE("dbglog_parser_type_init failed ret %d", |
| 1302 | ret); |
| 1303 | break; |
| 1304 | case WMI_DBGLOG_REPORT_ENABLE: |
| 1305 | ret = dbglog_report_enable(wma->wmi_handle, |
| 1306 | privcmd->param_value); |
| 1307 | if (ret) |
| 1308 | WMA_LOGE("dbglog_report_enable failed ret %d", |
| 1309 | ret); |
| 1310 | break; |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1311 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 1312 | ret = wma_unified_fw_profiling_cmd(wma->wmi_handle, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1313 | WMI_WLAN_PROFILE_TRIGGER_CMDID, |
| 1314 | privcmd->param_value, 0); |
| 1315 | if (ret) |
| 1316 | WMA_LOGE("Profile cmd failed for %d ret %d", |
| 1317 | WMI_WLAN_PROFILE_TRIGGER_CMDID, ret); |
| 1318 | break; |
| 1319 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 1320 | ret = wma_unified_fw_profiling_cmd(wma->wmi_handle, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1321 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 1322 | privcmd->param_value, |
| 1323 | privcmd->param_sec_value); |
| 1324 | if (ret) |
| 1325 | WMA_LOGE("Profile cmd failed for %d ret %d", |
| 1326 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 1327 | ret); |
| 1328 | break; |
| 1329 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 1330 | ret = wma_unified_fw_profiling_cmd(wma->wmi_handle, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1331 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 1332 | privcmd->param_value, |
| 1333 | privcmd->param_sec_value); |
| 1334 | if (ret) |
| 1335 | WMA_LOGE("Profile cmd failed for %d ret %d", |
| 1336 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 1337 | ret); |
| 1338 | break; |
| 1339 | case WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID: |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 1340 | ret = wma_unified_fw_profiling_cmd(wma->wmi_handle, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1341 | WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID, |
| 1342 | 0, 0); |
| 1343 | if (ret) |
| 1344 | WMA_LOGE("Profile cmd failed for %d ret %d", |
| 1345 | WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID, |
| 1346 | ret); |
| 1347 | break; |
| 1348 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 1349 | ret = wma_unified_fw_profiling_cmd(wma->wmi_handle, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1350 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 1351 | 0, 0); |
| 1352 | if (ret) |
| 1353 | WMA_LOGE("Profile cmd failed for %d ret %d", |
| 1354 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 1355 | ret); |
| 1356 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1357 | case WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID: |
| 1358 | /* Set the Green AP */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1359 | ret = wmi_unified_green_ap_ps_send |
| 1360 | (wma->wmi_handle, privcmd->param_value, |
| 1361 | WMA_WILDCARD_PDEV_ID); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1362 | if (ret) { |
| 1363 | WMA_LOGE("Set GreenAP Failed val %d", |
| 1364 | privcmd->param_value); |
| 1365 | } |
| 1366 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1367 | |
| 1368 | default: |
| 1369 | WMA_LOGE("Invalid param id 0x%x", privcmd->param_id); |
| 1370 | break; |
| 1371 | } |
| 1372 | break; |
| 1373 | case PPS_CMD: |
| 1374 | WMA_LOGD("dbg pid %d pval %d", privcmd->param_id, |
| 1375 | privcmd->param_value); |
| 1376 | switch (privcmd->param_id) { |
| 1377 | |
| 1378 | case WMI_VDEV_PPS_PAID_MATCH: |
| 1379 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1380 | (PKT_PWR_SAVE_PAID_MATCH & 0xffff); |
| 1381 | intr[vid].config.pps_params.paid_match_enable = |
| 1382 | privcmd->param_value; |
| 1383 | break; |
| 1384 | case WMI_VDEV_PPS_GID_MATCH: |
| 1385 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1386 | (PKT_PWR_SAVE_GID_MATCH & 0xffff); |
| 1387 | intr[vid].config.pps_params.gid_match_enable = |
| 1388 | privcmd->param_value; |
| 1389 | break; |
| 1390 | case WMI_VDEV_PPS_EARLY_TIM_CLEAR: |
| 1391 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1392 | (PKT_PWR_SAVE_EARLY_TIM_CLEAR & 0xffff); |
| 1393 | intr[vid].config.pps_params.tim_clear = |
| 1394 | privcmd->param_value; |
| 1395 | break; |
| 1396 | case WMI_VDEV_PPS_EARLY_DTIM_CLEAR: |
| 1397 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1398 | (PKT_PWR_SAVE_EARLY_DTIM_CLEAR & 0xffff); |
| 1399 | intr[vid].config.pps_params.dtim_clear = |
| 1400 | privcmd->param_value; |
| 1401 | break; |
| 1402 | case WMI_VDEV_PPS_EOF_PAD_DELIM: |
| 1403 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1404 | (PKT_PWR_SAVE_EOF_PAD_DELIM & 0xffff); |
| 1405 | intr[vid].config.pps_params.eof_delim = |
| 1406 | privcmd->param_value; |
| 1407 | break; |
| 1408 | case WMI_VDEV_PPS_MACADDR_MISMATCH: |
| 1409 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1410 | (PKT_PWR_SAVE_MACADDR_MISMATCH & 0xffff); |
| 1411 | intr[vid].config.pps_params.mac_match = |
| 1412 | privcmd->param_value; |
| 1413 | break; |
| 1414 | case WMI_VDEV_PPS_DELIM_CRC_FAIL: |
| 1415 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1416 | (PKT_PWR_SAVE_DELIM_CRC_FAIL & 0xffff); |
| 1417 | intr[vid].config.pps_params.delim_fail = |
| 1418 | privcmd->param_value; |
| 1419 | break; |
| 1420 | case WMI_VDEV_PPS_GID_NSTS_ZERO: |
| 1421 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1422 | (PKT_PWR_SAVE_GID_NSTS_ZERO & 0xffff); |
| 1423 | intr[vid].config.pps_params.nsts_zero = |
| 1424 | privcmd->param_value; |
| 1425 | break; |
| 1426 | case WMI_VDEV_PPS_RSSI_CHECK: |
| 1427 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1428 | (PKT_PWR_SAVE_RSSI_CHECK & 0xffff); |
| 1429 | intr[vid].config.pps_params.rssi_chk = |
| 1430 | privcmd->param_value; |
| 1431 | break; |
| 1432 | case WMI_VDEV_PPS_5G_EBT: |
| 1433 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1434 | (PKT_PWR_SAVE_5G_EBT & 0xffff); |
| 1435 | intr[vid].config.pps_params.ebt_5g = |
| 1436 | privcmd->param_value; |
| 1437 | break; |
| 1438 | default: |
| 1439 | WMA_LOGE("Invalid param id 0x%x", privcmd->param_id); |
| 1440 | break; |
| 1441 | } |
| 1442 | break; |
| 1443 | |
| 1444 | case QPOWER_CMD: |
| 1445 | WMA_LOGD("QPOWER CLI CMD pid %d pval %d", privcmd->param_id, |
| 1446 | privcmd->param_value); |
| 1447 | switch (privcmd->param_id) { |
| 1448 | case WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT: |
| 1449 | WMA_LOGD("QPOWER CLI CMD:Ps Poll Cnt val %d", |
| 1450 | privcmd->param_value); |
| 1451 | /* Set the QPower Ps Poll Count */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1452 | ret = wma_unified_set_sta_ps_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1453 | vid, WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT, |
| 1454 | privcmd->param_value); |
| 1455 | if (ret) { |
| 1456 | WMA_LOGE("Set Q-PsPollCnt Failed vdevId %d val %d", |
| 1457 | vid, privcmd->param_value); |
| 1458 | } else { |
| 1459 | qparams->max_ps_poll_cnt = privcmd->param_value; |
| 1460 | } |
| 1461 | break; |
| 1462 | case WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE: |
| 1463 | WMA_LOGD("QPOWER CLI CMD:Max Tx Before wake val %d", |
| 1464 | privcmd->param_value); |
| 1465 | /* Set the QPower Max Tx Before Wake */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1466 | ret = wma_unified_set_sta_ps_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1467 | vid, WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE, |
| 1468 | privcmd->param_value); |
| 1469 | if (ret) { |
| 1470 | WMA_LOGE("Set Q-MaxTxBefWake Failed vId %d val %d", |
| 1471 | vid, privcmd->param_value); |
| 1472 | } else { |
| 1473 | qparams->max_tx_before_wake = |
| 1474 | privcmd->param_value; |
| 1475 | } |
| 1476 | break; |
| 1477 | case WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL: |
| 1478 | WMA_LOGD("QPOWER CLI CMD:Ps Poll Wake Inv val %d", |
| 1479 | privcmd->param_value); |
| 1480 | /* Set the QPower Spec Ps Poll Wake Inv */ |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 1481 | ret = wma_unified_set_sta_ps_param(wma->wmi_handle, vid, |
| 1482 | WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1483 | privcmd->param_value); |
| 1484 | if (ret) { |
| 1485 | WMA_LOGE("Set Q-PsPoll WakeIntv Failed vId %d val %d", |
| 1486 | vid, privcmd->param_value); |
| 1487 | } else { |
| 1488 | qparams->spec_ps_poll_wake_interval = |
| 1489 | privcmd->param_value; |
| 1490 | } |
| 1491 | break; |
| 1492 | case WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL: |
| 1493 | WMA_LOGD("QPOWER CLI CMD:Spec NoData Ps Poll val %d", |
| 1494 | privcmd->param_value); |
| 1495 | /* Set the QPower Spec NoData PsPoll */ |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 1496 | ret = wma_unified_set_sta_ps_param(wma->wmi_handle, vid, |
| 1497 | WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1498 | privcmd->param_value); |
| 1499 | if (ret) { |
| 1500 | WMA_LOGE("Set Q-SpecNoDataPsPoll Failed vId %d val %d", |
| 1501 | vid, privcmd->param_value); |
| 1502 | } else { |
| 1503 | qparams->max_spec_nodata_ps_poll = |
| 1504 | privcmd->param_value; |
| 1505 | } |
| 1506 | break; |
| 1507 | |
| 1508 | default: |
| 1509 | WMA_LOGE("Invalid param id 0x%x", privcmd->param_id); |
| 1510 | break; |
| 1511 | } |
| 1512 | break; |
| 1513 | case GTX_CMD: |
| 1514 | WMA_LOGD("vdev id %d pid %d pval %d", privcmd->param_vdev_id, |
| 1515 | privcmd->param_id, privcmd->param_value); |
| 1516 | switch (privcmd->param_id) { |
| 1517 | case WMI_VDEV_PARAM_GTX_HT_MCS: |
| 1518 | intr[vid].config.gtx_info.gtxRTMask[0] = |
| 1519 | privcmd->param_value; |
| 1520 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1521 | privcmd->param_vdev_id, |
| 1522 | &intr[vid].config.gtx_info); |
| 1523 | break; |
| 1524 | case WMI_VDEV_PARAM_GTX_VHT_MCS: |
| 1525 | intr[vid].config.gtx_info.gtxRTMask[1] = |
| 1526 | privcmd->param_value; |
| 1527 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1528 | privcmd->param_vdev_id, |
| 1529 | &intr[vid].config.gtx_info); |
| 1530 | break; |
| 1531 | |
| 1532 | case WMI_VDEV_PARAM_GTX_USR_CFG: |
| 1533 | intr[vid].config.gtx_info.gtxUsrcfg = |
| 1534 | privcmd->param_value; |
| 1535 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1536 | privcmd->param_vdev_id, |
| 1537 | &intr[vid].config.gtx_info); |
| 1538 | break; |
| 1539 | |
| 1540 | case WMI_VDEV_PARAM_GTX_THRE: |
| 1541 | intr[vid].config.gtx_info.gtxPERThreshold = |
| 1542 | privcmd->param_value; |
| 1543 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1544 | privcmd->param_vdev_id, |
| 1545 | &intr[vid].config.gtx_info); |
| 1546 | break; |
| 1547 | |
| 1548 | case WMI_VDEV_PARAM_GTX_MARGIN: |
| 1549 | intr[vid].config.gtx_info.gtxPERMargin = |
| 1550 | privcmd->param_value; |
| 1551 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1552 | privcmd->param_vdev_id, |
| 1553 | &intr[vid].config.gtx_info); |
| 1554 | break; |
| 1555 | |
| 1556 | case WMI_VDEV_PARAM_GTX_STEP: |
| 1557 | intr[vid].config.gtx_info.gtxTPCstep = |
| 1558 | privcmd->param_value; |
| 1559 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1560 | privcmd->param_vdev_id, |
| 1561 | &intr[vid].config.gtx_info); |
| 1562 | break; |
| 1563 | |
| 1564 | case WMI_VDEV_PARAM_GTX_MINTPC: |
| 1565 | intr[vid].config.gtx_info.gtxTPCMin = |
| 1566 | privcmd->param_value; |
| 1567 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1568 | privcmd->param_vdev_id, |
| 1569 | &intr[vid].config.gtx_info); |
| 1570 | break; |
| 1571 | |
| 1572 | case WMI_VDEV_PARAM_GTX_BW_MASK: |
| 1573 | intr[vid].config.gtx_info.gtxBWMask = |
| 1574 | privcmd->param_value; |
| 1575 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1576 | privcmd->param_vdev_id, |
| 1577 | &intr[vid].config.gtx_info); |
| 1578 | if (ret) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 1579 | WMA_LOGE("wma_vdev_set_param failed ret %d", |
| 1580 | ret); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1581 | return; |
| 1582 | } |
| 1583 | break; |
| 1584 | default: |
| 1585 | break; |
| 1586 | } |
| 1587 | break; |
| 1588 | |
| 1589 | default: |
| 1590 | WMA_LOGE("Invalid vpdev command id"); |
| 1591 | } |
| 1592 | if (1 == privcmd->param_vp_dev) { |
| 1593 | switch (privcmd->param_id) { |
| 1594 | case WMI_VDEV_PARAM_NSS: |
| 1595 | intr[vid].config.nss = privcmd->param_value; |
| 1596 | break; |
| 1597 | case WMI_VDEV_PARAM_LDPC: |
| 1598 | intr[vid].config.ldpc = privcmd->param_value; |
| 1599 | break; |
| 1600 | case WMI_VDEV_PARAM_TX_STBC: |
| 1601 | intr[vid].config.tx_stbc = privcmd->param_value; |
| 1602 | break; |
| 1603 | case WMI_VDEV_PARAM_RX_STBC: |
| 1604 | intr[vid].config.rx_stbc = privcmd->param_value; |
| 1605 | break; |
| 1606 | case WMI_VDEV_PARAM_SGI: |
| 1607 | intr[vid].config.shortgi = privcmd->param_value; |
| 1608 | break; |
| 1609 | case WMI_VDEV_PARAM_ENABLE_RTSCTS: |
| 1610 | intr[vid].config.rtscts_en = privcmd->param_value; |
| 1611 | break; |
| 1612 | case WMI_VDEV_PARAM_CHWIDTH: |
| 1613 | intr[vid].config.chwidth = privcmd->param_value; |
| 1614 | break; |
| 1615 | case WMI_VDEV_PARAM_FIXED_RATE: |
| 1616 | intr[vid].config.tx_rate = privcmd->param_value; |
| 1617 | break; |
| 1618 | case WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE: |
| 1619 | intr[vid].config.erx_adjust = privcmd->param_value; |
| 1620 | break; |
| 1621 | case WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM: |
| 1622 | intr[vid].config.erx_bmiss_num = privcmd->param_value; |
| 1623 | break; |
| 1624 | case WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE: |
| 1625 | intr[vid].config.erx_bmiss_cycle = privcmd->param_value; |
| 1626 | break; |
| 1627 | case WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP: |
| 1628 | intr[vid].config.erx_slop_step = privcmd->param_value; |
| 1629 | break; |
| 1630 | case WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP: |
| 1631 | intr[vid].config.erx_init_slop = privcmd->param_value; |
| 1632 | break; |
| 1633 | case WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE: |
| 1634 | intr[vid].config.erx_adj_pause = privcmd->param_value; |
| 1635 | break; |
| 1636 | case WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE: |
| 1637 | intr[vid].config.erx_dri_sample = privcmd->param_value; |
| 1638 | break; |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 1639 | case WMI_VDEV_PARAM_HE_DCM: |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 1640 | case WMI_VDEV_PARAM_HE_RANGE_EXT: |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 1641 | wma_set_he_vdev_param(&intr[vid], privcmd->param_id, |
| 1642 | privcmd->param_value); |
| 1643 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1644 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 1645 | WMA_LOGE("Invalid wma_cli_set vdev command/Not yet implemented 0x%x", |
| 1646 | privcmd->param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1647 | break; |
| 1648 | } |
| 1649 | } else if (2 == privcmd->param_vp_dev) { |
| 1650 | switch (privcmd->param_id) { |
| 1651 | case WMI_PDEV_PARAM_ANI_ENABLE: |
| 1652 | wma->pdevconfig.ani_enable = privcmd->param_value; |
| 1653 | break; |
| 1654 | case WMI_PDEV_PARAM_ANI_POLL_PERIOD: |
| 1655 | wma->pdevconfig.ani_poll_len = privcmd->param_value; |
| 1656 | break; |
| 1657 | case WMI_PDEV_PARAM_ANI_LISTEN_PERIOD: |
| 1658 | wma->pdevconfig.ani_listen_len = privcmd->param_value; |
| 1659 | break; |
| 1660 | case WMI_PDEV_PARAM_ANI_OFDM_LEVEL: |
| 1661 | wma->pdevconfig.ani_ofdm_level = privcmd->param_value; |
| 1662 | break; |
| 1663 | case WMI_PDEV_PARAM_ANI_CCK_LEVEL: |
| 1664 | wma->pdevconfig.ani_cck_level = privcmd->param_value; |
| 1665 | break; |
| 1666 | case WMI_PDEV_PARAM_DYNAMIC_BW: |
| 1667 | wma->pdevconfig.cwmenable = privcmd->param_value; |
| 1668 | break; |
| 1669 | case WMI_PDEV_PARAM_CTS_CBW: |
| 1670 | wma->pdevconfig.cts_cbw = privcmd->param_value; |
| 1671 | break; |
| 1672 | case WMI_PDEV_PARAM_TX_CHAIN_MASK: |
| 1673 | wma->pdevconfig.txchainmask = privcmd->param_value; |
| 1674 | break; |
| 1675 | case WMI_PDEV_PARAM_RX_CHAIN_MASK: |
| 1676 | wma->pdevconfig.rxchainmask = privcmd->param_value; |
| 1677 | break; |
| 1678 | case WMI_PDEV_PARAM_BURST_ENABLE: |
| 1679 | wma->pdevconfig.burst_enable = privcmd->param_value; |
| 1680 | if ((wma->pdevconfig.burst_enable == 1) && |
| 1681 | (wma->pdevconfig.burst_dur == 0)) |
| 1682 | wma->pdevconfig.burst_dur = |
| 1683 | WMA_DEFAULT_SIFS_BURST_DURATION; |
| 1684 | else if (wma->pdevconfig.burst_enable == 0) |
| 1685 | wma->pdevconfig.burst_dur = 0; |
| 1686 | break; |
| 1687 | case WMI_PDEV_PARAM_BURST_DUR: |
| 1688 | wma->pdevconfig.burst_dur = privcmd->param_value; |
| 1689 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1690 | case WMI_PDEV_PARAM_TXPOWER_LIMIT2G: |
| 1691 | wma->pdevconfig.txpow2g = privcmd->param_value; |
| 1692 | if ((pMac->roam.configParam.bandCapability == |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1693 | BAND_ALL) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1694 | (pMac->roam.configParam.bandCapability == |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1695 | BAND_2G)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1696 | if (cfg_set_int(pMac, |
| 1697 | WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 1698 | privcmd->param_value) != |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 1699 | eSIR_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1700 | WMA_LOGE("could not set WNI_CFG_CURRENT_TX_POWER_LEVEL"); |
| 1701 | |
| 1702 | } else { |
| 1703 | WMA_LOGE("Current band is not 2G"); |
| 1704 | } |
| 1705 | break; |
| 1706 | case WMI_PDEV_PARAM_TXPOWER_LIMIT5G: |
| 1707 | wma->pdevconfig.txpow5g = privcmd->param_value; |
| 1708 | if ((pMac->roam.configParam.bandCapability == |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1709 | BAND_ALL) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1710 | (pMac->roam.configParam.bandCapability == |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1711 | BAND_5G)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1712 | if (cfg_set_int(pMac, |
| 1713 | WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 1714 | privcmd->param_value) != |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 1715 | eSIR_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1716 | WMA_LOGE("could not set WNI_CFG_CURRENT_TX_POWER_LEVEL"); |
| 1717 | |
| 1718 | } else { |
| 1719 | WMA_LOGE("Current band is not 5G"); |
| 1720 | } |
| 1721 | break; |
| 1722 | default: |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 1723 | WMA_LOGD("Invalid wma_cli_set pdev command/Not yet implemented 0x%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1724 | privcmd->param_id); |
| 1725 | break; |
| 1726 | } |
| 1727 | } else if (5 == privcmd->param_vp_dev) { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1728 | ret = wma_vdev_set_param(wma->wmi_handle, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 1729 | privcmd->param_vdev_id, |
| 1730 | WMI_VDEV_PARAM_PACKET_POWERSAVE, |
| 1731 | pps_val); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1732 | if (ret) |
| 1733 | WMA_LOGE("Failed to send wmi packet power save cmd"); |
| 1734 | else |
| 1735 | WMA_LOGD("Sent packet power save cmd %d value %x to target", |
| 1736 | privcmd->param_id, pps_val); |
| 1737 | } |
| 1738 | } |
| 1739 | |
Dustin Brown | 0555718 | 2017-10-12 14:44:49 -0700 | [diff] [blame] | 1740 | uint32_t wma_critical_events_in_flight(void) |
| 1741 | { |
| 1742 | t_wma_handle *wma; |
| 1743 | |
| 1744 | wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 1745 | if (!wma) |
| 1746 | return 0; |
| 1747 | |
| 1748 | return qdf_atomic_read(&wma->critical_events_in_flight); |
| 1749 | } |
| 1750 | |
| 1751 | static bool wma_event_is_critical(uint32_t event_id) |
| 1752 | { |
| 1753 | switch (event_id) { |
| 1754 | case WMI_ROAM_SYNCH_EVENTID: |
| 1755 | return true; |
| 1756 | default: |
| 1757 | return false; |
| 1758 | } |
| 1759 | } |
| 1760 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1761 | /** |
| 1762 | * wma_process_fw_event() - process any fw event |
| 1763 | * @wma: wma handle |
| 1764 | * @buf: fw event buffer |
| 1765 | * |
| 1766 | * This function process any fw event to serialize it through mc thread. |
| 1767 | * |
| 1768 | * Return: none |
| 1769 | */ |
| 1770 | static int wma_process_fw_event(tp_wma_handle wma, |
| 1771 | wma_process_fw_event_params *buf) |
| 1772 | { |
| 1773 | struct wmi_unified *wmi_handle = (struct wmi_unified *)buf->wmi_handle; |
Dustin Brown | 0555718 | 2017-10-12 14:44:49 -0700 | [diff] [blame] | 1774 | uint32_t event_id = WMI_GET_FIELD(qdf_nbuf_data(buf->evt_buf), |
| 1775 | WMI_CMD_HDR, COMMANDID); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1776 | |
| 1777 | wmi_process_fw_event(wmi_handle, buf->evt_buf); |
Dustin Brown | 0555718 | 2017-10-12 14:44:49 -0700 | [diff] [blame] | 1778 | |
| 1779 | if (wma_event_is_critical(event_id)) |
| 1780 | qdf_atomic_dec(&wma->critical_events_in_flight); |
| 1781 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1782 | return 0; |
| 1783 | } |
| 1784 | |
| 1785 | /** |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1786 | * wmi_process_fw_event_tasklet_ctx() - process in tasklet context |
| 1787 | * @ctx: handle to wmi |
| 1788 | * @ev: wmi event buffer |
| 1789 | * |
| 1790 | * Event process by below function will be in tasket context, |
| 1791 | * need to use this method only for time sensitive functions. |
| 1792 | * |
| 1793 | * Return: none |
| 1794 | */ |
| 1795 | static int wma_process_fw_event_tasklet_ctx(void *ctx, void *ev) |
| 1796 | { |
| 1797 | wmi_process_fw_event(ctx, ev); |
| 1798 | |
| 1799 | return 0; |
| 1800 | } |
| 1801 | |
| 1802 | /** |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 1803 | * wma_process_hal_pwr_dbg_cmd() - send hal pwr dbg cmd to fw. |
| 1804 | * @handle: wma handle |
| 1805 | * @sir_pwr_dbg_params: unit test command |
| 1806 | * |
| 1807 | * This function send unit test command to fw. |
| 1808 | * |
| 1809 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 1810 | */ |
| 1811 | QDF_STATUS wma_process_hal_pwr_dbg_cmd(WMA_HANDLE handle, |
| 1812 | struct sir_mac_pwr_dbg_cmd * |
| 1813 | sir_pwr_dbg_params) |
| 1814 | { |
| 1815 | tp_wma_handle wma_handle = (tp_wma_handle)handle; |
| 1816 | int i; |
| 1817 | struct wmi_power_dbg_params wmi_pwr_dbg_params; |
| 1818 | QDF_STATUS status; |
| 1819 | |
| 1820 | if (!sir_pwr_dbg_params) { |
| 1821 | WMA_LOGE("%s: sir_pwr_dbg_params is null", __func__); |
| 1822 | return QDF_STATUS_E_INVAL; |
| 1823 | } |
| 1824 | wmi_pwr_dbg_params.module_id = sir_pwr_dbg_params->module_id; |
| 1825 | wmi_pwr_dbg_params.pdev_id = sir_pwr_dbg_params->pdev_id; |
| 1826 | wmi_pwr_dbg_params.num_args = sir_pwr_dbg_params->num_args; |
| 1827 | |
| 1828 | for (i = 0; i < wmi_pwr_dbg_params.num_args; i++) |
| 1829 | wmi_pwr_dbg_params.args[i] = sir_pwr_dbg_params->args[i]; |
| 1830 | |
| 1831 | status = wmi_unified_send_power_dbg_cmd(wma_handle->wmi_handle, |
| 1832 | &wmi_pwr_dbg_params); |
| 1833 | |
| 1834 | return status; |
| 1835 | } |
| 1836 | |
Houston Hoffman | b6084f1 | 2017-05-30 19:24:07 -0700 | [diff] [blame] | 1837 | static void wma_discard_fw_event(struct scheduler_msg *msg) |
| 1838 | { |
Will Huang | 9323e85 | 2018-02-02 17:55:15 +0800 | [diff] [blame] | 1839 | if (!msg->bodyptr) |
| 1840 | return; |
| 1841 | |
Houston Hoffman | b6084f1 | 2017-05-30 19:24:07 -0700 | [diff] [blame] | 1842 | switch (msg->type) { |
| 1843 | case WMA_PROCESS_FW_EVENT: |
| 1844 | qdf_nbuf_free(((wma_process_fw_event_params *)msg->bodyptr) |
| 1845 | ->evt_buf); |
| 1846 | break; |
Abhishek Singh | caf6a65 | 2017-07-06 17:35:42 +0530 | [diff] [blame] | 1847 | case WMA_SET_LINK_STATE: |
| 1848 | qdf_mem_free(((tpLinkStateParams) msg->bodyptr)->callbackArg); |
| 1849 | break; |
Houston Hoffman | b6084f1 | 2017-05-30 19:24:07 -0700 | [diff] [blame] | 1850 | } |
Will Huang | 9323e85 | 2018-02-02 17:55:15 +0800 | [diff] [blame] | 1851 | |
| 1852 | qdf_mem_free(msg->bodyptr); |
Houston Hoffman | b6084f1 | 2017-05-30 19:24:07 -0700 | [diff] [blame] | 1853 | msg->bodyptr = NULL; |
| 1854 | msg->bodyval = 0; |
| 1855 | msg->type = 0; |
| 1856 | } |
| 1857 | |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 1858 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1859 | * wma_process_fw_event_handler() - common event handler to serialize |
| 1860 | * event processing through mc_thread |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1861 | * @ctx: wmi context |
| 1862 | * @ev: event buffer |
| 1863 | * @rx_ctx: rx execution context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1864 | * |
| 1865 | * Return: 0 on success, errno on failure |
| 1866 | */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1867 | static int wma_process_fw_event_mc_thread_ctx(void *ctx, void *ev) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1868 | { |
| 1869 | wma_process_fw_event_params *params_buf; |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 1870 | struct scheduler_msg cds_msg = { 0 }; |
Dustin Brown | 0555718 | 2017-10-12 14:44:49 -0700 | [diff] [blame] | 1871 | tp_wma_handle wma; |
| 1872 | uint32_t event_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1873 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1874 | params_buf = qdf_mem_malloc(sizeof(wma_process_fw_event_params)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1875 | if (!params_buf) { |
| 1876 | WMA_LOGE("%s: Failed alloc memory for params_buf", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1877 | qdf_nbuf_free(ev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1878 | return -ENOMEM; |
| 1879 | } |
| 1880 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1881 | params_buf->wmi_handle = (struct wmi_unified *)ctx; |
| 1882 | params_buf->evt_buf = (wmi_buf_t *)ev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1883 | |
Dustin Brown | 0555718 | 2017-10-12 14:44:49 -0700 | [diff] [blame] | 1884 | wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 1885 | event_id = WMI_GET_FIELD(qdf_nbuf_data(params_buf->evt_buf), |
| 1886 | WMI_CMD_HDR, COMMANDID); |
| 1887 | if (wma && wma_event_is_critical(event_id)) |
| 1888 | qdf_atomic_inc(&wma->critical_events_in_flight); |
| 1889 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1890 | cds_msg.type = WMA_PROCESS_FW_EVENT; |
| 1891 | cds_msg.bodyptr = params_buf; |
| 1892 | cds_msg.bodyval = 0; |
Houston Hoffman | b6084f1 | 2017-05-30 19:24:07 -0700 | [diff] [blame] | 1893 | cds_msg.flush_callback = wma_discard_fw_event; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1894 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1895 | if (QDF_STATUS_SUCCESS != |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 1896 | scheduler_post_msg(QDF_MODULE_ID_WMA, &cds_msg)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 1897 | WMA_LOGE("%s: Failed to post WMA_PROCESS_FW_EVENT msg", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1898 | __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1899 | qdf_nbuf_free(ev); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1900 | qdf_mem_free(params_buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1901 | return -EFAULT; |
| 1902 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1903 | return 0; |
| 1904 | |
| 1905 | } |
| 1906 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1907 | /** |
| 1908 | * wma_process_fw_event_handler() - common event handler to serialize |
| 1909 | * event processing through mc_thread |
| 1910 | * @ctx: wmi context |
| 1911 | * @ev: event buffer |
| 1912 | * @rx_ctx: rx execution context |
| 1913 | * |
| 1914 | * Return: 0 on success, errno on failure |
| 1915 | */ |
| 1916 | int wma_process_fw_event_handler(void *ctx, void *ev, uint8_t rx_ctx) |
| 1917 | { |
| 1918 | int err = 0; |
| 1919 | |
| 1920 | if (rx_ctx == WMA_RX_SERIALIZER_CTX) { |
| 1921 | err = wma_process_fw_event_mc_thread_ctx(ctx, ev); |
| 1922 | } else if (rx_ctx == WMA_RX_TASKLET_CTX) { |
| 1923 | wma_process_fw_event_tasklet_ctx(ctx, ev); |
| 1924 | } else { |
| 1925 | WMA_LOGE("%s: invalid wmi event execution context", __func__); |
| 1926 | qdf_nbuf_free(ev); |
| 1927 | } |
| 1928 | |
| 1929 | return err; |
| 1930 | } |
| 1931 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1932 | #ifdef WLAN_FEATURE_NAN |
| 1933 | /** |
| 1934 | * wma_set_nan_enable() - set nan enable flag in WMA handle |
| 1935 | * @wma_handle: Pointer to wma handle |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 1936 | * @cds_cfg: Pointer to CDS Configuration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1937 | * |
| 1938 | * Return: none |
| 1939 | */ |
| 1940 | static void wma_set_nan_enable(tp_wma_handle wma_handle, |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 1941 | struct cds_config_info *cds_cfg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1942 | { |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 1943 | wma_handle->is_nan_enabled = cds_cfg->is_nan_enabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1944 | } |
| 1945 | #else |
| 1946 | static void wma_set_nan_enable(tp_wma_handle wma_handle, |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 1947 | struct cds_config_info *cds_cfg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1948 | { |
| 1949 | } |
| 1950 | #endif |
| 1951 | |
| 1952 | /** |
Komal Seelam | 02d0934 | 2016-02-23 18:03:19 +0530 | [diff] [blame] | 1953 | * wma_init_max_no_of_peers - API to initialize wma configuration params |
| 1954 | * @wma_handle: WMA Handle |
| 1955 | * @max_peers: Max Peers supported |
| 1956 | * |
| 1957 | * Return: void |
| 1958 | */ |
| 1959 | static void wma_init_max_no_of_peers(tp_wma_handle wma_handle, |
| 1960 | uint16_t max_peers) |
| 1961 | { |
| 1962 | struct wma_ini_config *cfg = wma_get_ini_handle(wma_handle); |
| 1963 | |
Naveen Rawat | 3580477 | 2016-06-27 15:40:28 -0700 | [diff] [blame] | 1964 | if (cfg == NULL) { |
| 1965 | WMA_LOGE("%s: NULL WMA ini handle", __func__); |
| 1966 | return; |
| 1967 | } |
| 1968 | |
Komal Seelam | 02d0934 | 2016-02-23 18:03:19 +0530 | [diff] [blame] | 1969 | cfg->max_no_of_peers = max_peers; |
| 1970 | } |
| 1971 | |
Prashanth Bhatta | e675ca7 | 2016-10-20 18:42:37 -0700 | [diff] [blame] | 1972 | /** |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1973 | * wma_cleanup_vdev_resp_queue() - cleanup vdev response queue |
| 1974 | * @wma: wma handle |
| 1975 | * |
| 1976 | * Return: none |
| 1977 | */ |
| 1978 | static void wma_cleanup_vdev_resp_queue(tp_wma_handle wma) |
| 1979 | { |
| 1980 | struct wma_target_req *req_msg = NULL; |
| 1981 | qdf_list_node_t *node1 = NULL; |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1982 | |
| 1983 | qdf_spin_lock_bh(&wma->vdev_respq_lock); |
| 1984 | if (!qdf_list_size(&wma->vdev_resp_queue)) { |
| 1985 | qdf_spin_unlock_bh(&wma->vdev_respq_lock); |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 1986 | WMA_LOGD(FL("request queue maybe empty")); |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1987 | return; |
| 1988 | } |
| 1989 | |
Sandeep Puligilla | 5ac6bd2 | 2017-10-17 12:33:56 -0700 | [diff] [blame] | 1990 | WMA_LOGD(FL("Cleaning up vdev resp queue")); |
| 1991 | |
Wu Gao | 30f65eb | 2017-08-09 19:56:10 +0800 | [diff] [blame] | 1992 | /* peek front, and then cleanup it in wma_vdev_resp_timer */ |
| 1993 | while (qdf_list_peek_front(&wma->vdev_resp_queue, &node1) == |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1994 | QDF_STATUS_SUCCESS) { |
| 1995 | req_msg = qdf_container_of(node1, struct wma_target_req, node); |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1996 | qdf_spin_unlock_bh(&wma->vdev_respq_lock); |
Abhishek Singh | c614ec4 | 2017-04-25 16:17:34 +0530 | [diff] [blame] | 1997 | qdf_mc_timer_stop(&req_msg->event_timeout); |
| 1998 | wma_vdev_resp_timer(req_msg); |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1999 | qdf_spin_lock_bh(&wma->vdev_respq_lock); |
| 2000 | } |
| 2001 | qdf_spin_unlock_bh(&wma->vdev_respq_lock); |
| 2002 | } |
| 2003 | |
| 2004 | /** |
Abhishek Singh | c614ec4 | 2017-04-25 16:17:34 +0530 | [diff] [blame] | 2005 | * wma_cleanup_hold_req() - cleanup hold request queue |
| 2006 | * @wma: wma handle |
| 2007 | * |
| 2008 | * Return: none |
| 2009 | */ |
| 2010 | static void wma_cleanup_hold_req(tp_wma_handle wma) |
| 2011 | { |
| 2012 | struct wma_target_req *req_msg = NULL; |
| 2013 | qdf_list_node_t *node1 = NULL; |
| 2014 | |
| 2015 | qdf_spin_lock_bh(&wma->wma_hold_req_q_lock); |
| 2016 | if (!qdf_list_size(&wma->wma_hold_req_queue)) { |
| 2017 | qdf_spin_unlock_bh(&wma->wma_hold_req_q_lock); |
| 2018 | WMA_LOGD(FL("request queue is empty")); |
| 2019 | return; |
| 2020 | } |
| 2021 | |
Wu Gao | 30f65eb | 2017-08-09 19:56:10 +0800 | [diff] [blame] | 2022 | /* peek front, and then cleanup it in wma_hold_req_timer */ |
Abhishek Singh | c614ec4 | 2017-04-25 16:17:34 +0530 | [diff] [blame] | 2023 | while (QDF_STATUS_SUCCESS == |
Wu Gao | 30f65eb | 2017-08-09 19:56:10 +0800 | [diff] [blame] | 2024 | qdf_list_peek_front(&wma->wma_hold_req_queue, &node1)) { |
Abhishek Singh | c614ec4 | 2017-04-25 16:17:34 +0530 | [diff] [blame] | 2025 | req_msg = qdf_container_of(node1, struct wma_target_req, node); |
| 2026 | qdf_spin_unlock_bh(&wma->wma_hold_req_q_lock); |
| 2027 | /* Cleanup timeout handler */ |
| 2028 | qdf_mc_timer_stop(&req_msg->event_timeout); |
Abhishek Singh | c614ec4 | 2017-04-25 16:17:34 +0530 | [diff] [blame] | 2029 | wma_hold_req_timer(req_msg); |
| 2030 | qdf_spin_lock_bh(&wma->wma_hold_req_q_lock); |
| 2031 | } |
| 2032 | qdf_spin_unlock_bh(&wma->wma_hold_req_q_lock); |
| 2033 | } |
| 2034 | |
| 2035 | /** |
Prashanth Bhatta | e675ca7 | 2016-10-20 18:42:37 -0700 | [diff] [blame] | 2036 | * wma_shutdown_notifier_cb - Shutdown notifer call back |
| 2037 | * @priv : WMA handle |
| 2038 | * |
| 2039 | * During recovery, WMA may wait for resume to complete if the crash happens |
| 2040 | * while in suspend. This may cause delays in completing the recovery. This call |
| 2041 | * back would be called during recovery and the event is completed so that if |
| 2042 | * the resume is waiting on FW to respond then it can get out of the wait so |
| 2043 | * that recovery thread can start bringing down all the modules. |
| 2044 | * |
| 2045 | * Return: None |
| 2046 | */ |
| 2047 | static void wma_shutdown_notifier_cb(void *priv) |
| 2048 | { |
| 2049 | tp_wma_handle wma_handle = priv; |
| 2050 | |
| 2051 | qdf_event_set(&wma_handle->wma_resume_event); |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 2052 | wma_cleanup_vdev_resp_queue(wma_handle); |
Abhishek Singh | c614ec4 | 2017-04-25 16:17:34 +0530 | [diff] [blame] | 2053 | wma_cleanup_hold_req(wma_handle); |
Mukul Sharma | 4c60a7e | 2017-03-06 19:42:18 +0530 | [diff] [blame] | 2054 | pmo_ucfg_psoc_wakeup_host_event_received(wma_handle->psoc); |
Prashanth Bhatta | e675ca7 | 2016-10-20 18:42:37 -0700 | [diff] [blame] | 2055 | } |
| 2056 | |
Mukul Sharma | 5ff3c58 | 2016-09-12 15:23:35 +0530 | [diff] [blame] | 2057 | struct wma_version_info g_wmi_version_info; |
| 2058 | |
Wen Gong | 3f00338 | 2018-05-14 14:26:37 +0800 | [diff] [blame^] | 2059 | #ifdef WLAN_FEATURE_MEMDUMP_ENABLE |
Komal Seelam | 02d0934 | 2016-02-23 18:03:19 +0530 | [diff] [blame] | 2060 | /** |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2061 | * wma_state_info_dump() - prints state information of wma layer |
| 2062 | * @buf: buffer pointer |
| 2063 | * @size: size of buffer to be filled |
| 2064 | * |
| 2065 | * This function is used to dump state information of wma layer |
| 2066 | * |
| 2067 | * Return: None |
| 2068 | */ |
Naveen Rawat | 3ff5cff | 2018-01-29 14:31:16 -0800 | [diff] [blame] | 2069 | #ifdef QCA_SUPPORT_CP_STATS |
| 2070 | static void wma_state_info_dump(char **buf_ptr, uint16_t *size) |
| 2071 | { |
| 2072 | uint8_t vdev_id; |
| 2073 | uint16_t len = 0; |
| 2074 | t_wma_handle *wma; |
| 2075 | char *buf = *buf_ptr; |
| 2076 | struct wma_txrx_node *iface; |
| 2077 | struct wake_lock_stats stats; |
| 2078 | struct wlan_objmgr_vdev *vdev; |
| 2079 | |
| 2080 | wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 2081 | if (!wma) { |
| 2082 | WMA_LOGE("%s: WMA context is invald!", __func__); |
| 2083 | return; |
| 2084 | } |
| 2085 | |
| 2086 | WMA_LOGE("%s: size of buffer: %d", __func__, *size); |
| 2087 | |
| 2088 | for (vdev_id = 0; vdev_id < wma->max_bssid; vdev_id++) { |
| 2089 | iface = &wma->interfaces[vdev_id]; |
| 2090 | if (!iface->handle) |
| 2091 | continue; |
| 2092 | |
| 2093 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc(wma->psoc, |
| 2094 | vdev_id, WLAN_LEGACY_WMA_ID); |
Yeshwanth Sriram Guntuka | 0e6f446 | 2018-05-07 17:33:43 +0530 | [diff] [blame] | 2095 | if (vdev == NULL) |
| 2096 | continue; |
Naveen Rawat | 3ff5cff | 2018-01-29 14:31:16 -0800 | [diff] [blame] | 2097 | ucfg_mc_cp_stats_get_vdev_wake_lock_stats(vdev, &stats); |
| 2098 | len += qdf_scnprintf(buf + len, *size - len, |
| 2099 | "\n" |
| 2100 | "vdev_id %d\n" |
| 2101 | "WoW Stats\n" |
| 2102 | "\tpno_match %u\n" |
| 2103 | "\tpno_complete %u\n" |
| 2104 | "\tgscan %u\n" |
| 2105 | "\tlow_rssi %u\n" |
| 2106 | "\trssi_breach %u\n" |
| 2107 | "\tucast %u\n" |
| 2108 | "\tbcast %u\n" |
| 2109 | "\ticmpv4 %u\n" |
| 2110 | "\ticmpv6 %u\n" |
| 2111 | "\tipv4_mcast %u\n" |
| 2112 | "\tipv6_mcast %u\n" |
| 2113 | "\tipv6_mcast_ra %u\n" |
| 2114 | "\tipv6_mcast_ns %u\n" |
| 2115 | "\tipv6_mcast_na %u\n" |
| 2116 | "\toem_response %u\n" |
| 2117 | "conn_state %d\n" |
| 2118 | "dtimPeriod %d\n" |
| 2119 | "chanmode %d\n" |
| 2120 | "vht_capable %d\n" |
| 2121 | "ht_capable %d\n" |
| 2122 | "chan_width %d\n" |
| 2123 | "vdev_active %d\n" |
| 2124 | "vdev_up %d\n" |
| 2125 | "aid %d\n" |
| 2126 | "rate_flags %d\n" |
| 2127 | "nss %d\n" |
| 2128 | "tx_power %d\n" |
| 2129 | "max_tx_power %d\n" |
| 2130 | "nwType %d\n" |
| 2131 | "tx_streams %d\n" |
| 2132 | "rx_streams %d\n" |
| 2133 | "chain_mask %d\n" |
| 2134 | "nss_2g %d\n" |
| 2135 | "nss_5g %d", |
| 2136 | vdev_id, |
| 2137 | stats.pno_match_wake_up_count, |
| 2138 | stats.pno_complete_wake_up_count, |
| 2139 | stats.gscan_wake_up_count, |
| 2140 | stats.low_rssi_wake_up_count, |
| 2141 | stats.rssi_breach_wake_up_count, |
| 2142 | stats.ucast_wake_up_count, |
| 2143 | stats.bcast_wake_up_count, |
| 2144 | stats.icmpv4_count, |
| 2145 | stats.icmpv6_count, |
| 2146 | stats.ipv4_mcast_wake_up_count, |
| 2147 | stats.ipv6_mcast_wake_up_count, |
| 2148 | stats.ipv6_mcast_ra_stats, |
| 2149 | stats.ipv6_mcast_ns_stats, |
| 2150 | stats.ipv6_mcast_na_stats, |
| 2151 | stats.oem_response_wake_up_count, |
| 2152 | iface->conn_state, |
| 2153 | iface->dtimPeriod, |
| 2154 | iface->chanmode, |
| 2155 | iface->vht_capable, |
| 2156 | iface->ht_capable, |
| 2157 | iface->chan_width, |
| 2158 | iface->vdev_active, |
| 2159 | wma_is_vdev_up(vdev_id), |
| 2160 | iface->aid, |
| 2161 | iface->rate_flags, |
| 2162 | iface->nss, |
| 2163 | iface->tx_power, |
| 2164 | iface->max_tx_power, |
| 2165 | iface->nwType, |
| 2166 | iface->tx_streams, |
| 2167 | iface->rx_streams, |
| 2168 | iface->chain_mask, |
| 2169 | iface->nss_2g, |
| 2170 | iface->nss_5g); |
Yeshwanth Sriram Guntuka | 0e6f446 | 2018-05-07 17:33:43 +0530 | [diff] [blame] | 2171 | wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID); |
Naveen Rawat | 3ff5cff | 2018-01-29 14:31:16 -0800 | [diff] [blame] | 2172 | } |
| 2173 | |
| 2174 | *size -= len; |
| 2175 | *buf_ptr += len; |
| 2176 | } |
| 2177 | #else /* QCA_SUPPORT_CP_STATS */ |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2178 | static void wma_state_info_dump(char **buf_ptr, uint16_t *size) |
| 2179 | { |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 2180 | t_wma_handle *wma; |
| 2181 | struct sir_vdev_wow_stats *stats; |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2182 | uint16_t len = 0; |
| 2183 | char *buf = *buf_ptr; |
| 2184 | struct wma_txrx_node *iface; |
| 2185 | uint8_t vdev_id; |
| 2186 | |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 2187 | wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 2188 | if (!wma) { |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2189 | WMA_LOGE("%s: WMA context is invald!", __func__); |
| 2190 | return; |
| 2191 | } |
| 2192 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2193 | WMA_LOGE("%s: size of buffer: %d", __func__, *size); |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2194 | |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 2195 | for (vdev_id = 0; vdev_id < wma->max_bssid; vdev_id++) { |
| 2196 | iface = &wma->interfaces[vdev_id]; |
| 2197 | if (!iface->handle) |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2198 | continue; |
| 2199 | |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 2200 | stats = &iface->wow_stats; |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2201 | len += qdf_scnprintf(buf + len, *size - len, |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 2202 | "\n" |
| 2203 | "vdev_id %d\n" |
| 2204 | "WoW Stats\n" |
| 2205 | "\tpno_match %u\n" |
| 2206 | "\tpno_complete %u\n" |
| 2207 | "\tgscan %u\n" |
| 2208 | "\tlow_rssi %u\n" |
| 2209 | "\trssi_breach %u\n" |
| 2210 | "\tucast %u\n" |
| 2211 | "\tbcast %u\n" |
| 2212 | "\ticmpv4 %u\n" |
| 2213 | "\ticmpv6 %u\n" |
| 2214 | "\tipv4_mcast %u\n" |
| 2215 | "\tipv6_mcast %u\n" |
| 2216 | "\tipv6_mcast_ra %u\n" |
| 2217 | "\tipv6_mcast_ns %u\n" |
| 2218 | "\tipv6_mcast_na %u\n" |
| 2219 | "\toem_response %u\n" |
| 2220 | "conn_state %d\n" |
| 2221 | "dtimPeriod %d\n" |
| 2222 | "chanmode %d\n" |
| 2223 | "vht_capable %d\n" |
| 2224 | "ht_capable %d\n" |
| 2225 | "chan_width %d\n" |
| 2226 | "vdev_active %d\n" |
| 2227 | "vdev_up %d\n" |
| 2228 | "aid %d\n" |
| 2229 | "rate_flags %d\n" |
| 2230 | "nss %d\n" |
| 2231 | "tx_power %d\n" |
| 2232 | "max_tx_power %d\n" |
| 2233 | "nwType %d\n" |
| 2234 | "tx_streams %d\n" |
| 2235 | "rx_streams %d\n" |
| 2236 | "chain_mask %d\n" |
| 2237 | "nss_2g %d\n" |
| 2238 | "nss_5g %d", |
| 2239 | vdev_id, |
| 2240 | stats->pno_match, |
| 2241 | stats->pno_complete, |
| 2242 | stats->gscan, |
| 2243 | stats->low_rssi, |
| 2244 | stats->rssi_breach, |
| 2245 | stats->ucast, |
| 2246 | stats->bcast, |
| 2247 | stats->icmpv4, |
| 2248 | stats->icmpv6, |
| 2249 | stats->ipv4_mcast, |
| 2250 | stats->ipv6_mcast, |
| 2251 | stats->ipv6_mcast_ra, |
| 2252 | stats->ipv6_mcast_ns, |
| 2253 | stats->ipv6_mcast_na, |
| 2254 | stats->oem_response, |
| 2255 | iface->conn_state, |
| 2256 | iface->dtimPeriod, |
| 2257 | iface->chanmode, |
| 2258 | iface->vht_capable, |
| 2259 | iface->ht_capable, |
| 2260 | iface->chan_width, |
| 2261 | iface->vdev_active, |
Mukul Sharma | f904723 | 2017-03-02 16:58:56 +0530 | [diff] [blame] | 2262 | wma_is_vdev_up(vdev_id), |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 2263 | iface->aid, |
| 2264 | iface->rate_flags, |
| 2265 | iface->nss, |
| 2266 | iface->tx_power, |
| 2267 | iface->max_tx_power, |
| 2268 | iface->nwType, |
| 2269 | iface->tx_streams, |
| 2270 | iface->rx_streams, |
| 2271 | iface->chain_mask, |
| 2272 | iface->nss_2g, |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2273 | iface->nss_5g); |
| 2274 | } |
| 2275 | |
| 2276 | *size -= len; |
| 2277 | *buf_ptr += len; |
| 2278 | } |
Naveen Rawat | 3ff5cff | 2018-01-29 14:31:16 -0800 | [diff] [blame] | 2279 | #endif /* QCA_SUPPORT_CP_STATS */ |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2280 | |
| 2281 | /** |
| 2282 | * wma_register_debug_callback() - registration function for wma layer |
| 2283 | * to print wma state information |
| 2284 | */ |
| 2285 | static void wma_register_debug_callback(void) |
| 2286 | { |
| 2287 | qdf_register_debug_callback(QDF_MODULE_ID_WMA, &wma_state_info_dump); |
| 2288 | } |
Wen Gong | 3f00338 | 2018-05-14 14:26:37 +0800 | [diff] [blame^] | 2289 | #else /* WLAN_FEATURE_MEMDUMP_ENABLE */ |
Wen Gong | aa6d55d | 2018-04-26 16:33:21 +0800 | [diff] [blame] | 2290 | static void wma_register_debug_callback(void) |
| 2291 | { |
| 2292 | } |
Wen Gong | 3f00338 | 2018-05-14 14:26:37 +0800 | [diff] [blame^] | 2293 | #endif /* WLAN_FEATURE_MEMDUMP_ENABLE */ |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2294 | /** |
| 2295 | * wma_register_tx_ops_handler() - register tx_ops of southbound |
| 2296 | * @tx_ops: tx_ops pointer in southbound |
| 2297 | * |
| 2298 | * Return: 0 on success, errno on failure |
| 2299 | */ |
| 2300 | static QDF_STATUS |
| 2301 | wma_register_tx_ops_handler(struct wlan_lmac_if_tx_ops *tx_ops) |
| 2302 | { |
| 2303 | /* |
| 2304 | * Assign tx_ops, it's up to UMAC modules to declare and define these |
| 2305 | * functions which are used to send wmi command to target. |
| 2306 | */ |
| 2307 | |
Himanshu Agarwal | ce716f8 | 2016-12-21 19:07:54 +0530 | [diff] [blame] | 2308 | if (!tx_ops) { |
| 2309 | WMA_LOGE("%s: pointer to lmac if tx ops is NULL", __func__); |
| 2310 | return QDF_STATUS_E_INVAL; |
| 2311 | } |
| 2312 | |
| 2313 | /* mgmt_txrx component's tx ops */ |
| 2314 | tx_ops->mgmt_txrx_tx_ops.mgmt_tx_send = wma_mgmt_unified_cmd_send; |
| 2315 | |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2316 | return QDF_STATUS_SUCCESS; |
| 2317 | } |
| 2318 | |
| 2319 | /** |
| 2320 | * wma_target_if_open() - Attach UMAC modules' interface with wmi layer |
| 2321 | * @wma_handle: wma handle |
| 2322 | * |
| 2323 | * Separate module defines below functions: |
| 2324 | * 1. tgt_wmi_<module>_<action> api sends wmi command, assigned to south bound |
| 2325 | * tx_ops function pointers; |
| 2326 | * 2. module's south dispatcher handles information from lower layer, assigned |
| 2327 | * to south bound rx_ops function pointers; |
| 2328 | * 3. wmi event handler deals with wmi event, extracts umac needed information, |
| 2329 | * and call rx_ops(module's dispatcher). It executes in tasklet context and |
| 2330 | * is up to dispatcher to decide the context to reside in tasklet or in |
| 2331 | * thread context. |
| 2332 | * |
| 2333 | * Return: None |
| 2334 | */ |
| 2335 | static void wma_target_if_open(tp_wma_handle wma_handle) |
| 2336 | { |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 2337 | struct wlan_objmgr_psoc *psoc = wma_handle->psoc; |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2338 | |
| 2339 | if (!psoc) |
| 2340 | return; |
| 2341 | |
Mukul Sharma | dad267e | 2017-02-04 13:25:34 +0530 | [diff] [blame] | 2342 | wlan_global_lmac_if_set_txops_registration_cb(WLAN_DEV_OL, |
| 2343 | target_if_register_tx_ops); |
| 2344 | wlan_lmac_if_set_umac_txops_registration_cb( |
| 2345 | wma_register_tx_ops_handler); |
| 2346 | wlan_global_lmac_if_open(psoc); |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2347 | |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2348 | } |
| 2349 | |
| 2350 | /** |
| 2351 | * wma_target_if_close() - Detach UMAC modules' interface with wmi layer |
| 2352 | * @wma_handle: wma handle |
| 2353 | * |
| 2354 | * Return: None |
| 2355 | */ |
| 2356 | static void wma_target_if_close(tp_wma_handle wma_handle) |
| 2357 | { |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 2358 | struct wlan_objmgr_psoc *psoc = wma_handle->psoc; |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2359 | |
| 2360 | if (!psoc) |
| 2361 | return; |
| 2362 | |
Mukul Sharma | dad267e | 2017-02-04 13:25:34 +0530 | [diff] [blame] | 2363 | wlan_global_lmac_if_close(psoc); |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2364 | } |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2365 | |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2366 | /** |
Mukul Sharma | c3e7a78 | 2017-02-03 12:16:11 +0530 | [diff] [blame] | 2367 | * wma_get_psoc_from_scn_handle() - API to get psoc from scn handle |
| 2368 | * @scn_handle: opaque wma handle |
| 2369 | * |
| 2370 | * API to get psoc from scn handle |
| 2371 | * |
| 2372 | * Return: None |
| 2373 | */ |
| 2374 | static struct wlan_objmgr_psoc *wma_get_psoc_from_scn_handle(void *scn_handle) |
| 2375 | { |
| 2376 | tp_wma_handle wma_handle; |
| 2377 | |
| 2378 | if (!scn_handle) { |
| 2379 | WMA_LOGE("invalid scn handle"); |
| 2380 | return NULL; |
| 2381 | } |
| 2382 | wma_handle = (tp_wma_handle)scn_handle; |
| 2383 | |
| 2384 | return wma_handle->psoc; |
| 2385 | } |
Himanshu Agarwal | 2228e07 | 2018-01-24 17:42:17 +0530 | [diff] [blame] | 2386 | |
| 2387 | /** |
| 2388 | * wma_get_pdev_from_scn_handle() - API to get pdev from scn handle |
| 2389 | * @scn_handle: opaque wma handle |
| 2390 | * |
| 2391 | * API to get pdev from scn handle |
| 2392 | * |
| 2393 | * Return: None |
| 2394 | */ |
| 2395 | static struct wlan_objmgr_pdev *wma_get_pdev_from_scn_handle(void *scn_handle) |
| 2396 | { |
| 2397 | tp_wma_handle wma_handle; |
| 2398 | |
| 2399 | if (!scn_handle) { |
| 2400 | WMA_LOGE("invalid scn handle"); |
| 2401 | return NULL; |
| 2402 | } |
| 2403 | wma_handle = (tp_wma_handle)scn_handle; |
| 2404 | |
| 2405 | return wma_handle->pdev; |
| 2406 | } |
| 2407 | |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2408 | /** |
| 2409 | * wma_legacy_service_ready_event_handler() - legacy (ext)service ready handler |
| 2410 | * @event_id: event_id |
| 2411 | * @handle: wma handle |
| 2412 | * @event_data: event data |
| 2413 | * @length: event length |
| 2414 | * |
| 2415 | * Return: 0 for success, negative error code for failure |
| 2416 | */ |
| 2417 | static int wma_legacy_service_ready_event_handler(uint32_t event_id, |
| 2418 | void *handle, |
| 2419 | uint8_t *event_data, |
| 2420 | uint32_t length) |
| 2421 | { |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 2422 | switch (event_id) { |
| 2423 | case wmi_service_ready_event_id: |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2424 | return wma_rx_service_ready_event(handle, event_data, length); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 2425 | case wmi_service_ready_ext_event_id: |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2426 | return wma_rx_service_ready_ext_event(handle, event_data, |
| 2427 | length); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 2428 | case wmi_ready_event_id: |
| 2429 | return wma_rx_ready_event(handle, event_data, length); |
| 2430 | default: |
| 2431 | WMA_LOGE("Legacy callback invoked with invalid event_id:%d", |
| 2432 | event_id); |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2433 | QDF_BUG(0); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 2434 | } |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2435 | |
| 2436 | return 0; |
| 2437 | } |
Mukul Sharma | c3e7a78 | 2017-02-03 12:16:11 +0530 | [diff] [blame] | 2438 | |
| 2439 | /** |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2440 | * wma_flush_complete_evt_handler() - FW log flush complete event handler |
| 2441 | * @handle: WMI handle |
| 2442 | * @event: Event recevied from FW |
| 2443 | * @len: Length of the event |
| 2444 | * |
| 2445 | */ |
| 2446 | static int wma_flush_complete_evt_handler(void *handle, |
| 2447 | u_int8_t *event, |
| 2448 | u_int32_t len) |
| 2449 | { |
| 2450 | QDF_STATUS status; |
| 2451 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 2452 | |
| 2453 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID_param_tlvs *param_buf; |
| 2454 | wmi_debug_mesg_flush_complete_fixed_param *wmi_event; |
Poddar, Siddarth | c2c0814 | 2017-09-13 17:49:56 +0530 | [diff] [blame] | 2455 | wmi_debug_mesg_fw_data_stall_param *data_stall_event; |
| 2456 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 2457 | uint8_t *buf_ptr; |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2458 | uint32_t reason_code; |
| 2459 | |
| 2460 | param_buf = (WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID_param_tlvs *) event; |
| 2461 | if (!param_buf) { |
| 2462 | WMA_LOGE("Invalid log flush complete event buffer"); |
| 2463 | return QDF_STATUS_E_FAILURE; |
| 2464 | } |
| 2465 | |
| 2466 | wmi_event = param_buf->fixed_param; |
| 2467 | reason_code = wmi_event->reserved0; |
Rajeev Kumar | dcce809 | 2018-05-02 15:48:17 -0700 | [diff] [blame] | 2468 | WMA_LOGD("Received reason code %d from FW", reason_code); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2469 | |
Poddar, Siddarth | c2c0814 | 2017-09-13 17:49:56 +0530 | [diff] [blame] | 2470 | buf_ptr = (uint8_t *)wmi_event; |
| 2471 | buf_ptr = buf_ptr + sizeof(wmi_debug_mesg_flush_complete_fixed_param) + |
| 2472 | WMI_TLV_HDR_SIZE; |
| 2473 | data_stall_event = (wmi_debug_mesg_fw_data_stall_param *) buf_ptr; |
| 2474 | |
| 2475 | if (((data_stall_event->tlv_header & 0xFFFF0000) >> 16 == |
| 2476 | WMITLV_TAG_STRUC_wmi_debug_mesg_fw_data_stall_param)) { |
| 2477 | /** |
| 2478 | * Log data stall info received from FW: |
| 2479 | * |
| 2480 | * Possible data stall recovery types: |
| 2481 | * WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_DISCONNECT |
| 2482 | * WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_MAC_PHY_RESET |
| 2483 | * WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_PDR |
| 2484 | * |
| 2485 | * Possible data stall event types: |
| 2486 | * WLAN_DBG_DATA_STALL_VDEV_PAUSE |
| 2487 | * WLAN_DBG_DATA_STALL_HWSCHED_CMD_FILTER |
| 2488 | * WLAN_DBG_DATA_STALL_HWSCHED_CMD_FLUSH |
| 2489 | * WLAN_DBG_DATA_STALL_RX_REFILL_FAILED |
| 2490 | * WLAN_DBG_DATA_STALL_RX_FCS_LEN_ERROR |
| 2491 | * |
| 2492 | * reason_code1: |
| 2493 | * The information stored in reason_code1 varies based on the |
| 2494 | * data stall type values: |
| 2495 | * |
| 2496 | * data_stall_type | reason_code1 |
| 2497 | * ----------------------------------------------------- |
| 2498 | * HWSCHED_CMD_FLUSH | flush req reason (0-40) |
| 2499 | * RX_REFILL_FAILED | ring_id (0-7) |
| 2500 | * RX_FCS_LEN_ERROR | exact error type |
| 2501 | * |
| 2502 | * reasone_code2: |
| 2503 | * on which tid/hwq stall happened |
| 2504 | * |
| 2505 | */ |
| 2506 | QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 2507 | "Data Stall event:"); |
| 2508 | QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 2509 | "data_stall_type: %x vdev_id_bitmap: %x reason_code1: %x reason_code2: %x recovery_type: %x ", |
| 2510 | data_stall_event->data_stall_type, |
| 2511 | data_stall_event->vdev_id_bitmap, |
| 2512 | data_stall_event->reason_code1, |
| 2513 | data_stall_event->reason_code2, |
| 2514 | data_stall_event->recovery_type); |
| 2515 | |
| 2516 | cdp_post_data_stall_event(soc, |
| 2517 | DATA_STALL_LOG_INDICATOR_FIRMWARE, |
| 2518 | data_stall_event->data_stall_type, |
| 2519 | 0XFF, |
| 2520 | data_stall_event->vdev_id_bitmap, |
| 2521 | data_stall_event->recovery_type); |
| 2522 | } |
| 2523 | |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2524 | /* |
| 2525 | * reason_code = 0; Flush event in response to flush command |
| 2526 | * reason_code = other value; Asynchronous flush event for fatal events |
| 2527 | */ |
| 2528 | if (!reason_code && (cds_is_log_report_in_progress() == false)) { |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 2529 | WMA_LOGD("Received WMI flush event without sending CMD"); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2530 | return -EINVAL; |
| 2531 | } else if (!reason_code && cds_is_log_report_in_progress() == true) { |
| 2532 | /* Flush event in response to flush command */ |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 2533 | WMA_LOGD("Received WMI flush event in response to flush CMD"); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2534 | status = qdf_mc_timer_stop(&wma->log_completion_timer); |
| 2535 | if (status != QDF_STATUS_SUCCESS) |
| 2536 | WMA_LOGE("Failed to stop the log completion timeout"); |
| 2537 | cds_logging_set_fw_flush_complete(); |
Zhu Jianmin | b639e9b | 2017-10-26 19:09:12 +0800 | [diff] [blame] | 2538 | return QDF_STATUS_SUCCESS; |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2539 | } else if (reason_code && cds_is_log_report_in_progress() == false) { |
| 2540 | /* Asynchronous flush event for fatal events */ |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2541 | status = cds_set_log_completion(WLAN_LOG_TYPE_FATAL, |
| 2542 | WLAN_LOG_INDICATOR_FIRMWARE, |
| 2543 | reason_code, false); |
| 2544 | if (QDF_STATUS_SUCCESS != status) { |
| 2545 | WMA_LOGE("%s: Failed to set log trigger params", |
| 2546 | __func__); |
| 2547 | return QDF_STATUS_E_FAILURE; |
| 2548 | } |
| 2549 | cds_logging_set_fw_flush_complete(); |
| 2550 | return status; |
| 2551 | } else { |
| 2552 | /* Asynchronous flush event for fatal event, |
| 2553 | * but, report in progress already |
| 2554 | */ |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 2555 | WMA_LOGD("%s: Bug report already in progress - dropping! type:%d, indicator=%d reason_code=%d", |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2556 | __func__, WLAN_LOG_TYPE_FATAL, |
| 2557 | WLAN_LOG_INDICATOR_FIRMWARE, reason_code); |
| 2558 | return QDF_STATUS_E_FAILURE; |
| 2559 | } |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 2560 | /* Asynchronous flush event for fatal event, |
| 2561 | * but, report in progress already |
| 2562 | */ |
| 2563 | WMA_LOGW("%s: Bug report already in progress - dropping! type:%d, indicator=%d reason_code=%d", |
| 2564 | __func__, WLAN_LOG_TYPE_FATAL, |
| 2565 | WLAN_LOG_INDICATOR_FIRMWARE, reason_code); |
| 2566 | return QDF_STATUS_E_FAILURE; |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2567 | } |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2568 | /** |
| 2569 | * wma_extract_single_phyerr_spectral() - extract single phy error from event |
| 2570 | * @handle: wma handle |
| 2571 | * @param evt_buf: pointer to event buffer |
| 2572 | * @param datalen: data length of event buffer |
| 2573 | * @param buf_offset: Pointer to hold value of current event buffer offset |
| 2574 | * post extraction |
| 2575 | * @param phyerr: Pointer to hold phyerr |
| 2576 | * |
| 2577 | * Return: QDF_STATUS |
| 2578 | */ |
| 2579 | static QDF_STATUS wma_extract_single_phyerr_spectral(void *handle, |
| 2580 | void *evt_buf, |
| 2581 | uint16_t datalen, uint16_t *buf_offset, |
| 2582 | wmi_host_phyerr_t *phyerr) |
| 2583 | { |
| 2584 | wmi_single_phyerr_rx_event *ev; |
| 2585 | int n = *buf_offset; |
| 2586 | |
| 2587 | ev = (wmi_single_phyerr_rx_event *)((uint8_t *)evt_buf + n); |
| 2588 | |
| 2589 | if (n < datalen) { |
| 2590 | /* ensure there's at least space for the header */ |
| 2591 | if ((datalen - n) < sizeof(ev->hdr)) { |
| 2592 | WMA_LOGE("%s: not enough space? (datalen=%d, n=%d, hdr=%zu bytes", |
| 2593 | __func__, datalen, n, sizeof(ev->hdr)); |
| 2594 | return QDF_STATUS_E_FAILURE; |
| 2595 | } |
| 2596 | |
| 2597 | phyerr->bufp = ev->bufp; |
| 2598 | phyerr->buf_len = ev->hdr.buf_len; |
| 2599 | |
| 2600 | /* |
| 2601 | * Sanity check the buffer length of the event against |
| 2602 | * what we currently have. |
| 2603 | * |
| 2604 | * Since buf_len is 32 bits, we check if it overflows |
| 2605 | * a large 32 bit value. It's not 0x7fffffff because |
| 2606 | * we increase n by (buf_len + sizeof(hdr)), which would |
| 2607 | * in itself cause n to overflow. |
| 2608 | * |
| 2609 | * If "int" is 64 bits then this becomes a moot point. |
| 2610 | */ |
| 2611 | if (ev->hdr.buf_len > 0x7f000000) { |
| 2612 | WMA_LOGE("%s: buf_len is garbage? (0x%x)", |
| 2613 | __func__, ev->hdr.buf_len); |
| 2614 | return QDF_STATUS_E_FAILURE; |
| 2615 | } |
| 2616 | if (n + ev->hdr.buf_len > datalen) { |
| 2617 | WMA_LOGE("%s: buf_len exceeds available space n=%d, buf_len=%d, datalen=%d", |
| 2618 | __func__, n, ev->hdr.buf_len, datalen); |
| 2619 | return QDF_STATUS_E_FAILURE; |
| 2620 | } |
| 2621 | |
| 2622 | phyerr->phy_err_code = WMI_UNIFIED_PHYERRCODE_GET(&ev->hdr); |
| 2623 | phyerr->tsf_timestamp = ev->hdr.tsf_timestamp; |
| 2624 | |
| 2625 | #ifdef DEBUG_SPECTRAL_SCAN |
| 2626 | WMA_LOGD("%s: len=%d, tsf=0x%08x, rssi = 0x%x/0x%x/0x%x/0x%x, comb rssi = 0x%x, phycode=%d", |
| 2627 | __func__, |
| 2628 | ev->hdr.buf_len, |
| 2629 | ev->hdr.tsf_timestamp, |
| 2630 | ev->hdr.rssi_chain0, |
| 2631 | ev->hdr.rssi_chain1, |
| 2632 | ev->hdr.rssi_chain2, |
| 2633 | ev->hdr.rssi_chain3, |
| 2634 | WMI_UNIFIED_RSSI_COMB_GET(&ev->hdr), |
| 2635 | phyerr->phy_err_code); |
| 2636 | |
| 2637 | /* |
| 2638 | * For now, unroll this loop - the chain 'value' field isn't |
| 2639 | * a variable but glued together into a macro field definition. |
| 2640 | * Grr. :-) |
| 2641 | */ |
| 2642 | WMA_LOGD("%s: chain 0: raw=0x%08x; pri20=%d sec20=%d sec40=%d sec80=%d", |
| 2643 | __func__, |
| 2644 | ev->hdr.rssi_chain0, |
| 2645 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, PRI20), |
| 2646 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, SEC20), |
| 2647 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, SEC40), |
| 2648 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, SEC80)); |
| 2649 | |
| 2650 | WMA_LOGD("%s: chain 1: raw=0x%08x: pri20=%d sec20=%d sec40=%d sec80=%d", |
| 2651 | __func__, |
| 2652 | ev->hdr.rssi_chain1, |
| 2653 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, PRI20), |
| 2654 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, SEC20), |
| 2655 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, SEC40), |
| 2656 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, SEC80)); |
| 2657 | |
| 2658 | WMA_LOGD("%s: chain 2: raw=0x%08x: pri20=%d sec20=%d sec40=%d sec80=%d", |
| 2659 | __func__, |
| 2660 | ev->hdr.rssi_chain2, |
| 2661 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, PRI20), |
| 2662 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, SEC20), |
| 2663 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, SEC40), |
| 2664 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, SEC80)); |
| 2665 | |
| 2666 | WMA_LOGD("%s: chain 3: raw=0x%08x: pri20=%d sec20=%d sec40=%d sec80=%d", |
| 2667 | __func__, |
| 2668 | ev->hdr.rssi_chain3, |
| 2669 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, PRI20), |
| 2670 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, SEC20), |
| 2671 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, SEC40), |
| 2672 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, SEC80)); |
| 2673 | |
| 2674 | |
| 2675 | WMA_LOGD("%s: freq_info_1=0x%08x, freq_info_2=0x%08x", |
| 2676 | __func__, ev->hdr.freq_info_1, ev->hdr.freq_info_2); |
| 2677 | |
| 2678 | /* |
| 2679 | * The NF chain values are signed and are negative - hence |
| 2680 | * the cast evilness. |
| 2681 | */ |
| 2682 | WMA_LOGD("%s: nfval[1]=0x%08x, nfval[2]=0x%08x, nf=%d/%d/%d/%d, freq1=%d, freq2=%d, cw=%d", |
| 2683 | __func__, |
| 2684 | ev->hdr.nf_list_1, |
| 2685 | ev->hdr.nf_list_2, |
| 2686 | (int) WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 0), |
| 2687 | (int) WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 1), |
| 2688 | (int) WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 2), |
| 2689 | (int) WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 3), |
| 2690 | WMI_UNIFIED_FREQ_INFO_GET(&ev->hdr, 1), |
| 2691 | WMI_UNIFIED_FREQ_INFO_GET(&ev->hdr, 2), |
| 2692 | WMI_UNIFIED_CHWIDTH_GET(&ev->hdr)); |
| 2693 | #endif |
| 2694 | |
| 2695 | /* |
| 2696 | * If required, pass spectral events to the spectral module |
| 2697 | */ |
| 2698 | if (ev->hdr.buf_len > 0) { |
| 2699 | |
| 2700 | /* Initialize the NF values to Zero. */ |
| 2701 | phyerr->rf_info.noise_floor[0] = |
| 2702 | WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 0); |
| 2703 | phyerr->rf_info.noise_floor[1] = |
| 2704 | WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 1); |
| 2705 | phyerr->rf_info.noise_floor[2] = |
| 2706 | WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 2); |
| 2707 | phyerr->rf_info.noise_floor[3] = |
| 2708 | WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 3); |
| 2709 | |
| 2710 | /* populate the rf info */ |
| 2711 | phyerr->rf_info.rssi_comb = |
| 2712 | WMI_UNIFIED_RSSI_COMB_GET(&ev->hdr); |
| 2713 | |
| 2714 | /* Need to unroll loop due to macro |
| 2715 | * constraints chain 0 |
| 2716 | */ |
| 2717 | phyerr->rf_info.pc_rssi_info[0].rssi_pri20 = |
| 2718 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, PRI20); |
| 2719 | phyerr->rf_info.pc_rssi_info[0].rssi_sec20 = |
| 2720 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, SEC20); |
| 2721 | phyerr->rf_info.pc_rssi_info[0].rssi_sec40 = |
| 2722 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, SEC40); |
| 2723 | phyerr->rf_info.pc_rssi_info[0].rssi_sec80 = |
| 2724 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, SEC80); |
| 2725 | |
| 2726 | /* chain 1 */ |
| 2727 | phyerr->rf_info.pc_rssi_info[1].rssi_pri20 = |
| 2728 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, PRI20); |
| 2729 | phyerr->rf_info.pc_rssi_info[1].rssi_sec20 = |
| 2730 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, SEC20); |
| 2731 | phyerr->rf_info.pc_rssi_info[1].rssi_sec40 = |
| 2732 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, SEC40); |
| 2733 | phyerr->rf_info.pc_rssi_info[1].rssi_sec80 = |
| 2734 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, SEC80); |
| 2735 | |
| 2736 | /* chain 2 */ |
| 2737 | phyerr->rf_info.pc_rssi_info[2].rssi_pri20 = |
| 2738 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, PRI20); |
| 2739 | phyerr->rf_info.pc_rssi_info[2].rssi_sec20 = |
| 2740 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, SEC20); |
| 2741 | phyerr->rf_info.pc_rssi_info[2].rssi_sec40 = |
| 2742 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, SEC40); |
| 2743 | phyerr->rf_info.pc_rssi_info[2].rssi_sec80 = |
| 2744 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, SEC80); |
| 2745 | |
| 2746 | /* chain 3 */ |
| 2747 | phyerr->rf_info.pc_rssi_info[3].rssi_pri20 = |
| 2748 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, PRI20); |
| 2749 | phyerr->rf_info.pc_rssi_info[3].rssi_sec20 = |
| 2750 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, SEC20); |
| 2751 | phyerr->rf_info.pc_rssi_info[3].rssi_sec40 = |
| 2752 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, SEC40); |
| 2753 | phyerr->rf_info.pc_rssi_info[3].rssi_sec80 = |
| 2754 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, SEC80); |
| 2755 | |
| 2756 | phyerr->chan_info.center_freq1 = |
| 2757 | WMI_UNIFIED_FREQ_INFO_GET(&ev->hdr, 1); |
| 2758 | phyerr->chan_info.center_freq2 = |
| 2759 | WMI_UNIFIED_FREQ_INFO_GET(&ev->hdr, 2); |
| 2760 | |
| 2761 | } |
| 2762 | |
| 2763 | /* |
| 2764 | * Advance the buffer pointer to the next PHY error. |
| 2765 | * buflen is the length of this payload, so we need to |
| 2766 | * advance past the current header _AND_ the payload. |
| 2767 | */ |
| 2768 | n += sizeof(*ev) + ev->hdr.buf_len; |
| 2769 | } |
| 2770 | *buf_offset += n; |
| 2771 | |
| 2772 | return QDF_STATUS_SUCCESS; |
| 2773 | } |
| 2774 | |
| 2775 | /** |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2776 | * spectral_phyerr_event_handler() - spectral phyerr event handler |
| 2777 | * @handle: wma handle |
| 2778 | * @data: data buffer |
| 2779 | * @datalen: buffer length |
| 2780 | * |
| 2781 | * Return: QDF_STATUS |
| 2782 | */ |
| 2783 | static QDF_STATUS spectral_phyerr_event_handler(void *handle, |
| 2784 | uint8_t *data, uint32_t datalen) |
| 2785 | { |
| 2786 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 2787 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2788 | uint16_t buf_offset, event_buf_len = 0; |
| 2789 | wmi_single_phyerr_rx_event *ev; |
| 2790 | wmi_host_phyerr_t phyerr; |
| 2791 | struct target_if_spectral_rfqual_info rfqual_info; |
| 2792 | struct target_if_spectral_chan_info chan_info; |
| 2793 | struct target_if_spectral_acs_stats acs_stats; |
| 2794 | |
| 2795 | if (NULL == wma) { |
| 2796 | WMA_LOGE("%s:wma handle is NULL", __func__); |
| 2797 | return QDF_STATUS_E_FAILURE; |
| 2798 | } |
| 2799 | |
| 2800 | memset(&phyerr, 0, sizeof(wmi_host_phyerr_t)); |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2801 | status = wmi_extract_comb_phyerr(wma->wmi_handle, data, datalen, |
| 2802 | &buf_offset, &phyerr); |
| 2803 | if (QDF_IS_STATUS_ERROR(status)) { |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2804 | WMA_LOGE("%s: extract comb phyerr failed", __func__); |
| 2805 | return QDF_STATUS_E_FAILURE; |
| 2806 | } |
| 2807 | |
| 2808 | ev = (wmi_single_phyerr_rx_event *)phyerr.bufp; |
| 2809 | event_buf_len = phyerr.buf_len; |
| 2810 | /* Loop over the bufp, extracting out phyerrors */ |
| 2811 | buf_offset = 0; |
| 2812 | while (buf_offset < event_buf_len) { |
| 2813 | if (wma_extract_single_phyerr_spectral(handle, ev, |
| 2814 | event_buf_len, &buf_offset, &phyerr)) { |
| 2815 | WMA_LOGE("%s: extract single phy err failed", __func__); |
| 2816 | return QDF_STATUS_E_FAILURE; |
| 2817 | } |
| 2818 | |
| 2819 | if (phyerr.buf_len > 0) { |
| 2820 | if (sizeof(phyerr.rf_info) > sizeof(rfqual_info)) |
| 2821 | qdf_mem_copy(&rfqual_info, &phyerr.rf_info, |
| 2822 | sizeof(rfqual_info)); |
| 2823 | else |
| 2824 | qdf_mem_copy(&rfqual_info, &phyerr.rf_info, |
| 2825 | sizeof(phyerr.rf_info)); |
| 2826 | |
| 2827 | if (sizeof(phyerr.chan_info) > sizeof(chan_info)) |
| 2828 | qdf_mem_copy(&chan_info, &phyerr.chan_info, |
| 2829 | sizeof(chan_info)); |
| 2830 | else |
| 2831 | qdf_mem_copy(&chan_info, &phyerr.chan_info, |
| 2832 | sizeof(phyerr.chan_info)); |
| 2833 | |
| 2834 | target_if_spectral_process_phyerr(wma->pdev, phyerr.bufp, |
| 2835 | phyerr.buf_len, |
| 2836 | &rfqual_info, |
| 2837 | &chan_info, |
| 2838 | phyerr.tsf64, |
| 2839 | &acs_stats); |
| 2840 | } |
| 2841 | } |
| 2842 | |
| 2843 | return status; |
| 2844 | } |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2845 | |
Arif Hussain | f63f7a3 | 2017-08-22 12:49:42 -0700 | [diff] [blame] | 2846 | /** |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2847 | * dfs_phyerr_event_handler() - dfs phyerr event handler |
| 2848 | * @handle: wma handle |
| 2849 | * @data: data buffer |
| 2850 | * @datalen: buffer length |
| 2851 | * @fulltsf: 64 bit event TSF |
| 2852 | * |
| 2853 | * Function to process DFS phy errors. |
| 2854 | * |
| 2855 | * Return: QDF_STATUS |
| 2856 | */ |
| 2857 | static QDF_STATUS dfs_phyerr_event_handler(tp_wma_handle handle, |
| 2858 | uint8_t *data, |
| 2859 | uint32_t datalen, |
| 2860 | uint64_t fulltsf) |
| 2861 | { |
| 2862 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2863 | struct wlan_lmac_if_dfs_rx_ops *dfs_rx_ops; |
| 2864 | wmi_host_phyerr_t phyerr; |
| 2865 | int8_t rssi_comb; |
| 2866 | uint16_t buf_offset; |
| 2867 | |
| 2868 | if (!handle->psoc) { |
| 2869 | WMA_LOGE("%s: psoc is null", __func__); |
| 2870 | return QDF_STATUS_E_INVAL; |
| 2871 | } |
| 2872 | |
| 2873 | dfs_rx_ops = wlan_lmac_if_get_dfs_rx_ops(handle->psoc); |
| 2874 | if (!dfs_rx_ops) { |
| 2875 | WMA_LOGE("%s: dfs_rx_ops is null", __func__); |
| 2876 | return QDF_STATUS_E_INVAL; |
| 2877 | } |
| 2878 | |
| 2879 | if (!dfs_rx_ops->dfs_process_phyerr) { |
| 2880 | WMA_LOGE("%s: dfs_process_phyerr handler is null", __func__); |
| 2881 | return QDF_STATUS_E_INVAL; |
| 2882 | } |
| 2883 | |
| 2884 | if (!handle->pdev) { |
| 2885 | WMA_LOGE("%s: pdev is null", __func__); |
| 2886 | return -EINVAL; |
| 2887 | } |
| 2888 | |
| 2889 | buf_offset = 0; |
| 2890 | while (buf_offset < datalen) { |
| 2891 | status = wmi_extract_single_phyerr(handle->wmi_handle, data, datalen, |
| 2892 | &buf_offset, &phyerr); |
| 2893 | if (QDF_IS_STATUS_ERROR(status)) { |
| 2894 | /* wmi_extract_single_phyerr has logs */ |
| 2895 | return status; |
| 2896 | } |
| 2897 | |
| 2898 | rssi_comb = phyerr.rf_info.rssi_comb & 0xFF; |
| 2899 | if (phyerr.buf_len > 0) |
| 2900 | dfs_rx_ops->dfs_process_phyerr(handle->pdev, |
| 2901 | &phyerr.bufp[0], |
| 2902 | phyerr.buf_len, |
| 2903 | rssi_comb, |
| 2904 | rssi_comb, |
| 2905 | phyerr.tsf_timestamp, |
| 2906 | fulltsf); |
| 2907 | } |
| 2908 | |
| 2909 | return QDF_STATUS_SUCCESS; |
| 2910 | } |
| 2911 | |
| 2912 | /** |
Arif Hussain | f63f7a3 | 2017-08-22 12:49:42 -0700 | [diff] [blame] | 2913 | * wma_unified_phyerr_rx_event_handler() - phyerr event handler |
| 2914 | * @handle: wma handle |
| 2915 | * @data: data buffer |
| 2916 | * @datalen: buffer length |
| 2917 | * |
| 2918 | * WMI Handler for WMI_PHYERR_EVENTID event from firmware. |
| 2919 | * This handler is currently handling DFS and spectral scan |
| 2920 | * phy errors. |
| 2921 | * |
| 2922 | * Return: 0 for success, other value for failure |
| 2923 | */ |
| 2924 | static int wma_unified_phyerr_rx_event_handler(void *handle, |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2925 | uint8_t *data, |
| 2926 | uint32_t datalen) |
| 2927 | { |
Arif Hussain | f63f7a3 | 2017-08-22 12:49:42 -0700 | [diff] [blame] | 2928 | /* phyerr handling is moved to cmn project |
| 2929 | * As WIN still uses handler registration in non-cmn code. |
| 2930 | * need complete testing of non offloaded DFS code before we enable |
| 2931 | * it in cmn code. |
| 2932 | **/ |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2933 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 2934 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2935 | wmi_host_phyerr_t phyerr; |
| 2936 | uint16_t buf_offset = 0; |
| 2937 | |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2938 | if (!wma) { |
| 2939 | WMA_LOGE("%s: wma handle is null", __func__); |
| 2940 | return -EINVAL; |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2941 | } |
| 2942 | |
| 2943 | /* sanity check on data length */ |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2944 | status = wmi_extract_comb_phyerr(wma->wmi_handle, data, datalen, |
| 2945 | &buf_offset, &phyerr); |
| 2946 | if (QDF_IS_STATUS_ERROR(status)) { |
| 2947 | WMA_LOGE("%s: extract phyerr failed: %d", __func__, status); |
| 2948 | return qdf_status_to_os_return(status); |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2949 | } |
| 2950 | |
| 2951 | /* handle different PHY Error conditions */ |
| 2952 | if (((phyerr.phy_err_mask0 & (WMI_PHY_ERROR_MASK0_RADAR | |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2953 | WMI_PHY_ERROR_MASK0_FALSE_RADAR_EXT | |
| 2954 | WMI_PHY_ERROR_MASK0_SPECTRAL_SCAN)) == 0)) { |
| 2955 | WMA_LOGD("%s: Unknown phy error event", __func__); |
| 2956 | return -EINVAL; |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2957 | } |
| 2958 | |
| 2959 | /* Handle Spectral or DFS PHY Error */ |
| 2960 | if (phyerr.phy_err_mask0 & (WMI_PHY_ERROR_MASK0_RADAR | |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2961 | WMI_PHY_ERROR_MASK0_FALSE_RADAR_EXT)) { |
| 2962 | if (wma->is_dfs_offloaded) { |
| 2963 | WMA_LOGD("%s: Unexpected phy error, dfs offloaded", |
| 2964 | __func__); |
| 2965 | return -EINVAL; |
| 2966 | } |
| 2967 | status = dfs_phyerr_event_handler(wma, |
| 2968 | phyerr.bufp, |
| 2969 | phyerr.buf_len, |
| 2970 | phyerr.tsf64); |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2971 | } else if (phyerr.phy_err_mask0 & (WMI_PHY_ERROR_MASK0_SPECTRAL_SCAN | |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2972 | WMI_PHY_ERROR_MASK0_FALSE_RADAR_EXT)) { |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2973 | status = spectral_phyerr_event_handler(wma, data, datalen); |
| 2974 | } |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2975 | |
| 2976 | return qdf_status_to_os_return(status); |
Arif Hussain | f63f7a3 | 2017-08-22 12:49:42 -0700 | [diff] [blame] | 2977 | } |
| 2978 | |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 2979 | void wma_vdev_init(struct wma_txrx_node *vdev) |
| 2980 | { |
| 2981 | qdf_wake_lock_create(&vdev->vdev_start_wakelock, "vdev_start"); |
| 2982 | qdf_wake_lock_create(&vdev->vdev_stop_wakelock, "vdev_stop"); |
Rajeev Kumar | 155a3e4 | 2017-10-10 15:31:17 -0700 | [diff] [blame] | 2983 | qdf_wake_lock_create(&vdev->vdev_set_key_wakelock, "vdev_set_key"); |
Naveen Rawat | d773414 | 2017-10-27 10:02:40 -0700 | [diff] [blame] | 2984 | vdev->is_waiting_for_key = false; |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 2985 | } |
| 2986 | |
| 2987 | void wma_vdev_deinit(struct wma_txrx_node *vdev) |
| 2988 | { |
| 2989 | qdf_wake_lock_destroy(&vdev->vdev_start_wakelock); |
| 2990 | qdf_wake_lock_destroy(&vdev->vdev_stop_wakelock); |
Rajeev Kumar | 155a3e4 | 2017-10-10 15:31:17 -0700 | [diff] [blame] | 2991 | qdf_wake_lock_destroy(&vdev->vdev_set_key_wakelock); |
Naveen Rawat | d773414 | 2017-10-27 10:02:40 -0700 | [diff] [blame] | 2992 | vdev->is_waiting_for_key = false; |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 2993 | } |
| 2994 | |
Kabilan Kannan | fc3a8c0 | 2018-02-21 13:36:29 -0800 | [diff] [blame] | 2995 | /** |
| 2996 | * wma_wmi_stop() - generic function to block WMI commands |
| 2997 | * @return: None |
| 2998 | */ |
| 2999 | void wma_wmi_stop(void) |
| 3000 | { |
| 3001 | tp_wma_handle wma_handle; |
| 3002 | |
| 3003 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 3004 | if (wma_handle == NULL) { |
| 3005 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 3006 | "wma_handle is NULL\n"); |
| 3007 | return; |
| 3008 | } |
| 3009 | wmi_stop(wma_handle->wmi_handle); |
| 3010 | } |
| 3011 | |
Naveen Rawat | e8b1b82 | 2018-01-30 09:46:16 -0800 | [diff] [blame] | 3012 | #ifdef QCA_SUPPORT_CP_STATS |
| 3013 | static void wma_register_stats_events(wmi_unified_t wmi_handle) {} |
| 3014 | #else |
| 3015 | static void wma_register_stats_events(wmi_unified_t wmi_handle) |
| 3016 | { |
| 3017 | wmi_unified_register_event_handler(wmi_handle, |
| 3018 | wmi_update_stats_event_id, |
| 3019 | wma_stats_event_handler, |
| 3020 | WMA_RX_SERIALIZER_CTX); |
| 3021 | } |
| 3022 | #endif |
| 3023 | |
Kabilan Kannan | fc3a8c0 | 2018-02-21 13:36:29 -0800 | [diff] [blame] | 3024 | /** |
| 3025 | * wma_open() - Allocate wma context and initialize it. |
| 3026 | * @cds_context: cds context |
| 3027 | * @wma_tgt_cfg_cb: tgt config callback fun |
| 3028 | * @radar_ind_cb: dfs radar indication callback |
| 3029 | * @cds_cfg: mac parameters |
| 3030 | * |
| 3031 | * Return: 0 on success, errno on failure |
| 3032 | */ |
Jeff Johnson | ff6addf | 2017-09-13 10:06:03 -0700 | [diff] [blame] | 3033 | QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3034 | wma_tgt_cfg_cb tgt_cfg_cb, |
bings | 482bae2 | 2018-01-17 16:25:31 +0800 | [diff] [blame] | 3035 | struct cds_config_info *cds_cfg, |
| 3036 | uint32_t target_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3037 | { |
| 3038 | tp_wma_handle wma_handle; |
| 3039 | HTC_HANDLE htc_handle; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3040 | qdf_device_t qdf_dev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3041 | void *wmi_handle; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3042 | QDF_STATUS qdf_status; |
Lin Bai | 04f603e | 2018-03-19 11:01:06 +0800 | [diff] [blame] | 3043 | struct wmi_unified_attach_params *params; |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 3044 | struct policy_mgr_wma_cbacks wma_cbacks; |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 3045 | struct target_psoc_info *tgt_psoc_info; |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3046 | int i; |
Jeff Johnson | ff6addf | 2017-09-13 10:06:03 -0700 | [diff] [blame] | 3047 | void *cds_context; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 3048 | target_resource_config *wlan_res_cfg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3049 | |
| 3050 | WMA_LOGD("%s: Enter", __func__); |
| 3051 | |
Jeff Johnson | ff6addf | 2017-09-13 10:06:03 -0700 | [diff] [blame] | 3052 | cds_context = cds_get_global_context(); |
| 3053 | if (!cds_context) { |
| 3054 | WMA_LOGE("%s: Invalid CDS context", __func__); |
| 3055 | return QDF_STATUS_E_INVAL; |
| 3056 | } |
| 3057 | |
Mukul Sharma | 5ff3c58 | 2016-09-12 15:23:35 +0530 | [diff] [blame] | 3058 | g_wmi_version_info.major = __WMI_VER_MAJOR_; |
| 3059 | g_wmi_version_info.minor = __WMI_VER_MINOR_; |
| 3060 | g_wmi_version_info.revision = __WMI_REVISION_; |
| 3061 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3062 | qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); |
| 3063 | htc_handle = cds_get_context(QDF_MODULE_ID_HTC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3064 | |
| 3065 | if (!htc_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3066 | WMA_LOGE("%s: Invalid HTC handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3067 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3068 | } |
| 3069 | |
| 3070 | /* Alloc memory for WMA Context */ |
Jeff Johnson | adb3b1c | 2017-09-13 10:42:36 -0700 | [diff] [blame] | 3071 | qdf_status = cds_alloc_context(QDF_MODULE_ID_WMA, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3072 | (void **)&wma_handle, |
Jeff Johnson | adb3b1c | 2017-09-13 10:42:36 -0700 | [diff] [blame] | 3073 | sizeof(*wma_handle)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3074 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3075 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3076 | WMA_LOGE("%s: Memory allocation failed for wma_handle", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3077 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3078 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3079 | } |
| 3080 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3081 | qdf_mem_zero(wma_handle, sizeof(t_wma_handle)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3082 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3083 | if (target_if_alloc_psoc_tgt_info(psoc)) { |
| 3084 | WMA_LOGE("%s target psoc info allocation failed", __func__); |
| 3085 | qdf_status = QDF_STATUS_E_NOMEM; |
| 3086 | goto err_free_wma_handle; |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 3087 | } |
| 3088 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3089 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3090 | #ifdef FEATURE_WLAN_EXTSCAN |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3091 | qdf_wake_lock_create(&wma_handle->extscan_wake_lock, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3092 | "wlan_extscan_wl"); |
| 3093 | #endif /* FEATURE_WLAN_EXTSCAN */ |
Mukul Sharma | e44d054 | 2017-05-23 21:50:56 +0530 | [diff] [blame] | 3094 | qdf_wake_lock_create(&wma_handle->wow_wake_lock, |
| 3095 | "wlan_wow_wl"); |
| 3096 | qdf_wake_lock_create(&wma_handle->wow_auth_req_wl, |
| 3097 | "wlan_auth_req_wl"); |
| 3098 | qdf_wake_lock_create(&wma_handle->wow_assoc_req_wl, |
| 3099 | "wlan_assoc_req_wl"); |
| 3100 | qdf_wake_lock_create(&wma_handle->wow_deauth_rec_wl, |
| 3101 | "wlan_deauth_rec_wl"); |
| 3102 | qdf_wake_lock_create(&wma_handle->wow_disassoc_rec_wl, |
| 3103 | "wlan_disassoc_rec_wl"); |
| 3104 | qdf_wake_lock_create(&wma_handle->wow_ap_assoc_lost_wl, |
| 3105 | "wlan_ap_assoc_lost_wl"); |
| 3106 | qdf_wake_lock_create(&wma_handle->wow_auto_shutdown_wl, |
| 3107 | "wlan_auto_shutdown_wl"); |
| 3108 | qdf_wake_lock_create(&wma_handle->roam_ho_wl, |
| 3109 | "wlan_roam_ho_wl"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3110 | } |
| 3111 | |
Selvaraj, Sridhar | 3a1823f | 2017-02-01 17:32:21 +0530 | [diff] [blame] | 3112 | qdf_status = wlan_objmgr_psoc_try_get_ref(psoc, WLAN_LEGACY_WMA_ID); |
| 3113 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 3114 | WMA_LOGE("%s: PSOC get_ref fails", __func__); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3115 | goto err_wma_handle; |
Selvaraj, Sridhar | 3a1823f | 2017-02-01 17:32:21 +0530 | [diff] [blame] | 3116 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3117 | wma_handle->psoc = psoc; |
| 3118 | |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 3119 | /* Open target_if layer and register wma callback */ |
| 3120 | wma_target_if_open(wma_handle); |
| 3121 | target_if_open(wma_get_psoc_from_scn_handle); |
| 3122 | |
Lin Bai | 04f603e | 2018-03-19 11:01:06 +0800 | [diff] [blame] | 3123 | /* |
| 3124 | * Allocate locally used params with its rx_ops member, |
| 3125 | * and free it immediately after used. |
| 3126 | */ |
| 3127 | params = qdf_mem_malloc(sizeof(*params) + sizeof(struct wmi_rx_ops)); |
| 3128 | if (!params) { |
| 3129 | WMA_LOGE("%s: failed to allocate attach params", __func__); |
| 3130 | qdf_status = QDF_STATUS_E_NOMEM; |
| 3131 | goto err_wma_handle; |
| 3132 | } |
| 3133 | |
| 3134 | params->rx_ops = (struct wmi_rx_ops *)(params + 1); |
| 3135 | params->osdev = NULL; |
| 3136 | params->target_type = WMI_TLV_TARGET; |
| 3137 | params->use_cookie = false; |
| 3138 | params->psoc = psoc; |
| 3139 | params->max_commands = WMI_MAX_CMDS; |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3140 | /* Attach mc_thread context processing function */ |
Lin Bai | 04f603e | 2018-03-19 11:01:06 +0800 | [diff] [blame] | 3141 | params->rx_ops->wma_process_fw_event_handler_cbk = |
| 3142 | wma_process_fw_event_handler; |
Surabhi Vishnoi | 75b1a81 | 2018-02-09 12:07:16 +0530 | [diff] [blame] | 3143 | |
Himanshu Agarwal | 88b16a4 | 2018-02-06 15:10:59 +0530 | [diff] [blame] | 3144 | /* initialize tlv attach */ |
| 3145 | wmi_tlv_init(); |
Surabhi Vishnoi | 75b1a81 | 2018-02-09 12:07:16 +0530 | [diff] [blame] | 3146 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3147 | /* attach the wmi */ |
Lin Bai | 04f603e | 2018-03-19 11:01:06 +0800 | [diff] [blame] | 3148 | wmi_handle = wmi_unified_attach(wma_handle, params); |
| 3149 | qdf_mem_free(params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3150 | if (!wmi_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3151 | WMA_LOGE("%s: failed to attach WMI", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3152 | qdf_status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3153 | goto err_wma_handle; |
| 3154 | } |
| 3155 | |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 3156 | target_if_register_legacy_service_ready_cb( |
| 3157 | wma_legacy_service_ready_event_handler); |
| 3158 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3159 | WMA_LOGA("WMA --> wmi_unified_attach - success"); |
Mukul Sharma | cc1f3f9 | 2017-01-30 19:56:24 +0530 | [diff] [blame] | 3160 | |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 3161 | /* store the wmi handle in tgt_if_handle */ |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3162 | tgt_psoc_info = wlan_psoc_get_tgt_if_handle(psoc); |
Mukul Sharma | cc1f3f9 | 2017-01-30 19:56:24 +0530 | [diff] [blame] | 3163 | |
bings | 6b41366 | 2018-02-06 17:51:36 +0800 | [diff] [blame] | 3164 | target_psoc_set_target_type(tgt_psoc_info, target_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3165 | /* Save the WMI & HTC handle */ |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3166 | target_psoc_set_wmi_hdl(tgt_psoc_info, wmi_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3167 | wma_handle->wmi_handle = wmi_handle; |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3168 | target_psoc_set_htc_hdl(tgt_psoc_info, htc_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3169 | wma_handle->cds_context = cds_context; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3170 | wma_handle->qdf_dev = qdf_dev; |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3171 | wma_handle->max_scan = cds_cfg->max_scan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3172 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3173 | /* Register Converged Event handlers */ |
| 3174 | init_deinit_register_tgt_psoc_ev_handlers(psoc); |
| 3175 | |
Manishekar Chandrasekaran | ebcab88 | 2016-05-04 12:55:14 +0530 | [diff] [blame] | 3176 | /* Initialize max_no_of_peers for wma_get_number_of_peers_supported() */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3177 | wma_init_max_no_of_peers(wma_handle, cds_cfg->max_station); |
Manishekar Chandrasekaran | ebcab88 | 2016-05-04 12:55:14 +0530 | [diff] [blame] | 3178 | /* Cap maxStation based on the target version */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3179 | cds_cfg->max_station = wma_get_number_of_peers_supported(wma_handle); |
Manishekar Chandrasekaran | ebcab88 | 2016-05-04 12:55:14 +0530 | [diff] [blame] | 3180 | /* Reinitialize max_no_of_peers based on the capped maxStation value */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3181 | wma_init_max_no_of_peers(wma_handle, cds_cfg->max_station); |
Manishekar Chandrasekaran | ebcab88 | 2016-05-04 12:55:14 +0530 | [diff] [blame] | 3182 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3183 | /* initialize default target config */ |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 3184 | wlan_res_cfg = target_psoc_get_wlan_res_cfg(tgt_psoc_info); |
Arif Hussain | d15902c | 2018-03-02 00:08:29 -0800 | [diff] [blame] | 3185 | if (!wlan_res_cfg) { |
| 3186 | WMA_LOGE("%s: wlan_res_cfg is null", __func__); |
| 3187 | qdf_status = QDF_STATUS_E_NOMEM; |
| 3188 | goto err_wma_handle; |
| 3189 | } |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 3190 | |
| 3191 | wma_set_default_tgt_config(wma_handle, wlan_res_cfg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3192 | |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3193 | wma_handle->tx_chain_mask_cck = cds_cfg->tx_chain_mask_cck; |
| 3194 | wma_handle->self_gen_frm_pwr = cds_cfg->self_gen_frm_pwr; |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3195 | wma_init_max_no_of_peers(wma_handle, cds_cfg->max_station); |
| 3196 | cds_cfg->max_station = wma_get_number_of_peers_supported(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3197 | |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3198 | cds_cfg->max_bssid = WMA_MAX_SUPPORTED_BSS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3199 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 3200 | wlan_res_cfg->num_keep_alive_pattern = WMA_MAXNUM_PERIODIC_TX_PTRNS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3201 | |
| 3202 | /* The current firmware implementation requires the number of |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 3203 | * offload peers should be (number of vdevs + 1). |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3204 | */ |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 3205 | wlan_res_cfg->num_offload_peers = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3206 | cds_cfg->ap_maxoffload_peers + 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3207 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 3208 | wlan_res_cfg->num_offload_reorder_buffs = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3209 | cds_cfg->ap_maxoffload_reorderbuffs + 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3210 | |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3211 | wma_handle->max_station = cds_cfg->max_station; |
| 3212 | wma_handle->max_bssid = cds_cfg->max_bssid; |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3213 | wma_handle->driver_type = cds_cfg->driver_type; |
| 3214 | wma_handle->ssdp = cds_cfg->ssdp; |
| 3215 | wma_handle->enable_mc_list = cds_cfg->enable_mc_list; |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 3216 | wma_handle->bpf_packet_filter_enable = |
| 3217 | cds_cfg->bpf_packet_filter_enable; |
Hanumanth Reddy Pothula | e87621b | 2017-04-12 20:53:35 +0530 | [diff] [blame] | 3218 | wma_handle->active_uc_bpf_mode = cds_cfg->active_uc_bpf_mode; |
| 3219 | wma_handle->active_mc_bc_bpf_mode = cds_cfg->active_mc_bc_bpf_mode; |
Srinivas Girigowda | 57b450e | 2016-10-27 21:00:46 -0700 | [diff] [blame] | 3220 | wma_handle->link_stats_results = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3221 | #ifdef FEATURE_WLAN_RA_FILTERING |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3222 | wma_handle->IsRArateLimitEnabled = cds_cfg->is_ra_ratelimit_enabled; |
| 3223 | wma_handle->RArateLimitInterval = cds_cfg->ra_ratelimit_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3224 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 3225 | #ifdef WLAN_FEATURE_LPSS |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3226 | wma_handle->is_lpass_enabled = cds_cfg->is_lpass_enabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3227 | #endif |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3228 | wma_set_nan_enable(wma_handle, cds_cfg); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3229 | wma_handle->interfaces = qdf_mem_malloc(sizeof(struct wma_txrx_node) * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3230 | wma_handle->max_bssid); |
| 3231 | if (!wma_handle->interfaces) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3232 | WMA_LOGE("%s: failed to allocate interface table", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3233 | qdf_status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3234 | goto err_scn_context; |
| 3235 | } |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3236 | |
Zhu Jianmin | a2f8e8d | 2018-02-11 16:37:10 +0800 | [diff] [blame] | 3237 | for (i = 0; i < wma_handle->max_bssid; ++i) { |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3238 | wma_vdev_init(&wma_handle->interfaces[i]); |
Zhu Jianmin | a2f8e8d | 2018-02-11 16:37:10 +0800 | [diff] [blame] | 3239 | wma_handle->interfaces[i].delay_before_vdev_stop = |
| 3240 | cds_cfg->delay_before_vdev_stop; |
| 3241 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3242 | /* Register the debug print event handler */ |
| 3243 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3244 | wmi_debug_print_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3245 | wma_unified_debug_print_event_handler, |
| 3246 | WMA_RX_SERIALIZER_CTX); |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 3247 | /* Register profiling event Handler */ |
| 3248 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3249 | wmi_wlan_profile_data_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3250 | wma_profile_data_report_event_handler, |
| 3251 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3252 | |
| 3253 | wma_handle->tgt_cfg_update_cb = tgt_cfg_cb; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3254 | wma_handle->old_hw_mode_index = WMA_DEFAULT_HW_MODE_INDEX; |
| 3255 | wma_handle->new_hw_mode_index = WMA_DEFAULT_HW_MODE_INDEX; |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 3256 | wma_handle->saved_chan.num_channels = 0; |
Sandeep Puligilla | afa5289 | 2016-10-26 19:03:16 -0700 | [diff] [blame] | 3257 | wma_handle->fw_timeout_crash = cds_cfg->fw_timeout_crash; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3258 | |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 3259 | qdf_status = qdf_mc_timer_init(&wma_handle->service_ready_ext_timer, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3260 | QDF_TIMER_TYPE_SW, |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 3261 | wma_service_ready_ext_evt_timeout, |
| 3262 | wma_handle); |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3263 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 3264 | WMA_LOGE("Failed to initialize service ready ext timeout"); |
| 3265 | goto err_event_init; |
| 3266 | } |
| 3267 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3268 | qdf_status = qdf_event_create(&wma_handle->target_suspend); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3269 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3270 | WMA_LOGE("%s: target suspend event initialization failed", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3271 | __func__); |
| 3272 | goto err_event_init; |
| 3273 | } |
| 3274 | |
| 3275 | /* Init Tx Frame Complete event */ |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3276 | qdf_status = qdf_event_create(&wma_handle->tx_frm_download_comp_event); |
| 3277 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3278 | WMA_LOGE("%s: failed to init tx_frm_download_comp_event", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3279 | __func__); |
| 3280 | goto err_event_init; |
| 3281 | } |
| 3282 | |
| 3283 | /* Init tx queue empty check event */ |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3284 | qdf_status = qdf_event_create(&wma_handle->tx_queue_empty_event); |
| 3285 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3286 | WMA_LOGE("%s: failed to init tx_queue_empty_event", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3287 | goto err_event_init; |
| 3288 | } |
| 3289 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3290 | qdf_status = qdf_event_create(&wma_handle->wma_resume_event); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3291 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3292 | WMA_LOGE("%s: wma_resume_event initialization failed", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3293 | __func__); |
| 3294 | goto err_event_init; |
| 3295 | } |
| 3296 | |
Prashanth Bhatta | e675ca7 | 2016-10-20 18:42:37 -0700 | [diff] [blame] | 3297 | qdf_status = cds_shutdown_notifier_register(wma_shutdown_notifier_cb, |
| 3298 | wma_handle); |
| 3299 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3300 | WMA_LOGE("%s: Shutdown notifier register failed: %d", |
Prashanth Bhatta | e675ca7 | 2016-10-20 18:42:37 -0700 | [diff] [blame] | 3301 | __func__, qdf_status); |
| 3302 | goto err_event_init; |
| 3303 | } |
| 3304 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3305 | qdf_status = qdf_event_create(&wma_handle->runtime_suspend); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3306 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3307 | WMA_LOGE("%s: runtime_suspend event initialization failed", |
Houston Hoffman | a76591b | 2015-11-10 16:52:05 -0800 | [diff] [blame] | 3308 | __func__); |
| 3309 | goto err_event_init; |
| 3310 | } |
| 3311 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3312 | qdf_status = qdf_event_create(&wma_handle->recovery_event); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3313 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3314 | WMA_LOGE("%s: recovery event initialization failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3315 | goto err_event_init; |
| 3316 | } |
| 3317 | |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 3318 | qdf_list_create(&wma_handle->vdev_resp_queue, |
Krishna Kumaar Natarajan | a5c53bd | 2015-10-27 11:48:27 -0700 | [diff] [blame] | 3319 | MAX_ENTRY_VDEV_RESP_QUEUE); |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3320 | qdf_spinlock_create(&wma_handle->vdev_respq_lock); |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 3321 | qdf_list_create(&wma_handle->wma_hold_req_queue, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3322 | MAX_ENTRY_HOLD_REQ_QUEUE); |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3323 | qdf_spinlock_create(&wma_handle->wma_hold_req_q_lock); |
Anurag Chouhan | 8e0ccd3 | 2016-02-19 15:30:20 +0530 | [diff] [blame] | 3324 | qdf_atomic_init(&wma_handle->is_wow_bus_suspended); |
| 3325 | qdf_atomic_init(&wma_handle->scan_id_counter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3326 | |
| 3327 | /* Register vdev start response event handler */ |
| 3328 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3329 | wmi_vdev_start_resp_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3330 | wma_vdev_start_resp_handler, |
| 3331 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3332 | |
| 3333 | /* Register vdev stop response event handler */ |
| 3334 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3335 | wmi_vdev_stopped_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3336 | wma_vdev_stop_resp_handler, |
| 3337 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3338 | |
| 3339 | /* register for STA kickout function */ |
| 3340 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3341 | wmi_peer_sta_kickout_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3342 | wma_peer_sta_kickout_event_handler, |
| 3343 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3344 | |
Naveen Rawat | e8b1b82 | 2018-01-30 09:46:16 -0800 | [diff] [blame] | 3345 | /* register for stats event */ |
| 3346 | wma_register_stats_events(wma_handle->wmi_handle); |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 3347 | |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 3348 | /* register for stats response event */ |
| 3349 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3350 | wmi_get_arp_stats_req_id, |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 3351 | wma_get_arp_stats_handler, |
| 3352 | WMA_RX_SERIALIZER_CTX); |
| 3353 | |
Will Huang | a981459 | 2017-05-24 15:47:58 +0800 | [diff] [blame] | 3354 | /* register for peer info response event */ |
| 3355 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3356 | wmi_peer_stats_info_event_id, |
Will Huang | a981459 | 2017-05-24 15:47:58 +0800 | [diff] [blame] | 3357 | wma_peer_info_event_handler, |
| 3358 | WMA_RX_SERIALIZER_CTX); |
| 3359 | |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 3360 | #ifdef WLAN_POWER_DEBUGFS |
| 3361 | /* register for Chip Power stats event */ |
| 3362 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3363 | wmi_pdev_chip_power_stats_event_id, |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 3364 | wma_unified_power_debug_stats_event_handler, |
| 3365 | WMA_RX_SERIALIZER_CTX); |
| 3366 | #endif |
| 3367 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3368 | /* register for linkspeed response event */ |
| 3369 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3370 | wmi_peer_estimated_linkspeed_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3371 | wma_link_speed_event_handler, |
| 3372 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3373 | |
| 3374 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 3375 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3376 | wmi_oem_response_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3377 | wma_oem_data_response_handler, |
| 3378 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3379 | #endif /* FEATURE_OEM_DATA_SUPPORT */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3380 | |
| 3381 | /* Register peer change event handler */ |
| 3382 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3383 | wmi_peer_state_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3384 | wma_peer_state_change_event_handler, |
| 3385 | WMA_RX_WORK_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3386 | |
| 3387 | /* Register beacon tx complete event id. The event is required |
| 3388 | * for sending channel switch announcement frames |
| 3389 | */ |
| 3390 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3391 | wmi_offload_bcn_tx_status_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3392 | wma_unified_bcntx_status_event_handler, |
| 3393 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3394 | |
| 3395 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3396 | wmi_update_vdev_rate_stats_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3397 | wma_link_status_event_handler, |
| 3398 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3399 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 3400 | /* Register event handler for processing Link Layer Stats |
| 3401 | * response from the FW |
| 3402 | */ |
| 3403 | wma_register_ll_stats_event_handler(wma_handle); |
| 3404 | |
| 3405 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 3406 | |
SaidiReddy Yenuga | cc733af | 2016-11-09 17:45:42 +0530 | [diff] [blame] | 3407 | wmi_set_tgt_assert(wma_handle->wmi_handle, |
| 3408 | cds_cfg->force_target_assert_enabled); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3409 | /* Firmware debug log */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3410 | qdf_status = dbglog_init(wma_handle->wmi_handle); |
| 3411 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3412 | WMA_LOGE("%s: Firmware Dbglog initialization failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3413 | goto err_dbglog_init; |
| 3414 | } |
| 3415 | |
| 3416 | /* |
| 3417 | * Update Powersave mode |
| 3418 | * 1 - Legacy Powersave + Deepsleep Disabled |
| 3419 | * 2 - QPower + Deepsleep Disabled |
| 3420 | * 3 - Legacy Powersave + Deepsleep Enabled |
| 3421 | * 4 - QPower + Deepsleep Enabled |
| 3422 | */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3423 | wma_handle->powersave_mode = cds_cfg->powersave_offload_enabled; |
| 3424 | wma_handle->staMaxLIModDtim = cds_cfg->sta_maxlimod_dtim; |
| 3425 | wma_handle->staModDtim = cds_cfg->sta_mod_dtim; |
| 3426 | wma_handle->staDynamicDtim = cds_cfg->sta_dynamic_dtim; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3427 | |
| 3428 | /* |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3429 | * Value of cds_cfg->wow_enable can be, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3430 | * 0 - Disable both magic pattern match and pattern byte match. |
| 3431 | * 1 - Enable magic pattern match on all interfaces. |
| 3432 | * 2 - Enable pattern byte match on all interfaces. |
| 3433 | * 3 - Enable both magic patter and pattern byte match on |
| 3434 | * all interfaces. |
| 3435 | */ |
| 3436 | wma_handle->wow.magic_ptrn_enable = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3437 | (cds_cfg->wow_enable & 0x01) ? true : false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3438 | wma_handle->ptrn_match_enable_all_vdev = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3439 | (cds_cfg->wow_enable & 0x02) ? true : false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3440 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3441 | /* register for install key completion event */ |
| 3442 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3443 | wmi_vdev_install_key_complete_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3444 | wma_vdev_install_key_complete_event_handler, |
| 3445 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3446 | #ifdef WLAN_FEATURE_NAN |
| 3447 | /* register for nan response event */ |
| 3448 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3449 | wmi_nan_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3450 | wma_nan_rsp_event_handler, |
| 3451 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3452 | #endif /* WLAN_FEATURE_NAN */ |
| 3453 | |
| 3454 | #ifdef WLAN_FEATURE_STATS_EXT |
| 3455 | /* register for extended stats event */ |
| 3456 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3457 | wmi_stats_ext_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3458 | wma_stats_ext_event_handler, |
| 3459 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3460 | #endif /* WLAN_FEATURE_STATS_EXT */ |
| 3461 | #ifdef FEATURE_WLAN_EXTSCAN |
| 3462 | wma_register_extscan_event_handler(wma_handle); |
| 3463 | #endif /* WLAN_FEATURE_STATS_EXT */ |
| 3464 | |
| 3465 | WMA_LOGD("%s: Exit", __func__); |
| 3466 | |
| 3467 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3468 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3469 | wmi_roam_synch_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3470 | wma_roam_synch_event_handler, |
| 3471 | WMA_RX_SERIALIZER_CTX); |
Padma, Santhosh Kumar | aa2433e | 2017-10-06 14:34:46 +0530 | [diff] [blame] | 3472 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3473 | wmi_roam_synch_frame_event_id, |
Padma, Santhosh Kumar | aa2433e | 2017-10-06 14:34:46 +0530 | [diff] [blame] | 3474 | wma_roam_synch_frame_event_handler, |
| 3475 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3476 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 3477 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3478 | wmi_rssi_breach_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3479 | wma_rssi_breached_event_handler, |
| 3480 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3481 | |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3482 | qdf_wake_lock_create(&wma_handle->wmi_cmd_rsp_wake_lock, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3483 | "wlan_fw_rsp_wakelock"); |
Prashanth Bhatta | 87b6dc0 | 2017-01-19 15:17:58 -0800 | [diff] [blame] | 3484 | qdf_runtime_lock_init(&wma_handle->wmi_cmd_rsp_runtime_lock); |
Sandeep Puligilla | 19ddda2 | 2016-01-05 12:18:02 -0800 | [diff] [blame] | 3485 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3486 | /* Register peer assoc conf event handler */ |
| 3487 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3488 | wmi_peer_assoc_conf_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3489 | wma_peer_assoc_conf_handler, |
| 3490 | WMA_RX_SERIALIZER_CTX); |
Sandeep Puligilla | 19ddda2 | 2016-01-05 12:18:02 -0800 | [diff] [blame] | 3491 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3492 | wmi_vdev_delete_resp_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3493 | wma_vdev_delete_handler, |
| 3494 | WMA_RX_SERIALIZER_CTX); |
Sandeep Puligilla | 19ddda2 | 2016-01-05 12:18:02 -0800 | [diff] [blame] | 3495 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3496 | wmi_peer_delete_response_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3497 | wma_peer_delete_handler, |
| 3498 | WMA_RX_SERIALIZER_CTX); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 3499 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3500 | wmi_bpf_capability_info_event_id, |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 3501 | wma_get_bpf_caps_event_handler, |
| 3502 | WMA_RX_SERIALIZER_CTX); |
Padma, Santhosh Kumar | d7cc079 | 2016-06-28 18:54:12 +0530 | [diff] [blame] | 3503 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3504 | wmi_chan_info_event_id, |
Kapil Gupta | 4f0c0c1 | 2017-02-07 15:21:15 +0530 | [diff] [blame] | 3505 | wma_chan_info_event_handler, |
| 3506 | WMA_RX_SERIALIZER_CTX); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 3507 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3508 | wmi_dbg_mesg_flush_complete_event_id, |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 3509 | wma_flush_complete_evt_handler, |
Rajeev Kumar | c3032b8 | 2017-02-14 15:56:01 -0800 | [diff] [blame] | 3510 | WMA_RX_WORK_CTX); |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 3511 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3512 | wmi_report_rx_aggr_failure_event_id, |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 3513 | wma_rx_aggr_failure_event_handler, |
| 3514 | WMA_RX_SERIALIZER_CTX); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 3515 | |
Ashish Kumar Dhanotiya | 9335d81 | 2017-06-30 16:57:20 +0530 | [diff] [blame] | 3516 | wma_handle->ito_repeat_count = cds_cfg->ito_repeat_count; |
Sandeep Puligilla | 819d94f | 2017-10-10 18:33:56 -0700 | [diff] [blame] | 3517 | wma_handle->bandcapability = cds_cfg->bandcapability; |
Ashish Kumar Dhanotiya | 9335d81 | 2017-06-30 16:57:20 +0530 | [diff] [blame] | 3518 | |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 3519 | /* Register PWR_SAVE_FAIL event only in case of recovery(1) */ |
Hanumanth Reddy Pothula | ab39595 | 2017-09-05 19:12:26 +0530 | [diff] [blame] | 3520 | if (cds_cfg->auto_power_save_fail_mode == |
| 3521 | PMO_FW_TO_SEND_WOW_IND_ON_PWR_FAILURE) { |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 3522 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3523 | wmi_pdev_chip_pwr_save_failure_detect_event_id, |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 3524 | wma_chip_power_save_failure_detected_handler, |
| 3525 | WMA_RX_WORK_CTX); |
| 3526 | } |
| 3527 | |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 3528 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 3529 | wmi_pdev_div_rssi_antid_event_id, |
| 3530 | wma_pdev_div_info_evt_handler, |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 3531 | WMA_RX_WORK_CTX); |
| 3532 | |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 3533 | |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 3534 | wma_register_debug_callback(); |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 3535 | /* Register callback with PMO so PMO can update the vdev pause bitmap*/ |
| 3536 | pmo_register_pause_bitmap_notifier(wma_handle->psoc, |
| 3537 | wma_vdev_update_pause_bitmap); |
| 3538 | pmo_register_get_pause_bitmap(wma_handle->psoc, |
| 3539 | wma_vdev_get_pause_bitmap); |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 3540 | pmo_register_is_device_in_low_pwr_mode(wma_handle->psoc, |
| 3541 | wma_vdev_is_device_in_low_pwr_mode); |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 3542 | wma_cbacks.wma_get_connection_info = wma_get_connection_info; |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 3543 | qdf_status = policy_mgr_register_wma_cb(wma_handle->psoc, &wma_cbacks); |
| 3544 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 3545 | WMA_LOGE("Failed to register wma cb with Policy Manager"); |
| 3546 | } |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 3547 | |
Arif Hussain | f63f7a3 | 2017-08-22 12:49:42 -0700 | [diff] [blame] | 3548 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3549 | wmi_phyerr_event_id, |
Arif Hussain | f63f7a3 | 2017-08-22 12:49:42 -0700 | [diff] [blame] | 3550 | wma_unified_phyerr_rx_event_handler, |
| 3551 | WMA_RX_WORK_CTX); |
| 3552 | |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 3553 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 3554 | wmi_sap_obss_detection_report_event_id, |
| 3555 | wma_vdev_obss_detection_info_handler, |
| 3556 | WMA_RX_SERIALIZER_CTX); |
| 3557 | |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 3558 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 3559 | wmi_obss_color_collision_report_event_id, |
| 3560 | wma_vdev_bss_color_collision_info_handler, |
| 3561 | WMA_RX_WORK_CTX); |
| 3562 | |
| 3563 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3564 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3565 | |
| 3566 | err_dbglog_init: |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3567 | qdf_wake_lock_destroy(&wma_handle->wmi_cmd_rsp_wake_lock); |
Prashanth Bhatta | 87b6dc0 | 2017-01-19 15:17:58 -0800 | [diff] [blame] | 3568 | qdf_runtime_lock_deinit(&wma_handle->wmi_cmd_rsp_runtime_lock); |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3569 | qdf_spinlock_destroy(&wma_handle->vdev_respq_lock); |
| 3570 | qdf_spinlock_destroy(&wma_handle->wma_hold_req_q_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3571 | err_event_init: |
| 3572 | wmi_unified_unregister_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3573 | wmi_debug_print_event_id); |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3574 | |
| 3575 | for (i = 0; i < wma_handle->max_bssid; ++i) |
| 3576 | wma_vdev_deinit(&wma_handle->interfaces[i]); |
| 3577 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3578 | qdf_mem_free(wma_handle->interfaces); |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3579 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3580 | err_scn_context: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3581 | qdf_mem_free(((p_cds_contextType) cds_context)->cfg_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3582 | OS_FREE(wmi_handle); |
| 3583 | |
| 3584 | err_wma_handle: |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3585 | target_if_free_psoc_tgt_info(psoc); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3586 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3587 | #ifdef FEATURE_WLAN_EXTSCAN |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3588 | qdf_wake_lock_destroy(&wma_handle->extscan_wake_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3589 | #endif /* FEATURE_WLAN_EXTSCAN */ |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3590 | qdf_wake_lock_destroy(&wma_handle->wow_wake_lock); |
Mukul Sharma | e44d054 | 2017-05-23 21:50:56 +0530 | [diff] [blame] | 3591 | qdf_wake_lock_destroy(&wma_handle->wow_auth_req_wl); |
| 3592 | qdf_wake_lock_destroy(&wma_handle->wow_assoc_req_wl); |
| 3593 | qdf_wake_lock_destroy(&wma_handle->wow_deauth_rec_wl); |
| 3594 | qdf_wake_lock_destroy(&wma_handle->wow_disassoc_rec_wl); |
| 3595 | qdf_wake_lock_destroy(&wma_handle->wow_ap_assoc_lost_wl); |
| 3596 | qdf_wake_lock_destroy(&wma_handle->wow_auto_shutdown_wl); |
| 3597 | qdf_wake_lock_destroy(&wma_handle->roam_ho_wl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3598 | } |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3599 | err_free_wma_handle: |
Jeff Johnson | adb3b1c | 2017-09-13 10:42:36 -0700 | [diff] [blame] | 3600 | cds_free_context(QDF_MODULE_ID_WMA, wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3601 | |
| 3602 | WMA_LOGD("%s: Exit", __func__); |
| 3603 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3604 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3605 | } |
| 3606 | |
| 3607 | /** |
| 3608 | * wma_pre_start() - wma pre start |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3609 | * |
| 3610 | * Return: 0 on success, errno on failure |
| 3611 | */ |
Jeff Johnson | 8ad89c6 | 2017-09-13 08:55:55 -0700 | [diff] [blame] | 3612 | QDF_STATUS wma_pre_start(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3613 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3614 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3615 | tp_wma_handle wma_handle; |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 3616 | struct scheduler_msg wma_msg = { 0 }; |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3617 | void *htc_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3618 | |
| 3619 | WMA_LOGD("%s: Enter", __func__); |
| 3620 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3621 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3622 | |
| 3623 | /* Validate the wma_handle */ |
| 3624 | if (NULL == wma_handle) { |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3625 | WMA_LOGE("%s: invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3626 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3627 | goto end; |
| 3628 | } |
Nachiket Kukade | 8003d25 | 2017-03-30 15:55:58 +0530 | [diff] [blame] | 3629 | |
Sourav Mohapatra | cf63257 | 2018-04-02 11:01:35 +0530 | [diff] [blame] | 3630 | htc_handle = lmac_get_htc_hdl(wma_handle->psoc); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3631 | if (!htc_handle) { |
| 3632 | WMA_LOGE("%s: invalid htc handle", __func__); |
| 3633 | qdf_status = QDF_STATUS_E_INVAL; |
| 3634 | goto end; |
| 3635 | } |
| 3636 | |
| 3637 | /* Open endpoint for ctrl path - WMI <--> HTC */ |
| 3638 | qdf_status = wmi_unified_connect_htc_service(wma_handle->wmi_handle, |
| 3639 | htc_handle); |
| 3640 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 3641 | WMA_LOGE("%s: wmi_unified_connect_htc_service", __func__); |
Nachiket Kukade | 8003d25 | 2017-03-30 15:55:58 +0530 | [diff] [blame] | 3642 | if (!cds_is_fw_down()) |
| 3643 | QDF_BUG(0); |
| 3644 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3645 | qdf_status = QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3646 | goto end; |
| 3647 | } |
| 3648 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 3649 | WMA_LOGD("WMA --> wmi_unified_connect_htc_service - success"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3650 | |
| 3651 | /* Trigger the CFG DOWNLOAD */ |
| 3652 | wma_msg.type = WNI_CFG_DNLD_REQ; |
| 3653 | wma_msg.bodyptr = NULL; |
| 3654 | wma_msg.bodyval = 0; |
| 3655 | |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 3656 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, &wma_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3657 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3658 | WMA_LOGE("%s: Failed to post WNI_CFG_DNLD_REQ msg", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3659 | QDF_ASSERT(0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3660 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3661 | } |
| 3662 | end: |
| 3663 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3664 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3665 | } |
| 3666 | |
Abhishek Singh | 2d775fd | 2017-08-18 10:51:33 +0530 | [diff] [blame] | 3667 | void wma_send_msg_by_priority(tp_wma_handle wma_handle, uint16_t msg_type, |
| 3668 | void *body_ptr, uint32_t body_val, bool is_high_priority) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3669 | { |
Abhishek Singh | 2d775fd | 2017-08-18 10:51:33 +0530 | [diff] [blame] | 3670 | struct scheduler_msg msg = {0}; |
| 3671 | QDF_STATUS status; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3672 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3673 | msg.type = msg_type; |
| 3674 | msg.bodyval = body_val; |
| 3675 | msg.bodyptr = body_ptr; |
Will Huang | 9323e85 | 2018-02-02 17:55:15 +0800 | [diff] [blame] | 3676 | msg.flush_callback = wma_discard_fw_event; |
Abhishek Singh | 2d775fd | 2017-08-18 10:51:33 +0530 | [diff] [blame] | 3677 | |
| 3678 | status = scheduler_post_msg_by_priority(QDF_MODULE_ID_PE, |
| 3679 | &msg, is_high_priority); |
| 3680 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 3681 | WMA_LOGE("Failed to post msg %d to PE", msg_type); |
| 3682 | if (body_ptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3683 | qdf_mem_free(body_ptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3684 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3685 | } |
| 3686 | |
Abhishek Singh | 2d775fd | 2017-08-18 10:51:33 +0530 | [diff] [blame] | 3687 | |
| 3688 | void wma_send_msg(tp_wma_handle wma_handle, uint16_t msg_type, |
| 3689 | void *body_ptr, uint32_t body_val) |
| 3690 | { |
| 3691 | wma_send_msg_by_priority(wma_handle, msg_type, |
| 3692 | body_ptr, body_val, false); |
| 3693 | } |
| 3694 | |
| 3695 | void wma_send_msg_high_priority(tp_wma_handle wma_handle, uint16_t msg_type, |
| 3696 | void *body_ptr, uint32_t body_val) |
| 3697 | { |
| 3698 | wma_send_msg_by_priority(wma_handle, msg_type, |
| 3699 | body_ptr, body_val, true); |
| 3700 | } |
| 3701 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3702 | /** |
| 3703 | * wma_set_base_macaddr_indicate() - set base mac address in fw |
| 3704 | * @wma_handle: wma handle |
| 3705 | * @customAddr: base mac address |
| 3706 | * |
| 3707 | * Return: 0 for success or error code |
| 3708 | */ |
| 3709 | static int wma_set_base_macaddr_indicate(tp_wma_handle wma_handle, |
| 3710 | tSirMacAddr *customAddr) |
| 3711 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3712 | int err; |
| 3713 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 3714 | err = wmi_unified_set_base_macaddr_indicate_cmd(wma_handle->wmi_handle, |
| 3715 | (uint8_t *)customAddr); |
| 3716 | if (err) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3717 | return -EIO; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3718 | WMA_LOGD("Base MAC Addr: " MAC_ADDRESS_STR, |
| 3719 | MAC_ADDR_ARRAY((*customAddr))); |
| 3720 | |
| 3721 | return 0; |
| 3722 | } |
| 3723 | |
| 3724 | /** |
| 3725 | * wma_log_supported_evt_handler() - Enable/Disable FW diag/log events |
| 3726 | * @handle: WMA handle |
| 3727 | * @event: Event received from FW |
| 3728 | * @len: Length of the event |
| 3729 | * |
| 3730 | * Enables the low frequency events and disables the high frequency |
| 3731 | * events. Bit 17 indicates if the event if low/high frequency. |
| 3732 | * 1 - high frequency, 0 - low frequency |
| 3733 | * |
| 3734 | * Return: 0 on successfully enabling/disabling the events |
| 3735 | */ |
| 3736 | static int wma_log_supported_evt_handler(void *handle, |
| 3737 | uint8_t *event, |
| 3738 | uint32_t len) |
| 3739 | { |
| 3740 | tp_wma_handle wma = (tp_wma_handle) handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3741 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 3742 | if (wmi_unified_log_supported_evt_cmd(wma->wmi_handle, |
| 3743 | event, len)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3744 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3745 | |
| 3746 | return 0; |
| 3747 | } |
| 3748 | |
| 3749 | /** |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3750 | * wma_pdev_set_hw_mode_resp_evt_handler() - Set HW mode resp evt handler |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3751 | * @handle: WMI handle |
| 3752 | * @event: Event recevied from FW |
| 3753 | * @len: Length of the event |
| 3754 | * |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3755 | * Event handler for WMI_PDEV_SET_HW_MODE_RESP_EVENTID that is sent to host |
| 3756 | * driver in response to a WMI_PDEV_SET_HW_MODE_CMDID being sent to WLAN |
| 3757 | * firmware |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3758 | * |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3759 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3760 | */ |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3761 | static int wma_pdev_set_hw_mode_resp_evt_handler(void *handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3762 | uint8_t *event, |
| 3763 | uint32_t len) |
| 3764 | { |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3765 | WMI_PDEV_SET_HW_MODE_RESP_EVENTID_param_tlvs *param_buf; |
| 3766 | wmi_pdev_set_hw_mode_response_event_fixed_param *wmi_event; |
| 3767 | wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3768 | uint32_t i; |
| 3769 | struct sir_set_hw_mode_resp *hw_mode_resp; |
| 3770 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 3771 | |
| 3772 | if (!wma) { |
| 3773 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 3774 | /* Since WMA handle itself is NULL, we cannot send fail |
| 3775 | * response back to LIM here |
| 3776 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3777 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3778 | } |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3779 | |
| 3780 | wma_release_wakelock(&wma->wmi_cmd_rsp_wake_lock); |
Tushnim Bhattacharyya | 4a03db8 | 2017-11-10 17:58:28 -0800 | [diff] [blame] | 3781 | wma_remove_req(wma, 0, WMA_PDEV_SET_HW_MODE_RESP); |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3782 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3783 | hw_mode_resp = qdf_mem_malloc(sizeof(*hw_mode_resp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3784 | if (!hw_mode_resp) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3785 | WMA_LOGE("%s: Memory allocation failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3786 | /* Since this memory allocation itself failed, we cannot |
| 3787 | * send fail response back to LIM here |
| 3788 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3789 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3790 | } |
| 3791 | |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3792 | param_buf = (WMI_PDEV_SET_HW_MODE_RESP_EVENTID_param_tlvs *) event; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3793 | if (!param_buf) { |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3794 | WMA_LOGE("Invalid WMI_PDEV_SET_HW_MODE_RESP_EVENTID event"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3795 | /* Need to send response back to upper layer to free |
| 3796 | * active command list |
| 3797 | */ |
| 3798 | goto fail; |
| 3799 | } |
Krunal Soni | 50a0554 | 2017-10-03 19:39:48 -0700 | [diff] [blame] | 3800 | if (param_buf->fixed_param->num_vdev_mac_entries >= |
| 3801 | MAX_VDEV_SUPPORTED) { |
| 3802 | WMA_LOGE("num_vdev_mac_entries crossed max value"); |
| 3803 | goto fail; |
| 3804 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3805 | |
| 3806 | wmi_event = param_buf->fixed_param; |
Abhinav Kumar | a03659c | 2017-12-28 15:18:07 +0530 | [diff] [blame] | 3807 | if (wmi_event->num_vdev_mac_entries > |
| 3808 | param_buf->num_wmi_pdev_set_hw_mode_response_vdev_mac_mapping) { |
| 3809 | WMA_LOGE("Invalid num_vdev_mac_entries: %d", |
| 3810 | wmi_event->num_vdev_mac_entries); |
| 3811 | goto fail; |
| 3812 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3813 | hw_mode_resp->status = wmi_event->status; |
| 3814 | hw_mode_resp->cfgd_hw_mode_index = wmi_event->cfgd_hw_mode_index; |
| 3815 | hw_mode_resp->num_vdev_mac_entries = wmi_event->num_vdev_mac_entries; |
| 3816 | |
Kiran Kumar Lokere | 1d411bb | 2017-11-29 15:24:05 -0800 | [diff] [blame] | 3817 | WMA_LOGD("%s: status:%d cfgd_hw_mode_index:%d num_vdev_mac_entries:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3818 | __func__, wmi_event->status, |
| 3819 | wmi_event->cfgd_hw_mode_index, |
| 3820 | wmi_event->num_vdev_mac_entries); |
| 3821 | vdev_mac_entry = |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3822 | param_buf->wmi_pdev_set_hw_mode_response_vdev_mac_mapping; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3823 | |
| 3824 | /* Store the vdev-mac map in WMA and prepare to send to PE */ |
| 3825 | for (i = 0; i < wmi_event->num_vdev_mac_entries; i++) { |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3826 | uint32_t vdev_id, mac_id, pdev_id; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3827 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3828 | vdev_id = vdev_mac_entry[i].vdev_id; |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3829 | pdev_id = vdev_mac_entry[i].pdev_id; |
| 3830 | if (pdev_id == WMI_PDEV_ID_SOC) { |
| 3831 | WMA_LOGE("%s: soc level id received for mac id)", |
| 3832 | __func__); |
| 3833 | QDF_BUG(0); |
| 3834 | goto fail; |
| 3835 | } |
| 3836 | mac_id = WMA_PDEV_TO_MAC_MAP(vdev_mac_entry[i].pdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3837 | |
Kiran Kumar Lokere | 1d411bb | 2017-11-29 15:24:05 -0800 | [diff] [blame] | 3838 | WMA_LOGD("%s: vdev_id:%d mac_id:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3839 | __func__, vdev_id, mac_id); |
| 3840 | |
| 3841 | hw_mode_resp->vdev_mac_map[i].vdev_id = vdev_id; |
| 3842 | hw_mode_resp->vdev_mac_map[i].mac_id = mac_id; |
| 3843 | wma_update_intf_hw_mode_params(vdev_id, mac_id, |
| 3844 | wmi_event->cfgd_hw_mode_index); |
| 3845 | } |
| 3846 | |
| 3847 | if (hw_mode_resp->status == SET_HW_MODE_STATUS_OK) { |
| 3848 | if (WMA_DEFAULT_HW_MODE_INDEX == wma->new_hw_mode_index) { |
| 3849 | wma->new_hw_mode_index = wmi_event->cfgd_hw_mode_index; |
| 3850 | } else { |
| 3851 | wma->old_hw_mode_index = wma->new_hw_mode_index; |
| 3852 | wma->new_hw_mode_index = wmi_event->cfgd_hw_mode_index; |
| 3853 | } |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 3854 | policy_mgr_update_hw_mode_index(wma->psoc, |
| 3855 | wmi_event->cfgd_hw_mode_index); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3856 | } |
| 3857 | |
Kiran Kumar Lokere | 1d411bb | 2017-11-29 15:24:05 -0800 | [diff] [blame] | 3858 | WMA_LOGD("%s: Updated: old_hw_mode_index:%d new_hw_mode_index:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3859 | __func__, wma->old_hw_mode_index, wma->new_hw_mode_index); |
| 3860 | |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3861 | wma_send_msg(wma, SIR_HAL_PDEV_SET_HW_MODE_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3862 | (void *) hw_mode_resp, 0); |
| 3863 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3864 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3865 | |
| 3866 | fail: |
| 3867 | WMA_LOGE("%s: Sending fail response to LIM", __func__); |
| 3868 | hw_mode_resp->status = SET_HW_MODE_STATUS_ECANCELED; |
| 3869 | hw_mode_resp->cfgd_hw_mode_index = 0; |
| 3870 | hw_mode_resp->num_vdev_mac_entries = 0; |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3871 | wma_send_msg(wma, SIR_HAL_PDEV_SET_HW_MODE_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3872 | (void *) hw_mode_resp, 0); |
| 3873 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3874 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3875 | } |
| 3876 | |
| 3877 | /** |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3878 | * wma_process_pdev_hw_mode_trans_ind() - Process HW mode transition info |
| 3879 | * |
| 3880 | * @handle: WMA handle |
| 3881 | * @fixed_param: Event fixed parameters |
| 3882 | * @vdev_mac_entry - vdev mac entry |
| 3883 | * @hw_mode_trans_ind - Buffer to store parsed information |
| 3884 | * |
| 3885 | * Parses fixed_param, vdev_mac_entry and fills in the information into |
| 3886 | * hw_mode_trans_ind and wma |
| 3887 | * |
| 3888 | * Return: None |
| 3889 | */ |
| 3890 | void wma_process_pdev_hw_mode_trans_ind(void *handle, |
| 3891 | wmi_pdev_hw_mode_transition_event_fixed_param *fixed_param, |
| 3892 | wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry, |
| 3893 | struct sir_hw_mode_trans_ind *hw_mode_trans_ind) |
| 3894 | { |
| 3895 | uint32_t i; |
| 3896 | tp_wma_handle wma = (tp_wma_handle) handle; |
gaurank kathpalia | d2967a7 | 2018-05-01 12:35:14 +0530 | [diff] [blame] | 3897 | if (fixed_param->num_vdev_mac_entries > MAX_VDEV_SUPPORTED) { |
| 3898 | WMA_LOGE("Number of Vdev mac entries %d exceeded" |
| 3899 | " max vdev supported %d", |
| 3900 | fixed_param->num_vdev_mac_entries, |
| 3901 | MAX_VDEV_SUPPORTED); |
| 3902 | return; |
| 3903 | } |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3904 | hw_mode_trans_ind->old_hw_mode_index = fixed_param->old_hw_mode_index; |
| 3905 | hw_mode_trans_ind->new_hw_mode_index = fixed_param->new_hw_mode_index; |
| 3906 | hw_mode_trans_ind->num_vdev_mac_entries = |
| 3907 | fixed_param->num_vdev_mac_entries; |
Kiran Kumar Lokere | 1d411bb | 2017-11-29 15:24:05 -0800 | [diff] [blame] | 3908 | WMA_LOGD("%s: old_hw_mode_index:%d new_hw_mode_index:%d entries=%d", |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3909 | __func__, fixed_param->old_hw_mode_index, |
| 3910 | fixed_param->new_hw_mode_index, |
| 3911 | fixed_param->num_vdev_mac_entries); |
| 3912 | |
| 3913 | /* Store the vdev-mac map in WMA and send to policy manager */ |
| 3914 | for (i = 0; i < fixed_param->num_vdev_mac_entries; i++) { |
| 3915 | uint32_t vdev_id, mac_id, pdev_id; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3916 | |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3917 | vdev_id = vdev_mac_entry[i].vdev_id; |
| 3918 | pdev_id = vdev_mac_entry[i].pdev_id; |
| 3919 | |
| 3920 | if (pdev_id == WMI_PDEV_ID_SOC) { |
| 3921 | WMA_LOGE("%s: soc level id received for mac id)", |
| 3922 | __func__); |
| 3923 | QDF_BUG(0); |
| 3924 | return; |
| 3925 | } |
| 3926 | |
| 3927 | mac_id = WMA_PDEV_TO_MAC_MAP(vdev_mac_entry[i].pdev_id); |
| 3928 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3929 | WMA_LOGE("%s: vdev_id:%d mac_id:%d", |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3930 | __func__, vdev_id, mac_id); |
| 3931 | |
| 3932 | hw_mode_trans_ind->vdev_mac_map[i].vdev_id = vdev_id; |
| 3933 | hw_mode_trans_ind->vdev_mac_map[i].mac_id = mac_id; |
| 3934 | wma_update_intf_hw_mode_params(vdev_id, mac_id, |
| 3935 | fixed_param->new_hw_mode_index); |
| 3936 | } |
| 3937 | wma->old_hw_mode_index = fixed_param->old_hw_mode_index; |
| 3938 | wma->new_hw_mode_index = fixed_param->new_hw_mode_index; |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 3939 | policy_mgr_update_new_hw_mode_index(wma->psoc, |
| 3940 | fixed_param->new_hw_mode_index); |
| 3941 | policy_mgr_update_old_hw_mode_index(wma->psoc, |
| 3942 | fixed_param->old_hw_mode_index); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3943 | |
Kiran Kumar Lokere | 1d411bb | 2017-11-29 15:24:05 -0800 | [diff] [blame] | 3944 | WMA_LOGD("%s: Updated: old_hw_mode_index:%d new_hw_mode_index:%d", |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3945 | __func__, wma->old_hw_mode_index, wma->new_hw_mode_index); |
| 3946 | } |
| 3947 | |
| 3948 | /** |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3949 | * wma_pdev_hw_mode_transition_evt_handler() - HW mode transition evt handler |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3950 | * @handle: WMI handle |
| 3951 | * @event: Event recevied from FW |
| 3952 | * @len: Length of the event |
| 3953 | * |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3954 | * Event handler for WMI_PDEV_HW_MODE_TRANSITION_EVENTID that indicates an |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3955 | * asynchronous hardware mode transition. This event notifies the host driver |
| 3956 | * that firmware independently changed the hardware mode for some reason, such |
| 3957 | * as Coex, LFR 3.0, etc |
| 3958 | * |
| 3959 | * Return: Success on receiving valid params from FW |
| 3960 | */ |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3961 | static int wma_pdev_hw_mode_transition_evt_handler(void *handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3962 | uint8_t *event, |
| 3963 | uint32_t len) |
| 3964 | { |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3965 | WMI_PDEV_HW_MODE_TRANSITION_EVENTID_param_tlvs *param_buf; |
| 3966 | wmi_pdev_hw_mode_transition_event_fixed_param *wmi_event; |
| 3967 | wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3968 | struct sir_hw_mode_trans_ind *hw_mode_trans_ind; |
| 3969 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 3970 | |
| 3971 | if (!wma) { |
| 3972 | /* This is an async event. So, not sending any event to LIM */ |
| 3973 | WMA_LOGE("Invalid WMA handle"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3974 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3975 | } |
| 3976 | |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3977 | param_buf = (WMI_PDEV_HW_MODE_TRANSITION_EVENTID_param_tlvs *) event; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3978 | if (!param_buf) { |
| 3979 | /* This is an async event. So, not sending any event to LIM */ |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3980 | WMA_LOGE("Invalid WMI_PDEV_HW_MODE_TRANSITION_EVENTID event"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3981 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3982 | } |
| 3983 | |
Arif Hussain | 34f7206 | 2017-10-04 17:25:24 -0700 | [diff] [blame] | 3984 | if (param_buf->fixed_param->num_vdev_mac_entries > MAX_VDEV_SUPPORTED) { |
| 3985 | WMA_LOGE("num_vdev_mac_entries: %d crossed max value: %d", |
| 3986 | param_buf->fixed_param->num_vdev_mac_entries, |
| 3987 | MAX_VDEV_SUPPORTED); |
| 3988 | return QDF_STATUS_E_FAILURE; |
| 3989 | } |
| 3990 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3991 | hw_mode_trans_ind = qdf_mem_malloc(sizeof(*hw_mode_trans_ind)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3992 | if (!hw_mode_trans_ind) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3993 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 3994 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3995 | } |
| 3996 | |
| 3997 | wmi_event = param_buf->fixed_param; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3998 | vdev_mac_entry = |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3999 | param_buf->wmi_pdev_set_hw_mode_response_vdev_mac_mapping; |
Abhinav Kumar | a03659c | 2017-12-28 15:18:07 +0530 | [diff] [blame] | 4000 | if (wmi_event->num_vdev_mac_entries > |
| 4001 | param_buf->num_wmi_pdev_set_hw_mode_response_vdev_mac_mapping) { |
| 4002 | WMA_LOGE("Invalid num_vdev_mac_entries: %d", |
| 4003 | wmi_event->num_vdev_mac_entries); |
| 4004 | qdf_mem_free(hw_mode_trans_ind); |
| 4005 | return -EINVAL; |
| 4006 | } |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4007 | wma_process_pdev_hw_mode_trans_ind(wma, wmi_event, vdev_mac_entry, |
| 4008 | hw_mode_trans_ind); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4009 | /* Pass the message to PE */ |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 4010 | wma_send_msg(wma, SIR_HAL_PDEV_HW_MODE_TRANS_IND, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4011 | (void *) hw_mode_trans_ind, 0); |
| 4012 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4013 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4014 | } |
| 4015 | |
| 4016 | /** |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4017 | * wma_pdev_set_dual_mode_config_resp_evt_handler() - Dual mode evt handler |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4018 | * @handle: WMI handle |
| 4019 | * @event: Event received from FW |
| 4020 | * @len: Length of the event |
| 4021 | * |
| 4022 | * Notifies the host driver of the completion or failure of a |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4023 | * WMI_PDEV_SET_MAC_CONFIG_CMDID command. This event would be returned to |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4024 | * the host driver once the firmware has completed a reconfiguration of the Scan |
| 4025 | * and FW mode configuration. This changes could include entering or leaving a |
| 4026 | * dual mac configuration for either scan and/or more permanent firmware mode. |
| 4027 | * |
| 4028 | * Return: Success on receiving valid params from FW |
| 4029 | */ |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4030 | static int wma_pdev_set_dual_mode_config_resp_evt_handler(void *handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4031 | uint8_t *event, |
| 4032 | uint32_t len) |
| 4033 | { |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4034 | WMI_PDEV_SET_MAC_CONFIG_RESP_EVENTID_param_tlvs *param_buf; |
| 4035 | wmi_pdev_set_mac_config_response_event_fixed_param *wmi_event; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4036 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 4037 | struct sir_dual_mac_config_resp *dual_mac_cfg_resp; |
| 4038 | |
| 4039 | if (!wma) { |
| 4040 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 4041 | /* Since the WMA handle is NULL, we cannot send resp to LIM. |
| 4042 | * So, returning from here. |
| 4043 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4044 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4045 | } |
Krunal Soni | a5ccb80 | 2017-07-03 12:59:40 -0700 | [diff] [blame] | 4046 | wma_release_wakelock(&wma->wmi_cmd_rsp_wake_lock); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4047 | dual_mac_cfg_resp = qdf_mem_malloc(sizeof(*dual_mac_cfg_resp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4048 | if (!dual_mac_cfg_resp) { |
| 4049 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 4050 | /* Since the mem alloc failed, we cannot send resp to LIM. |
| 4051 | * So, returning from here. |
| 4052 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4053 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4054 | } |
| 4055 | |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4056 | param_buf = (WMI_PDEV_SET_MAC_CONFIG_RESP_EVENTID_param_tlvs *) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4057 | event; |
| 4058 | if (!param_buf) { |
| 4059 | WMA_LOGE("%s: Invalid event", __func__); |
| 4060 | goto fail; |
| 4061 | } |
| 4062 | |
| 4063 | wmi_event = param_buf->fixed_param; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4064 | WMA_LOGD("%s: status:%d", __func__, wmi_event->status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4065 | dual_mac_cfg_resp->status = wmi_event->status; |
| 4066 | |
| 4067 | if (SET_HW_MODE_STATUS_OK == dual_mac_cfg_resp->status) { |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 4068 | policy_mgr_update_dbs_scan_config(wma->psoc); |
| 4069 | policy_mgr_update_dbs_fw_config(wma->psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4070 | } |
| 4071 | |
| 4072 | /* Pass the message to PE */ |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4073 | wma_send_msg(wma, SIR_HAL_PDEV_MAC_CFG_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4074 | (void *) dual_mac_cfg_resp, 0); |
| 4075 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4076 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4077 | |
| 4078 | fail: |
| 4079 | WMA_LOGE("%s: Sending fail response to LIM", __func__); |
| 4080 | dual_mac_cfg_resp->status = SET_HW_MODE_STATUS_ECANCELED; |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4081 | wma_send_msg(wma, SIR_HAL_PDEV_MAC_CFG_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4082 | (void *) dual_mac_cfg_resp, 0); |
| 4083 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4084 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4085 | |
| 4086 | } |
| 4087 | |
| 4088 | /** |
gaurank kathpalia | 85f8a61 | 2018-02-21 18:55:24 +0530 | [diff] [blame] | 4089 | * wma_send_time_stamp_sync_cmd() - timer callback send timestamp to |
| 4090 | * firmware to sync with host. |
| 4091 | * @wma_handle: wma handle |
| 4092 | * |
| 4093 | * Return: void |
| 4094 | */ |
| 4095 | static void wma_send_time_stamp_sync_cmd(void *data) |
| 4096 | { |
| 4097 | tp_wma_handle wma_handle; |
| 4098 | QDF_STATUS qdf_status; |
| 4099 | |
| 4100 | wma_handle = (tp_wma_handle) data; |
| 4101 | |
| 4102 | wmi_send_time_stamp_sync_cmd_tlv(wma_handle->wmi_handle); |
| 4103 | |
| 4104 | /* Start/Restart the timer */ |
| 4105 | qdf_status = qdf_mc_timer_start(&wma_handle->wma_fw_time_sync_timer, |
| 4106 | WMA_FW_TIME_SYNC_TIMER); |
| 4107 | if (QDF_IS_STATUS_ERROR(qdf_status)) |
| 4108 | WMA_LOGE("Failed to start the firmware time sync timer"); |
| 4109 | } |
| 4110 | |
| 4111 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4112 | * wma_start() - wma start function. |
| 4113 | * Intialize event handlers and timers. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4114 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4115 | * Return: 0 on success, QDF Error on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4116 | */ |
Jeff Johnson | d489255 | 2017-09-13 08:41:31 -0700 | [diff] [blame] | 4117 | QDF_STATUS wma_start(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4118 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4119 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4120 | tp_wma_handle wma_handle; |
| 4121 | int status; |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 4122 | struct wmi_spectral_cmd_ops cmd_ops; |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4123 | struct wmi_unified *wmi_handle; |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 4124 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4125 | WMA_LOGD("%s: Enter", __func__); |
| 4126 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4127 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4128 | /* validate the wma_handle */ |
| 4129 | if (NULL == wma_handle) { |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4130 | WMA_LOGE("%s: Invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4131 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4132 | goto end; |
| 4133 | } |
Sandeep Puligilla | d698bf5 | 2017-09-15 16:07:02 -0700 | [diff] [blame] | 4134 | |
Sourav Mohapatra | cf63257 | 2018-04-02 11:01:35 +0530 | [diff] [blame] | 4135 | wmi_handle = get_wmi_unified_hdl_from_psoc(wma_handle->psoc); |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4136 | if (!wmi_handle) { |
| 4137 | WMA_LOGE("%s: Invalid wmi handle", __func__); |
| 4138 | qdf_status = QDF_STATUS_E_INVAL; |
| 4139 | goto end; |
| 4140 | } |
| 4141 | |
| 4142 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4143 | wmi_roam_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4144 | wma_roam_event_callback, |
Padma, Santhosh Kumar | 18169ce | 2017-03-02 18:04:02 +0530 | [diff] [blame] | 4145 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4146 | if (0 != status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4147 | WMA_LOGE("%s: Failed to register Roam callback", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4148 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4149 | goto end; |
| 4150 | } |
| 4151 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4152 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4153 | wmi_wow_wakeup_host_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4154 | wma_wow_wakeup_host_event, |
| 4155 | WMA_RX_TASKLET_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4156 | if (status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4157 | WMA_LOGE("%s: Failed to register wow wakeup host event handler", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4158 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4159 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4160 | goto end; |
| 4161 | } |
| 4162 | |
Will Huang | 3cd2b7c | 2017-11-17 13:16:56 +0800 | [diff] [blame] | 4163 | if (wma_d0_wow_is_supported()) { |
| 4164 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4165 | wmi_handle, |
Will Huang | 9adefff | 2017-12-15 14:50:03 +0800 | [diff] [blame] | 4166 | wmi_d0_wow_disable_ack_event_id, |
Will Huang | 3cd2b7c | 2017-11-17 13:16:56 +0800 | [diff] [blame] | 4167 | wma_d0_wow_disable_ack_event, |
| 4168 | WMA_RX_TASKLET_CTX); |
| 4169 | if (status) { |
| 4170 | WMA_LOGE("%s: Failed to register d0wow disable ack" |
| 4171 | " event handler", __func__); |
| 4172 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4173 | goto end; |
| 4174 | } |
| 4175 | } |
| 4176 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4177 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4178 | wmi_pdev_resume_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4179 | wma_pdev_resume_event_handler, |
| 4180 | WMA_RX_TASKLET_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4181 | if (status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4182 | WMA_LOGE("%s: Failed to register PDEV resume event handler", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4183 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4184 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4185 | goto end; |
| 4186 | } |
Poddar, Siddarth | 5a91f5b | 2016-04-28 12:24:10 +0530 | [diff] [blame] | 4187 | #if defined(QCA_LL_LEGACY_TX_FLOW_CONTROL) || \ |
| 4188 | defined(QCA_LL_TX_FLOW_CONTROL_V2) || defined(CONFIG_HL_SUPPORT) |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 4189 | WMA_LOGD("MCC TX Pause Event Handler register"); |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4190 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4191 | wmi_tx_pause_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4192 | wma_mcc_vdev_tx_pause_evt_handler, |
| 4193 | WMA_RX_TASKLET_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4194 | #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ |
| 4195 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4196 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 4197 | WMA_LOGD("Registering auto shutdown handler"); |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4198 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4199 | wmi_host_auto_shutdown_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4200 | wma_auto_shutdown_event_handler, |
| 4201 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4202 | if (status) { |
| 4203 | WMA_LOGE("Failed to register WMI Auto shutdown event handler"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4204 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4205 | goto end; |
| 4206 | } |
| 4207 | #endif /* FEATURE_WLAN_AUTO_SHUTDOWN */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4208 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4209 | wmi_thermal_mgmt_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4210 | wma_thermal_mgmt_evt_handler, |
| 4211 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4212 | if (status) { |
| 4213 | WMA_LOGE("Failed to register thermal mitigation event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4214 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4215 | goto end; |
| 4216 | } |
| 4217 | |
Zhang Qian | 47e22ce | 2018-01-04 15:38:38 +0800 | [diff] [blame] | 4218 | status = wma_ocb_register_callbacks(wma_handle); |
| 4219 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 4220 | WMA_LOGE("Failed to register OCB callbacks"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4221 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4222 | goto end; |
| 4223 | } |
| 4224 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4225 | qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4226 | |
| 4227 | #ifdef QCA_WIFI_FTM |
| 4228 | /* |
| 4229 | * Tx mgmt attach requires TXRX context which is not created |
| 4230 | * in FTM mode. So skip the TX mgmt attach. |
| 4231 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4232 | if (cds_get_conparam() == QDF_GLOBAL_FTM_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4233 | goto end; |
| 4234 | #endif /* QCA_WIFI_FTM */ |
| 4235 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4236 | if (wmi_service_enabled(wmi_handle, wmi_service_rmc)) { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4237 | |
| 4238 | WMA_LOGD("FW supports cesium network, registering event handlers"); |
| 4239 | |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4240 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4241 | wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4242 | wmi_peer_info_event_id, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4243 | wma_ibss_peer_info_event_handler, |
| 4244 | WMA_RX_SERIALIZER_CTX); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4245 | if (status) { |
| 4246 | WMA_LOGE("Failed to register ibss peer info event cb"); |
| 4247 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4248 | goto end; |
| 4249 | } |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4250 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4251 | wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4252 | wmi_peer_tx_fail_cnt_thr_event_id, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4253 | wma_fast_tx_fail_event_handler, |
| 4254 | WMA_RX_SERIALIZER_CTX); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4255 | if (status) { |
| 4256 | WMA_LOGE("Failed to register peer fast tx failure event cb"); |
| 4257 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4258 | goto end; |
| 4259 | } |
| 4260 | } else { |
| 4261 | WMA_LOGE("Target does not support cesium network"); |
| 4262 | } |
| 4263 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4264 | qdf_status = wma_tx_attach(wma_handle); |
| 4265 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4266 | WMA_LOGE("%s: Failed to register tx management", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4267 | goto end; |
| 4268 | } |
| 4269 | |
gaurank kathpalia | 85f8a61 | 2018-02-21 18:55:24 +0530 | [diff] [blame] | 4270 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
| 4271 | /* Initialize firmware time stamp sync timer */ |
| 4272 | qdf_status = |
| 4273 | qdf_mc_timer_init(&wma_handle->wma_fw_time_sync_timer, |
| 4274 | QDF_TIMER_TYPE_SW, |
| 4275 | wma_send_time_stamp_sync_cmd, |
| 4276 | wma_handle); |
| 4277 | if (QDF_IS_STATUS_ERROR(qdf_status)) |
| 4278 | WMA_LOGE(FL("Failed to initialize firmware time stamp sync timer")); |
| 4279 | /* Start firmware time stamp sync timer */ |
| 4280 | wma_send_time_stamp_sync_cmd(wma_handle); |
| 4281 | } |
| 4282 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4283 | /* Initialize log completion timeout */ |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 4284 | qdf_status = qdf_mc_timer_init(&wma_handle->log_completion_timer, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4285 | QDF_TIMER_TYPE_SW, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4286 | wma_log_completion_timeout, |
| 4287 | wma_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4288 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4289 | WMA_LOGE("Failed to initialize log completion timeout"); |
| 4290 | goto end; |
| 4291 | } |
| 4292 | |
Jeff Johnson | 6136fb9 | 2017-03-30 15:21:49 -0700 | [diff] [blame] | 4293 | status = wma_fips_register_event_handlers(wma_handle); |
| 4294 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 4295 | WMA_LOGE("Failed to register FIPS event handler"); |
| 4296 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4297 | goto end; |
| 4298 | } |
| 4299 | |
Jeff Johnson | f0e54b0 | 2017-12-18 15:22:25 -0800 | [diff] [blame] | 4300 | status = wma_sar_register_event_handlers(wma_handle); |
| 4301 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 4302 | WMA_LOGE("Failed to register SAR event handlers"); |
| 4303 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4304 | goto end; |
| 4305 | } |
| 4306 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4307 | /* Initialize the get temperature event handler */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4308 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4309 | wmi_pdev_temperature_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4310 | wma_pdev_temperature_evt_handler, |
| 4311 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4312 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4313 | WMA_LOGE("Failed to register get_temperature event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4314 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4315 | goto end; |
| 4316 | } |
| 4317 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4318 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4319 | wmi_vdev_tsf_report_event_id, |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 4320 | wma_vdev_tsf_handler, |
| 4321 | WMA_RX_SERIALIZER_CTX); |
| 4322 | if (0 != status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4323 | WMA_LOGE("%s: Failed to register tsf callback", __func__); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 4324 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4325 | goto end; |
| 4326 | } |
| 4327 | |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 4328 | /* Initialize the wma_pdev_set_hw_mode_resp_evt_handler event handler */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4329 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4330 | wmi_pdev_set_hw_mode_rsp_event_id, |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 4331 | wma_pdev_set_hw_mode_resp_evt_handler, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4332 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4333 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4334 | WMA_LOGE("Failed to register set hw mode resp event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4335 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4336 | goto end; |
| 4337 | } |
| 4338 | |
| 4339 | /* Initialize the WMI_SOC_HW_MODE_TRANSITION_EVENTID event handler */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4340 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4341 | wmi_pdev_hw_mode_transition_event_id, |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 4342 | wma_pdev_hw_mode_transition_evt_handler, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4343 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4344 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4345 | WMA_LOGE("Failed to register hw mode transition event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4346 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4347 | goto end; |
| 4348 | } |
| 4349 | |
| 4350 | /* Initialize the set dual mac configuration event handler */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4351 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4352 | wmi_pdev_set_mac_config_resp_event_id, |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4353 | wma_pdev_set_dual_mode_config_resp_evt_handler, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4354 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4355 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4356 | WMA_LOGE("Failed to register hw mode transition event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4357 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4358 | goto end; |
| 4359 | } |
| 4360 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4361 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4362 | wmi_coex_bt_activity_event_id, |
Vidyullatha Kanchanapally | be0ebb3 | 2017-03-23 14:36:21 +0530 | [diff] [blame] | 4363 | wma_wlan_bt_activity_evt_handler, |
| 4364 | WMA_RX_SERIALIZER_CTX); |
| 4365 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 4366 | WMA_LOGE("Failed to register coex bt activity event handler"); |
| 4367 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4368 | goto end; |
| 4369 | } |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 4370 | |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 4371 | cmd_ops.wmi_spectral_configure_cmd_send = |
| 4372 | wmi_unified_vdev_spectral_configure_cmd_send; |
| 4373 | cmd_ops.wmi_spectral_enable_cmd_send = |
| 4374 | wmi_unified_vdev_spectral_enable_cmd_send; |
| 4375 | wlan_register_wmi_spectral_cmd_ops(wma_handle->pdev, &cmd_ops); |
Vidyullatha Kanchanapally | be0ebb3 | 2017-03-23 14:36:21 +0530 | [diff] [blame] | 4376 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4377 | end: |
| 4378 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4379 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4380 | } |
| 4381 | |
| 4382 | /** |
| 4383 | * wma_stop() - wma stop function. |
| 4384 | * cleanup timers and suspend target. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4385 | * @reason: reason for wma_stop. |
| 4386 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4387 | * Return: 0 on success, QDF Error on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4388 | */ |
Jeff Johnson | acc1cc7 | 2017-09-13 08:47:49 -0700 | [diff] [blame] | 4389 | QDF_STATUS wma_stop(uint8_t reason) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4390 | { |
| 4391 | tp_wma_handle wma_handle; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4392 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | ede435f | 2015-12-01 16:16:36 +0530 | [diff] [blame] | 4393 | int i; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4394 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4395 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4396 | WMA_LOGD("%s: Enter", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4397 | /* validate the wma_handle */ |
| 4398 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4399 | WMA_LOGE("%s: Invalid handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4400 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4401 | goto end; |
| 4402 | } |
| 4403 | #ifdef QCA_WIFI_FTM |
| 4404 | /* |
| 4405 | * Tx mgmt detach requires TXRX context which is not created |
| 4406 | * in FTM mode. So skip the TX mgmt detach. |
| 4407 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4408 | if (cds_get_conparam() == QDF_GLOBAL_FTM_MODE) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4409 | qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4410 | goto end; |
| 4411 | } |
| 4412 | #endif /* QCA_WIFI_FTM */ |
| 4413 | |
| 4414 | if (wma_handle->ack_work_ctx) { |
| 4415 | cds_flush_work(&wma_handle->ack_work_ctx->ack_cmp_work); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4416 | qdf_mem_free(wma_handle->ack_work_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4417 | wma_handle->ack_work_ctx = NULL; |
| 4418 | } |
| 4419 | |
| 4420 | /* Destroy the timer for log completion */ |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 4421 | qdf_status = qdf_mc_timer_destroy(&wma_handle->log_completion_timer); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4422 | if (qdf_status != QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4423 | WMA_LOGE("Failed to destroy the log completion timer"); |
Govind Singh | ede435f | 2015-12-01 16:16:36 +0530 | [diff] [blame] | 4424 | /* clean up ll-queue for all vdev */ |
| 4425 | for (i = 0; i < wma_handle->max_bssid; i++) { |
| 4426 | if (wma_handle->interfaces[i].handle && |
Mukul Sharma | f904723 | 2017-03-02 16:58:56 +0530 | [diff] [blame] | 4427 | wma_is_vdev_up(i)) { |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 4428 | cdp_fc_vdev_flush( |
| 4429 | cds_get_context(QDF_MODULE_ID_SOC), |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 4430 | wma_handle-> |
| 4431 | interfaces[i].handle); |
Govind Singh | ede435f | 2015-12-01 16:16:36 +0530 | [diff] [blame] | 4432 | } |
| 4433 | } |
gaurank kathpalia | 85f8a61 | 2018-02-21 18:55:24 +0530 | [diff] [blame] | 4434 | |
| 4435 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
| 4436 | /* Destroy firmware time stamp sync timer */ |
| 4437 | qdf_status = qdf_mc_timer_destroy( |
| 4438 | &wma_handle->wma_fw_time_sync_timer); |
| 4439 | if (QDF_IS_STATUS_ERROR(qdf_status)) |
| 4440 | WMA_LOGE(FL("Failed to destroy the fw time sync timer")); |
| 4441 | } |
| 4442 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4443 | qdf_status = wma_tx_detach(wma_handle); |
| 4444 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4445 | WMA_LOGE("%s: Failed to deregister tx management", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4446 | goto end; |
| 4447 | } |
| 4448 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4449 | end: |
| 4450 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4451 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4452 | } |
| 4453 | |
| 4454 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4455 | * wma_wmi_service_close() - close wma wmi service interface. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4456 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4457 | * Return: 0 on success, QDF Error on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4458 | */ |
Jeff Johnson | 7b3ddc2 | 2017-09-13 09:42:44 -0700 | [diff] [blame] | 4459 | QDF_STATUS wma_wmi_service_close(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4460 | { |
Jeff Johnson | 7b3ddc2 | 2017-09-13 09:42:44 -0700 | [diff] [blame] | 4461 | void *cds_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4462 | tp_wma_handle wma_handle; |
| 4463 | struct beacon_info *bcn; |
| 4464 | int i; |
| 4465 | |
| 4466 | WMA_LOGD("%s: Enter", __func__); |
| 4467 | |
Jeff Johnson | 7b3ddc2 | 2017-09-13 09:42:44 -0700 | [diff] [blame] | 4468 | cds_ctx = cds_get_global_context(); |
| 4469 | if (!cds_ctx) { |
| 4470 | WMA_LOGE("%s: Invalid CDS context", __func__); |
| 4471 | return QDF_STATUS_E_INVAL; |
| 4472 | } |
| 4473 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4474 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4475 | |
| 4476 | /* validate the wma_handle */ |
| 4477 | if (NULL == wma_handle) { |
| 4478 | WMA_LOGE("%s: Invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4479 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4480 | } |
| 4481 | |
| 4482 | /* validate the wmi handle */ |
| 4483 | if (NULL == wma_handle->wmi_handle) { |
| 4484 | WMA_LOGE("%s: Invalid wmi handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4485 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4486 | } |
| 4487 | |
| 4488 | /* dettach the wmi serice */ |
| 4489 | WMA_LOGD("calling wmi_unified_detach"); |
| 4490 | wmi_unified_detach(wma_handle->wmi_handle); |
| 4491 | wma_handle->wmi_handle = NULL; |
| 4492 | |
| 4493 | for (i = 0; i < wma_handle->max_bssid; i++) { |
| 4494 | bcn = wma_handle->interfaces[i].beacon; |
| 4495 | |
| 4496 | if (bcn) { |
| 4497 | if (bcn->dma_mapped) |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 4498 | qdf_nbuf_unmap_single(wma_handle->qdf_dev, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4499 | bcn->buf, QDF_DMA_TO_DEVICE); |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 4500 | qdf_nbuf_free(bcn->buf); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4501 | qdf_mem_free(bcn); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4502 | wma_handle->interfaces[i].beacon = NULL; |
| 4503 | } |
| 4504 | |
| 4505 | if (wma_handle->interfaces[i].handle) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4506 | qdf_mem_free(wma_handle->interfaces[i].handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4507 | wma_handle->interfaces[i].handle = NULL; |
| 4508 | } |
Yue Ma | 664effc | 2016-01-12 18:43:54 -0800 | [diff] [blame] | 4509 | |
| 4510 | if (wma_handle->interfaces[i].addBssStaContext) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4511 | qdf_mem_free(wma_handle-> |
Yue Ma | 664effc | 2016-01-12 18:43:54 -0800 | [diff] [blame] | 4512 | interfaces[i].addBssStaContext); |
| 4513 | wma_handle->interfaces[i].addBssStaContext = NULL; |
| 4514 | } |
| 4515 | |
| 4516 | if (wma_handle->interfaces[i].del_staself_req) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4517 | qdf_mem_free(wma_handle->interfaces[i].del_staself_req); |
Yue Ma | 664effc | 2016-01-12 18:43:54 -0800 | [diff] [blame] | 4518 | wma_handle->interfaces[i].del_staself_req = NULL; |
| 4519 | } |
yeshwanth sriram guntuka | 8dd8038 | 2017-01-30 17:04:58 +0530 | [diff] [blame] | 4520 | |
| 4521 | if (wma_handle->interfaces[i].stats_rsp) { |
| 4522 | qdf_mem_free(wma_handle->interfaces[i].stats_rsp); |
| 4523 | wma_handle->interfaces[i].stats_rsp = NULL; |
| 4524 | } |
Abhishek Singh | 7e5e934 | 2017-04-12 18:22:07 +0530 | [diff] [blame] | 4525 | |
| 4526 | if (wma_handle->interfaces[i].psnr_req) { |
| 4527 | qdf_mem_free(wma_handle-> |
| 4528 | interfaces[i].psnr_req); |
| 4529 | wma_handle->interfaces[i].psnr_req = NULL; |
| 4530 | } |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 4531 | |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 4532 | if (wma_handle->interfaces[i].rcpi_req) { |
| 4533 | qdf_mem_free(wma_handle-> |
| 4534 | interfaces[i].rcpi_req); |
| 4535 | wma_handle->interfaces[i].rcpi_req = NULL; |
| 4536 | } |
| 4537 | |
Padma, Santhosh Kumar | aa2433e | 2017-10-06 14:34:46 +0530 | [diff] [blame] | 4538 | if (wma_handle->interfaces[i].roam_synch_frame_ind. |
| 4539 | bcn_probe_rsp) { |
| 4540 | qdf_mem_free(wma_handle->interfaces[i]. |
| 4541 | roam_synch_frame_ind.bcn_probe_rsp); |
| 4542 | wma_handle->interfaces[i].roam_synch_frame_ind. |
| 4543 | bcn_probe_rsp = NULL; |
| 4544 | } |
| 4545 | |
| 4546 | if (wma_handle->interfaces[i].roam_synch_frame_ind. |
| 4547 | reassoc_req) { |
| 4548 | qdf_mem_free(wma_handle->interfaces[i]. |
| 4549 | roam_synch_frame_ind.reassoc_req); |
| 4550 | wma_handle->interfaces[i].roam_synch_frame_ind. |
| 4551 | reassoc_req = NULL; |
| 4552 | } |
| 4553 | |
| 4554 | if (wma_handle->interfaces[i].roam_synch_frame_ind. |
| 4555 | reassoc_rsp) { |
| 4556 | qdf_mem_free(wma_handle->interfaces[i]. |
| 4557 | roam_synch_frame_ind.reassoc_rsp); |
| 4558 | wma_handle->interfaces[i].roam_synch_frame_ind. |
| 4559 | reassoc_rsp = NULL; |
| 4560 | } |
| 4561 | |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 4562 | wma_vdev_deinit(&wma_handle->interfaces[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4563 | } |
| 4564 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4565 | qdf_mem_free(wma_handle->interfaces); |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 4566 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4567 | /* free the wma_handle */ |
Jeff Johnson | adb3b1c | 2017-09-13 10:42:36 -0700 | [diff] [blame] | 4568 | cds_free_context(QDF_MODULE_ID_WMA, wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4569 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4570 | qdf_mem_free(((p_cds_contextType) cds_ctx)->cfg_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4571 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4572 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4573 | } |
| 4574 | |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4575 | /** |
| 4576 | * wma_wmi_work_close() - close the work queue items associated with WMI |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4577 | * |
| 4578 | * This function closes work queue items associated with WMI, but not fully |
| 4579 | * closes WMI service. |
| 4580 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4581 | * Return: QDF_STATUS_SUCCESS if work close is successful. Otherwise |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4582 | * proper error codes. |
| 4583 | */ |
Jeff Johnson | 6b8473d | 2017-09-13 09:20:53 -0700 | [diff] [blame] | 4584 | QDF_STATUS wma_wmi_work_close(void) |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4585 | { |
| 4586 | tp_wma_handle wma_handle; |
| 4587 | |
| 4588 | WMA_LOGD("%s: Enter", __func__); |
| 4589 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4590 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4591 | |
| 4592 | /* validate the wma_handle */ |
| 4593 | if (NULL == wma_handle) { |
| 4594 | WMA_LOGE("%s: Invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4595 | return QDF_STATUS_E_INVAL; |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4596 | } |
| 4597 | |
| 4598 | /* validate the wmi handle */ |
| 4599 | if (NULL == wma_handle->wmi_handle) { |
| 4600 | WMA_LOGE("%s: Invalid wmi handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4601 | return QDF_STATUS_E_INVAL; |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4602 | } |
| 4603 | |
| 4604 | /* remove the wmi work */ |
| 4605 | WMA_LOGD("calling wmi_unified_remove_work"); |
| 4606 | wmi_unified_remove_work(wma_handle->wmi_handle); |
| 4607 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4608 | return QDF_STATUS_SUCCESS; |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4609 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4610 | |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 4611 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4612 | * wma_close() - wma close function. |
| 4613 | * cleanup resources attached with wma. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4614 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4615 | * Return: 0 on success, QDF Error on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4616 | */ |
Jeff Johnson | 542da35 | 2017-09-13 09:17:28 -0700 | [diff] [blame] | 4617 | QDF_STATUS wma_close(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4618 | { |
| 4619 | tp_wma_handle wma_handle; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4620 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4621 | |
| 4622 | WMA_LOGD("%s: Enter", __func__); |
| 4623 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4624 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4625 | |
| 4626 | /* validate the wma_handle */ |
| 4627 | if (NULL == wma_handle) { |
| 4628 | WMA_LOGE("%s: Invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4629 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4630 | } |
| 4631 | |
| 4632 | /* validate the wmi handle */ |
| 4633 | if (NULL == wma_handle->wmi_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4634 | WMA_LOGE("%s: Invalid wmi handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4635 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4636 | } |
| 4637 | |
| 4638 | /* Free DBS list */ |
| 4639 | if (wma_handle->hw_mode.hw_mode_list) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4640 | qdf_mem_free(wma_handle->hw_mode.hw_mode_list); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4641 | wma_handle->hw_mode.hw_mode_list = NULL; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4642 | WMA_LOGD("%s: DBS list is freed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4643 | } |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 4644 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4645 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4646 | #ifdef FEATURE_WLAN_EXTSCAN |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 4647 | qdf_wake_lock_destroy(&wma_handle->extscan_wake_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4648 | #endif /* FEATURE_WLAN_EXTSCAN */ |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 4649 | qdf_wake_lock_destroy(&wma_handle->wow_wake_lock); |
Mukul Sharma | e44d054 | 2017-05-23 21:50:56 +0530 | [diff] [blame] | 4650 | qdf_wake_lock_destroy(&wma_handle->wow_auth_req_wl); |
| 4651 | qdf_wake_lock_destroy(&wma_handle->wow_assoc_req_wl); |
| 4652 | qdf_wake_lock_destroy(&wma_handle->wow_deauth_rec_wl); |
| 4653 | qdf_wake_lock_destroy(&wma_handle->wow_disassoc_rec_wl); |
| 4654 | qdf_wake_lock_destroy(&wma_handle->wow_ap_assoc_lost_wl); |
| 4655 | qdf_wake_lock_destroy(&wma_handle->wow_auto_shutdown_wl); |
| 4656 | qdf_wake_lock_destroy(&wma_handle->roam_ho_wl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4657 | } |
| 4658 | |
| 4659 | /* unregister Firmware debug log */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4660 | qdf_status = dbglog_deinit(wma_handle->wmi_handle); |
| 4661 | if (qdf_status != QDF_STATUS_SUCCESS) |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4662 | WMA_LOGE("%s: dbglog_deinit failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4663 | |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 4664 | qdf_status = qdf_mc_timer_destroy(&wma_handle->service_ready_ext_timer); |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 4665 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4666 | WMA_LOGE("%s: Failed to destroy service ready ext event timer", |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 4667 | __func__); |
| 4668 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 4669 | qdf_event_destroy(&wma_handle->target_suspend); |
| 4670 | qdf_event_destroy(&wma_handle->wma_resume_event); |
| 4671 | qdf_event_destroy(&wma_handle->runtime_suspend); |
| 4672 | qdf_event_destroy(&wma_handle->recovery_event); |
Kai Liu | 27f2037 | 2016-09-28 23:52:36 +0800 | [diff] [blame] | 4673 | qdf_event_destroy(&wma_handle->tx_frm_download_comp_event); |
| 4674 | qdf_event_destroy(&wma_handle->tx_queue_empty_event); |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 4675 | wma_cleanup_vdev_resp_queue(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4676 | wma_cleanup_hold_req(wma_handle); |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 4677 | qdf_wake_lock_destroy(&wma_handle->wmi_cmd_rsp_wake_lock); |
Prashanth Bhatta | 87b6dc0 | 2017-01-19 15:17:58 -0800 | [diff] [blame] | 4678 | qdf_runtime_lock_deinit(&wma_handle->wmi_cmd_rsp_runtime_lock); |
Poddar, Siddarth | 2fb9807 | 2017-07-19 14:58:30 +0530 | [diff] [blame] | 4679 | qdf_spinlock_destroy(&wma_handle->vdev_respq_lock); |
| 4680 | qdf_spinlock_destroy(&wma_handle->wma_hold_req_q_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4681 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4682 | if (NULL != wma_handle->pGetRssiReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4683 | qdf_mem_free(wma_handle->pGetRssiReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4684 | wma_handle->pGetRssiReq = NULL; |
| 4685 | } |
Deepak Dhamdhere | bf1f9b1 | 2016-05-27 14:49:41 -0700 | [diff] [blame] | 4686 | |
yeshwanth sriram guntuka | 584c233 | 2017-07-29 12:50:25 +0530 | [diff] [blame] | 4687 | wma_unified_radio_tx_mem_free(wma_handle); |
Srinivas Girigowda | ad874a8 | 2016-10-25 14:08:00 -0700 | [diff] [blame] | 4688 | |
Kiran Kumar Lokere | f089a3a | 2017-04-20 21:39:26 -0700 | [diff] [blame] | 4689 | if (wma_handle->pdev) { |
| 4690 | wlan_objmgr_pdev_release_ref(wma_handle->pdev, |
| 4691 | WLAN_LEGACY_WMA_ID); |
| 4692 | wma_handle->pdev = NULL; |
| 4693 | } |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 4694 | |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 4695 | pmo_unregister_pause_bitmap_notifier(wma_handle->psoc, |
| 4696 | wma_vdev_update_pause_bitmap); |
| 4697 | pmo_unregister_get_pause_bitmap(wma_handle->psoc, |
| 4698 | wma_vdev_get_pause_bitmap); |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 4699 | pmo_unregister_is_device_in_low_pwr_mode(wma_handle->psoc, |
| 4700 | wma_vdev_is_device_in_low_pwr_mode); |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 4701 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 4702 | target_if_free_psoc_tgt_info(wma_handle->psoc); |
| 4703 | |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 4704 | wlan_objmgr_psoc_release_ref(wma_handle->psoc, WLAN_LEGACY_WMA_ID); |
| 4705 | wma_handle->psoc = NULL; |
| 4706 | target_if_close(); |
| 4707 | wma_target_if_close(wma_handle); |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 4708 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4709 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4710 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4711 | } |
| 4712 | |
| 4713 | /** |
| 4714 | * wma_update_fw_config() - update fw configuration |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 4715 | * @psoc: psoc to query configuration from |
| 4716 | * @tgt_hdl: target capability info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4717 | * |
| 4718 | * Return: none |
| 4719 | */ |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 4720 | static void wma_update_fw_config(struct wlan_objmgr_psoc *psoc, |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4721 | struct target_psoc_info *tgt_hdl) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4722 | { |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 4723 | target_resource_config *cfg = &tgt_hdl->info.wlan_res_cfg; |
| 4724 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4725 | /* Override the no. of max fragments as per platform configuration */ |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 4726 | cfg->max_frag_entries = QDF_MIN(QCA_OL_11AC_TX_MAX_FRAGS, |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4727 | target_if_get_max_frag_entry(tgt_hdl)); |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 4728 | target_if_set_max_frag_entry(tgt_hdl, cfg->max_frag_entries); |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4729 | |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 4730 | cfg->num_wow_filters = ucfg_pmo_get_num_wow_filters(psoc); |
| 4731 | cfg->bpf_instruction_size = ucfg_pmo_get_apf_instruction_size(psoc); |
Dustin Brown | 67d69eb | 2018-03-02 11:11:34 -0800 | [diff] [blame] | 4732 | cfg->num_packet_filters = ucfg_pmo_get_num_packet_filters(psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4733 | } |
| 4734 | |
| 4735 | /** |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame] | 4736 | * wma_set_tx_partition_base() - set TX MSDU ID partition base for IPA |
| 4737 | * @value: TX MSDU ID partition base |
| 4738 | * |
| 4739 | * Return: none |
| 4740 | */ |
| 4741 | #ifdef IPA_OFFLOAD |
| 4742 | static void wma_set_tx_partition_base(uint32_t value) |
| 4743 | { |
| 4744 | cdp_ipa_set_uc_tx_partition_base( |
| 4745 | cds_get_context(QDF_MODULE_ID_SOC), |
| 4746 | (struct cdp_cfg *)cds_get_context(QDF_MODULE_ID_CFG), |
| 4747 | value); |
| 4748 | WMA_LOGD("%s: TX_MSDU_ID_PARTITION=%d", __func__, |
| 4749 | value); |
| 4750 | } |
| 4751 | #else |
| 4752 | static void wma_set_tx_partition_base(uint32_t value) |
| 4753 | { |
| 4754 | } |
| 4755 | #endif |
| 4756 | |
| 4757 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4758 | * wma_update_target_services() - update target services from wma handle |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4759 | * @wmi_handle: Unified wmi handle |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4760 | * @cfg: target services |
| 4761 | * |
| 4762 | * Return: none |
| 4763 | */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4764 | static inline void wma_update_target_services(struct wmi_unified *wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4765 | struct wma_tgt_services *cfg) |
| 4766 | { |
| 4767 | /* STA power save */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4768 | cfg->sta_power_save = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4769 | wmi_service_sta_pwrsave); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4770 | |
| 4771 | /* Enable UAPSD */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4772 | cfg->uapsd = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4773 | wmi_service_ap_uapsd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4774 | |
| 4775 | /* Update AP DFS service */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4776 | cfg->ap_dfs = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4777 | wmi_service_ap_dfs); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4778 | |
| 4779 | /* Enable 11AC */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4780 | cfg->en_11ac = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4781 | wmi_service_11ac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4782 | if (cfg->en_11ac) |
| 4783 | g_fw_wlan_feat_caps |= (1 << DOT11AC); |
| 4784 | |
| 4785 | /* Proactive ARP response */ |
| 4786 | g_fw_wlan_feat_caps |= (1 << WLAN_PERIODIC_TX_PTRN); |
| 4787 | |
| 4788 | /* Enable WOW */ |
| 4789 | g_fw_wlan_feat_caps |= (1 << WOW); |
| 4790 | |
| 4791 | /* ARP offload */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4792 | cfg->arp_offload = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4793 | wmi_service_arpns_offload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4794 | |
| 4795 | /* Adaptive early-rx */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4796 | cfg->early_rx = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4797 | wmi_service_early_rx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4798 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 4799 | /* PNO offload */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4800 | if (wmi_service_enabled(wmi_handle, wmi_service_nlo)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4801 | cfg->pno_offload = true; |
| 4802 | #endif /* FEATURE_WLAN_SCAN_PNO */ |
| 4803 | |
| 4804 | #ifdef FEATURE_WLAN_EXTSCAN |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4805 | if (wmi_service_enabled(wmi_handle, wmi_service_extscan)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4806 | g_fw_wlan_feat_caps |= (1 << EXTENDED_SCAN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4807 | #endif /* FEATURE_WLAN_EXTSCAN */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4808 | cfg->lte_coex_ant_share = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4809 | wmi_service_lte_ant_share_support); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4810 | #ifdef FEATURE_WLAN_TDLS |
| 4811 | /* Enable TDLS */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4812 | if (wmi_service_enabled(wmi_handle, wmi_service_tdls)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4813 | cfg->en_tdls = 1; |
| 4814 | g_fw_wlan_feat_caps |= (1 << TDLS); |
| 4815 | } |
| 4816 | /* Enable advanced TDLS features */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4817 | if (wmi_service_enabled(wmi_handle, wmi_service_tdls_offchan)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4818 | cfg->en_tdls_offchan = 1; |
| 4819 | g_fw_wlan_feat_caps |= (1 << TDLS_OFF_CHANNEL); |
| 4820 | } |
| 4821 | |
| 4822 | cfg->en_tdls_uapsd_buf_sta = |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4823 | wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4824 | wmi_service_tdls_uapsd_buffer_sta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4825 | cfg->en_tdls_uapsd_sleep_sta = |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4826 | wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4827 | wmi_service_tdls_uapsd_sleep_sta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4828 | #endif /* FEATURE_WLAN_TDLS */ |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4829 | if (wmi_service_enabled |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4830 | (wmi_handle, wmi_service_beacon_offload)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4831 | cfg->beacon_offload = true; |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4832 | if (wmi_service_enabled |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4833 | (wmi_handle, wmi_service_sta_pmf_offload)) |
mukul sharma | 72c8b22 | 2015-09-04 17:02:01 +0530 | [diff] [blame] | 4834 | cfg->pmf_offload = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4835 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4836 | /* Enable Roam Offload */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4837 | cfg->en_roam_offload = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4838 | wmi_service_roam_ho_offload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4839 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4840 | #ifdef WLAN_FEATURE_NAN |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4841 | if (wmi_service_enabled(wmi_handle, wmi_service_nan)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4842 | g_fw_wlan_feat_caps |= (1 << NAN); |
| 4843 | #endif /* WLAN_FEATURE_NAN */ |
| 4844 | |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4845 | if (wmi_service_enabled(wmi_handle, wmi_service_rtt)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4846 | g_fw_wlan_feat_caps |= (1 << RTT); |
Yun Park | 4d968df | 2016-10-11 11:44:15 -0700 | [diff] [blame] | 4847 | |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4848 | if (wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4849 | wmi_service_tx_msdu_id_new_partition_support)) { |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame] | 4850 | wma_set_tx_partition_base(HTT_TX_IPA_NEW_MSDU_ID_SPACE_BEGIN); |
Yun Park | 4d968df | 2016-10-11 11:44:15 -0700 | [diff] [blame] | 4851 | } else { |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame] | 4852 | wma_set_tx_partition_base(HTT_TX_IPA_MSDU_ID_SPACE_BEGIN); |
Yun Park | 4d968df | 2016-10-11 11:44:15 -0700 | [diff] [blame] | 4853 | } |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 4854 | |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4855 | wma_he_update_tgt_services(wmi_handle, cfg); |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 4856 | |
| 4857 | cfg->get_peer_info_enabled = |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4858 | wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4859 | wmi_service_peer_stats_info); |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4860 | if (wmi_service_enabled(wmi_handle, wmi_service_fils_support)) |
Vignesh Viswanathan | 731186f | 2017-09-18 13:47:37 +0530 | [diff] [blame] | 4861 | cfg->is_fils_roaming_supported = true; |
Varun Reddy Yeturu | 62c3265 | 2017-10-26 15:32:35 -0700 | [diff] [blame] | 4862 | |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4863 | if (wmi_service_enabled(wmi_handle, wmi_service_mawc_support)) |
Varun Reddy Yeturu | 62c3265 | 2017-10-26 15:32:35 -0700 | [diff] [blame] | 4864 | cfg->is_fw_mawc_capable = true; |
| 4865 | |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4866 | if (wmi_service_enabled(wmi_handle, |
| 4867 | wmi_service_11k_neighbour_report_support)) |
Vignesh Viswanathan | 694e28e | 2018-01-18 20:53:57 +0530 | [diff] [blame] | 4868 | cfg->is_11k_offload_supported = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4869 | } |
| 4870 | |
| 4871 | /** |
| 4872 | * wma_update_target_ht_cap() - update ht capabality from wma handle |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4873 | * @tgt_hdl: pointer to structure target_psoc_info |
| 4874 | * @cfg: ht capability |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4875 | * |
| 4876 | * Return: none |
| 4877 | */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4878 | static inline void |
| 4879 | wma_update_target_ht_cap(struct target_psoc_info *tgt_hdl, |
| 4880 | struct wma_tgt_ht_cap *cfg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4881 | { |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4882 | int ht_cap_info; |
| 4883 | |
| 4884 | ht_cap_info = target_if_get_ht_cap_info(tgt_hdl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4885 | /* RX STBC */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4886 | cfg->ht_rx_stbc = !!(ht_cap_info & WMI_HT_CAP_RX_STBC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4887 | |
| 4888 | /* TX STBC */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4889 | cfg->ht_tx_stbc = !!(ht_cap_info & WMI_HT_CAP_TX_STBC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4890 | |
| 4891 | /* MPDU density */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4892 | cfg->mpdu_density = ht_cap_info & WMI_HT_CAP_MPDU_DENSITY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4893 | |
| 4894 | /* HT RX LDPC */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4895 | cfg->ht_rx_ldpc = !!(ht_cap_info & WMI_HT_CAP_LDPC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4896 | |
| 4897 | /* HT SGI */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4898 | cfg->ht_sgi_20 = !!(ht_cap_info & WMI_HT_CAP_HT20_SGI); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4899 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4900 | cfg->ht_sgi_40 = !!(ht_cap_info & WMI_HT_CAP_HT40_SGI); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4901 | |
| 4902 | /* RF chains */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4903 | cfg->num_rf_chains = target_if_get_num_rf_chains(tgt_hdl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4904 | |
Jeff Johnson | 3fd2182 | 2016-11-08 11:30:37 -0800 | [diff] [blame] | 4905 | WMA_LOGD("%s: ht_cap_info - %x ht_rx_stbc - %d, ht_tx_stbc - %d\n" |
| 4906 | "mpdu_density - %d ht_rx_ldpc - %d ht_sgi_20 - %d\n" |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4907 | "ht_sgi_40 - %d num_rf_chains - %d", __func__, |
| 4908 | ht_cap_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4909 | cfg->ht_rx_stbc, cfg->ht_tx_stbc, cfg->mpdu_density, |
| 4910 | cfg->ht_rx_ldpc, cfg->ht_sgi_20, cfg->ht_sgi_40, |
| 4911 | cfg->num_rf_chains); |
| 4912 | |
| 4913 | } |
| 4914 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4915 | /** |
| 4916 | * wma_update_target_vht_cap() - update vht capabality from wma handle |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4917 | * @tgt_hdl: pointer to structure target_psoc_info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4918 | * @cfg: vht capabality |
| 4919 | * |
| 4920 | * Return: none |
| 4921 | */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4922 | static inline void |
| 4923 | wma_update_target_vht_cap(struct target_psoc_info *tgt_hdl, |
| 4924 | struct wma_tgt_vht_cap *cfg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4925 | { |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4926 | int vht_cap_info = target_if_get_vht_cap_info(tgt_hdl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4927 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4928 | if (vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_11454) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4929 | cfg->vht_max_mpdu = WMI_VHT_CAP_MAX_MPDU_LEN_11454; |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4930 | else if (vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_7935) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4931 | cfg->vht_max_mpdu = WMI_VHT_CAP_MAX_MPDU_LEN_7935; |
| 4932 | else |
| 4933 | cfg->vht_max_mpdu = 0; |
| 4934 | |
| 4935 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4936 | if (vht_cap_info & WMI_VHT_CAP_CH_WIDTH_80P80_160MHZ) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4937 | cfg->supp_chan_width = 1 << eHT_CHANNEL_WIDTH_80P80MHZ; |
| 4938 | cfg->supp_chan_width |= 1 << eHT_CHANNEL_WIDTH_160MHZ; |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4939 | } else if (vht_cap_info & WMI_VHT_CAP_CH_WIDTH_160MHZ) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4940 | cfg->supp_chan_width = 1 << eHT_CHANNEL_WIDTH_160MHZ; |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4941 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4942 | cfg->supp_chan_width = 1 << eHT_CHANNEL_WIDTH_80MHZ; |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4943 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4944 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4945 | cfg->vht_rx_ldpc = vht_cap_info & WMI_VHT_CAP_RX_LDPC; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4946 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4947 | cfg->vht_short_gi_80 = vht_cap_info & WMI_VHT_CAP_SGI_80MHZ; |
| 4948 | cfg->vht_short_gi_160 = vht_cap_info & WMI_VHT_CAP_SGI_160MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4949 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4950 | cfg->vht_tx_stbc = vht_cap_info & WMI_VHT_CAP_TX_STBC; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4951 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4952 | cfg->vht_rx_stbc = |
| 4953 | (vht_cap_info & WMI_VHT_CAP_RX_STBC_1SS) | |
| 4954 | (vht_cap_info & WMI_VHT_CAP_RX_STBC_2SS) | |
| 4955 | (vht_cap_info & WMI_VHT_CAP_RX_STBC_3SS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4956 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4957 | cfg->vht_max_ampdu_len_exp = (vht_cap_info & |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4958 | WMI_VHT_CAP_MAX_AMPDU_LEN_EXP) |
| 4959 | >> WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT; |
| 4960 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4961 | cfg->vht_su_bformer = vht_cap_info & WMI_VHT_CAP_SU_BFORMER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4962 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4963 | cfg->vht_su_bformee = vht_cap_info & WMI_VHT_CAP_SU_BFORMEE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4964 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4965 | cfg->vht_mu_bformer = vht_cap_info & WMI_VHT_CAP_MU_BFORMER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4966 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4967 | cfg->vht_mu_bformee = vht_cap_info & WMI_VHT_CAP_MU_BFORMEE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4968 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4969 | cfg->vht_txop_ps = vht_cap_info & WMI_VHT_CAP_TXOP_PS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4970 | |
Jeff Johnson | 3fd2182 | 2016-11-08 11:30:37 -0800 | [diff] [blame] | 4971 | WMA_LOGD("%s: max_mpdu %d supp_chan_width %x rx_ldpc %x\n" |
| 4972 | "short_gi_80 %x tx_stbc %x rx_stbc %x txop_ps %x\n" |
| 4973 | "su_bformee %x mu_bformee %x max_ampdu_len_exp %d", __func__, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4974 | cfg->vht_max_mpdu, cfg->supp_chan_width, cfg->vht_rx_ldpc, |
| 4975 | cfg->vht_short_gi_80, cfg->vht_tx_stbc, cfg->vht_rx_stbc, |
| 4976 | cfg->vht_txop_ps, cfg->vht_su_bformee, cfg->vht_mu_bformee, |
| 4977 | cfg->vht_max_ampdu_len_exp); |
| 4978 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4979 | |
| 4980 | /** |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 4981 | * wma_update_supported_bands() - update supported bands from service ready ext |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 4982 | * @supported_bands: Supported band given by FW through service ready ext params |
| 4983 | * @new_supported_bands: New supported band which needs to be updated by |
| 4984 | * this API which WMA layer understands |
| 4985 | * |
| 4986 | * This API will convert FW given supported band to enum which WMA layer |
| 4987 | * understands |
| 4988 | * |
| 4989 | * Return: QDF_STATUS |
| 4990 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 4991 | static QDF_STATUS wma_update_supported_bands( |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 4992 | WLAN_BAND_CAPABILITY supported_bands, |
| 4993 | WMI_PHY_CAPABILITY *new_supported_bands) |
| 4994 | { |
| 4995 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 4996 | |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 4997 | if (!new_supported_bands) { |
| 4998 | WMA_LOGE("%s: NULL new supported band variable", __func__); |
| 4999 | return QDF_STATUS_E_FAILURE; |
| 5000 | } |
| 5001 | switch (supported_bands) { |
| 5002 | case WLAN_2G_CAPABILITY: |
| 5003 | *new_supported_bands |= WMI_11G_CAPABILITY; |
| 5004 | break; |
| 5005 | case WLAN_5G_CAPABILITY: |
| 5006 | *new_supported_bands |= WMI_11A_CAPABILITY; |
| 5007 | break; |
| 5008 | default: |
| 5009 | WMA_LOGE("%s: wrong supported band", __func__); |
| 5010 | status = QDF_STATUS_E_FAILURE; |
| 5011 | break; |
| 5012 | } |
| 5013 | return status; |
| 5014 | } |
| 5015 | |
| 5016 | /** |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5017 | * wma_derive_ext_ht_cap() - Derive HT caps based on given value |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5018 | * @ht_cap: given pointer to HT caps which needs to be updated |
| 5019 | * @tx_chain: given tx chainmask value |
| 5020 | * @rx_chain: given rx chainmask value |
| 5021 | * @value: new HT cap info provided in form of bitmask |
| 5022 | * |
| 5023 | * This function takes the value provided in form of bitmask and decodes |
| 5024 | * it. After decoding, what ever value it gets, it takes the union(max) or |
| 5025 | * intersection(min) with previously derived values. |
| 5026 | * |
| 5027 | * Return: none |
| 5028 | * |
| 5029 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5030 | static void wma_derive_ext_ht_cap( |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5031 | struct wma_tgt_ht_cap *ht_cap, uint32_t value, |
| 5032 | uint32_t tx_chain, uint32_t rx_chain) |
| 5033 | { |
| 5034 | struct wma_tgt_ht_cap tmp = {0}; |
| 5035 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5036 | if (ht_cap == NULL) |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5037 | return; |
| 5038 | |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 5039 | if (!qdf_mem_cmp(ht_cap, &tmp, sizeof(struct wma_tgt_ht_cap))) { |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5040 | ht_cap->ht_rx_stbc = (!!(value & WMI_HT_CAP_RX_STBC)); |
| 5041 | ht_cap->ht_tx_stbc = (!!(value & WMI_HT_CAP_TX_STBC)); |
| 5042 | ht_cap->mpdu_density = (!!(value & WMI_HT_CAP_MPDU_DENSITY)); |
| 5043 | ht_cap->ht_rx_ldpc = (!!(value & WMI_HT_CAP_RX_LDPC)); |
| 5044 | ht_cap->ht_sgi_20 = (!!(value & WMI_HT_CAP_HT20_SGI)); |
| 5045 | ht_cap->ht_sgi_40 = (!!(value & WMI_HT_CAP_HT40_SGI)); |
| 5046 | ht_cap->num_rf_chains = |
| 5047 | QDF_MAX(wma_get_num_of_setbits_from_bitmask(tx_chain), |
| 5048 | wma_get_num_of_setbits_from_bitmask(rx_chain)); |
| 5049 | } else { |
| 5050 | ht_cap->ht_rx_stbc = QDF_MIN(ht_cap->ht_rx_stbc, |
| 5051 | (!!(value & WMI_HT_CAP_RX_STBC))); |
| 5052 | ht_cap->ht_tx_stbc = QDF_MAX(ht_cap->ht_tx_stbc, |
| 5053 | (!!(value & WMI_HT_CAP_TX_STBC))); |
| 5054 | ht_cap->mpdu_density = QDF_MIN(ht_cap->mpdu_density, |
| 5055 | (!!(value & WMI_HT_CAP_MPDU_DENSITY))); |
| 5056 | ht_cap->ht_rx_ldpc = QDF_MIN(ht_cap->ht_rx_ldpc, |
| 5057 | (!!(value & WMI_HT_CAP_RX_LDPC))); |
| 5058 | ht_cap->ht_sgi_20 = QDF_MIN(ht_cap->ht_sgi_20, |
| 5059 | (!!(value & WMI_HT_CAP_HT20_SGI))); |
| 5060 | ht_cap->ht_sgi_40 = QDF_MIN(ht_cap->ht_sgi_40, |
| 5061 | (!!(value & WMI_HT_CAP_HT40_SGI))); |
| 5062 | ht_cap->num_rf_chains = |
| 5063 | QDF_MAX(ht_cap->num_rf_chains, |
| 5064 | QDF_MAX(wma_get_num_of_setbits_from_bitmask( |
| 5065 | tx_chain), |
| 5066 | wma_get_num_of_setbits_from_bitmask( |
| 5067 | rx_chain))); |
| 5068 | } |
| 5069 | } |
| 5070 | |
| 5071 | /** |
| 5072 | * wma_update_target_ext_ht_cap() - Update HT caps with given extended cap |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5073 | * @tgt_hdl - target psoc information |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5074 | * @ht_cap: HT cap structure to be filled |
| 5075 | * |
| 5076 | * This function loop through each hardware mode and for each hardware mode |
| 5077 | * again it loop through each MAC/PHY and pull the caps 2G and 5G specific |
| 5078 | * HT caps and derives the final cap. |
| 5079 | * |
| 5080 | * Return: none |
| 5081 | * |
| 5082 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5083 | static void wma_update_target_ext_ht_cap(struct target_psoc_info *tgt_hdl, |
| 5084 | struct wma_tgt_ht_cap *ht_cap) |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5085 | { |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5086 | int i, total_mac_phy_cnt; |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5087 | uint32_t ht_2g, ht_5g; |
| 5088 | struct wma_tgt_ht_cap tmp_ht_cap = {0}, tmp_cap = {0}; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5089 | struct wlan_psoc_host_mac_phy_caps *mac_phy_cap; |
| 5090 | int num_hw_modes; |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5091 | |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5092 | total_mac_phy_cnt = target_psoc_get_total_mac_phy_cnt(tgt_hdl); |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5093 | num_hw_modes = target_psoc_get_num_hw_modes(tgt_hdl); |
| 5094 | mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5095 | /* |
| 5096 | * for legacy device extended cap might not even come, so in that case |
| 5097 | * don't overwrite legacy values |
| 5098 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5099 | if (!num_hw_modes) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5100 | WMA_LOGD("%s: No extended HT cap for current SOC", __func__); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5101 | return; |
| 5102 | } |
| 5103 | |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5104 | for (i = 0; i < total_mac_phy_cnt; i++) { |
| 5105 | ht_2g = mac_phy_cap[i].ht_cap_info_2G; |
| 5106 | ht_5g = mac_phy_cap[i].ht_cap_info_5G; |
| 5107 | if (ht_2g) |
| 5108 | wma_derive_ext_ht_cap(&tmp_ht_cap, |
| 5109 | ht_2g, |
| 5110 | mac_phy_cap[i].tx_chain_mask_2G, |
| 5111 | mac_phy_cap[i].rx_chain_mask_2G); |
| 5112 | if (ht_5g) |
| 5113 | wma_derive_ext_ht_cap(&tmp_ht_cap, |
| 5114 | ht_5g, |
| 5115 | mac_phy_cap[i].tx_chain_mask_5G, |
| 5116 | mac_phy_cap[i].rx_chain_mask_5G); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5117 | } |
| 5118 | |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 5119 | if (qdf_mem_cmp(&tmp_cap, &tmp_ht_cap, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5120 | sizeof(struct wma_tgt_ht_cap))) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5121 | qdf_mem_copy(ht_cap, &tmp_ht_cap, |
| 5122 | sizeof(struct wma_tgt_ht_cap)); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5123 | } |
| 5124 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5125 | WMA_LOGD("%s: [ext ht cap] ht_rx_stbc - %d, ht_tx_stbc - %d\n" |
Jeff Johnson | 3fd2182 | 2016-11-08 11:30:37 -0800 | [diff] [blame] | 5126 | "mpdu_density - %d ht_rx_ldpc - %d ht_sgi_20 - %d\n" |
| 5127 | "ht_sgi_40 - %d num_rf_chains - %d", __func__, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5128 | ht_cap->ht_rx_stbc, ht_cap->ht_tx_stbc, |
| 5129 | ht_cap->mpdu_density, ht_cap->ht_rx_ldpc, |
| 5130 | ht_cap->ht_sgi_20, ht_cap->ht_sgi_40, |
| 5131 | ht_cap->num_rf_chains); |
| 5132 | } |
| 5133 | |
| 5134 | /** |
| 5135 | * wma_derive_ext_vht_cap() - Derive VHT caps based on given value |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5136 | * @vht_cap: pointer to given VHT caps to be filled |
| 5137 | * @value: new VHT cap info provided in form of bitmask |
| 5138 | * |
| 5139 | * This function takes the value provided in form of bitmask and decodes |
| 5140 | * it. After decoding, what ever value it gets, it takes the union(max) or |
| 5141 | * intersection(min) with previously derived values. |
| 5142 | * |
| 5143 | * Return: none |
| 5144 | * |
| 5145 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5146 | static void wma_derive_ext_vht_cap( |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5147 | struct wma_tgt_vht_cap *vht_cap, uint32_t value) |
| 5148 | { |
| 5149 | struct wma_tgt_vht_cap tmp_cap = {0}; |
| 5150 | uint32_t tmp = 0; |
| 5151 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5152 | if (vht_cap == NULL) |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5153 | return; |
| 5154 | |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 5155 | if (!qdf_mem_cmp(vht_cap, &tmp_cap, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5156 | sizeof(struct wma_tgt_vht_cap))) { |
| 5157 | if (value & WMI_VHT_CAP_MAX_MPDU_LEN_11454) |
| 5158 | vht_cap->vht_max_mpdu = WMI_VHT_CAP_MAX_MPDU_LEN_11454; |
| 5159 | else if (value & WMI_VHT_CAP_MAX_MPDU_LEN_7935) |
| 5160 | vht_cap->vht_max_mpdu = WMI_VHT_CAP_MAX_MPDU_LEN_7935; |
| 5161 | else |
| 5162 | vht_cap->vht_max_mpdu = 0; |
| 5163 | |
| 5164 | if (value & WMI_VHT_CAP_CH_WIDTH_80P80_160MHZ) { |
| 5165 | vht_cap->supp_chan_width = |
| 5166 | 1 << eHT_CHANNEL_WIDTH_80P80MHZ; |
| 5167 | vht_cap->supp_chan_width |= |
| 5168 | 1 << eHT_CHANNEL_WIDTH_160MHZ; |
| 5169 | } else if (value & WMI_VHT_CAP_CH_WIDTH_160MHZ) { |
| 5170 | vht_cap->supp_chan_width = |
| 5171 | 1 << eHT_CHANNEL_WIDTH_160MHZ; |
| 5172 | } else { |
| 5173 | vht_cap->supp_chan_width = 1 << eHT_CHANNEL_WIDTH_80MHZ; |
| 5174 | } |
| 5175 | vht_cap->vht_rx_ldpc = value & WMI_VHT_CAP_RX_LDPC; |
| 5176 | vht_cap->vht_short_gi_80 = value & WMI_VHT_CAP_SGI_80MHZ; |
| 5177 | vht_cap->vht_short_gi_160 = value & WMI_VHT_CAP_SGI_160MHZ; |
| 5178 | vht_cap->vht_tx_stbc = value & WMI_VHT_CAP_TX_STBC; |
| 5179 | vht_cap->vht_rx_stbc = |
| 5180 | (value & WMI_VHT_CAP_RX_STBC_1SS) | |
| 5181 | (value & WMI_VHT_CAP_RX_STBC_2SS) | |
| 5182 | (value & WMI_VHT_CAP_RX_STBC_3SS); |
| 5183 | vht_cap->vht_max_ampdu_len_exp = |
| 5184 | (value & WMI_VHT_CAP_MAX_AMPDU_LEN_EXP) >> |
| 5185 | WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT; |
| 5186 | vht_cap->vht_su_bformer = value & WMI_VHT_CAP_SU_BFORMER; |
| 5187 | vht_cap->vht_su_bformee = value & WMI_VHT_CAP_SU_BFORMEE; |
| 5188 | vht_cap->vht_mu_bformer = value & WMI_VHT_CAP_MU_BFORMER; |
| 5189 | vht_cap->vht_mu_bformee = value & WMI_VHT_CAP_MU_BFORMEE; |
| 5190 | vht_cap->vht_txop_ps = value & WMI_VHT_CAP_TXOP_PS; |
| 5191 | } else { |
| 5192 | if (value & WMI_VHT_CAP_MAX_MPDU_LEN_11454) |
| 5193 | tmp = WMI_VHT_CAP_MAX_MPDU_LEN_11454; |
| 5194 | else if (value & WMI_VHT_CAP_MAX_MPDU_LEN_7935) |
| 5195 | tmp = WMI_VHT_CAP_MAX_MPDU_LEN_7935; |
| 5196 | else |
| 5197 | tmp = 0; |
| 5198 | vht_cap->vht_max_mpdu = QDF_MIN(vht_cap->vht_max_mpdu, tmp); |
| 5199 | |
| 5200 | if ((value & WMI_VHT_CAP_CH_WIDTH_80P80_160MHZ)) { |
| 5201 | tmp = (1 << eHT_CHANNEL_WIDTH_80P80MHZ) | |
| 5202 | (1 << eHT_CHANNEL_WIDTH_160MHZ); |
| 5203 | } else if (value & WMI_VHT_CAP_CH_WIDTH_160MHZ) { |
| 5204 | tmp = 1 << eHT_CHANNEL_WIDTH_160MHZ; |
| 5205 | } else { |
| 5206 | tmp = 1 << eHT_CHANNEL_WIDTH_80MHZ; |
| 5207 | } |
| 5208 | vht_cap->supp_chan_width = |
| 5209 | QDF_MAX(vht_cap->supp_chan_width, tmp); |
| 5210 | vht_cap->vht_rx_ldpc = QDF_MIN(vht_cap->vht_rx_ldpc, |
| 5211 | value & WMI_VHT_CAP_RX_LDPC); |
| 5212 | vht_cap->vht_short_gi_80 = QDF_MAX(vht_cap->vht_short_gi_80, |
| 5213 | value & WMI_VHT_CAP_SGI_80MHZ); |
| 5214 | vht_cap->vht_short_gi_160 = QDF_MAX(vht_cap->vht_short_gi_160, |
| 5215 | value & WMI_VHT_CAP_SGI_160MHZ); |
| 5216 | vht_cap->vht_tx_stbc = QDF_MAX(vht_cap->vht_tx_stbc, |
| 5217 | value & WMI_VHT_CAP_TX_STBC); |
| 5218 | vht_cap->vht_rx_stbc = QDF_MIN(vht_cap->vht_rx_stbc, |
| 5219 | (value & WMI_VHT_CAP_RX_STBC_1SS) | |
| 5220 | (value & WMI_VHT_CAP_RX_STBC_2SS) | |
| 5221 | (value & WMI_VHT_CAP_RX_STBC_3SS)); |
| 5222 | vht_cap->vht_max_ampdu_len_exp = |
| 5223 | QDF_MIN(vht_cap->vht_max_ampdu_len_exp, |
| 5224 | (value & WMI_VHT_CAP_MAX_AMPDU_LEN_EXP) >> |
| 5225 | WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT); |
| 5226 | vht_cap->vht_su_bformer = QDF_MAX(vht_cap->vht_su_bformer, |
| 5227 | value & WMI_VHT_CAP_SU_BFORMER); |
| 5228 | vht_cap->vht_su_bformee = QDF_MAX(vht_cap->vht_su_bformee, |
| 5229 | value & WMI_VHT_CAP_SU_BFORMEE); |
| 5230 | vht_cap->vht_mu_bformer = QDF_MAX(vht_cap->vht_mu_bformer, |
| 5231 | value & WMI_VHT_CAP_MU_BFORMER); |
| 5232 | vht_cap->vht_mu_bformee = QDF_MAX(vht_cap->vht_mu_bformee, |
| 5233 | value & WMI_VHT_CAP_MU_BFORMEE); |
| 5234 | vht_cap->vht_txop_ps = QDF_MIN(vht_cap->vht_txop_ps, |
| 5235 | value & WMI_VHT_CAP_TXOP_PS); |
| 5236 | } |
| 5237 | } |
| 5238 | |
| 5239 | /** |
| 5240 | * wma_update_target_ext_vht_cap() - Update VHT caps with given extended cap |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5241 | * @tgt_hdl - target psoc information |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5242 | * @vht_cap: VHT cap structure to be filled |
| 5243 | * |
| 5244 | * This function loop through each hardware mode and for each hardware mode |
| 5245 | * again it loop through each MAC/PHY and pull the caps 2G and 5G specific |
| 5246 | * VHT caps and derives the final cap. |
| 5247 | * |
| 5248 | * Return: none |
| 5249 | * |
| 5250 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5251 | static void wma_update_target_ext_vht_cap(struct target_psoc_info *tgt_hdl, |
| 5252 | struct wma_tgt_vht_cap *vht_cap) |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5253 | { |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5254 | int i, num_hw_modes, total_mac_phy_cnt; |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5255 | uint32_t vht_cap_info_2g, vht_cap_info_5g; |
| 5256 | struct wma_tgt_vht_cap tmp_vht_cap = {0}, tmp_cap = {0}; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5257 | struct wlan_psoc_host_mac_phy_caps *mac_phy_cap; |
| 5258 | |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5259 | total_mac_phy_cnt = target_psoc_get_total_mac_phy_cnt(tgt_hdl); |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5260 | num_hw_modes = target_psoc_get_num_hw_modes(tgt_hdl); |
| 5261 | mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5262 | |
| 5263 | /* |
| 5264 | * for legacy device extended cap might not even come, so in that case |
| 5265 | * don't overwrite legacy values |
| 5266 | */ |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5267 | if (!num_hw_modes) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5268 | WMA_LOGD("%s: No extended VHT cap for current SOC", __func__); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5269 | return; |
| 5270 | } |
| 5271 | |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5272 | for (i = 0; i < total_mac_phy_cnt; i++) { |
| 5273 | vht_cap_info_2g = mac_phy_cap[i].vht_cap_info_2G; |
| 5274 | vht_cap_info_5g = mac_phy_cap[i].vht_cap_info_5G; |
| 5275 | if (vht_cap_info_2g) |
| 5276 | wma_derive_ext_vht_cap(&tmp_vht_cap, |
| 5277 | vht_cap_info_2g); |
| 5278 | if (vht_cap_info_5g) |
| 5279 | wma_derive_ext_vht_cap(&tmp_vht_cap, |
| 5280 | vht_cap_info_5g); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5281 | } |
| 5282 | |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 5283 | if (qdf_mem_cmp(&tmp_cap, &tmp_vht_cap, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5284 | sizeof(struct wma_tgt_vht_cap))) { |
| 5285 | qdf_mem_copy(vht_cap, &tmp_vht_cap, |
| 5286 | sizeof(struct wma_tgt_vht_cap)); |
| 5287 | } |
| 5288 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5289 | WMA_LOGD("%s: [ext vhtcap] max_mpdu %d supp_chan_width %x rx_ldpc %x\n" |
Jeff Johnson | 3fd2182 | 2016-11-08 11:30:37 -0800 | [diff] [blame] | 5290 | "short_gi_80 %x tx_stbc %x rx_stbc %x txop_ps %x\n" |
| 5291 | "su_bformee %x mu_bformee %x max_ampdu_len_exp %d", __func__, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5292 | vht_cap->vht_max_mpdu, vht_cap->supp_chan_width, |
| 5293 | vht_cap->vht_rx_ldpc, vht_cap->vht_short_gi_80, |
| 5294 | vht_cap->vht_tx_stbc, vht_cap->vht_rx_stbc, |
| 5295 | vht_cap->vht_txop_ps, vht_cap->vht_su_bformee, |
| 5296 | vht_cap->vht_mu_bformee, vht_cap->vht_max_ampdu_len_exp); |
| 5297 | } |
| 5298 | |
| 5299 | /** |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 5300 | * wma_update_ra_rate_limit() - update wma config |
| 5301 | * @wma_handle: wma handle |
| 5302 | * @cfg: target config |
| 5303 | * |
| 5304 | * Return: none |
| 5305 | */ |
| 5306 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 5307 | static void wma_update_ra_rate_limit(tp_wma_handle wma_handle, |
| 5308 | struct wma_tgt_cfg *cfg) |
| 5309 | { |
| 5310 | cfg->is_ra_rate_limit_enabled = wma_handle->IsRArateLimitEnabled; |
| 5311 | } |
| 5312 | #else |
| 5313 | static void wma_update_ra_rate_limit(tp_wma_handle wma_handle, |
| 5314 | struct wma_tgt_cfg *cfg) |
| 5315 | { |
| 5316 | } |
| 5317 | #endif |
| 5318 | |
| 5319 | /** |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 5320 | * wma_update_hdd_band_cap() - update band cap which hdd understands |
| 5321 | * @supported_band: supported band which has been given by FW |
| 5322 | * @tgt_cfg: target configuration to be updated |
| 5323 | * |
| 5324 | * Convert WMA given supported band to enum which HDD understands |
| 5325 | * |
| 5326 | * Return: None |
| 5327 | */ |
| 5328 | static void wma_update_hdd_band_cap(WMI_PHY_CAPABILITY supported_band, |
| 5329 | struct wma_tgt_cfg *tgt_cfg) |
| 5330 | { |
| 5331 | switch (supported_band) { |
| 5332 | case WMI_11G_CAPABILITY: |
| 5333 | case WMI_11NG_CAPABILITY: |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 5334 | tgt_cfg->band_cap = BAND_2G; |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 5335 | break; |
| 5336 | case WMI_11A_CAPABILITY: |
| 5337 | case WMI_11NA_CAPABILITY: |
| 5338 | case WMI_11AC_CAPABILITY: |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 5339 | tgt_cfg->band_cap = BAND_5G; |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 5340 | break; |
| 5341 | case WMI_11AG_CAPABILITY: |
| 5342 | case WMI_11NAG_CAPABILITY: |
| 5343 | default: |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 5344 | tgt_cfg->band_cap = BAND_ALL; |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 5345 | } |
| 5346 | } |
| 5347 | |
| 5348 | /** |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 5349 | * wma_update_obss_detection_support() - update obss detection offload support |
| 5350 | * @wh: wma handle |
| 5351 | * @tgt_cfg: target configuration to be updated |
| 5352 | * |
| 5353 | * Update obss detection offload support based on service bit. |
| 5354 | * |
| 5355 | * Return: None |
| 5356 | */ |
| 5357 | static void wma_update_obss_detection_support(tp_wma_handle wh, |
| 5358 | struct wma_tgt_cfg *tgt_cfg) |
| 5359 | { |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 5360 | if (wmi_service_enabled(wh->wmi_handle, |
| 5361 | wmi_service_ap_obss_detection_offload)) |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 5362 | tgt_cfg->obss_detection_offloaded = true; |
| 5363 | else |
| 5364 | tgt_cfg->obss_detection_offloaded = false; |
| 5365 | } |
| 5366 | |
| 5367 | /** |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 5368 | * wma_update_obss_color_collision_support() - update obss color collision |
| 5369 | * offload support |
| 5370 | * @wh: wma handle |
| 5371 | * @tgt_cfg: target configuration to be updated |
| 5372 | * |
| 5373 | * Update obss color collision offload support based on service bit. |
| 5374 | * |
| 5375 | * Return: None |
| 5376 | */ |
| 5377 | static void wma_update_obss_color_collision_support(tp_wma_handle wh, |
| 5378 | struct wma_tgt_cfg *tgt_cfg) |
| 5379 | { |
| 5380 | if (wmi_service_enabled(wh->wmi_handle, wmi_service_bss_color_offload)) |
| 5381 | tgt_cfg->obss_color_collision_offloaded = true; |
| 5382 | else |
| 5383 | tgt_cfg->obss_color_collision_offloaded = false; |
| 5384 | } |
| 5385 | |
Jeff Johnson | 6ec742c | 2018-03-31 15:21:08 -0700 | [diff] [blame] | 5386 | #ifdef WLAN_SUPPORT_GREEN_AP |
| 5387 | static void wma_green_ap_register_handlers(tp_wma_handle wma_handle) |
| 5388 | { |
| 5389 | if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 5390 | WMI_SERVICE_EGAP)) |
| 5391 | target_if_green_ap_register_egap_event_handler( |
| 5392 | wma_handle->pdev); |
| 5393 | |
| 5394 | } |
| 5395 | #else |
| 5396 | static void wma_green_ap_register_handlers(tp_wma_handle wma_handle) |
| 5397 | { |
| 5398 | } |
| 5399 | #endif |
| 5400 | |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 5401 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5402 | * wma_update_hdd_cfg() - update HDD config |
| 5403 | * @wma_handle: wma handle |
| 5404 | * |
| 5405 | * Return: none |
| 5406 | */ |
| 5407 | static void wma_update_hdd_cfg(tp_wma_handle wma_handle) |
| 5408 | { |
| 5409 | struct wma_tgt_cfg tgt_cfg; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5410 | void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5411 | target_resource_config *wlan_res_cfg; |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5412 | struct wlan_psoc_host_service_ext_param *service_ext_param; |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 5413 | struct target_psoc_info *tgt_hdl; |
| 5414 | struct wmi_unified *wmi_handle; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5415 | |
| 5416 | WMA_LOGD("%s: Enter", __func__); |
| 5417 | |
| 5418 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 5419 | if (!tgt_hdl) { |
| 5420 | WMA_LOGE("%s: target psoc info is NULL", __func__); |
| 5421 | return; |
| 5422 | } |
| 5423 | |
| 5424 | wlan_res_cfg = target_psoc_get_wlan_res_cfg(tgt_hdl); |
Arif Hussain | d15902c | 2018-03-02 00:08:29 -0800 | [diff] [blame] | 5425 | if (!wlan_res_cfg) { |
| 5426 | WMA_LOGE("%s: wlan_res_cfg is null", __func__); |
| 5427 | return; |
| 5428 | } |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5429 | service_ext_param = |
| 5430 | target_psoc_get_service_ext_param(tgt_hdl); |
Sourav Mohapatra | cf63257 | 2018-04-02 11:01:35 +0530 | [diff] [blame] | 5431 | wmi_handle = get_wmi_unified_hdl_from_psoc(wma_handle->psoc); |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 5432 | if (!wmi_handle) { |
| 5433 | WMA_LOGE("%s: wmi handle is NULL", __func__); |
| 5434 | return; |
| 5435 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5436 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5437 | qdf_mem_zero(&tgt_cfg, sizeof(struct wma_tgt_cfg)); |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 5438 | |
| 5439 | tgt_cfg.sub_20_support = wma_handle->sub_20_support; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5440 | tgt_cfg.reg_domain = wma_handle->reg_cap.eeprom_rd; |
| 5441 | tgt_cfg.eeprom_rd_ext = wma_handle->reg_cap.eeprom_rd_ext; |
| 5442 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5443 | tgt_cfg.max_intf_count = wlan_res_cfg->num_vdevs; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5444 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5445 | qdf_mem_copy(tgt_cfg.hw_macaddr.bytes, wma_handle->hwaddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5446 | ATH_MAC_LEN); |
| 5447 | |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 5448 | wma_update_target_services(wmi_handle, &tgt_cfg.services); |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5449 | wma_update_target_ht_cap(tgt_hdl, &tgt_cfg.ht_cap); |
| 5450 | wma_update_target_vht_cap(tgt_hdl, &tgt_cfg.vht_cap); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5451 | /* |
| 5452 | * This will overwrite the structure filled by wma_update_target_ht_cap |
| 5453 | * and wma_update_target_vht_cap APIs. |
| 5454 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5455 | wma_update_target_ext_ht_cap(tgt_hdl, &tgt_cfg.ht_cap); |
| 5456 | wma_update_target_ext_vht_cap(tgt_hdl, &tgt_cfg.vht_cap); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5457 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5458 | wma_update_target_ext_he_cap(tgt_hdl, &tgt_cfg); |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 5459 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5460 | tgt_cfg.target_fw_version = target_if_get_fw_version(tgt_hdl); |
| 5461 | if (service_ext_param) |
| 5462 | tgt_cfg.target_fw_vers_ext = |
| 5463 | service_ext_param->fw_build_vers_ext; |
| 5464 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5465 | #ifdef WLAN_FEATURE_LPSS |
| 5466 | tgt_cfg.lpss_support = wma_handle->lpss_support; |
| 5467 | #endif /* WLAN_FEATURE_LPSS */ |
| 5468 | tgt_cfg.ap_arpns_support = wma_handle->ap_arpns_support; |
Rajeev Kumar | e5a1682 | 2016-07-27 13:11:42 -0700 | [diff] [blame] | 5469 | tgt_cfg.bpf_enabled = wma_handle->bpf_enabled; |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 5470 | tgt_cfg.dfs_cac_offload = wma_handle->is_dfs_offloaded; |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 5471 | tgt_cfg.rcpi_enabled = wma_handle->rcpi_enabled; |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 5472 | wma_update_ra_rate_limit(wma_handle, &tgt_cfg); |
Arunk Khandavalli | 80a6135 | 2018-01-25 12:19:37 +0530 | [diff] [blame] | 5473 | wma_update_hdd_band_cap(target_if_get_phy_capability(tgt_hdl), |
| 5474 | &tgt_cfg); |
Krishna Kumaar Natarajan | 1ae4911 | 2015-11-24 21:43:22 -0800 | [diff] [blame] | 5475 | tgt_cfg.fine_time_measurement_cap = |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5476 | target_if_get_wmi_fw_sub_feat_caps(tgt_hdl); |
Rajeev Kumar Sirasanagandla | 4787300 | 2016-09-09 13:46:09 +0530 | [diff] [blame] | 5477 | tgt_cfg.wmi_max_len = wmi_get_max_msg_len(wma_handle->wmi_handle) |
| 5478 | - WMI_TLV_HEADROOM; |
Nachiket Kukade | 8b4bfd8 | 2017-05-25 18:34:48 +0530 | [diff] [blame] | 5479 | tgt_cfg.tx_bfee_8ss_enabled = wma_handle->tx_bfee_8ss_enabled; |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 5480 | wma_update_obss_detection_support(wma_handle, &tgt_cfg); |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 5481 | wma_update_obss_color_collision_support(wma_handle, &tgt_cfg); |
Deepak Dhamdhere | 13230d3 | 2016-05-26 00:46:53 -0700 | [diff] [blame] | 5482 | wma_update_hdd_cfg_ndp(wma_handle, &tgt_cfg); |
Naveen Rawat | cb186cf | 2016-07-11 13:47:19 -0700 | [diff] [blame] | 5483 | wma_handle->tgt_cfg_update_cb(hdd_ctx, &tgt_cfg); |
Himanshu Agarwal | 2228e07 | 2018-01-24 17:42:17 +0530 | [diff] [blame] | 5484 | target_if_store_pdev_target_if_ctx(wma_get_pdev_from_scn_handle); |
Nachiket Kukade | 7dda8c2 | 2018-03-12 19:59:43 +0530 | [diff] [blame] | 5485 | target_pdev_set_wmi_handle(wma_handle->pdev->tgt_if_handle, |
| 5486 | wma_handle->wmi_handle); |
Jeff Johnson | 6ec742c | 2018-03-31 15:21:08 -0700 | [diff] [blame] | 5487 | wma_green_ap_register_handlers(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5488 | } |
| 5489 | |
| 5490 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5491 | * wma_dump_dbs_hw_mode() - Print the DBS HW modes |
| 5492 | * @wma_handle: WMA handle |
| 5493 | * |
| 5494 | * Prints the DBS HW modes sent by the FW as part |
| 5495 | * of WMI ready event |
| 5496 | * |
| 5497 | * Return: None |
| 5498 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 5499 | static void wma_dump_dbs_hw_mode(tp_wma_handle wma_handle) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5500 | { |
| 5501 | uint32_t i, param; |
| 5502 | |
| 5503 | if (!wma_handle) { |
| 5504 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 5505 | return; |
| 5506 | } |
| 5507 | |
| 5508 | for (i = 0; i < wma_handle->num_dbs_hw_modes; i++) { |
| 5509 | param = wma_handle->hw_mode.hw_mode_list[i]; |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 5510 | WMA_LOGD("%s:[%d]-MAC0: tx_ss:%d rx_ss:%d bw_idx:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5511 | __func__, i, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5512 | WMA_HW_MODE_MAC0_TX_STREAMS_GET(param), |
| 5513 | WMA_HW_MODE_MAC0_RX_STREAMS_GET(param), |
| 5514 | WMA_HW_MODE_MAC0_BANDWIDTH_GET(param)); |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 5515 | WMA_LOGD("%s:[%d]-MAC1: tx_ss:%d rx_ss:%d bw_idx:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5516 | __func__, i, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5517 | WMA_HW_MODE_MAC1_TX_STREAMS_GET(param), |
| 5518 | WMA_HW_MODE_MAC1_RX_STREAMS_GET(param), |
| 5519 | WMA_HW_MODE_MAC1_BANDWIDTH_GET(param)); |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 5520 | WMA_LOGD("%s:[%d] DBS:%d SBS:%d", __func__, i, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5521 | WMA_HW_MODE_DBS_MODE_GET(param), |
| 5522 | WMA_HW_MODE_SBS_MODE_GET(param)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5523 | } |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 5524 | policy_mgr_dump_dbs_hw_mode(wma_handle->psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5525 | } |
| 5526 | |
| 5527 | /** |
| 5528 | * wma_init_scan_fw_mode_config() - Initialize scan/fw mode config |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5529 | * @psoc: Object manager psoc |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 5530 | * @scan_config: Scam mode configuration |
| 5531 | * @fw_config: FW mode configuration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5532 | * |
| 5533 | * Enables all the valid bits of concurrent_scan_config_bits and |
| 5534 | * fw_mode_config_bits. |
| 5535 | * |
| 5536 | * Return: None |
| 5537 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5538 | static void wma_init_scan_fw_mode_config(struct wlan_objmgr_psoc *psoc, |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 5539 | uint32_t scan_config, |
| 5540 | uint32_t fw_config) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5541 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5542 | WMA_LOGD("%s: Enter", __func__); |
| 5543 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5544 | if (!psoc) { |
| 5545 | WMA_LOGE("%s: obj psoc is NULL", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5546 | return; |
| 5547 | } |
| 5548 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5549 | policy_mgr_init_dbs_config(psoc, scan_config, fw_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5550 | } |
| 5551 | |
| 5552 | /** |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 5553 | * wma_update_ra_limit() - update ra limit based on bpf filter |
| 5554 | * enabled or not |
| 5555 | * @handle: wma handle |
| 5556 | * |
| 5557 | * Return: none |
| 5558 | */ |
| 5559 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 5560 | static void wma_update_ra_limit(tp_wma_handle wma_handle) |
| 5561 | { |
| 5562 | if (wma_handle->bpf_enabled) |
| 5563 | wma_handle->IsRArateLimitEnabled = false; |
| 5564 | } |
| 5565 | #else |
| 5566 | static void wma_update_ra__limit(tp_wma_handle handle) |
| 5567 | { |
| 5568 | } |
| 5569 | #endif |
| 5570 | |
Dustin Brown | 06259e5 | 2018-02-28 16:00:02 -0800 | [diff] [blame] | 5571 | static void wma_set_pmo_caps(struct wlan_objmgr_psoc *psoc) |
| 5572 | { |
| 5573 | QDF_STATUS status; |
| 5574 | struct pmo_device_caps caps; |
| 5575 | |
| 5576 | caps.arp_ns_offload = |
| 5577 | wma_is_service_enabled(wmi_service_arpns_offload); |
| 5578 | caps.apf = |
| 5579 | wma_is_service_enabled(wmi_service_bpf_offload); |
| 5580 | caps.packet_filter = |
| 5581 | wma_is_service_enabled(wmi_service_packet_filter_offload); |
| 5582 | caps.unified_wow = |
| 5583 | wma_is_service_enabled(wmi_service_unified_wow_capability); |
| 5584 | |
| 5585 | status = ucfg_pmo_psoc_set_caps(psoc, &caps); |
| 5586 | if (QDF_IS_STATUS_ERROR(status)) |
| 5587 | WMA_LOGE("Failed to set PMO capabilities; status:%d", status); |
| 5588 | } |
| 5589 | |
| 5590 | static void wma_set_component_caps(struct wlan_objmgr_psoc *psoc) |
| 5591 | { |
| 5592 | wma_set_pmo_caps(psoc); |
| 5593 | } |
| 5594 | |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 5595 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5596 | * wma_rx_service_ready_event() - event handler to process |
| 5597 | * wmi rx sevice ready event. |
| 5598 | * @handle: wma handle |
| 5599 | * @cmd_param_info: command params info |
| 5600 | * |
| 5601 | * Return: none |
| 5602 | */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5603 | int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info, |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5604 | uint32_t length) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5605 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5606 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5607 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 5608 | wmi_service_ready_event_fixed_param *ev; |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5609 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5610 | uint32_t *ev_wlan_dbs_hw_mode_list; |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 5611 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 5612 | struct target_psoc_info *tgt_hdl; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5613 | struct wlan_psoc_target_capability_info *tgt_cap_info; |
| 5614 | target_resource_config *wlan_res_cfg; |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5615 | struct wmi_unified *wmi_handle; |
| 5616 | uint32_t *service_bitmap; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5617 | |
| 5618 | WMA_LOGD("%s: Enter", __func__); |
| 5619 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5620 | if (!handle) { |
| 5621 | WMA_LOGE("%s: wma_handle passed is NULL", __func__); |
| 5622 | return -EINVAL; |
| 5623 | } |
| 5624 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 5625 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 5626 | if (!tgt_hdl) { |
| 5627 | WMA_LOGE("%s: target psoc info is NULL", __func__); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5628 | return -EINVAL; |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 5629 | } |
| 5630 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5631 | wlan_res_cfg = target_psoc_get_wlan_res_cfg(tgt_hdl); |
| 5632 | tgt_cap_info = target_psoc_get_target_caps(tgt_hdl); |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5633 | service_bitmap = target_psoc_get_service_bitmap(tgt_hdl); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5634 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5635 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) cmd_param_info; |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5636 | if (!param_buf) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5637 | WMA_LOGE("%s: Invalid arguments", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5638 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5639 | } |
| 5640 | |
| 5641 | ev = param_buf->fixed_param; |
| 5642 | if (!ev) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5643 | WMA_LOGE("%s: Invalid buffer", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5644 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5645 | } |
| 5646 | |
Sourav Mohapatra | cf63257 | 2018-04-02 11:01:35 +0530 | [diff] [blame] | 5647 | wmi_handle = get_wmi_unified_hdl_from_psoc(wma_handle->psoc); |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5648 | if (!wmi_handle) { |
| 5649 | WMA_LOGE("%s: wmi handle is NULL", __func__); |
| 5650 | return -EINVAL; |
| 5651 | } |
| 5652 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 5653 | WMA_LOGD("WMA <-- WMI_SERVICE_READY_EVENTID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5654 | |
Amar Singhal | 7b038ca | 2017-10-04 13:38:39 -0700 | [diff] [blame] | 5655 | if (ev->num_dbs_hw_modes > param_buf->num_wlan_dbs_hw_mode_list) { |
| 5656 | WMA_LOGE("FW dbs_hw_mode entry %d more than value %d in TLV hdr", |
| 5657 | ev->num_dbs_hw_modes, |
| 5658 | param_buf->num_wlan_dbs_hw_mode_list); |
| 5659 | return -EINVAL; |
| 5660 | } |
| 5661 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5662 | wma_handle->num_dbs_hw_modes = ev->num_dbs_hw_modes; |
| 5663 | ev_wlan_dbs_hw_mode_list = param_buf->wlan_dbs_hw_mode_list; |
| 5664 | wma_handle->hw_mode.hw_mode_list = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5665 | qdf_mem_malloc(sizeof(*wma_handle->hw_mode.hw_mode_list) * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5666 | wma_handle->num_dbs_hw_modes); |
| 5667 | if (!wma_handle->hw_mode.hw_mode_list) { |
| 5668 | WMA_LOGE("%s: Memory allocation failed for DBS", __func__); |
| 5669 | /* Continuing with the rest of the processing */ |
| 5670 | } |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5671 | |
| 5672 | if (wma_handle->hw_mode.hw_mode_list) |
| 5673 | qdf_mem_copy(wma_handle->hw_mode.hw_mode_list, |
| 5674 | ev_wlan_dbs_hw_mode_list, |
| 5675 | (sizeof(*wma_handle->hw_mode.hw_mode_list) * |
| 5676 | wma_handle->num_dbs_hw_modes)); |
| 5677 | |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 5678 | policy_mgr_init_dbs_hw_mode(wma_handle->psoc, |
| 5679 | ev->num_dbs_hw_modes, ev_wlan_dbs_hw_mode_list); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5680 | wma_dump_dbs_hw_mode(wma_handle); |
| 5681 | |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 5682 | /* Initializes the fw_mode and scan_config to zero. |
| 5683 | * If ext service ready event is present it will set |
| 5684 | * the actual values of these two params. |
| 5685 | * This is to ensure that no garbage values would be |
| 5686 | * present in the absence of ext service ready event. |
| 5687 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5688 | wma_init_scan_fw_mode_config(wma_handle->psoc, 0, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5689 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5690 | qdf_mem_copy(&wma_handle->reg_cap, param_buf->hal_reg_capabilities, |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5691 | sizeof(HAL_REG_CAPABILITIES)); |
| 5692 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5693 | wma_handle->vht_supp_mcs = ev->vht_supp_mcs; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5694 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5695 | wma_handle->new_hw_mode_index = tgt_cap_info->default_dbs_hw_mode_index; |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 5696 | policy_mgr_update_new_hw_mode_index(wma_handle->psoc, |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5697 | tgt_cap_info->default_dbs_hw_mode_index); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5698 | |
| 5699 | WMA_LOGD("%s: Firmware default hw mode index : %d", |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5700 | __func__, tgt_cap_info->default_dbs_hw_mode_index); |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 5701 | WMA_LOGI("%s: Firmware build version : %08x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5702 | __func__, ev->fw_build_vers); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5703 | WMA_LOGD("FW fine time meas cap: 0x%x", |
| 5704 | tgt_cap_info->wmi_fw_sub_feat_caps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5705 | |
| 5706 | if (ev->hw_bd_id) { |
| 5707 | wma_handle->hw_bd_id = ev->hw_bd_id; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5708 | qdf_mem_copy(wma_handle->hw_bd_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5709 | ev->hw_bd_info, sizeof(ev->hw_bd_info)); |
| 5710 | |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 5711 | WMA_LOGI("%s: Board version: %x.%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5712 | __func__, |
| 5713 | wma_handle->hw_bd_info[0], wma_handle->hw_bd_info[1]); |
| 5714 | } else { |
| 5715 | wma_handle->hw_bd_id = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5716 | qdf_mem_zero(wma_handle->hw_bd_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5717 | sizeof(wma_handle->hw_bd_info)); |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 5718 | WMA_LOGW("%s: Board version is unknown!", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5719 | } |
| 5720 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5721 | /* wmi service is ready */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5722 | qdf_mem_copy(wma_handle->wmi_service_bitmap, |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5723 | service_bitmap, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5724 | sizeof(wma_handle->wmi_service_bitmap)); |
Nirav Shah | 22bf44d | 2015-12-10 15:39:48 +0530 | [diff] [blame] | 5725 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 5726 | cdp_cfg_tx_set_is_mgmt_over_wmi_enabled(soc, |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5727 | wmi_service_enabled(wmi_handle, wmi_service_mgmt_tx_wmi)); |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 5728 | cdp_set_desc_global_pool_size(soc, ev->num_msdu_desc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5729 | /* SWBA event handler for beacon transmission */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5730 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5731 | wmi_host_swba_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5732 | wma_beacon_swba_handler, |
| 5733 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5734 | if (QDF_IS_STATUS_ERROR(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5735 | WMA_LOGE("Failed to register swba beacon event cb"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5736 | goto free_hw_mode_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5737 | } |
| 5738 | #ifdef WLAN_FEATURE_LPSS |
| 5739 | wma_handle->lpss_support = |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5740 | wmi_service_enabled(wmi_handle, wmi_service_lpass); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5741 | #endif /* WLAN_FEATURE_LPSS */ |
| 5742 | |
| 5743 | /* |
| 5744 | * This Service bit is added to check for ARP/NS Offload |
| 5745 | * support for LL/HL targets |
| 5746 | */ |
| 5747 | wma_handle->ap_arpns_support = |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5748 | wmi_service_enabled(wmi_handle, wmi_service_ap_arpns_offload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5749 | |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 5750 | wma_handle->bpf_enabled = (wma_handle->bpf_packet_filter_enable && |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5751 | wmi_service_enabled(wmi_handle, wmi_service_bpf_offload)); |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 5752 | wma_update_ra_limit(wma_handle); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5753 | |
| 5754 | if (wmi_service_enabled(wmi_handle, wmi_service_csa_offload)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5755 | WMA_LOGD("%s: FW support CSA offload capability", __func__); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5756 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5757 | wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5758 | wmi_csa_handling_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5759 | wma_csa_offload_handler, |
| 5760 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5761 | if (QDF_IS_STATUS_ERROR(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5762 | WMA_LOGE("Failed to register CSA offload event cb"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5763 | goto free_hw_mode_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5764 | } |
| 5765 | } |
| 5766 | |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5767 | if (wmi_service_enabled(wmi_handle, wmi_service_mgmt_tx_wmi)) { |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 5768 | WMA_LOGD("Firmware supports management TX over WMI,use WMI interface instead of HTT for management Tx"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5769 | /* |
| 5770 | * Register Tx completion event handler for MGMT Tx over WMI |
| 5771 | * case |
| 5772 | */ |
| 5773 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5774 | wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5775 | wmi_mgmt_tx_completion_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5776 | wma_mgmt_tx_completion_handler, |
| 5777 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5778 | if (QDF_IS_STATUS_ERROR(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5779 | WMA_LOGE("Failed to register MGMT over WMI completion handler"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5780 | goto free_hw_mode_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5781 | } |
| 5782 | |
Nirav Shah | 2048997 | 2016-06-16 19:20:28 +0530 | [diff] [blame] | 5783 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5784 | wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5785 | wmi_mgmt_tx_bundle_completion_event_id, |
Nirav Shah | 2048997 | 2016-06-16 19:20:28 +0530 | [diff] [blame] | 5786 | wma_mgmt_tx_bundle_completion_handler, |
| 5787 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5788 | if (QDF_IS_STATUS_ERROR(status)) { |
Nirav Shah | 2048997 | 2016-06-16 19:20:28 +0530 | [diff] [blame] | 5789 | WMA_LOGE("Failed to register MGMT over WMI completion handler"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5790 | goto free_hw_mode_list; |
Nirav Shah | 2048997 | 2016-06-16 19:20:28 +0530 | [diff] [blame] | 5791 | } |
| 5792 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5793 | } else { |
| 5794 | WMA_LOGE("FW doesnot support WMI_SERVICE_MGMT_TX_WMI, Use HTT interface for Management Tx"); |
| 5795 | } |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5796 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5797 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5798 | if (wmi_service_enabled(wmi_handle, wmi_service_gtk_offload)) { |
| 5799 | status = wmi_unified_register_event_handler( |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5800 | wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5801 | wmi_gtk_offload_status_event_id, |
Mukul Sharma | 3d36c39 | 2017-01-18 18:39:12 +0530 | [diff] [blame] | 5802 | target_if_pmo_gtk_offload_status_event, |
| 5803 | WMA_RX_WORK_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5804 | if (QDF_IS_STATUS_ERROR(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5805 | WMA_LOGE("Failed to register GTK offload event cb"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5806 | goto free_hw_mode_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5807 | } |
| 5808 | } |
| 5809 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
| 5810 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5811 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5812 | wmi_tbttoffset_update_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5813 | wma_tbttoffset_update_event_handler, |
| 5814 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5815 | if (QDF_IS_STATUS_ERROR(status)) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5816 | WMA_LOGE("Failed to register WMI_TBTTOFFSET_UPDATE_EVENTID callback"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5817 | goto free_hw_mode_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5818 | } |
| 5819 | |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 5820 | if (wmi_service_enabled(wma_handle->wmi_handle, |
| 5821 | wmi_service_rcpi_support)) { |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 5822 | /* register for rcpi response event */ |
| 5823 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5824 | wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5825 | wmi_update_rcpi_event_id, |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 5826 | wma_rcpi_event_handler, |
| 5827 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5828 | if (QDF_IS_STATUS_ERROR(status)) { |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 5829 | WMA_LOGE("Failed to register RCPI event handler"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5830 | goto free_hw_mode_list; |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 5831 | } |
| 5832 | wma_handle->rcpi_enabled = true; |
| 5833 | } |
| 5834 | |
Govind Singh | efc5ccd | 2016-04-25 11:11:55 +0530 | [diff] [blame] | 5835 | /* mac_id is replaced with pdev_id in converged firmware to have |
| 5836 | * multi-radio support. In order to maintain backward compatibility |
| 5837 | * with old fw, host needs to check WMI_SERVICE_DEPRECATED_REPLACE |
| 5838 | * in service bitmap from FW and host needs to set use_pdev_id in |
| 5839 | * wmi_resource_config to true. If WMI_SERVICE_DEPRECATED_REPLACE |
| 5840 | * service is not set, then host shall not expect MAC ID from FW in |
| 5841 | * VDEV START RESPONSE event and host shall use PDEV ID. |
| 5842 | */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5843 | if (wmi_service_enabled(wmi_handle, wmi_service_deprecated_replace)) |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5844 | wlan_res_cfg->use_pdev_id = true; |
Govind Singh | efc5ccd | 2016-04-25 11:11:55 +0530 | [diff] [blame] | 5845 | else |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5846 | wlan_res_cfg->use_pdev_id = false; |
Govind Singh | efc5ccd | 2016-04-25 11:11:55 +0530 | [diff] [blame] | 5847 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5848 | wlan_res_cfg->max_num_dbs_scan_duty_cycle = CDS_DBS_SCAN_CLIENTS_MAX; |
Nitesh Shah | f9a09ff | 2017-05-22 15:46:25 +0530 | [diff] [blame] | 5849 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5850 | /* Initialize the log supported event handler */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5851 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5852 | wmi_diag_event_id_log_supported_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5853 | wma_log_supported_evt_handler, |
| 5854 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5855 | if (QDF_IS_STATUS_ERROR(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5856 | WMA_LOGE("Failed to register log supported event cb"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5857 | goto free_hw_mode_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5858 | } |
| 5859 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 5860 | cdp_mark_first_wakeup_packet(soc, |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5861 | wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 5862 | wmi_service_mark_first_wakeup_packet)); |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 5863 | wma_handle->is_dfs_offloaded = |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5864 | wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 5865 | wmi_service_dfs_phyerr_offload); |
Deepak Dhamdhere | 13230d3 | 2016-05-26 00:46:53 -0700 | [diff] [blame] | 5866 | wma_handle->nan_datapath_enabled = |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 5867 | wmi_service_enabled(wma_handle->wmi_handle, |
| 5868 | wmi_service_nan_data); |
Dustin Brown | 06259e5 | 2018-02-28 16:00:02 -0800 | [diff] [blame] | 5869 | |
| 5870 | wma_set_component_caps(wma_handle->psoc); |
| 5871 | |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 5872 | wma_update_fw_config(wma_handle->psoc, tgt_hdl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5873 | |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5874 | status = wmi_unified_save_fw_version_cmd(wmi_handle, param_buf); |
| 5875 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 5876 | WMA_LOGE("Failed to send WMI_INIT_CMDID command"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5877 | goto free_hw_mode_list; |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 5878 | } |
| 5879 | |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5880 | status = qdf_mc_timer_start(&wma_handle->service_ready_ext_timer, |
| 5881 | WMA_SERVICE_READY_EXT_TIMEOUT); |
| 5882 | if (QDF_IS_STATUS_ERROR(status)) |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 5883 | WMA_LOGE("Failed to start the service ready ext timer"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5884 | |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5885 | wma_handle->tx_bfee_8ss_enabled = |
| 5886 | wmi_service_enabled(wmi_handle, wmi_service_8ss_tx_bfee); |
Nachiket Kukade | 8b4bfd8 | 2017-05-25 18:34:48 +0530 | [diff] [blame] | 5887 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 5888 | target_psoc_set_num_radios(tgt_hdl, 1); |
| 5889 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5890 | return 0; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5891 | |
| 5892 | free_hw_mode_list: |
| 5893 | if (wma_handle->hw_mode.hw_mode_list) { |
| 5894 | qdf_mem_free(wma_handle->hw_mode.hw_mode_list); |
| 5895 | wma_handle->hw_mode.hw_mode_list = NULL; |
| 5896 | WMA_LOGD("%s: DBS list is freed", __func__); |
| 5897 | } |
| 5898 | |
| 5899 | return -EINVAL; |
| 5900 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5901 | } |
| 5902 | |
| 5903 | /** |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5904 | * wma_get_phyid_for_given_band() - to get phyid for band |
| 5905 | * |
| 5906 | * @wma_handle: Pointer to wma handle |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5907 | * @tgt_hdl: target psoc information |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5908 | * @band: enum value of for 2G or 5G band |
| 5909 | * @phyid: Pointer to phyid which needs to be filled |
| 5910 | * |
| 5911 | * This API looks in to the map to find out which particular phy supports |
| 5912 | * provided band and return the idx (also called phyid) of that phy. Caller |
| 5913 | * use this phyid to fetch various caps of that phy |
| 5914 | * |
| 5915 | * Return: QDF_STATUS |
| 5916 | */ |
| 5917 | static QDF_STATUS wma_get_phyid_for_given_band( |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5918 | tp_wma_handle wma_handle, |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5919 | struct target_psoc_info *tgt_hdl, |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5920 | enum cds_band_type band, uint8_t *phyid) |
| 5921 | { |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5922 | uint8_t idx, i, num_radios; |
| 5923 | struct wlan_psoc_host_mac_phy_caps *mac_phy_cap; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5924 | |
| 5925 | if (!wma_handle) { |
| 5926 | WMA_LOGE("Invalid wma handle"); |
| 5927 | return QDF_STATUS_E_FAILURE; |
| 5928 | } |
| 5929 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5930 | idx = 0; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5931 | *phyid = idx; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5932 | num_radios = target_psoc_get_num_radios(tgt_hdl); |
| 5933 | mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5934 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5935 | for (i = 0; i < num_radios; i++) { |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5936 | if ((band == CDS_BAND_2GHZ) && |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5937 | (WLAN_2G_CAPABILITY == mac_phy_cap[idx + i].supported_bands)) { |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5938 | *phyid = idx + i; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5939 | WMA_LOGD("Select 2G capable phyid[%d]", *phyid); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5940 | return QDF_STATUS_SUCCESS; |
| 5941 | } else if ((band == CDS_BAND_5GHZ) && |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5942 | (WLAN_5G_CAPABILITY == mac_phy_cap[idx + i].supported_bands)) { |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5943 | *phyid = idx + i; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5944 | WMA_LOGD("Select 5G capable phyid[%d]", *phyid); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5945 | return QDF_STATUS_SUCCESS; |
| 5946 | } |
| 5947 | } |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5948 | WMA_LOGD("Using default single hw mode phyid[%d]", *phyid); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5949 | return QDF_STATUS_SUCCESS; |
| 5950 | } |
| 5951 | |
| 5952 | /** |
| 5953 | * wma_get_caps_for_phyidx_hwmode() - to fetch caps for given hw mode and band |
| 5954 | * @caps_per_phy: Pointer to capabilities structure which needs to be filled |
| 5955 | * @hw_mode: Provided hardware mode |
| 5956 | * @band: Provide band i.e. 2G or 5G |
| 5957 | * |
| 5958 | * This API finds cap which suitable for provided hw mode and band. If user |
| 5959 | * is provides some invalid hw mode then it will automatically falls back to |
| 5960 | * default hw mode |
| 5961 | * |
| 5962 | * Return: QDF_STATUS |
| 5963 | */ |
| 5964 | QDF_STATUS wma_get_caps_for_phyidx_hwmode(struct wma_caps_per_phy *caps_per_phy, |
| 5965 | enum hw_mode_dbs_capab hw_mode, enum cds_band_type band) |
| 5966 | { |
| 5967 | t_wma_handle *wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5968 | struct target_psoc_info *tgt_hdl; |
| 5969 | int ht_cap_info, vht_cap_info; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5970 | uint8_t phyid, our_hw_mode = hw_mode, num_hw_modes; |
| 5971 | struct wlan_psoc_host_mac_phy_caps *mac_phy_cap; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5972 | |
| 5973 | if (!wma_handle) { |
| 5974 | WMA_LOGE("Invalid wma handle"); |
| 5975 | return QDF_STATUS_E_FAILURE; |
| 5976 | } |
| 5977 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5978 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 5979 | if (!tgt_hdl) { |
| 5980 | WMA_LOGE("%s: target psoc info is NULL", __func__); |
| 5981 | return -EINVAL; |
| 5982 | } |
| 5983 | |
| 5984 | ht_cap_info = target_if_get_ht_cap_info(tgt_hdl); |
| 5985 | vht_cap_info = target_if_get_vht_cap_info(tgt_hdl); |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5986 | num_hw_modes = target_psoc_get_num_hw_modes(tgt_hdl); |
| 5987 | mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5988 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5989 | if (!num_hw_modes) { |
jiad | 080abce | 2017-08-08 15:17:39 +0800 | [diff] [blame] | 5990 | WMA_LOGD("Invalid number of hw modes, use legacy HT/VHT caps"); |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5991 | caps_per_phy->ht_2g = ht_cap_info; |
| 5992 | caps_per_phy->ht_5g = ht_cap_info; |
| 5993 | caps_per_phy->vht_2g = vht_cap_info; |
| 5994 | caps_per_phy->vht_5g = vht_cap_info; |
jiad | 080abce | 2017-08-08 15:17:39 +0800 | [diff] [blame] | 5995 | /* legacy platform doesn't support HE IE */ |
| 5996 | caps_per_phy->he_2g = 0; |
| 5997 | caps_per_phy->he_5g = 0; |
| 5998 | |
| 5999 | return QDF_STATUS_SUCCESS; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6000 | } |
| 6001 | |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 6002 | if (!policy_mgr_is_dbs_enable(wma_handle->psoc)) |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6003 | our_hw_mode = HW_MODE_DBS_NONE; |
| 6004 | |
| 6005 | if (!caps_per_phy) { |
| 6006 | WMA_LOGE("Invalid caps pointer"); |
| 6007 | return QDF_STATUS_E_FAILURE; |
| 6008 | } |
| 6009 | |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6010 | if (QDF_STATUS_SUCCESS != |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6011 | wma_get_phyid_for_given_band(wma_handle, tgt_hdl, band, &phyid)) { |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6012 | WMA_LOGE("Invalid phyid"); |
| 6013 | return QDF_STATUS_E_FAILURE; |
| 6014 | } |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6015 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6016 | caps_per_phy->ht_2g = mac_phy_cap[phyid].ht_cap_info_2G; |
| 6017 | caps_per_phy->ht_5g = mac_phy_cap[phyid].ht_cap_info_5G; |
| 6018 | caps_per_phy->vht_2g = mac_phy_cap[phyid].vht_cap_info_2G; |
| 6019 | caps_per_phy->vht_5g = mac_phy_cap[phyid].vht_cap_info_5G; |
| 6020 | caps_per_phy->he_2g = mac_phy_cap[phyid].he_cap_info_2G; |
| 6021 | caps_per_phy->he_5g = mac_phy_cap[phyid].he_cap_info_5G; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6022 | |
Naveen Rawat | 9832247 | 2018-03-06 10:29:42 -0800 | [diff] [blame] | 6023 | caps_per_phy->tx_chain_mask_2G = mac_phy_cap->tx_chain_mask_2G; |
| 6024 | caps_per_phy->rx_chain_mask_2G = mac_phy_cap->rx_chain_mask_2G; |
| 6025 | caps_per_phy->tx_chain_mask_5G = mac_phy_cap->tx_chain_mask_5G; |
| 6026 | caps_per_phy->rx_chain_mask_5G = mac_phy_cap->rx_chain_mask_5G; |
| 6027 | |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6028 | return QDF_STATUS_SUCCESS; |
| 6029 | } |
| 6030 | |
| 6031 | /** |
| 6032 | * wma_is_rx_ldpc_supported_for_channel() - to find out if ldpc is supported |
| 6033 | * |
| 6034 | * @channel: Channel number for which it needs to check if rx ldpc is enabled |
| 6035 | * |
| 6036 | * This API takes channel number as argument and takes default hw mode as DBS |
| 6037 | * to check if rx LDPC support is enabled for that channel or no |
| 6038 | */ |
| 6039 | bool wma_is_rx_ldpc_supported_for_channel(uint32_t channel) |
| 6040 | { |
jiad | 080abce | 2017-08-08 15:17:39 +0800 | [diff] [blame] | 6041 | t_wma_handle *wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6042 | struct target_psoc_info *tgt_hdl; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6043 | struct wma_caps_per_phy caps_per_phy = {0}; |
| 6044 | enum cds_band_type band; |
| 6045 | bool status; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6046 | uint8_t num_hw_modes; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6047 | |
Amar Singhal | 4c3fbb4 | 2018-01-02 13:20:28 -0800 | [diff] [blame] | 6048 | if (!wma_handle) { |
| 6049 | WMA_LOGE("Invalid wma handle"); |
| 6050 | return false; |
| 6051 | } |
| 6052 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6053 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 6054 | if (!tgt_hdl) { |
| 6055 | WMA_LOGE("Target handle is NULL"); |
| 6056 | return QDF_STATUS_E_FAILURE; |
| 6057 | } |
| 6058 | |
| 6059 | num_hw_modes = target_psoc_get_num_hw_modes(tgt_hdl); |
| 6060 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 6061 | if (!WLAN_REG_IS_24GHZ_CH(channel)) |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6062 | band = CDS_BAND_5GHZ; |
| 6063 | else |
| 6064 | band = CDS_BAND_2GHZ; |
| 6065 | |
| 6066 | if (QDF_STATUS_SUCCESS != wma_get_caps_for_phyidx_hwmode( |
| 6067 | &caps_per_phy, |
| 6068 | HW_MODE_DBS, band)) { |
| 6069 | return false; |
| 6070 | } |
jiad | 080abce | 2017-08-08 15:17:39 +0800 | [diff] [blame] | 6071 | |
| 6072 | /* |
| 6073 | * Legacy platforms like Rome set WMI_HT_CAP_LDPC to specify RX LDPC |
| 6074 | * capability. But new platforms like Helium set WMI_HT_CAP_RX_LDPC |
| 6075 | * instead. |
| 6076 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6077 | if (0 == num_hw_modes) { |
jiad | 080abce | 2017-08-08 15:17:39 +0800 | [diff] [blame] | 6078 | status = (!!(caps_per_phy.ht_2g & WMI_HT_CAP_LDPC)); |
| 6079 | } else { |
| 6080 | if (WLAN_REG_IS_24GHZ_CH(channel)) |
| 6081 | status = (!!(caps_per_phy.ht_2g & WMI_HT_CAP_RX_LDPC)); |
| 6082 | else |
| 6083 | status = (!!(caps_per_phy.ht_5g & WMI_HT_CAP_RX_LDPC)); |
| 6084 | } |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6085 | |
| 6086 | return status; |
| 6087 | } |
| 6088 | |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 6089 | /** |
| 6090 | * wma_print_mac_phy_capabilities() - Prints MAC PHY capabilities |
| 6091 | * @cap: pointer to WMI_MAC_PHY_CAPABILITIES |
| 6092 | * @index: MAC_PHY index |
| 6093 | * |
| 6094 | * Return: none |
| 6095 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6096 | static void wma_print_mac_phy_capabilities(struct wlan_psoc_host_mac_phy_caps |
| 6097 | *cap, int index) |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 6098 | { |
| 6099 | uint32_t mac_2G, mac_5G; |
| 6100 | uint32_t phy_2G[WMI_MAX_HECAP_PHY_SIZE]; |
| 6101 | uint32_t phy_5G[WMI_MAX_HECAP_PHY_SIZE]; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6102 | struct wlan_psoc_host_ppe_threshold ppet_2G, ppet_5G; |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 6103 | |
| 6104 | WMA_LOGI("\t: index [%d]", index); |
| 6105 | WMA_LOGI("\t: cap for hw_mode_id[%d]", cap->hw_mode_id); |
| 6106 | WMA_LOGI("\t: pdev_id[%d]", cap->pdev_id); |
| 6107 | WMA_LOGI("\t: phy_id[%d]", cap->phy_id); |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6108 | WMA_LOGI("\t: supports_11b[%d]", cap->supports_11b); |
| 6109 | WMA_LOGI("\t: supports_11g[%d]", cap->supports_11g); |
| 6110 | WMA_LOGI("\t: supports_11a[%d]", cap->supports_11a); |
| 6111 | WMA_LOGI("\t: supports_11n[%d]", cap->supports_11n); |
| 6112 | WMA_LOGI("\t: supports_11ac[%d]", cap->supports_11ac); |
| 6113 | WMA_LOGI("\t: supports_11ax[%d]", cap->supports_11ax); |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 6114 | WMA_LOGI("\t: supported_bands[%d]", cap->supported_bands); |
| 6115 | WMA_LOGI("\t: ampdu_density[%d]", cap->ampdu_density); |
| 6116 | WMA_LOGI("\t: max_bw_supported_2G[%d]", cap->max_bw_supported_2G); |
| 6117 | WMA_LOGI("\t: ht_cap_info_2G[%d]", cap->ht_cap_info_2G); |
| 6118 | WMA_LOGI("\t: vht_cap_info_2G[%d]", cap->vht_cap_info_2G); |
| 6119 | WMA_LOGI("\t: vht_supp_mcs_2G[%d]", cap->vht_supp_mcs_2G); |
| 6120 | WMA_LOGI("\t: tx_chain_mask_2G[%d]", cap->tx_chain_mask_2G); |
| 6121 | WMA_LOGI("\t: rx_chain_mask_2G[%d]", cap->rx_chain_mask_2G); |
| 6122 | WMA_LOGI("\t: max_bw_supported_5G[%d]", cap->max_bw_supported_5G); |
| 6123 | WMA_LOGI("\t: ht_cap_info_5G[%d]", cap->ht_cap_info_5G); |
| 6124 | WMA_LOGI("\t: vht_cap_info_5G[%d]", cap->vht_cap_info_5G); |
| 6125 | WMA_LOGI("\t: vht_supp_mcs_5G[%d]", cap->vht_supp_mcs_5G); |
| 6126 | WMA_LOGI("\t: tx_chain_mask_5G[%d]", cap->tx_chain_mask_5G); |
| 6127 | WMA_LOGI("\t: rx_chain_mask_5G[%d]", cap->rx_chain_mask_5G); |
| 6128 | WMA_LOGI("\t: he_cap_info_2G[%08x]", cap->he_cap_info_2G); |
| 6129 | WMA_LOGI("\t: he_supp_mcs_2G[%08x]", cap->he_supp_mcs_2G); |
| 6130 | WMA_LOGI("\t: he_cap_info_5G[%08x]", cap->he_cap_info_5G); |
| 6131 | WMA_LOGI("\t: he_supp_mcs_5G[%08x]", cap->he_supp_mcs_5G); |
| 6132 | mac_2G = cap->he_cap_info_2G; |
| 6133 | mac_5G = cap->he_cap_info_5G; |
| 6134 | qdf_mem_copy(phy_2G, cap->he_cap_phy_info_2G, |
| 6135 | WMI_MAX_HECAP_PHY_SIZE * 4); |
| 6136 | qdf_mem_copy(phy_5G, cap->he_cap_phy_info_5G, |
| 6137 | WMI_MAX_HECAP_PHY_SIZE * 4); |
| 6138 | ppet_2G = cap->he_ppet2G; |
| 6139 | ppet_5G = cap->he_ppet5G; |
| 6140 | |
| 6141 | wma_print_he_mac_cap(mac_2G); |
| 6142 | wma_print_he_phy_cap(phy_2G); |
| 6143 | wma_print_he_ppet(&ppet_2G); |
| 6144 | wma_print_he_mac_cap(mac_5G); |
| 6145 | wma_print_he_phy_cap(phy_5G); |
| 6146 | wma_print_he_ppet(&ppet_5G); |
| 6147 | } |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6148 | |
| 6149 | /** |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6150 | * wma_print_populate_soc_caps() - Prints all the caps populated per hw mode |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6151 | * @tgt_info: target related info |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6152 | * |
| 6153 | * This function prints all the caps populater per hw mode and per PHY |
| 6154 | * |
| 6155 | * Return: none |
| 6156 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6157 | static void wma_print_populate_soc_caps(struct target_psoc_info *tgt_hdl) |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6158 | { |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 6159 | int i, num_hw_modes, total_mac_phy_cnt; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6160 | struct wlan_psoc_host_mac_phy_caps *mac_phy_cap, *tmp; |
| 6161 | |
| 6162 | num_hw_modes = target_psoc_get_num_hw_modes(tgt_hdl); |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 6163 | total_mac_phy_cnt = target_psoc_get_total_mac_phy_cnt(tgt_hdl); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6164 | |
| 6165 | /* print number of hw modes */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6166 | WMA_LOGD("%s: num of hw modes [%d]", __func__, num_hw_modes); |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 6167 | WMA_LOGD("%s: num mac_phy_cnt [%d]", __func__, total_mac_phy_cnt); |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6168 | mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6169 | WMA_LOGD("%s: <====== HW mode cap printing starts ======>", __func__); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6170 | /* print cap of each hw mode */ |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 6171 | for (i = 0; i < total_mac_phy_cnt; i++) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6172 | WMA_LOGD("====>: hw mode id[%d], phy_id map[%d]", |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 6173 | mac_phy_cap[i].hw_mode_id, |
| 6174 | mac_phy_cap[i].phy_id); |
| 6175 | tmp = &mac_phy_cap[i]; |
| 6176 | wma_print_mac_phy_capabilities(tmp, i); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6177 | } |
| 6178 | WMA_LOGI("%s: <====== HW mode cap printing ends ======>\n", __func__); |
| 6179 | } |
| 6180 | |
| 6181 | /** |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6182 | * wma_map_wmi_channel_width_to_hw_mode_bw() - returns bandwidth |
| 6183 | * in terms of hw_mode_bandwidth |
| 6184 | * @width: bandwidth in terms of wmi_channel_width |
| 6185 | * |
| 6186 | * This function returns the bandwidth in terms of hw_mode_bandwidth. |
| 6187 | * |
| 6188 | * Return: BW in terms of hw_mode_bandwidth. |
| 6189 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6190 | static enum hw_mode_bandwidth wma_map_wmi_channel_width_to_hw_mode_bw( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6191 | wmi_channel_width width) |
| 6192 | { |
| 6193 | switch (width) { |
| 6194 | case WMI_CHAN_WIDTH_20: |
| 6195 | return HW_MODE_20_MHZ; |
| 6196 | case WMI_CHAN_WIDTH_40: |
| 6197 | return HW_MODE_40_MHZ; |
| 6198 | case WMI_CHAN_WIDTH_80: |
| 6199 | return HW_MODE_80_MHZ; |
| 6200 | case WMI_CHAN_WIDTH_160: |
| 6201 | return HW_MODE_160_MHZ; |
| 6202 | case WMI_CHAN_WIDTH_80P80: |
| 6203 | return HW_MODE_80_PLUS_80_MHZ; |
| 6204 | case WMI_CHAN_WIDTH_5: |
| 6205 | return HW_MODE_5_MHZ; |
| 6206 | case WMI_CHAN_WIDTH_10: |
| 6207 | return HW_MODE_10_MHZ; |
| 6208 | default: |
| 6209 | return HW_MODE_BW_NONE; |
| 6210 | } |
| 6211 | |
| 6212 | return HW_MODE_BW_NONE; |
| 6213 | } |
| 6214 | |
| 6215 | /** |
| 6216 | * wma_get_hw_mode_params() - get TX-RX stream and bandwidth |
| 6217 | * supported from the capabilities. |
| 6218 | * @caps: PHY capability |
| 6219 | * @info: param to store TX-RX stream and BW information |
| 6220 | * |
| 6221 | * This function will calculate TX-RX stream and bandwidth supported |
| 6222 | * as per the PHY capability, and assign to mac_ss_bw_info. |
| 6223 | * |
| 6224 | * Return: none |
| 6225 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6226 | static void wma_get_hw_mode_params(struct wlan_psoc_host_mac_phy_caps *caps, |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6227 | struct mac_ss_bw_info *info) |
| 6228 | { |
| 6229 | if (!caps) { |
| 6230 | WMA_LOGE("%s: Invalid capabilities", __func__); |
| 6231 | return; |
| 6232 | } |
| 6233 | |
| 6234 | info->mac_tx_stream = wma_get_num_of_setbits_from_bitmask( |
| 6235 | QDF_MAX(caps->tx_chain_mask_2G, |
| 6236 | caps->tx_chain_mask_5G)); |
| 6237 | info->mac_rx_stream = wma_get_num_of_setbits_from_bitmask( |
| 6238 | QDF_MAX(caps->rx_chain_mask_2G, |
| 6239 | caps->rx_chain_mask_5G)); |
| 6240 | info->mac_bw = wma_map_wmi_channel_width_to_hw_mode_bw( |
| 6241 | QDF_MAX(caps->max_bw_supported_2G, |
| 6242 | caps->max_bw_supported_5G)); |
| 6243 | } |
| 6244 | |
| 6245 | /** |
| 6246 | * wma_set_hw_mode_params() - sets TX-RX stream, bandwidth and |
| 6247 | * DBS in hw_mode_list |
| 6248 | * @wma_handle: pointer to wma global structure |
| 6249 | * @mac0_ss_bw_info: TX-RX streams, BW for MAC0 |
| 6250 | * @mac1_ss_bw_info: TX-RX streams, BW for MAC1 |
| 6251 | * @pos: refers to hw_mode_index |
| 6252 | * @dbs_mode: dbs_mode for the dbs_hw_mode |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6253 | * @sbs_mode: sbs_mode for the sbs_hw_mode |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6254 | * |
| 6255 | * This function sets TX-RX stream, bandwidth and DBS mode in |
| 6256 | * hw_mode_list. |
| 6257 | * |
| 6258 | * Return: none |
| 6259 | */ |
| 6260 | static void wma_set_hw_mode_params(t_wma_handle *wma_handle, |
| 6261 | struct mac_ss_bw_info mac0_ss_bw_info, |
| 6262 | struct mac_ss_bw_info mac1_ss_bw_info, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6263 | uint32_t pos, uint32_t dbs_mode, |
| 6264 | uint32_t sbs_mode) |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6265 | { |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6266 | WMA_HW_MODE_MAC0_TX_STREAMS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6267 | wma_handle->hw_mode.hw_mode_list[pos], |
| 6268 | mac0_ss_bw_info.mac_tx_stream); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6269 | WMA_HW_MODE_MAC0_RX_STREAMS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6270 | wma_handle->hw_mode.hw_mode_list[pos], |
| 6271 | mac0_ss_bw_info.mac_rx_stream); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6272 | WMA_HW_MODE_MAC0_BANDWIDTH_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6273 | wma_handle->hw_mode.hw_mode_list[pos], |
| 6274 | mac0_ss_bw_info.mac_bw); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6275 | WMA_HW_MODE_MAC1_TX_STREAMS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6276 | wma_handle->hw_mode.hw_mode_list[pos], |
| 6277 | mac1_ss_bw_info.mac_tx_stream); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6278 | WMA_HW_MODE_MAC1_RX_STREAMS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6279 | wma_handle->hw_mode.hw_mode_list[pos], |
| 6280 | mac1_ss_bw_info.mac_rx_stream); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6281 | WMA_HW_MODE_MAC1_BANDWIDTH_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6282 | wma_handle->hw_mode.hw_mode_list[pos], |
| 6283 | mac1_ss_bw_info.mac_bw); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6284 | WMA_HW_MODE_DBS_MODE_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6285 | wma_handle->hw_mode.hw_mode_list[pos], |
| 6286 | dbs_mode); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6287 | WMA_HW_MODE_AGILE_DFS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6288 | wma_handle->hw_mode.hw_mode_list[pos], |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6289 | HW_MODE_AGILE_DFS_NONE); |
| 6290 | WMA_HW_MODE_SBS_MODE_SET( |
| 6291 | wma_handle->hw_mode.hw_mode_list[pos], |
| 6292 | sbs_mode); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6293 | } |
| 6294 | |
| 6295 | /** |
| 6296 | * wma_update_hw_mode_list() - updates hw_mode_list |
| 6297 | * @wma_handle: pointer to wma global structure |
Arunk Khandavalli | 80a6135 | 2018-01-25 12:19:37 +0530 | [diff] [blame] | 6298 | * @tgt_hdl - target psoc information |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6299 | * |
| 6300 | * This function updates hw_mode_list with tx_streams, rx_streams, |
| 6301 | * bandwidth, dbs and agile dfs for each hw_mode. |
| 6302 | * |
| 6303 | * Returns: 0 for success else failure. |
| 6304 | */ |
Arunk Khandavalli | 80a6135 | 2018-01-25 12:19:37 +0530 | [diff] [blame] | 6305 | static QDF_STATUS wma_update_hw_mode_list(t_wma_handle *wma_handle, |
| 6306 | struct target_psoc_info *tgt_hdl) |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6307 | { |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6308 | struct wlan_psoc_host_mac_phy_caps *tmp, *mac_phy_cap; |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6309 | uint32_t i, hw_config_type, j = 0; |
| 6310 | uint32_t dbs_mode, sbs_mode; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6311 | struct mac_ss_bw_info mac0_ss_bw_info = {0}; |
| 6312 | struct mac_ss_bw_info mac1_ss_bw_info = {0}; |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6313 | WMI_PHY_CAPABILITY new_supported_band = 0; |
| 6314 | bool supported_band_update_failure = false; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6315 | struct wlan_psoc_target_capability_info *tgt_cap_info; |
| 6316 | int num_hw_modes; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6317 | |
| 6318 | if (!wma_handle) { |
| 6319 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 6320 | return QDF_STATUS_E_FAILURE; |
| 6321 | } |
| 6322 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6323 | num_hw_modes = target_psoc_get_num_hw_modes(tgt_hdl); |
| 6324 | mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); |
| 6325 | tgt_cap_info = target_psoc_get_target_caps(tgt_hdl); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6326 | /* |
| 6327 | * This list was updated as part of service ready event. Re-populate |
| 6328 | * HW mode list from the device capabilities. |
| 6329 | */ |
| 6330 | if (wma_handle->hw_mode.hw_mode_list) { |
| 6331 | qdf_mem_free(wma_handle->hw_mode.hw_mode_list); |
| 6332 | wma_handle->hw_mode.hw_mode_list = NULL; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6333 | WMA_LOGD("%s: DBS list is freed", __func__); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6334 | } |
| 6335 | |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6336 | wma_handle->hw_mode.hw_mode_list = |
| 6337 | qdf_mem_malloc(sizeof(*wma_handle->hw_mode.hw_mode_list) * |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6338 | num_hw_modes); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6339 | if (!wma_handle->hw_mode.hw_mode_list) { |
| 6340 | WMA_LOGE("%s: Memory allocation failed for DBS", __func__); |
| 6341 | return QDF_STATUS_E_FAILURE; |
| 6342 | } |
| 6343 | |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 6344 | WMA_LOGD("%s: Updated HW mode list: Num modes:%d", |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6345 | __func__, num_hw_modes); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6346 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6347 | for (i = 0; i < num_hw_modes; i++) { |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6348 | /* Update for MAC0 */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6349 | tmp = &mac_phy_cap[j++]; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6350 | wma_get_hw_mode_params(tmp, &mac0_ss_bw_info); |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6351 | hw_config_type = mac_phy_cap[j].hw_mode_config_type; |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6352 | dbs_mode = HW_MODE_DBS_NONE; |
| 6353 | sbs_mode = HW_MODE_SBS_NONE; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6354 | mac1_ss_bw_info.mac_tx_stream = 0; |
| 6355 | mac1_ss_bw_info.mac_rx_stream = 0; |
| 6356 | mac1_ss_bw_info.mac_bw = 0; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6357 | if (wma_update_supported_bands(tmp->supported_bands, |
| 6358 | &new_supported_band) |
| 6359 | != QDF_STATUS_SUCCESS) |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6360 | supported_band_update_failure = true; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6361 | |
| 6362 | /* SBS and DBS have dual MAC. Upto 2 MACs are considered. */ |
| 6363 | if ((hw_config_type == WMI_HW_MODE_DBS) || |
| 6364 | (hw_config_type == WMI_HW_MODE_SBS_PASSIVE) || |
| 6365 | (hw_config_type == WMI_HW_MODE_SBS)) { |
| 6366 | /* Update for MAC1 */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6367 | tmp = &mac_phy_cap[j++]; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6368 | wma_get_hw_mode_params(tmp, &mac1_ss_bw_info); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6369 | if (hw_config_type == WMI_HW_MODE_DBS) |
| 6370 | dbs_mode = HW_MODE_DBS; |
| 6371 | if ((hw_config_type == WMI_HW_MODE_SBS_PASSIVE) || |
| 6372 | (hw_config_type == WMI_HW_MODE_SBS)) |
| 6373 | sbs_mode = HW_MODE_SBS; |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6374 | if (QDF_STATUS_SUCCESS != |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6375 | wma_update_supported_bands(tmp->supported_bands, |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6376 | &new_supported_band)) |
| 6377 | supported_band_update_failure = true; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6378 | } |
| 6379 | |
| 6380 | /* Updating HW mode list */ |
| 6381 | wma_set_hw_mode_params(wma_handle, mac0_ss_bw_info, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6382 | mac1_ss_bw_info, i, dbs_mode, |
| 6383 | sbs_mode); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6384 | } |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 6385 | |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6386 | /* overwrite phy_capability which we got from service ready event */ |
| 6387 | if (!supported_band_update_failure) { |
| 6388 | WMA_LOGD("%s: updating supported band from old[%d] to new[%d]", |
Arunk Khandavalli | 80a6135 | 2018-01-25 12:19:37 +0530 | [diff] [blame] | 6389 | __func__, target_if_get_phy_capability(tgt_hdl), |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6390 | new_supported_band); |
Arunk Khandavalli | 80a6135 | 2018-01-25 12:19:37 +0530 | [diff] [blame] | 6391 | target_if_set_phy_capability(tgt_hdl, new_supported_band); |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6392 | } |
| 6393 | |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 6394 | if (QDF_STATUS_SUCCESS != |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6395 | policy_mgr_update_hw_mode_list(wma_handle->psoc, |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6396 | tgt_hdl)) |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 6397 | WMA_LOGE("%s: failed to update policy manager", __func__); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6398 | wma_dump_dbs_hw_mode(wma_handle); |
| 6399 | return QDF_STATUS_SUCCESS; |
| 6400 | } |
| 6401 | |
Naveen Rawat | 4efe41b | 2017-04-29 16:23:14 -0700 | [diff] [blame] | 6402 | static void wma_init_wifi_pos_dma_rings(t_wma_handle *wma_handle, |
| 6403 | uint8_t num_mac, void *buf) |
| 6404 | { |
| 6405 | struct hif_softc *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); |
Amar Singhal | 4c3fbb4 | 2018-01-02 13:20:28 -0800 | [diff] [blame] | 6406 | void *hal_soc; |
| 6407 | |
| 6408 | if (!hif_ctx) { |
| 6409 | WMA_LOGE("invalid hif context"); |
| 6410 | return; |
| 6411 | } |
| 6412 | |
| 6413 | hal_soc = hif_get_hal_handle(hif_ctx); |
Naveen Rawat | 4efe41b | 2017-04-29 16:23:14 -0700 | [diff] [blame] | 6414 | |
| 6415 | wifi_pos_init_cir_cfr_rings(wma_handle->psoc, hal_soc, num_mac, buf); |
| 6416 | } |
| 6417 | |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6418 | /** |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6419 | * wma_populate_soc_caps() - populate entire SOC's capabilities |
| 6420 | * @wma_handle: pointer to wma global structure |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6421 | * @tgt_hdl: target psoc information |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6422 | * @param_buf: pointer to param of service ready extension event from fw |
| 6423 | * |
| 6424 | * This API populates all capabilities of entire SOC. For example, |
| 6425 | * how many number of hw modes are supported by this SOC, what are the |
| 6426 | * capabilities of each phy per hw mode, what are HAL reg capabilities per |
| 6427 | * phy. |
| 6428 | * |
| 6429 | * Return: none |
| 6430 | */ |
| 6431 | static void wma_populate_soc_caps(t_wma_handle *wma_handle, |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6432 | struct target_psoc_info *tgt_hdl, |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6433 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf) |
| 6434 | { |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6435 | |
| 6436 | WMA_LOGD("%s: Enter", __func__); |
| 6437 | |
Naveen Rawat | 4efe41b | 2017-04-29 16:23:14 -0700 | [diff] [blame] | 6438 | wma_init_wifi_pos_dma_rings(wma_handle, |
| 6439 | param_buf->num_oem_dma_ring_caps, |
| 6440 | param_buf->oem_dma_ring_caps); |
| 6441 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6442 | wma_print_populate_soc_caps(tgt_hdl); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6443 | } |
| 6444 | |
| 6445 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6446 | * wma_rx_service_ready_ext_event() - evt handler for sevice ready ext event. |
| 6447 | * @handle: wma handle |
| 6448 | * @event: params of the service ready extended event |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6449 | * @length: param length |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6450 | * |
| 6451 | * Return: none |
| 6452 | */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6453 | int wma_rx_service_ready_ext_event(void *handle, uint8_t *event, |
| 6454 | uint32_t length) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6455 | { |
| 6456 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 6457 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 6458 | wmi_service_ready_ext_event_fixed_param *ev; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6459 | QDF_STATUS ret; |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6460 | struct target_psoc_info *tgt_hdl; |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 6461 | uint32_t conc_scan_config_bits, fw_config_bits; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6462 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6463 | WMA_LOGD("%s: Enter", __func__); |
| 6464 | |
| 6465 | if (!wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6466 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6467 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6468 | } |
| 6469 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6470 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 6471 | if (!tgt_hdl) { |
| 6472 | WMA_LOGE("%s: target psoc info is NULL", __func__); |
| 6473 | return -EINVAL; |
| 6474 | } |
| 6475 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6476 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 6477 | if (!param_buf) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6478 | WMA_LOGE("%s: Invalid event", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6479 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6480 | } |
| 6481 | |
| 6482 | ev = param_buf->fixed_param; |
| 6483 | if (!ev) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6484 | WMA_LOGE("%s: Invalid buffer", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6485 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6486 | } |
| 6487 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6488 | WMA_LOGD("WMA <-- WMI_SERVICE_READY_EXT_EVENTID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6489 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 6490 | fw_config_bits = target_if_get_fw_config_bits(tgt_hdl); |
| 6491 | conc_scan_config_bits = target_if_get_conc_scan_config_bits(tgt_hdl); |
| 6492 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6493 | WMA_LOGD("%s: Defaults: scan config:%x FW mode config:%x", |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 6494 | __func__, conc_scan_config_bits, fw_config_bits); |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 6495 | |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 6496 | ret = qdf_mc_timer_stop(&wma_handle->service_ready_ext_timer); |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 6497 | if (!QDF_IS_STATUS_SUCCESS(ret)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6498 | WMA_LOGE("Failed to stop the service ready ext timer"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6499 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6500 | } |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6501 | wma_populate_soc_caps(wma_handle, tgt_hdl, param_buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6502 | |
Arunk Khandavalli | 80a6135 | 2018-01-25 12:19:37 +0530 | [diff] [blame] | 6503 | ret = wma_update_hw_mode_list(wma_handle, tgt_hdl); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6504 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 6505 | WMA_LOGE("Failed to update hw mode list"); |
| 6506 | return -EINVAL; |
| 6507 | } |
| 6508 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6509 | WMA_LOGD("WMA --> WMI_INIT_CMDID"); |
Mukul Sharma | b10c8c7 | 2017-11-02 17:25:59 +0530 | [diff] [blame] | 6510 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6511 | wma_init_scan_fw_mode_config(wma_handle->psoc, conc_scan_config_bits, |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 6512 | fw_config_bits); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6513 | |
| 6514 | target_psoc_set_num_radios(tgt_hdl, 1); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6515 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6516 | } |
| 6517 | |
| 6518 | /** |
| 6519 | * wma_rx_ready_event() - event handler to process |
| 6520 | * wmi rx ready event. |
| 6521 | * @handle: wma handle |
| 6522 | * @cmd_param_info: command params info |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6523 | * @length: param length |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6524 | * |
| 6525 | * Return: none |
| 6526 | */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6527 | int wma_rx_ready_event(void *handle, uint8_t *cmd_param_info, |
| 6528 | uint32_t length) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6529 | { |
| 6530 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 6531 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 6532 | wmi_ready_event_fixed_param *ev = NULL; |
| 6533 | |
| 6534 | WMA_LOGD("%s: Enter", __func__); |
| 6535 | |
| 6536 | param_buf = (WMI_READY_EVENTID_param_tlvs *) cmd_param_info; |
| 6537 | if (!(wma_handle && param_buf)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6538 | WMA_LOGE("%s: Invalid arguments", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6539 | QDF_ASSERT(0); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6540 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6541 | } |
| 6542 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6543 | WMA_LOGD("WMA <-- WMI_READY_EVENTID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6544 | |
| 6545 | ev = param_buf->fixed_param; |
| 6546 | /* Indicate to the waiting thread that the ready |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 6547 | * event was received |
| 6548 | */ |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 6549 | wma_handle->sub_20_support = |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 6550 | wmi_service_enabled(wma_handle->wmi_handle, |
| 6551 | wmi_service_half_rate_quarter_rate_support); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6552 | wma_handle->wmi_ready = true; |
| 6553 | wma_handle->wlan_init_status = ev->status; |
| 6554 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6555 | /* copy the mac addr */ |
| 6556 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, wma_handle->myaddr); |
| 6557 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, wma_handle->hwaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6558 | wma_update_hdd_cfg(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6559 | WMA_LOGD("Exit"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6560 | |
| 6561 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6562 | } |
| 6563 | |
| 6564 | /** |
| 6565 | * wma_setneedshutdown() - setting wma needshutdown flag |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6566 | * |
| 6567 | * Return: none |
| 6568 | */ |
Jeff Johnson | 1f8d0a0 | 2017-09-13 08:09:05 -0700 | [diff] [blame] | 6569 | void wma_setneedshutdown(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6570 | { |
| 6571 | tp_wma_handle wma_handle; |
| 6572 | |
| 6573 | WMA_LOGD("%s: Enter", __func__); |
| 6574 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6575 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6576 | |
| 6577 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6578 | WMA_LOGE("%s: Invalid arguments", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6579 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6580 | return; |
| 6581 | } |
| 6582 | |
| 6583 | wma_handle->needShutdown = true; |
| 6584 | WMA_LOGD("%s: Exit", __func__); |
| 6585 | } |
| 6586 | |
| 6587 | /** |
| 6588 | * wma_needshutdown() - Is wma needs shutdown? |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6589 | * |
| 6590 | * Return: returns true/false |
| 6591 | */ |
Jeff Johnson | 1b5404e | 2017-09-13 08:04:46 -0700 | [diff] [blame] | 6592 | bool wma_needshutdown(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6593 | { |
| 6594 | tp_wma_handle wma_handle; |
| 6595 | |
| 6596 | WMA_LOGD("%s: Enter", __func__); |
| 6597 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6598 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6599 | |
| 6600 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6601 | WMA_LOGE("%s: Invalid arguments", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6602 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6603 | return false; |
| 6604 | } |
| 6605 | |
| 6606 | WMA_LOGD("%s: Exit", __func__); |
| 6607 | return wma_handle->needShutdown; |
| 6608 | } |
| 6609 | |
| 6610 | /** |
| 6611 | * wma_wait_for_ready_event() - wait for wma ready event |
| 6612 | * @handle: wma handle |
| 6613 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 6614 | * Return: 0 for success or QDF error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6615 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6616 | QDF_STATUS wma_wait_for_ready_event(WMA_HANDLE handle) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6617 | { |
| 6618 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6619 | QDF_STATUS qdf_status; |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6620 | struct target_psoc_info *tgt_hdl; |
| 6621 | int timeleft; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6622 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6623 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 6624 | if (!tgt_hdl) { |
| 6625 | WMA_LOGE("%s: target psoc info is NULL", __func__); |
| 6626 | return QDF_STATUS_E_INVAL; |
| 6627 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6628 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6629 | timeleft = qdf_wait_queue_timeout( |
| 6630 | tgt_hdl->info.event_queue, |
| 6631 | ((tgt_hdl->info.wmi_service_ready) && |
| 6632 | (tgt_hdl->info.wmi_ready)), |
| 6633 | WMA_READY_EVENTID_TIMEOUT); |
| 6634 | if (!timeleft) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6635 | WMA_LOGE("%s: Timeout waiting for ready event from FW", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6636 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6637 | qdf_status = QDF_STATUS_E_FAILURE; |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6638 | } else { |
| 6639 | WMA_LOGI("%s Ready event received from FW", __func__); |
| 6640 | qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6641 | } |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6642 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6643 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6644 | } |
| 6645 | |
| 6646 | /** |
| 6647 | * wma_set_ppsconfig() - set pps config in fw |
| 6648 | * @vdev_id: vdev id |
| 6649 | * @pps_param: pps params |
| 6650 | * @val : param value |
| 6651 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 6652 | * Return: 0 for success or QDF error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6653 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6654 | QDF_STATUS wma_set_ppsconfig(uint8_t vdev_id, uint16_t pps_param, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6655 | int val) |
| 6656 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6657 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6658 | int ret = -EIO; |
| 6659 | uint32_t pps_val; |
| 6660 | |
| 6661 | if (NULL == wma) { |
| 6662 | WMA_LOGE("%s: Failed to get wma", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6663 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6664 | } |
| 6665 | |
| 6666 | switch (pps_param) { |
| 6667 | case WMA_VHT_PPS_PAID_MATCH: |
| 6668 | pps_val = ((val << 31) & 0xffff0000) | |
| 6669 | (PKT_PWR_SAVE_PAID_MATCH & 0xffff); |
| 6670 | goto pkt_pwr_save_config; |
| 6671 | case WMA_VHT_PPS_GID_MATCH: |
| 6672 | pps_val = ((val << 31) & 0xffff0000) | |
| 6673 | (PKT_PWR_SAVE_GID_MATCH & 0xffff); |
| 6674 | goto pkt_pwr_save_config; |
| 6675 | case WMA_VHT_PPS_DELIM_CRC_FAIL: |
| 6676 | pps_val = ((val << 31) & 0xffff0000) | |
| 6677 | (PKT_PWR_SAVE_DELIM_CRC_FAIL & 0xffff); |
| 6678 | goto pkt_pwr_save_config; |
| 6679 | |
| 6680 | /* Enable the code below as and when the functionality |
| 6681 | * is supported/added in host. |
| 6682 | */ |
| 6683 | #ifdef NOT_YET |
| 6684 | case WMA_VHT_PPS_EARLY_TIM_CLEAR: |
| 6685 | pps_val = ((val << 31) & 0xffff0000) | |
| 6686 | (PKT_PWR_SAVE_EARLY_TIM_CLEAR & 0xffff); |
| 6687 | goto pkt_pwr_save_config; |
| 6688 | case WMA_VHT_PPS_EARLY_DTIM_CLEAR: |
| 6689 | pps_val = ((val << 31) & 0xffff0000) | |
| 6690 | (PKT_PWR_SAVE_EARLY_DTIM_CLEAR & 0xffff); |
| 6691 | goto pkt_pwr_save_config; |
| 6692 | case WMA_VHT_PPS_EOF_PAD_DELIM: |
| 6693 | pps_val = ((val << 31) & 0xffff0000) | |
| 6694 | (PKT_PWR_SAVE_EOF_PAD_DELIM & 0xffff); |
| 6695 | goto pkt_pwr_save_config; |
| 6696 | case WMA_VHT_PPS_MACADDR_MISMATCH: |
| 6697 | pps_val = ((val << 31) & 0xffff0000) | |
| 6698 | (PKT_PWR_SAVE_MACADDR_MISMATCH & 0xffff); |
| 6699 | goto pkt_pwr_save_config; |
| 6700 | case WMA_VHT_PPS_GID_NSTS_ZERO: |
| 6701 | pps_val = ((val << 31) & 0xffff0000) | |
| 6702 | (PKT_PWR_SAVE_GID_NSTS_ZERO & 0xffff); |
| 6703 | goto pkt_pwr_save_config; |
| 6704 | case WMA_VHT_PPS_RSSI_CHECK: |
| 6705 | pps_val = ((val << 31) & 0xffff0000) | |
| 6706 | (PKT_PWR_SAVE_RSSI_CHECK & 0xffff); |
| 6707 | goto pkt_pwr_save_config; |
| 6708 | #endif /* NOT_YET */ |
| 6709 | pkt_pwr_save_config: |
| 6710 | WMA_LOGD("vdev_id:%d val:0x%x pps_val:0x%x", vdev_id, |
| 6711 | val, pps_val); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6712 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 6713 | WMI_VDEV_PARAM_PACKET_POWERSAVE, |
| 6714 | pps_val); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6715 | break; |
| 6716 | default: |
| 6717 | WMA_LOGE("%s:INVALID PPS CONFIG", __func__); |
| 6718 | } |
| 6719 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6720 | return (ret) ? QDF_STATUS_E_FAILURE : QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6721 | } |
| 6722 | |
| 6723 | /** |
| 6724 | * wma_process_set_mas() - Function to enable/disable MAS |
| 6725 | * @wma: Pointer to WMA handle |
| 6726 | * @mas_val: 1-Enable MAS, 0-Disable MAS |
| 6727 | * |
| 6728 | * This function enables/disables the MAS value |
| 6729 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 6730 | * Return: QDF_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6731 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6732 | static QDF_STATUS wma_process_set_mas(tp_wma_handle wma, |
| 6733 | uint32_t *mas_val) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6734 | { |
| 6735 | uint32_t val; |
| 6736 | |
| 6737 | if (NULL == wma || NULL == mas_val) { |
| 6738 | WMA_LOGE("%s: Invalid input to enable/disable MAS", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6739 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6740 | } |
| 6741 | |
| 6742 | val = (*mas_val); |
| 6743 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6744 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6745 | wma_set_enable_disable_mcc_adaptive_scheduler(val)) { |
| 6746 | WMA_LOGE("%s: Unable to enable/disable MAS", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6747 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6748 | } |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 6749 | WMA_LOGE("%s: Value is %d", __func__, val); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6750 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6751 | } |
| 6752 | |
| 6753 | /** |
| 6754 | * wma_process_set_miracast() - Function to set miracast value in WMA |
| 6755 | * @wma: Pointer to WMA handle |
| 6756 | * @miracast_val: 0-Disabled,1-Source,2-Sink |
| 6757 | * |
| 6758 | * This function stores the miracast value in WMA |
| 6759 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 6760 | * Return: QDF_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6761 | * |
| 6762 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6763 | static QDF_STATUS wma_process_set_miracast(tp_wma_handle wma, |
| 6764 | uint32_t *miracast_val) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6765 | { |
| 6766 | if (NULL == wma || NULL == miracast_val) { |
| 6767 | WMA_LOGE("%s: Invalid input to store miracast value", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6768 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6769 | } |
| 6770 | |
| 6771 | wma->miracast_value = *miracast_val; |
| 6772 | WMA_LOGE("%s: Miracast value is %d", __func__, wma->miracast_value); |
| 6773 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6774 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6775 | } |
| 6776 | |
| 6777 | /** |
| 6778 | * wma_config_stats_factor() - Function to configure stats avg. factor |
| 6779 | * @wma: pointer to WMA handle |
| 6780 | * @avg_factor: stats. avg. factor passed down by userspace |
| 6781 | * |
| 6782 | * This function configures the avg. stats value in firmware |
| 6783 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6784 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6785 | * |
| 6786 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6787 | static QDF_STATUS wma_config_stats_factor(tp_wma_handle wma, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6788 | struct sir_stats_avg_factor *avg_factor) |
| 6789 | { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6790 | QDF_STATUS ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6791 | |
| 6792 | if (NULL == wma || NULL == avg_factor) { |
| 6793 | WMA_LOGE("%s: Invalid input of stats avg factor", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6794 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6795 | } |
| 6796 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6797 | ret = wma_vdev_set_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6798 | avg_factor->vdev_id, |
| 6799 | WMI_VDEV_PARAM_STATS_AVG_FACTOR, |
| 6800 | avg_factor->stats_avg_factor); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6801 | if (QDF_IS_STATUS_ERROR(ret)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6802 | WMA_LOGE(" failed to set avg_factor for vdev_id %d", |
| 6803 | avg_factor->vdev_id); |
| 6804 | } |
| 6805 | |
| 6806 | WMA_LOGD("%s: Set stats_avg_factor %d for vdev_id %d", __func__, |
| 6807 | avg_factor->stats_avg_factor, avg_factor->vdev_id); |
| 6808 | |
| 6809 | return ret; |
| 6810 | } |
| 6811 | |
| 6812 | /** |
| 6813 | * wma_config_guard_time() - Function to set guard time in firmware |
| 6814 | * @wma: pointer to WMA handle |
| 6815 | * @guard_time: guard time passed down by userspace |
| 6816 | * |
| 6817 | * This function configures the guard time in firmware |
| 6818 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6819 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6820 | * |
| 6821 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6822 | static QDF_STATUS wma_config_guard_time(tp_wma_handle wma, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6823 | struct sir_guard_time_request *guard_time) |
| 6824 | { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6825 | QDF_STATUS ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6826 | |
| 6827 | if (NULL == wma || NULL == guard_time) { |
| 6828 | WMA_LOGE("%s: Invalid input of guard time", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6829 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6830 | } |
| 6831 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6832 | ret = wma_vdev_set_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6833 | guard_time->vdev_id, |
| 6834 | WMI_VDEV_PARAM_RX_LEAK_WINDOW, |
| 6835 | guard_time->guard_time); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6836 | if (QDF_IS_STATUS_ERROR(ret)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6837 | WMA_LOGE(" failed to set guard time for vdev_id %d", |
| 6838 | guard_time->vdev_id); |
| 6839 | } |
| 6840 | |
| 6841 | WMA_LOGD("Set guard time %d for vdev_id %d", |
| 6842 | guard_time->guard_time, guard_time->vdev_id); |
| 6843 | |
| 6844 | return ret; |
| 6845 | } |
| 6846 | |
| 6847 | /** |
| 6848 | * wma_enable_specific_fw_logs() - Start/Stop logging of diag event/log id |
| 6849 | * @wma_handle: WMA handle |
| 6850 | * @start_log: Start logging related parameters |
| 6851 | * |
| 6852 | * Send the command to the FW based on which specific logging of diag |
| 6853 | * event/log id can be started/stopped |
| 6854 | * |
| 6855 | * Return: None |
| 6856 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6857 | static void wma_enable_specific_fw_logs(tp_wma_handle wma_handle, |
| 6858 | struct sir_wifi_start_log *start_log) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6859 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6860 | |
| 6861 | if (!start_log) { |
| 6862 | WMA_LOGE("%s: start_log pointer is NULL", __func__); |
| 6863 | return; |
| 6864 | } |
| 6865 | if (!wma_handle) { |
| 6866 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 6867 | return; |
| 6868 | } |
| 6869 | |
| 6870 | if (!((start_log->ring_id == RING_ID_CONNECTIVITY) || |
| 6871 | (start_log->ring_id == RING_ID_FIRMWARE_DEBUG))) { |
| 6872 | WMA_LOGD("%s: Not connectivity or fw debug ring: %d", |
| 6873 | __func__, start_log->ring_id); |
| 6874 | return; |
| 6875 | } |
| 6876 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 6877 | wmi_unified_enable_specific_fw_logs_cmd(wma_handle->wmi_handle, |
| 6878 | (struct wmi_wifi_start_log *)start_log); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6879 | } |
| 6880 | |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 6881 | #define MEGABYTE (1024 * 1024) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6882 | /** |
| 6883 | * wma_set_wifi_start_packet_stats() - Start/stop packet stats |
| 6884 | * @wma_handle: WMA handle |
| 6885 | * @start_log: Struture containing the start wifi logger params |
| 6886 | * |
| 6887 | * This function is used to send the WMA commands to start/stop logging |
| 6888 | * of per packet statistics |
| 6889 | * |
| 6890 | * Return: None |
| 6891 | * |
| 6892 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6893 | #ifdef REMOVE_PKT_LOG |
| 6894 | static void wma_set_wifi_start_packet_stats(void *wma_handle, |
| 6895 | struct sir_wifi_start_log *start_log) |
| 6896 | { |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6897 | } |
Venkata Sharath Chandra Manchala | 1240fc7 | 2017-10-26 17:32:29 -0700 | [diff] [blame] | 6898 | |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6899 | #else |
| 6900 | static void wma_set_wifi_start_packet_stats(void *wma_handle, |
| 6901 | struct sir_wifi_start_log *start_log) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6902 | { |
Komal Seelam | 3d20286 | 2016-02-24 18:43:24 +0530 | [diff] [blame] | 6903 | struct hif_opaque_softc *scn; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6904 | uint32_t log_state; |
| 6905 | |
| 6906 | if (!start_log) { |
| 6907 | WMA_LOGE("%s: start_log pointer is NULL", __func__); |
| 6908 | return; |
| 6909 | } |
| 6910 | if (!wma_handle) { |
| 6911 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 6912 | return; |
| 6913 | } |
| 6914 | |
| 6915 | /* No need to register for ring IDs other than packet stats */ |
| 6916 | if (start_log->ring_id != RING_ID_PER_PACKET_STATS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6917 | WMA_LOGD("%s: Ring id is not for per packet stats: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6918 | __func__, start_log->ring_id); |
| 6919 | return; |
| 6920 | } |
| 6921 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6922 | scn = cds_get_context(QDF_MODULE_ID_HIF); |
Naveen Rawat | b2109f6 | 2016-07-21 14:18:15 -0700 | [diff] [blame] | 6923 | if (scn == NULL) { |
| 6924 | WMA_LOGE("%s: Invalid HIF handle", __func__); |
| 6925 | return; |
| 6926 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6927 | |
Venkata Sharath Chandra Manchala | 1240fc7 | 2017-10-26 17:32:29 -0700 | [diff] [blame] | 6928 | #ifdef HELIUMPLUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6929 | log_state = ATH_PKTLOG_ANI | ATH_PKTLOG_RCUPDATE | ATH_PKTLOG_RCFIND | |
Nirav Shah | dcc4c87 | 2016-07-28 11:35:26 +0530 | [diff] [blame] | 6930 | ATH_PKTLOG_RX | ATH_PKTLOG_TX | |
Venkata Sharath Chandra Manchala | 2996517 | 2018-01-18 14:17:29 -0800 | [diff] [blame] | 6931 | ATH_PKTLOG_TEXT | ATH_PKTLOG_SW_EVENT; |
Venkata Sharath Chandra Manchala | 1240fc7 | 2017-10-26 17:32:29 -0700 | [diff] [blame] | 6932 | #else |
| 6933 | log_state = ATH_PKTLOG_LITE_T2H | ATH_PKTLOG_LITE_RX; |
| 6934 | #endif |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 6935 | if (start_log->size != 0) { |
| 6936 | pktlog_setsize(scn, start_log->size * MEGABYTE); |
| 6937 | return; |
Poddar, Siddarth | ab99a27 | 2017-04-10 12:53:26 +0530 | [diff] [blame] | 6938 | } else if (start_log->is_pktlog_buff_clear == true) { |
| 6939 | pktlog_clearbuff(scn, start_log->is_pktlog_buff_clear); |
| 6940 | return; |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 6941 | } |
| 6942 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6943 | if (start_log->verbose_level == WLAN_LOG_LEVEL_ACTIVE) { |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 6944 | pktlog_enable(scn, log_state, start_log->ini_triggered, |
Poddar, Siddarth | eefe348 | 2016-09-21 18:12:59 +0530 | [diff] [blame] | 6945 | start_log->user_triggered, |
| 6946 | start_log->is_iwpriv_command); |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6947 | WMA_LOGD("%s: Enabling per packet stats", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6948 | } else { |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 6949 | pktlog_enable(scn, 0, start_log->ini_triggered, |
Poddar, Siddarth | eefe348 | 2016-09-21 18:12:59 +0530 | [diff] [blame] | 6950 | start_log->user_triggered, |
| 6951 | start_log->is_iwpriv_command); |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6952 | WMA_LOGD("%s: Disabling per packet stats", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6953 | } |
| 6954 | } |
| 6955 | #endif |
| 6956 | |
| 6957 | /** |
| 6958 | * wma_send_flush_logs_to_fw() - Send log flush command to FW |
| 6959 | * @wma_handle: WMI handle |
| 6960 | * |
| 6961 | * This function is used to send the flush command to the FW, |
| 6962 | * that will flush the fw logs that are residue in the FW |
| 6963 | * |
| 6964 | * Return: None |
| 6965 | */ |
| 6966 | void wma_send_flush_logs_to_fw(tp_wma_handle wma_handle) |
| 6967 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6968 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6969 | int ret; |
| 6970 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 6971 | ret = wmi_unified_flush_logs_to_fw_cmd(wma_handle->wmi_handle); |
| 6972 | if (ret != EOK) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6973 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6974 | |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 6975 | status = qdf_mc_timer_start(&wma_handle->log_completion_timer, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6976 | WMA_LOG_COMPLETION_TIMER); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6977 | if (status != QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6978 | WMA_LOGE("Failed to start the log completion timer"); |
| 6979 | } |
| 6980 | |
| 6981 | /** |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 6982 | * wma_update_wep_default_key - To update default key id |
| 6983 | * @wma: pointer to wma handler |
| 6984 | * @update_def_key: pointer to wep_update_default_key_idx |
| 6985 | * |
| 6986 | * This function makes a copy of default key index to txrx node |
| 6987 | * |
| 6988 | * Return: Success |
| 6989 | */ |
| 6990 | static QDF_STATUS wma_update_wep_default_key(tp_wma_handle wma, |
| 6991 | struct wep_update_default_key_idx *update_def_key) |
| 6992 | { |
| 6993 | struct wma_txrx_node *iface = |
| 6994 | &wma->interfaces[update_def_key->session_id]; |
| 6995 | iface->wep_default_key_idx = update_def_key->default_idx; |
| 6996 | |
| 6997 | return QDF_STATUS_SUCCESS; |
| 6998 | } |
| 6999 | |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 7000 | /** |
| 7001 | * wma_update_tx_fail_cnt_th() - Set threshold for TX pkt fail |
| 7002 | * @wma_handle: WMA handle |
| 7003 | * @tx_fail_cnt_th: sme_tx_fail_cnt_threshold parameter |
| 7004 | * |
| 7005 | * This function is used to set Tx pkt fail count threshold, |
| 7006 | * FW will do disconnect with station once this threshold is reached. |
| 7007 | * |
| 7008 | * Return: VOS_STATUS_SUCCESS on success, error number otherwise |
| 7009 | */ |
| 7010 | static QDF_STATUS wma_update_tx_fail_cnt_th(tp_wma_handle wma, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7011 | struct sme_tx_fail_cnt_threshold *tx_fail_cnt_th) |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 7012 | { |
| 7013 | u_int8_t vdev_id; |
| 7014 | u_int32_t tx_fail_disconn_th; |
| 7015 | int ret = -EIO; |
| 7016 | |
| 7017 | if (!wma || !wma->wmi_handle) { |
| 7018 | WMA_LOGE(FL("WMA is closed, can not issue Tx pkt fail count threshold")); |
| 7019 | return QDF_STATUS_E_INVAL; |
| 7020 | } |
| 7021 | vdev_id = tx_fail_cnt_th->session_id; |
| 7022 | tx_fail_disconn_th = tx_fail_cnt_th->tx_fail_cnt_threshold; |
| 7023 | WMA_LOGD("Set TX pkt fail count threshold vdevId %d count %d", |
| 7024 | vdev_id, tx_fail_disconn_th); |
| 7025 | |
| 7026 | |
| 7027 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 7028 | WMI_VDEV_PARAM_DISCONNECT_TH, |
| 7029 | tx_fail_disconn_th); |
| 7030 | |
| 7031 | if (ret) { |
| 7032 | WMA_LOGE(FL("Failed to send TX pkt fail count threshold command")); |
| 7033 | return QDF_STATUS_E_FAILURE; |
| 7034 | } |
| 7035 | |
| 7036 | return QDF_STATUS_SUCCESS; |
| 7037 | } |
| 7038 | |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 7039 | /** |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 7040 | * wma_update_short_retry_limit() - Set retry limit for short frames |
| 7041 | * @wma_handle: WMA handle |
| 7042 | * @short_retry_limit_th: retry limir count for Short frames. |
| 7043 | * |
| 7044 | * This function is used to configure the transmission retry limit at which |
| 7045 | * short frames needs to be retry. |
| 7046 | * |
| 7047 | * Return: VOS_STATUS_SUCCESS on success, error number otherwise |
| 7048 | */ |
| 7049 | static QDF_STATUS wma_update_short_retry_limit(tp_wma_handle wma, |
| 7050 | struct sme_short_retry_limit *short_retry_limit_th) |
| 7051 | { |
| 7052 | uint8_t vdev_id; |
| 7053 | uint32_t short_retry_limit; |
| 7054 | int ret; |
| 7055 | |
| 7056 | if (!wma || !wma->wmi_handle) { |
| 7057 | WMA_LOGE("WMA is closed, can not issue short retry limit threshold"); |
| 7058 | return QDF_STATUS_E_INVAL; |
| 7059 | } |
| 7060 | vdev_id = short_retry_limit_th->session_id; |
| 7061 | short_retry_limit = short_retry_limit_th->short_retry_limit; |
| 7062 | WMA_LOGD("Set short retry limit threshold vdevId %d count %d", |
| 7063 | vdev_id, short_retry_limit); |
| 7064 | |
| 7065 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 7066 | WMI_VDEV_PARAM_NON_AGG_SW_RETRY_TH, |
| 7067 | short_retry_limit); |
| 7068 | |
| 7069 | if (ret) { |
| 7070 | WMA_LOGE("Failed to send short limit threshold command"); |
| 7071 | return QDF_STATUS_E_FAILURE; |
| 7072 | } |
| 7073 | return QDF_STATUS_SUCCESS; |
| 7074 | } |
| 7075 | |
| 7076 | /** |
| 7077 | * wma_update_long_retry_limit() - Set retry limit for long frames |
| 7078 | * @wma_handle: WMA handle |
| 7079 | * @long_retry_limit_th: retry limir count for long frames |
| 7080 | * |
| 7081 | * This function is used to configure the transmission retry limit at which |
| 7082 | * long frames needs to be retry |
| 7083 | * |
| 7084 | * Return: VOS_STATUS_SUCCESS on success, error number otherwise |
| 7085 | */ |
| 7086 | static QDF_STATUS wma_update_long_retry_limit(tp_wma_handle wma, |
| 7087 | struct sme_long_retry_limit *long_retry_limit_th) |
| 7088 | { |
| 7089 | uint8_t vdev_id; |
| 7090 | uint32_t long_retry_limit; |
| 7091 | int ret; |
| 7092 | |
| 7093 | if (!wma || !wma->wmi_handle) { |
| 7094 | WMA_LOGE("WMA is closed, can not issue long retry limit threshold"); |
| 7095 | return QDF_STATUS_E_INVAL; |
| 7096 | } |
| 7097 | vdev_id = long_retry_limit_th->session_id; |
| 7098 | long_retry_limit = long_retry_limit_th->long_retry_limit; |
| 7099 | WMA_LOGD("Set TX pkt fail count threshold vdevId %d count %d", |
| 7100 | vdev_id, long_retry_limit); |
| 7101 | |
| 7102 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 7103 | WMI_VDEV_PARAM_AGG_SW_RETRY_TH, |
| 7104 | long_retry_limit); |
| 7105 | |
| 7106 | if (ret) { |
| 7107 | WMA_LOGE("Failed to send long limit threshold command"); |
| 7108 | return QDF_STATUS_E_FAILURE; |
| 7109 | } |
| 7110 | |
| 7111 | return QDF_STATUS_SUCCESS; |
| 7112 | } |
| 7113 | |
Agrawal, Ashish | 4e5fa1c | 2016-09-21 19:03:43 +0530 | [diff] [blame] | 7114 | /* |
| 7115 | * wma_update_sta_inactivity_timeout() - Set sta_inactivity_timeout to fw |
| 7116 | * @wma_handle: WMA handle |
| 7117 | * @sta_inactivity_timer: sme_sta_inactivity_timeout |
| 7118 | * |
| 7119 | * This function is used to set sta_inactivity_timeout. |
| 7120 | * If a station does not send anything in sta_inactivity_timeout seconds, an |
| 7121 | * empty data frame is sent to it in order to verify whether it is |
| 7122 | * still in range. If this frame is not ACKed, the station will be |
| 7123 | * disassociated and then deauthenticated. |
| 7124 | * |
| 7125 | * Return: None |
| 7126 | */ |
| 7127 | void wma_update_sta_inactivity_timeout(tp_wma_handle wma, |
| 7128 | struct sme_sta_inactivity_timeout *sta_inactivity_timer) |
| 7129 | { |
| 7130 | uint8_t vdev_id; |
| 7131 | uint32_t max_unresponsive_time; |
| 7132 | uint32_t min_inactive_time, max_inactive_time; |
| 7133 | |
| 7134 | if (!wma || !wma->wmi_handle) { |
| 7135 | WMA_LOGE("WMA is closed, can not issue sta_inactivity_timeout"); |
| 7136 | return; |
| 7137 | } |
| 7138 | vdev_id = sta_inactivity_timer->session_id; |
| 7139 | max_unresponsive_time = sta_inactivity_timer->sta_inactivity_timeout; |
| 7140 | max_inactive_time = max_unresponsive_time * TWO_THIRD; |
| 7141 | min_inactive_time = max_unresponsive_time - max_inactive_time; |
| 7142 | |
| 7143 | if (wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 7144 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS, |
| 7145 | min_inactive_time)) |
| 7146 | WMA_LOGE("Failed to Set AP MIN IDLE INACTIVE TIME"); |
| 7147 | |
| 7148 | if (wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 7149 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS, |
| 7150 | max_inactive_time)) |
| 7151 | WMA_LOGE("Failed to Set AP MAX IDLE INACTIVE TIME"); |
| 7152 | |
| 7153 | if (wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 7154 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS, |
| 7155 | max_unresponsive_time)) |
| 7156 | WMA_LOGE("Failed to Set MAX UNRESPONSIVE TIME"); |
| 7157 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 7158 | WMA_LOGD("%s:vdev_id:%d min_inactive_time: %u max_inactive_time: %u max_unresponsive_time: %u", |
Agrawal, Ashish | 4e5fa1c | 2016-09-21 19:03:43 +0530 | [diff] [blame] | 7159 | __func__, vdev_id, |
| 7160 | min_inactive_time, max_inactive_time, |
| 7161 | max_unresponsive_time); |
| 7162 | } |
| 7163 | |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 7164 | #ifdef WLAN_FEATURE_WOW_PULSE |
| 7165 | |
| 7166 | |
| 7167 | #define WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM \ |
| 7168 | WMI_WOW_HOSTWAKEUP_GPIO_PIN_PATTERN_CONFIG_CMD_fixed_param |
| 7169 | |
| 7170 | |
| 7171 | #define WMITLV_TAG_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM \ |
| 7172 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_gpio_pin_pattern_config_cmd_fixed_param |
| 7173 | |
| 7174 | /** |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7175 | * wma_send_wow_pulse_cmd() - send wmi cmd of wow pulse cmd |
| 7176 | * information to fw. |
| 7177 | * @wma_handle: wma handler |
| 7178 | * @udp_response: wow_pulse_mode pointer |
| 7179 | * |
| 7180 | * Return: Return QDF_STATUS |
| 7181 | */ |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 7182 | static QDF_STATUS wma_send_wow_pulse_cmd(tp_wma_handle wma_handle, |
| 7183 | struct wow_pulse_mode *wow_pulse_cmd) |
| 7184 | { |
| 7185 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 7186 | wmi_buf_t buf; |
| 7187 | WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM *cmd; |
| 7188 | u_int16_t len; |
| 7189 | |
| 7190 | len = sizeof(*cmd); |
| 7191 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 7192 | if (!buf) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7193 | WMA_LOGE("wmi_buf_alloc failed"); |
| 7194 | return QDF_STATUS_E_NOMEM; |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 7195 | } |
| 7196 | |
| 7197 | cmd = (WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM *)wmi_buf_data(buf); |
| 7198 | qdf_mem_zero(cmd, len); |
| 7199 | |
| 7200 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7201 | WMITLV_TAG_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM, |
| 7202 | WMITLV_GET_STRUCT_TLVLEN( |
| 7203 | WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM)); |
| 7204 | |
| 7205 | cmd->enable = wow_pulse_cmd->wow_pulse_enable; |
| 7206 | cmd->pin = wow_pulse_cmd->wow_pulse_pin; |
| 7207 | cmd->interval_low = wow_pulse_cmd->wow_pulse_interval_low; |
| 7208 | cmd->interval_high = wow_pulse_cmd->wow_pulse_interval_high; |
| 7209 | cmd->repeat_cnt = WMI_WOW_PULSE_REPEAT_CNT; |
| 7210 | |
| 7211 | if (wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 7212 | WMI_WOW_HOSTWAKEUP_GPIO_PIN_PATTERN_CONFIG_CMDID)) { |
| 7213 | WMA_LOGE("Failed to send send wow pulse"); |
| 7214 | wmi_buf_free(buf); |
| 7215 | status = QDF_STATUS_E_FAILURE; |
| 7216 | } |
| 7217 | |
| 7218 | WMA_LOGD("%s: Exit", __func__); |
| 7219 | return status; |
| 7220 | } |
| 7221 | |
| 7222 | #undef WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM |
| 7223 | #undef WMITLV_TAG_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM |
| 7224 | #undef WMI_WOW_PULSE_REPEAT_CNT |
| 7225 | |
| 7226 | #else |
| 7227 | static inline QDF_STATUS wma_send_wow_pulse_cmd(tp_wma_handle wma_handle, |
| 7228 | struct wow_pulse_mode *wow_pulse_cmd) |
| 7229 | { |
| 7230 | return QDF_STATUS_E_FAILURE; |
| 7231 | } |
| 7232 | #endif |
| 7233 | |
| 7234 | |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 7235 | /** |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 7236 | * wma_process_power_debug_stats_req() - Process the Chip Power stats collect |
| 7237 | * request and pass the Power stats request to Fw |
| 7238 | * @wma_handle: WMA handle |
| 7239 | * |
| 7240 | * Return: QDF_STATUS |
| 7241 | */ |
| 7242 | #ifdef WLAN_POWER_DEBUGFS |
| 7243 | static QDF_STATUS wma_process_power_debug_stats_req(tp_wma_handle wma_handle) |
| 7244 | { |
| 7245 | wmi_pdev_get_chip_power_stats_cmd_fixed_param *cmd; |
| 7246 | int32_t len; |
| 7247 | wmi_buf_t buf; |
| 7248 | uint8_t *buf_ptr; |
| 7249 | int ret; |
| 7250 | |
| 7251 | if (!wma_handle) { |
| 7252 | WMA_LOGE("%s: input pointer is NULL", __func__); |
| 7253 | return QDF_STATUS_E_FAILURE; |
| 7254 | } |
| 7255 | |
| 7256 | len = sizeof(*cmd); |
| 7257 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 7258 | if (!buf) { |
| 7259 | WMA_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7260 | return QDF_STATUS_E_NOMEM; |
| 7261 | } |
| 7262 | |
| 7263 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 7264 | cmd = (wmi_pdev_get_chip_power_stats_cmd_fixed_param *) buf_ptr; |
| 7265 | |
| 7266 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7267 | WMITLV_TAG_STRUC_wmi_get_chip_power_stats_cmd_fixed_param, |
| 7268 | WMITLV_GET_STRUCT_TLVLEN( |
| 7269 | wmi_pdev_get_chip_power_stats_cmd_fixed_param)); |
| 7270 | cmd->pdev_id = 0; |
| 7271 | |
| 7272 | WMA_LOGD("POWER_DEBUG_STATS - Get Request Params; Pdev id - %d", |
| 7273 | cmd->pdev_id); |
| 7274 | ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 7275 | WMI_PDEV_GET_CHIP_POWER_STATS_CMDID); |
| 7276 | if (ret) { |
| 7277 | WMA_LOGE("%s: Failed to send power debug stats request", |
| 7278 | __func__); |
| 7279 | wmi_buf_free(buf); |
| 7280 | return QDF_STATUS_E_FAILURE; |
| 7281 | } |
| 7282 | return QDF_STATUS_SUCCESS; |
| 7283 | } |
| 7284 | #else |
| 7285 | static QDF_STATUS wma_process_power_debug_stats_req(tp_wma_handle wma_handle) |
| 7286 | { |
| 7287 | return QDF_STATUS_SUCCESS; |
| 7288 | } |
| 7289 | #endif |
| 7290 | |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 7291 | /** |
| 7292 | * wma_set_arp_req_stats() - process set arp stats request command to fw |
| 7293 | * @wma_handle: WMA handle |
| 7294 | * @req_buf: set srp stats request buffer |
| 7295 | * |
| 7296 | * Return: None |
| 7297 | */ |
| 7298 | static void wma_set_arp_req_stats(WMA_HANDLE handle, |
| 7299 | struct set_arp_stats_params *req_buf) |
| 7300 | { |
| 7301 | int status; |
| 7302 | struct set_arp_stats *arp_stats; |
| 7303 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 7304 | |
| 7305 | if (!wma_handle || !wma_handle->wmi_handle) { |
| 7306 | WMA_LOGE("%s: WMA is closed, cannot send per roam config", |
| 7307 | __func__); |
| 7308 | return; |
| 7309 | } |
Yeshwanth Sriram Guntuka | d5aae7f | 2017-11-27 14:33:51 +0530 | [diff] [blame] | 7310 | if (!wma_is_vdev_valid(req_buf->vdev_id)) { |
| 7311 | WMA_LOGE("vdev id not active or not valid"); |
| 7312 | return; |
| 7313 | } |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 7314 | |
| 7315 | arp_stats = (struct set_arp_stats *)req_buf; |
| 7316 | status = wmi_unified_set_arp_stats_req(wma_handle->wmi_handle, |
| 7317 | arp_stats); |
| 7318 | if (status != EOK) |
| 7319 | WMA_LOGE("%s: failed to set arp stats to FW", |
| 7320 | __func__); |
| 7321 | } |
| 7322 | |
| 7323 | /** |
| 7324 | * wma_get_arp_req_stats() - process get arp stats request command to fw |
| 7325 | * @wma_handle: WMA handle |
| 7326 | * @req_buf: get srp stats request buffer |
| 7327 | * |
| 7328 | * Return: None |
| 7329 | */ |
| 7330 | static void wma_get_arp_req_stats(WMA_HANDLE handle, |
| 7331 | struct get_arp_stats_params *req_buf) |
| 7332 | { |
| 7333 | int status; |
| 7334 | struct get_arp_stats *arp_stats; |
| 7335 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 7336 | |
| 7337 | if (!wma_handle || !wma_handle->wmi_handle) { |
| 7338 | WMA_LOGE("%s: WMA is closed, cannot send per roam config", |
| 7339 | __func__); |
| 7340 | return; |
| 7341 | } |
Yeshwanth Sriram Guntuka | 3e4d96f | 2017-12-19 14:09:04 +0530 | [diff] [blame] | 7342 | if (!wma_is_vdev_valid(req_buf->vdev_id)) { |
| 7343 | WMA_LOGE("vdev id not active or not valid"); |
| 7344 | return; |
| 7345 | } |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 7346 | |
| 7347 | arp_stats = (struct get_arp_stats *)req_buf; |
| 7348 | status = wmi_unified_get_arp_stats_req(wma_handle->wmi_handle, |
| 7349 | arp_stats); |
| 7350 | if (status != EOK) |
| 7351 | WMA_LOGE("%s: failed to send get arp stats to FW", |
| 7352 | __func__); |
| 7353 | } |
| 7354 | |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 7355 | /** |
| 7356 | * wma_set_del_pmkid_cache() - API to set/delete PMKID cache entry in fw |
| 7357 | * @handle: WMA handle |
| 7358 | * @pmk_cache: PMK cache entry |
| 7359 | * |
| 7360 | * Return: None |
| 7361 | */ |
| 7362 | static void wma_set_del_pmkid_cache(WMA_HANDLE handle, |
| 7363 | struct wmi_unified_pmk_cache *pmk_cache) |
| 7364 | { |
| 7365 | int status; |
| 7366 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 7367 | |
| 7368 | if (!wma_handle || !wma_handle->wmi_handle) { |
| 7369 | WMA_LOGE("WMA is closed, cannot send set del pmkid"); |
| 7370 | return; |
| 7371 | } |
| 7372 | |
| 7373 | status = wmi_unified_set_del_pmkid_cache(wma_handle->wmi_handle, |
| 7374 | pmk_cache); |
| 7375 | if (status != EOK) |
| 7376 | WMA_LOGE("failed to send set/del pmkid cmd to fw"); |
| 7377 | } |
| 7378 | |
Vignesh Viswanathan | 694e28e | 2018-01-18 20:53:57 +0530 | [diff] [blame] | 7379 | /** |
Vignesh Viswanathan | 694e28e | 2018-01-18 20:53:57 +0530 | [diff] [blame] | 7380 | * wma_send_invoke_neighbor_report() - API to send invoke neighbor report |
| 7381 | * command to fw |
| 7382 | * |
| 7383 | * @handle: WMA handle |
| 7384 | * @params: Pointer to invoke neighbor report params |
| 7385 | * |
| 7386 | * Return: None |
| 7387 | */ |
| 7388 | static |
| 7389 | void wma_send_invoke_neighbor_report(WMA_HANDLE handle, |
| 7390 | struct wmi_invoke_neighbor_report_params *params) |
| 7391 | { |
| 7392 | QDF_STATUS status; |
| 7393 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 7394 | |
| 7395 | if (!wma_handle || !wma_handle->wmi_handle) { |
| 7396 | WMA_LOGE("WMA is closed, cannot send invoke neighbor report"); |
| 7397 | return; |
| 7398 | } |
| 7399 | |
| 7400 | status = wmi_unified_invoke_neighbor_report_cmd(wma_handle->wmi_handle, |
| 7401 | params); |
| 7402 | |
| 7403 | if (status != QDF_STATUS_SUCCESS) |
| 7404 | WMA_LOGE("failed to send invoke neighbor report command"); |
| 7405 | } |
| 7406 | |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 7407 | QDF_STATUS wma_set_rx_reorder_timeout_val(tp_wma_handle wma_handle, |
| 7408 | struct sir_set_rx_reorder_timeout_val *reorder_timeout) |
| 7409 | { |
| 7410 | wmi_pdev_set_reorder_timeout_val_cmd_fixed_param *cmd; |
| 7411 | uint32_t len; |
| 7412 | wmi_buf_t buf; |
| 7413 | int ret; |
| 7414 | |
| 7415 | if (!reorder_timeout) { |
| 7416 | WMA_LOGE(FL("invalid pointer")); |
| 7417 | return QDF_STATUS_E_INVAL; |
| 7418 | } |
| 7419 | |
| 7420 | if (!wma_handle) { |
| 7421 | WMA_LOGE(FL("WMA context is invald!")); |
| 7422 | return QDF_STATUS_E_INVAL; |
| 7423 | } |
| 7424 | len = sizeof(*cmd); |
| 7425 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 7426 | |
| 7427 | if (!buf) { |
| 7428 | WMA_LOGE(FL("Failed allocate wmi buffer")); |
| 7429 | return QDF_STATUS_E_NOMEM; |
| 7430 | } |
| 7431 | cmd = (wmi_pdev_set_reorder_timeout_val_cmd_fixed_param *) |
| 7432 | wmi_buf_data(buf); |
| 7433 | |
| 7434 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7435 | WMITLV_TAG_STRUC_wmi_pdev_set_reorder_timeout_val_cmd_fixed_param, |
| 7436 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_reorder_timeout_val_cmd_fixed_param)); |
| 7437 | |
| 7438 | memcpy(cmd->rx_timeout_pri, reorder_timeout->rx_timeout_pri, |
| 7439 | sizeof(reorder_timeout->rx_timeout_pri)); |
| 7440 | |
| 7441 | WMA_LOGD("rx aggr record timeout: VO: %d, VI: %d, BE: %d, BK: %d", |
| 7442 | cmd->rx_timeout_pri[0], cmd->rx_timeout_pri[1], |
| 7443 | cmd->rx_timeout_pri[2], cmd->rx_timeout_pri[3]); |
| 7444 | |
| 7445 | ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 7446 | WMI_PDEV_SET_REORDER_TIMEOUT_VAL_CMDID); |
| 7447 | if (ret) { |
| 7448 | WMA_LOGE(FL("Failed to send aggregation timeout")); |
| 7449 | wmi_buf_free(buf); |
| 7450 | return QDF_STATUS_E_FAILURE; |
| 7451 | } |
| 7452 | |
| 7453 | return QDF_STATUS_SUCCESS; |
| 7454 | } |
| 7455 | |
| 7456 | QDF_STATUS wma_set_rx_blocksize(tp_wma_handle wma_handle, |
| 7457 | struct sir_peer_set_rx_blocksize *peer_rx_blocksize) |
| 7458 | { |
| 7459 | wmi_peer_set_rx_blocksize_cmd_fixed_param *cmd; |
| 7460 | int32_t len; |
| 7461 | wmi_buf_t buf; |
| 7462 | u_int8_t *buf_ptr; |
| 7463 | int ret; |
| 7464 | |
| 7465 | if (!peer_rx_blocksize) { |
| 7466 | WMA_LOGE(FL("invalid pointer")); |
| 7467 | return QDF_STATUS_E_INVAL; |
| 7468 | } |
| 7469 | |
| 7470 | if (!wma_handle) { |
| 7471 | WMA_LOGE(FL(" WMA context is invald!")); |
| 7472 | return QDF_STATUS_E_INVAL; |
| 7473 | } |
| 7474 | |
| 7475 | len = sizeof(*cmd); |
| 7476 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 7477 | |
| 7478 | if (!buf) { |
| 7479 | WMA_LOGE(FL("Failed allocate wmi buffer")); |
| 7480 | return QDF_STATUS_E_NOMEM; |
| 7481 | } |
| 7482 | |
| 7483 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 7484 | cmd = (wmi_peer_set_rx_blocksize_cmd_fixed_param *) buf_ptr; |
| 7485 | |
| 7486 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7487 | WMITLV_TAG_STRUC_wmi_peer_set_rx_blocksize_cmd_fixed_param, |
| 7488 | WMITLV_GET_STRUCT_TLVLEN(wmi_peer_set_rx_blocksize_cmd_fixed_param)); |
| 7489 | |
| 7490 | cmd->vdev_id = peer_rx_blocksize->vdev_id; |
| 7491 | cmd->rx_block_ack_win_limit = |
| 7492 | peer_rx_blocksize->rx_block_ack_win_limit; |
| 7493 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_rx_blocksize->peer_macaddr.bytes, |
| 7494 | &cmd->peer_macaddr); |
| 7495 | |
| 7496 | WMA_LOGD("rx aggr blocksize: %d", cmd->rx_block_ack_win_limit); |
| 7497 | |
| 7498 | ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 7499 | WMI_PEER_SET_RX_BLOCKSIZE_CMDID); |
| 7500 | if (ret) { |
| 7501 | WMA_LOGE(FL("Failed to send aggregation size command")); |
| 7502 | wmi_buf_free(buf); |
| 7503 | return QDF_STATUS_E_FAILURE; |
| 7504 | } |
| 7505 | |
| 7506 | return QDF_STATUS_SUCCESS; |
| 7507 | } |
| 7508 | |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7509 | QDF_STATUS wma_get_chain_rssi(tp_wma_handle wma_handle, |
| 7510 | struct get_chain_rssi_req_params *req_params) |
| 7511 | { |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7512 | wmi_pdev_div_get_rssi_antid_fixed_param *cmd; |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7513 | wmi_buf_t wmi_buf; |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7514 | uint32_t len = sizeof(wmi_pdev_div_get_rssi_antid_fixed_param); |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7515 | u_int8_t *buf_ptr; |
| 7516 | |
| 7517 | if (!wma_handle) { |
| 7518 | WMA_LOGE(FL("WMA is closed, can not issue cmd")); |
| 7519 | return QDF_STATUS_E_INVAL; |
| 7520 | } |
| 7521 | |
| 7522 | wmi_buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 7523 | if (!wmi_buf) { |
| 7524 | WMA_LOGE(FL("wmi_buf_alloc failed")); |
| 7525 | return QDF_STATUS_E_NOMEM; |
| 7526 | } |
| 7527 | |
| 7528 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 7529 | |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7530 | cmd = (wmi_pdev_div_get_rssi_antid_fixed_param *)buf_ptr; |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7531 | WMITLV_SET_HDR(&cmd->tlv_header, |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7532 | WMITLV_TAG_STRUC_wmi_pdev_div_get_rssi_antid_fixed_param, |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7533 | WMITLV_GET_STRUCT_TLVLEN( |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7534 | wmi_pdev_div_get_rssi_antid_fixed_param)); |
| 7535 | cmd->pdev_id = 0; |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7536 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req_params->peer_macaddr.bytes, |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7537 | &cmd->macaddr); |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7538 | |
| 7539 | if (wmi_unified_cmd_send(wma_handle->wmi_handle, wmi_buf, len, |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7540 | WMI_PDEV_DIV_GET_RSSI_ANTID_CMDID)) { |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7541 | WMA_LOGE(FL("failed to send get chain rssi command")); |
| 7542 | wmi_buf_free(wmi_buf); |
| 7543 | return QDF_STATUS_E_FAILURE; |
| 7544 | } |
| 7545 | |
| 7546 | return QDF_STATUS_SUCCESS; |
| 7547 | } |
| 7548 | |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 7549 | #if defined(WLAN_FEATURE_FILS_SK) |
| 7550 | /** |
| 7551 | * wma_roam_scan_send_hlp() - API to send HLP IE info to fw |
| 7552 | * @wma_handle: WMA handle |
| 7553 | * @req: HLP params |
| 7554 | * |
| 7555 | * Return: QDF_STATUS |
| 7556 | */ |
| 7557 | static QDF_STATUS wma_roam_scan_send_hlp(tp_wma_handle wma_handle, |
| 7558 | struct hlp_params *req) |
| 7559 | { |
| 7560 | struct hlp_params *params; |
| 7561 | QDF_STATUS status; |
| 7562 | |
| 7563 | params = qdf_mem_malloc(sizeof(*params)); |
| 7564 | if (!params) { |
| 7565 | WMA_LOGE("%s : Memory allocation failed", __func__); |
| 7566 | return QDF_STATUS_E_NOMEM; |
| 7567 | } |
| 7568 | |
| 7569 | params->vdev_id = req->vdev_id; |
| 7570 | params->hlp_ie_len = req->hlp_ie_len; |
| 7571 | qdf_mem_copy(params->hlp_ie, req->hlp_ie, req->hlp_ie_len); |
| 7572 | status = wmi_unified_roam_send_hlp_cmd(wma_handle->wmi_handle, params); |
| 7573 | |
| 7574 | WMA_LOGD("Send HLP status %d vdev id %d", status, params->vdev_id); |
| 7575 | qdf_trace_hex_dump(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG, |
| 7576 | params->hlp_ie, 10); |
| 7577 | |
| 7578 | qdf_mem_free(params); |
| 7579 | return status; |
| 7580 | } |
| 7581 | #else |
| 7582 | static QDF_STATUS wma_roam_scan_send_hlp(tp_wma_handle wma_handle, |
| 7583 | struct hlp_params *req) |
| 7584 | { |
| 7585 | return QDF_STATUS_SUCCESS; |
| 7586 | } |
| 7587 | #endif |
| 7588 | |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 7589 | /** |
Ganesh Kondabattini | 3573957 | 2017-06-21 16:26:39 +0530 | [diff] [blame] | 7590 | * wma_process_set_limit_off_chan() - set limit off chanel parameters |
| 7591 | * @wma_handle: pointer to wma handle |
| 7592 | * @param: pointer to sir_limit_off_chan |
| 7593 | * |
| 7594 | * Return: QDF_STATUS_SUCCESS for success or error code. |
| 7595 | */ |
| 7596 | static QDF_STATUS wma_process_limit_off_chan(tp_wma_handle wma_handle, |
| 7597 | struct sir_limit_off_chan *param) |
| 7598 | { |
| 7599 | int32_t err; |
| 7600 | struct wmi_limit_off_chan_param limit_off_chan_param; |
| 7601 | |
Rajeev Kumar | 752d64e | 2017-10-05 16:32:58 -0700 | [diff] [blame] | 7602 | if (param->vdev_id >= wma_handle->max_bssid) { |
| 7603 | WMA_LOGE(FL("Invalid vdev_id: %d"), param->vdev_id); |
| 7604 | return QDF_STATUS_E_INVAL; |
| 7605 | } |
| 7606 | if (!wma_is_vdev_up(param->vdev_id)) { |
| 7607 | WMA_LOGE("vdev %d is not up skipping limit_off_chan_param", |
| 7608 | param->vdev_id); |
| 7609 | return QDF_STATUS_E_INVAL; |
| 7610 | } |
| 7611 | |
Ganesh Kondabattini | 3573957 | 2017-06-21 16:26:39 +0530 | [diff] [blame] | 7612 | limit_off_chan_param.vdev_id = param->vdev_id; |
| 7613 | limit_off_chan_param.status = param->is_tos_active; |
| 7614 | limit_off_chan_param.max_offchan_time = param->max_off_chan_time; |
| 7615 | limit_off_chan_param.rest_time = param->rest_time; |
| 7616 | limit_off_chan_param.skip_dfs_chans = param->skip_dfs_chans; |
| 7617 | |
| 7618 | err = wmi_unified_send_limit_off_chan_cmd(wma_handle->wmi_handle, |
| 7619 | &limit_off_chan_param); |
| 7620 | if (err) { |
| 7621 | WMA_LOGE("\n failed to set limit off chan cmd"); |
| 7622 | return QDF_STATUS_E_FAILURE; |
| 7623 | } |
| 7624 | |
| 7625 | return QDF_STATUS_SUCCESS; |
| 7626 | } |
| 7627 | |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 7628 | static QDF_STATUS wma_process_obss_color_collision_req(tp_wma_handle wma_handle, |
| 7629 | struct wmi_obss_color_collision_cfg_param *cfg) |
| 7630 | { |
| 7631 | QDF_STATUS status; |
| 7632 | |
| 7633 | if (cfg->vdev_id >= wma_handle->max_bssid) { |
| 7634 | WMA_LOGE(FL("Invalid vdev_id: %d"), cfg->vdev_id); |
| 7635 | return QDF_STATUS_E_INVAL; |
| 7636 | } |
| 7637 | if (!wma_is_vdev_up(cfg->vdev_id)) { |
| 7638 | WMA_LOGE("vdev %d is not up skipping obss color collision req", |
| 7639 | cfg->vdev_id); |
| 7640 | return QDF_STATUS_E_INVAL; |
| 7641 | } |
| 7642 | |
| 7643 | status = wmi_unified_send_obss_color_collision_cfg_cmd(wma_handle-> |
| 7644 | wmi_handle, cfg); |
| 7645 | if (QDF_IS_STATUS_ERROR(status)) |
| 7646 | WMA_LOGE("Failed to send obss color collision cfg"); |
| 7647 | |
| 7648 | return status; |
| 7649 | } |
| 7650 | |
Ganesh Kondabattini | 3573957 | 2017-06-21 16:26:39 +0530 | [diff] [blame] | 7651 | /** |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 7652 | * wma_send_obss_detection_cfg() - send obss detection cfg to firmware |
| 7653 | * @wma_handle: pointer to wma handle |
| 7654 | * @cfg: obss detection configuration |
| 7655 | * |
| 7656 | * Send obss detection configuration to firmware. |
| 7657 | * |
| 7658 | * Return: None |
| 7659 | */ |
| 7660 | static void wma_send_obss_detection_cfg(tp_wma_handle wma_handle, |
| 7661 | struct wmi_obss_detection_cfg_param |
| 7662 | *cfg) |
| 7663 | { |
| 7664 | QDF_STATUS status; |
| 7665 | |
| 7666 | if (cfg->vdev_id >= wma_handle->max_bssid) { |
| 7667 | WMA_LOGE(FL("Invalid vdev_id: %d"), cfg->vdev_id); |
| 7668 | return; |
| 7669 | } |
| 7670 | if (!wma_is_vdev_up(cfg->vdev_id)) { |
| 7671 | WMA_LOGE("vdev %d is not up skipping obss detection req", |
| 7672 | cfg->vdev_id); |
| 7673 | return; |
| 7674 | } |
| 7675 | |
| 7676 | status = wmi_unified_send_obss_detection_cfg_cmd(wma_handle->wmi_handle, |
| 7677 | cfg); |
| 7678 | if (QDF_IS_STATUS_ERROR(status)) |
| 7679 | WMA_LOGE("Failed to send obss detection cfg"); |
| 7680 | |
| 7681 | return; |
| 7682 | } |
| 7683 | |
| 7684 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7685 | * wma_mc_process_msg() - process wma messages and call appropriate function. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7686 | * @msg: message |
| 7687 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 7688 | * Return: QDF_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7689 | */ |
Jeff Johnson | 5be42ab | 2017-09-13 09:10:39 -0700 | [diff] [blame] | 7690 | static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7691 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7692 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7693 | tp_wma_handle wma_handle; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 7694 | struct cdp_vdev *txrx_vdev_handle = NULL; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 7695 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7696 | extern uint8_t *mac_trace_get_wma_msg_string(uint16_t wmaMsg); |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 7697 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7698 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7699 | if (NULL == msg) { |
| 7700 | WMA_LOGE("msg is NULL"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7701 | QDF_ASSERT(0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7702 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7703 | goto end; |
| 7704 | } |
| 7705 | |
| 7706 | WMA_LOGD("msg->type = %x %s", msg->type, |
| 7707 | mac_trace_get_wma_msg_string(msg->type)); |
| 7708 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7709 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7710 | |
| 7711 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 7712 | WMA_LOGE("%s: wma_handle is NULL", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7713 | QDF_ASSERT(0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7714 | qdf_mem_free(msg->bodyptr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7715 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7716 | goto end; |
| 7717 | } |
| 7718 | |
| 7719 | switch (msg->type) { |
| 7720 | |
| 7721 | /* Message posted by wmi for all control path related |
| 7722 | * FW events to serialize through mc_thread. |
| 7723 | */ |
| 7724 | case WMA_PROCESS_FW_EVENT: |
| 7725 | wma_process_fw_event(wma_handle, |
| 7726 | (wma_process_fw_event_params *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7727 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7728 | break; |
| 7729 | |
| 7730 | #ifdef FEATURE_WLAN_ESE |
| 7731 | case WMA_TSM_STATS_REQ: |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 7732 | WMA_LOGD("McThread: WMA_TSM_STATS_REQ"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7733 | wma_process_tsm_stats_req(wma_handle, (void *)msg->bodyptr); |
| 7734 | break; |
| 7735 | #endif /* FEATURE_WLAN_ESE */ |
| 7736 | case WNI_CFG_DNLD_REQ: |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 7737 | WMA_LOGD("McThread: WNI_CFG_DNLD_REQ"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7738 | qdf_status = wma_wni_cfg_dnld(wma_handle); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7739 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) |
Jeff Johnson | f7ab814 | 2017-09-13 09:04:23 -0700 | [diff] [blame] | 7740 | cds_wma_complete_cback(); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7741 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7742 | WMA_LOGD("config download failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7743 | break; |
| 7744 | case WMA_ADD_STA_SELF_REQ: |
| 7745 | txrx_vdev_handle = |
| 7746 | wma_vdev_attach(wma_handle, |
| 7747 | (struct add_sta_self_params *) msg-> |
| 7748 | bodyptr, 1); |
| 7749 | if (!txrx_vdev_handle) { |
| 7750 | WMA_LOGE("Failed to attach vdev"); |
| 7751 | } else { |
| 7752 | /* Register with TxRx Module for Data Ack Complete Cb */ |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 7753 | if (soc) { |
| 7754 | cdp_data_tx_cb_set(soc, txrx_vdev_handle, |
| 7755 | wma_data_tx_ack_comp_hdlr, |
| 7756 | wma_handle); |
| 7757 | } else { |
| 7758 | WMA_LOGE("%s: SOC context is NULL", __func__); |
| 7759 | qdf_status = QDF_STATUS_E_FAILURE; |
| 7760 | goto end; |
| 7761 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7762 | } |
| 7763 | break; |
| 7764 | case WMA_DEL_STA_SELF_REQ: |
| 7765 | wma_vdev_detach(wma_handle, |
| 7766 | (struct del_sta_self_params *) msg->bodyptr, 1); |
| 7767 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7768 | case WMA_UPDATE_CHAN_LIST_REQ: |
| 7769 | wma_update_channel_list(wma_handle, |
| 7770 | (tSirUpdateChanList *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7771 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7772 | break; |
| 7773 | case WMA_SET_LINK_STATE: |
| 7774 | wma_set_linkstate(wma_handle, (tpLinkStateParams) msg->bodyptr); |
| 7775 | break; |
| 7776 | case WMA_CHNL_SWITCH_REQ: |
| 7777 | wma_set_channel(wma_handle, |
| 7778 | (tpSwitchChannelParams) msg->bodyptr); |
| 7779 | break; |
| 7780 | case WMA_ADD_BSS_REQ: |
| 7781 | wma_add_bss(wma_handle, (tpAddBssParams) msg->bodyptr); |
| 7782 | break; |
| 7783 | case WMA_ADD_STA_REQ: |
| 7784 | wma_add_sta(wma_handle, (tpAddStaParams) msg->bodyptr); |
| 7785 | break; |
| 7786 | case WMA_SET_BSSKEY_REQ: |
| 7787 | wma_set_bsskey(wma_handle, (tpSetBssKeyParams) msg->bodyptr); |
| 7788 | break; |
| 7789 | case WMA_SET_STAKEY_REQ: |
| 7790 | wma_set_stakey(wma_handle, (tpSetStaKeyParams) msg->bodyptr); |
| 7791 | break; |
| 7792 | case WMA_DELETE_STA_REQ: |
| 7793 | wma_delete_sta(wma_handle, (tpDeleteStaParams) msg->bodyptr); |
| 7794 | break; |
Deepak Dhamdhere | 2dae1bd | 2016-10-27 10:58:29 -0700 | [diff] [blame] | 7795 | case WMA_DELETE_BSS_HO_FAIL_REQ: |
| 7796 | wma_delete_bss_ho_fail(wma_handle, |
| 7797 | (tpDeleteBssParams) msg->bodyptr); |
| 7798 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7799 | case WMA_DELETE_BSS_REQ: |
| 7800 | wma_delete_bss(wma_handle, (tpDeleteBssParams) msg->bodyptr); |
| 7801 | break; |
| 7802 | case WMA_UPDATE_EDCA_PROFILE_IND: |
| 7803 | wma_process_update_edca_param_req(wma_handle, |
| 7804 | (tEdcaParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7805 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7806 | break; |
| 7807 | case WMA_SEND_BEACON_REQ: |
| 7808 | wma_send_beacon(wma_handle, (tpSendbeaconParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7809 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7810 | break; |
| 7811 | case WMA_SEND_PROBE_RSP_TMPL: |
| 7812 | wma_send_probe_rsp_tmpl(wma_handle, |
| 7813 | (tpSendProbeRespParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7814 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7815 | break; |
| 7816 | case WMA_CLI_SET_CMD: |
| 7817 | wma_process_cli_set_cmd(wma_handle, |
| 7818 | (wma_cli_set_cmd_t *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7819 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7820 | break; |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 7821 | case WMA_SET_PDEV_IE_REQ: |
| 7822 | wma_process_set_pdev_ie_req(wma_handle, |
| 7823 | (struct set_ie_param *)msg->bodyptr); |
| 7824 | qdf_mem_free(msg->bodyptr); |
| 7825 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7826 | #if !defined(REMOVE_PKT_LOG) |
| 7827 | case WMA_PKTLOG_ENABLE_REQ: |
| 7828 | wma_pktlog_wmi_send_cmd(wma_handle, |
| 7829 | (struct ath_pktlog_wmi_params *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7830 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7831 | break; |
| 7832 | #endif /* REMOVE_PKT_LOG */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7833 | case WMA_ENTER_PS_REQ: |
| 7834 | wma_enable_sta_ps_mode(wma_handle, |
| 7835 | (tpEnablePsParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7836 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7837 | break; |
| 7838 | case WMA_EXIT_PS_REQ: |
| 7839 | wma_disable_sta_ps_mode(wma_handle, |
| 7840 | (tpDisablePsParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7841 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7842 | break; |
| 7843 | case WMA_ENABLE_UAPSD_REQ: |
| 7844 | wma_enable_uapsd_mode(wma_handle, |
| 7845 | (tpEnableUapsdParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7846 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7847 | break; |
| 7848 | case WMA_DISABLE_UAPSD_REQ: |
| 7849 | wma_disable_uapsd_mode(wma_handle, |
| 7850 | (tpDisableUapsdParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7851 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7852 | break; |
Kiran Kumar Lokere | 6d3a30d | 2018-01-15 18:18:29 -0800 | [diff] [blame] | 7853 | case WMA_SET_DTIM_PERIOD: |
| 7854 | wma_set_dtim_period(wma_handle, |
| 7855 | (struct set_dtim_params *)msg->bodyptr); |
| 7856 | qdf_mem_free(msg->bodyptr); |
| 7857 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7858 | case WMA_SET_TX_POWER_REQ: |
| 7859 | wma_set_tx_power(wma_handle, (tpMaxTxPowerParams) msg->bodyptr); |
| 7860 | break; |
| 7861 | case WMA_SET_MAX_TX_POWER_REQ: |
| 7862 | wma_set_max_tx_power(wma_handle, |
| 7863 | (tpMaxTxPowerParams) msg->bodyptr); |
| 7864 | break; |
| 7865 | case WMA_SET_KEEP_ALIVE: |
| 7866 | wma_set_keepalive_req(wma_handle, |
| 7867 | (tSirKeepAliveReq *) msg->bodyptr); |
| 7868 | break; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 7869 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7870 | case WMA_SET_PLM_REQ: |
| 7871 | wma_config_plm(wma_handle, (tpSirPlmReq) msg->bodyptr); |
| 7872 | break; |
| 7873 | #endif |
| 7874 | case WMA_GET_STATISTICS_REQ: |
| 7875 | wma_get_stats_req(wma_handle, |
| 7876 | (tAniGetPEStatsReq *) msg->bodyptr); |
| 7877 | break; |
| 7878 | |
| 7879 | case WMA_CONFIG_PARAM_UPDATE_REQ: |
Rajeev Kumar | 156188e | 2017-01-21 17:23:52 -0800 | [diff] [blame] | 7880 | wma_update_cfg_params(wma_handle, msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7881 | break; |
| 7882 | |
| 7883 | case WMA_UPDATE_OP_MODE: |
| 7884 | wma_process_update_opmode(wma_handle, |
| 7885 | (tUpdateVHTOpMode *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7886 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7887 | break; |
| 7888 | case WMA_UPDATE_RX_NSS: |
| 7889 | wma_process_update_rx_nss(wma_handle, |
| 7890 | (tUpdateRxNss *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7891 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7892 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7893 | case WMA_UPDATE_MEMBERSHIP: |
| 7894 | wma_process_update_membership(wma_handle, |
| 7895 | (tUpdateMembership *) msg->bodyptr); |
| 7896 | break; |
| 7897 | case WMA_UPDATE_USERPOS: |
| 7898 | wma_process_update_userpos(wma_handle, |
| 7899 | (tUpdateUserPos *) msg->bodyptr); |
| 7900 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7901 | case WMA_UPDATE_BEACON_IND: |
| 7902 | wma_process_update_beacon_params(wma_handle, |
| 7903 | (tUpdateBeaconParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7904 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7905 | break; |
| 7906 | |
| 7907 | case WMA_ADD_TS_REQ: |
| 7908 | wma_add_ts_req(wma_handle, (tAddTsParams *) msg->bodyptr); |
| 7909 | break; |
| 7910 | |
| 7911 | case WMA_DEL_TS_REQ: |
| 7912 | wma_del_ts_req(wma_handle, (tDelTsParams *) msg->bodyptr); |
| 7913 | break; |
| 7914 | |
| 7915 | case WMA_AGGR_QOS_REQ: |
| 7916 | wma_aggr_qos_req(wma_handle, (tAggrAddTsParams *) msg->bodyptr); |
| 7917 | break; |
| 7918 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7919 | case WMA_8023_MULTICAST_LIST_REQ: |
| 7920 | wma_process_mcbc_set_filter_req(wma_handle, |
| 7921 | (tpSirRcvFltMcAddrList) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7922 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7923 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7924 | case WMA_ROAM_SCAN_OFFLOAD_REQ: |
| 7925 | /* |
| 7926 | * Main entry point or roaming directives from CSR. |
| 7927 | */ |
Varun Reddy Yeturu | 30bc42c | 2016-02-04 10:07:30 -0800 | [diff] [blame] | 7928 | wma_process_roaming_config(wma_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7929 | (tSirRoamOffloadScanReq *) msg->bodyptr); |
| 7930 | break; |
| 7931 | |
| 7932 | case WMA_RATE_UPDATE_IND: |
| 7933 | wma_process_rate_update_indicate(wma_handle, |
| 7934 | (tSirRateUpdateInd *) msg->bodyptr); |
| 7935 | break; |
| 7936 | |
| 7937 | #ifdef FEATURE_WLAN_TDLS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7938 | case WMA_UPDATE_TDLS_PEER_STATE: |
| 7939 | wma_update_tdls_peer_state(wma_handle, |
| 7940 | (tTdlsPeerStateParams *) msg->bodyptr); |
| 7941 | break; |
| 7942 | case WMA_TDLS_SET_OFFCHAN_MODE: |
| 7943 | wma_set_tdls_offchan_mode(wma_handle, |
| 7944 | (tdls_chan_switch_params *)msg->bodyptr); |
| 7945 | break; |
| 7946 | #endif /* FEATURE_WLAN_TDLS */ |
| 7947 | case WMA_ADD_PERIODIC_TX_PTRN_IND: |
| 7948 | wma_process_add_periodic_tx_ptrn_ind(wma_handle, |
| 7949 | (tSirAddPeriodicTxPtrn *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7950 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7951 | break; |
| 7952 | case WMA_DEL_PERIODIC_TX_PTRN_IND: |
| 7953 | wma_process_del_periodic_tx_ptrn_ind(wma_handle, |
| 7954 | (tSirDelPeriodicTxPtrn *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7955 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7956 | break; |
| 7957 | case WMA_TX_POWER_LIMIT: |
| 7958 | wma_process_tx_power_limits(wma_handle, |
| 7959 | (tSirTxPowerLimit *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7960 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7961 | break; |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 7962 | case WMA_SEND_ADDBA_REQ: |
| 7963 | wma_process_send_addba_req(wma_handle, |
| 7964 | (struct send_add_ba_req *)msg->bodyptr); |
| 7965 | break; |
| 7966 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7967 | #ifdef FEATURE_WLAN_CH_AVOID |
| 7968 | case WMA_CH_AVOID_UPDATE_REQ: |
| 7969 | wma_process_ch_avoid_update_req(wma_handle, |
| 7970 | (tSirChAvoidUpdateReq *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7971 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7972 | break; |
| 7973 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 7974 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 7975 | case WMA_SET_AUTO_SHUTDOWN_TIMER_REQ: |
| 7976 | wma_set_auto_shutdown_timer_req(wma_handle, msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7977 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7978 | break; |
| 7979 | #endif /* FEATURE_WLAN_AUTO_SHUTDOWN */ |
| 7980 | case WMA_DHCP_START_IND: |
| 7981 | case WMA_DHCP_STOP_IND: |
| 7982 | wma_process_dhcp_ind(wma_handle, (tAniDHCPInd *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7983 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7984 | break; |
| 7985 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 7986 | case WMA_IBSS_CESIUM_ENABLE_IND: |
| 7987 | wma_process_cesium_enable_ind(wma_handle); |
| 7988 | break; |
| 7989 | case WMA_GET_IBSS_PEER_INFO_REQ: |
| 7990 | wma_process_get_peer_info_req(wma_handle, |
| 7991 | (tSirIbssGetPeerInfoReqParams *) |
| 7992 | msg->bodyptr); |
| 7993 | qdf_mem_free(msg->bodyptr); |
| 7994 | break; |
| 7995 | case WMA_TX_FAIL_MONITOR_IND: |
| 7996 | wma_process_tx_fail_monitor_ind(wma_handle, |
| 7997 | (tAniTXFailMonitorInd *) msg->bodyptr); |
| 7998 | qdf_mem_free(msg->bodyptr); |
| 7999 | break; |
| 8000 | |
| 8001 | case WMA_RMC_ENABLE_IND: |
| 8002 | wma_process_rmc_enable_ind(wma_handle); |
| 8003 | break; |
| 8004 | case WMA_RMC_DISABLE_IND: |
| 8005 | wma_process_rmc_disable_ind(wma_handle); |
| 8006 | break; |
| 8007 | case WMA_RMC_ACTION_PERIOD_IND: |
| 8008 | wma_process_rmc_action_period_ind(wma_handle); |
| 8009 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8010 | case WMA_INIT_THERMAL_INFO_CMD: |
| 8011 | wma_process_init_thermal_info(wma_handle, |
| 8012 | (t_thermal_mgmt *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8013 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8014 | break; |
| 8015 | |
| 8016 | case WMA_SET_THERMAL_LEVEL: |
| 8017 | wma_process_set_thermal_level(wma_handle, msg->bodyval); |
| 8018 | break; |
Poddar, Siddarth | 5a91f5b | 2016-04-28 12:24:10 +0530 | [diff] [blame] | 8019 | #ifdef CONFIG_HL_SUPPORT |
| 8020 | case WMA_INIT_BAD_PEER_TX_CTL_INFO_CMD: |
| 8021 | wma_process_init_bad_peer_tx_ctl_info( |
| 8022 | wma_handle, |
| 8023 | (struct t_bad_peer_txtcl_config *)msg->bodyptr); |
| 8024 | qdf_mem_free(msg->bodyptr); |
| 8025 | break; |
| 8026 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8027 | case WMA_SET_MIMOPS_REQ: |
| 8028 | wma_process_set_mimops_req(wma_handle, |
| 8029 | (tSetMIMOPS *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8030 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8031 | break; |
| 8032 | case WMA_SET_SAP_INTRABSS_DIS: |
| 8033 | wma_set_vdev_intrabss_fwd(wma_handle, |
| 8034 | (tDisableIntraBssFwd *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8035 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8036 | break; |
Will Huang | a981459 | 2017-05-24 15:47:58 +0800 | [diff] [blame] | 8037 | case WMA_GET_PEER_INFO: |
| 8038 | wma_get_peer_info(wma_handle, msg->bodyptr); |
| 8039 | qdf_mem_free(msg->bodyptr); |
| 8040 | break; |
| 8041 | case WMA_GET_PEER_INFO_EXT: |
| 8042 | wma_get_peer_info_ext(wma_handle, msg->bodyptr); |
| 8043 | qdf_mem_free(msg->bodyptr); |
| 8044 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8045 | case WMA_MODEM_POWER_STATE_IND: |
| 8046 | wma_notify_modem_power_state(wma_handle, |
| 8047 | (tSirModemPowerStateInd *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8048 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8049 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8050 | #ifdef WLAN_FEATURE_STATS_EXT |
| 8051 | case WMA_STATS_EXT_REQUEST: |
| 8052 | wma_stats_ext_req(wma_handle, |
| 8053 | (tpStatsExtRequest) (msg->bodyptr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8054 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8055 | break; |
| 8056 | #endif /* WLAN_FEATURE_STATS_EXT */ |
| 8057 | case WMA_HIDDEN_SSID_VDEV_RESTART: |
| 8058 | wma_hidden_ssid_vdev_restart(wma_handle, |
| 8059 | (tHalHiddenSsidVdevRestart *) msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8060 | break; |
| 8061 | #ifdef WLAN_FEATURE_EXTWOW_SUPPORT |
| 8062 | case WMA_WLAN_EXT_WOW: |
| 8063 | wma_enable_ext_wow(wma_handle, |
| 8064 | (tSirExtWoWParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8065 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8066 | break; |
| 8067 | case WMA_WLAN_SET_APP_TYPE1_PARAMS: |
| 8068 | wma_set_app_type1_params_in_fw(wma_handle, |
| 8069 | (tSirAppType1Params *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8070 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8071 | break; |
| 8072 | case WMA_WLAN_SET_APP_TYPE2_PARAMS: |
| 8073 | wma_set_app_type2_params_in_fw(wma_handle, |
| 8074 | (tSirAppType2Params *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8075 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8076 | break; |
| 8077 | #endif /* WLAN_FEATURE_EXTWOW_SUPPORT */ |
| 8078 | #ifdef FEATURE_WLAN_EXTSCAN |
| 8079 | case WMA_EXTSCAN_START_REQ: |
| 8080 | wma_start_extscan(wma_handle, |
| 8081 | (tSirWifiScanCmdReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8082 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8083 | break; |
| 8084 | case WMA_EXTSCAN_STOP_REQ: |
| 8085 | wma_stop_extscan(wma_handle, |
| 8086 | (tSirExtScanStopReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8087 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8088 | break; |
| 8089 | case WMA_EXTSCAN_SET_BSSID_HOTLIST_REQ: |
| 8090 | wma_extscan_start_hotlist_monitor(wma_handle, |
| 8091 | (tSirExtScanSetBssidHotListReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8092 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8093 | break; |
| 8094 | case WMA_EXTSCAN_RESET_BSSID_HOTLIST_REQ: |
| 8095 | wma_extscan_stop_hotlist_monitor(wma_handle, |
| 8096 | (tSirExtScanResetBssidHotlistReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8097 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8098 | break; |
| 8099 | case WMA_EXTSCAN_SET_SIGNF_CHANGE_REQ: |
| 8100 | wma_extscan_start_change_monitor(wma_handle, |
| 8101 | (tSirExtScanSetSigChangeReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8102 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8103 | break; |
| 8104 | case WMA_EXTSCAN_RESET_SIGNF_CHANGE_REQ: |
| 8105 | wma_extscan_stop_change_monitor(wma_handle, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 8106 | (tSirExtScanResetSignificantChangeReqParams *) |
| 8107 | msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8108 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8109 | break; |
| 8110 | case WMA_EXTSCAN_GET_CACHED_RESULTS_REQ: |
| 8111 | wma_extscan_get_cached_results(wma_handle, |
| 8112 | (tSirExtScanGetCachedResultsReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8113 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8114 | break; |
| 8115 | case WMA_EXTSCAN_GET_CAPABILITIES_REQ: |
| 8116 | wma_extscan_get_capabilities(wma_handle, |
| 8117 | (tSirGetExtScanCapabilitiesReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8118 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8119 | break; |
| 8120 | case WMA_SET_EPNO_LIST_REQ: |
| 8121 | wma_set_epno_network_list(wma_handle, |
| 8122 | (struct wifi_epno_params *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8123 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8124 | break; |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 8125 | case WMA_SET_PER_ROAM_CONFIG_CMD: |
| 8126 | wma_update_per_roam_config(wma_handle, |
| 8127 | (struct wmi_per_roam_config_req *)msg->bodyptr); |
| 8128 | qdf_mem_free(msg->bodyptr); |
| 8129 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8130 | case WMA_SET_PASSPOINT_LIST_REQ: |
| 8131 | /* Issue reset passpoint network list first and clear |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 8132 | * the entries |
| 8133 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8134 | wma_reset_passpoint_network_list(wma_handle, |
| 8135 | (struct wifi_passpoint_req *)msg->bodyptr); |
| 8136 | |
| 8137 | wma_set_passpoint_network_list(wma_handle, |
| 8138 | (struct wifi_passpoint_req *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8139 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8140 | break; |
| 8141 | case WMA_RESET_PASSPOINT_LIST_REQ: |
| 8142 | wma_reset_passpoint_network_list(wma_handle, |
| 8143 | (struct wifi_passpoint_req *)msg->bodyptr); |
| 8144 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8145 | #endif /* FEATURE_WLAN_EXTSCAN */ |
| 8146 | case WMA_SET_SCAN_MAC_OUI_REQ: |
| 8147 | wma_scan_probe_setoui(wma_handle, msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8148 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8149 | break; |
| 8150 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 8151 | case WMA_LINK_LAYER_STATS_CLEAR_REQ: |
| 8152 | wma_process_ll_stats_clear_req(wma_handle, |
| 8153 | (tpSirLLStatsClearReq) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8154 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8155 | break; |
| 8156 | case WMA_LINK_LAYER_STATS_SET_REQ: |
| 8157 | wma_process_ll_stats_set_req(wma_handle, |
| 8158 | (tpSirLLStatsSetReq) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8159 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8160 | break; |
| 8161 | case WMA_LINK_LAYER_STATS_GET_REQ: |
| 8162 | wma_process_ll_stats_get_req(wma_handle, |
| 8163 | (tpSirLLStatsGetReq) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8164 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8165 | break; |
Zhang Qian | 73c348a | 2017-03-13 16:15:55 +0800 | [diff] [blame] | 8166 | case WDA_LINK_LAYER_STATS_SET_THRESHOLD: |
| 8167 | wma_config_stats_ext_threshold(wma_handle, |
| 8168 | (struct sir_ll_ext_stats_threshold *)msg->bodyptr); |
| 8169 | qdf_mem_free(msg->bodyptr); |
| 8170 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8171 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8172 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8173 | case WMA_ROAM_OFFLOAD_SYNCH_FAIL: |
| 8174 | wma_process_roam_synch_fail(wma_handle, |
| 8175 | (struct roam_offload_synch_fail *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8176 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8177 | break; |
| 8178 | case SIR_HAL_ROAM_INVOKE: |
| 8179 | wma_process_roam_invoke(wma_handle, |
| 8180 | (struct wma_roam_invoke_cmd *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8181 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8182 | break; |
| 8183 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 8184 | #ifdef WLAN_FEATURE_NAN |
| 8185 | case WMA_NAN_REQUEST: |
| 8186 | wma_nan_req(wma_handle, (tNanRequest *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8187 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8188 | break; |
| 8189 | #endif /* WLAN_FEATURE_NAN */ |
| 8190 | case SIR_HAL_SET_BASE_MACADDR_IND: |
| 8191 | wma_set_base_macaddr_indicate(wma_handle, |
| 8192 | (tSirMacAddr *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8193 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8194 | break; |
| 8195 | case WMA_LINK_STATUS_GET_REQ: |
| 8196 | wma_process_link_status_req(wma_handle, |
| 8197 | (tAniGetLinkStatus *) msg->bodyptr); |
| 8198 | break; |
| 8199 | case WMA_GET_TEMPERATURE_REQ: |
| 8200 | wma_get_temperature(wma_handle); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8201 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8202 | break; |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 8203 | case WMA_TSF_GPIO_PIN: |
| 8204 | wma_set_tsf_gpio_pin(wma_handle, msg->bodyval); |
| 8205 | break; |
| 8206 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8207 | #ifdef DHCP_SERVER_OFFLOAD |
| 8208 | case WMA_SET_DHCP_SERVER_OFFLOAD_CMD: |
| 8209 | wma_process_dhcpserver_offload(wma_handle, |
| 8210 | (tSirDhcpSrvOffloadInfo *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8211 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8212 | break; |
| 8213 | #endif /* DHCP_SERVER_OFFLOAD */ |
| 8214 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 8215 | case WMA_LED_FLASHING_REQ: |
Jeff Johnson | 5a6b660 | 2017-10-04 14:44:30 -0700 | [diff] [blame] | 8216 | wma_set_led_flashing(wma_handle, msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8217 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8218 | break; |
| 8219 | #endif /* WLAN_FEATURE_GPIO_LED_FLASHING */ |
| 8220 | case SIR_HAL_SET_MAS: |
| 8221 | wma_process_set_mas(wma_handle, |
| 8222 | (uint32_t *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8223 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8224 | break; |
| 8225 | case SIR_HAL_SET_MIRACAST: |
| 8226 | wma_process_set_miracast(wma_handle, |
| 8227 | (uint32_t *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8228 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8229 | break; |
| 8230 | case SIR_HAL_CONFIG_STATS_FACTOR: |
| 8231 | wma_config_stats_factor(wma_handle, |
| 8232 | (struct sir_stats_avg_factor *) |
| 8233 | msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8234 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8235 | break; |
| 8236 | case SIR_HAL_CONFIG_GUARD_TIME: |
| 8237 | wma_config_guard_time(wma_handle, |
| 8238 | (struct sir_guard_time_request *) |
| 8239 | msg->bodyptr); |
Vignesh Viswanathan | 9fa8fef | 2017-12-12 14:45:38 +0530 | [diff] [blame] | 8240 | qdf_mem_free(msg->bodyptr); |
| 8241 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8242 | case SIR_HAL_START_STOP_LOGGING: |
| 8243 | wma_set_wifi_start_packet_stats(wma_handle, |
| 8244 | (struct sir_wifi_start_log *)msg->bodyptr); |
| 8245 | wma_enable_specific_fw_logs(wma_handle, |
| 8246 | (struct sir_wifi_start_log *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8247 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8248 | break; |
| 8249 | case SIR_HAL_FLUSH_LOG_TO_FW: |
| 8250 | wma_send_flush_logs_to_fw(wma_handle); |
| 8251 | /* Body ptr is NULL here */ |
| 8252 | break; |
| 8253 | case WMA_SET_RSSI_MONITOR_REQ: |
| 8254 | wma_set_rssi_monitoring(wma_handle, |
| 8255 | (struct rssi_monitor_req *)msg->bodyptr); |
Prakash Dhavali | 87ddca3 | 2016-11-29 17:02:11 -0800 | [diff] [blame] | 8256 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8257 | break; |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8258 | case SIR_HAL_PDEV_SET_PCL_TO_FW: |
| 8259 | wma_send_pdev_set_pcl_cmd(wma_handle, |
| 8260 | (struct wmi_pcl_chan_weights *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8261 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8262 | break; |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 8263 | case SIR_HAL_PDEV_SET_HW_MODE: |
| 8264 | wma_send_pdev_set_hw_mode_cmd(wma_handle, |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 8265 | (struct policy_mgr_hw_mode *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8266 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8267 | break; |
| 8268 | case WMA_OCB_SET_CONFIG_CMD: |
| 8269 | wma_ocb_set_config_req(wma_handle, |
| 8270 | (struct sir_ocb_config *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8271 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8272 | break; |
| 8273 | case WMA_OCB_SET_UTC_TIME_CMD: |
| 8274 | wma_ocb_set_utc_time(wma_handle, |
| 8275 | (struct sir_ocb_utc *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8276 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8277 | break; |
| 8278 | case WMA_OCB_START_TIMING_ADVERT_CMD: |
| 8279 | wma_ocb_start_timing_advert(wma_handle, |
| 8280 | (struct sir_ocb_timing_advert *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8281 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8282 | break; |
| 8283 | case WMA_OCB_STOP_TIMING_ADVERT_CMD: |
| 8284 | wma_ocb_stop_timing_advert(wma_handle, |
| 8285 | (struct sir_ocb_timing_advert *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8286 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8287 | break; |
| 8288 | case WMA_DCC_CLEAR_STATS_CMD: |
| 8289 | wma_dcc_clear_stats(wma_handle, |
| 8290 | (struct sir_dcc_clear_stats *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8291 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8292 | break; |
| 8293 | case WMA_OCB_GET_TSF_TIMER_CMD: |
| 8294 | wma_ocb_get_tsf_timer(wma_handle, |
| 8295 | (struct sir_ocb_get_tsf_timer *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8296 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8297 | break; |
Manikandan Mohan | 80dea79 | 2016-04-28 16:36:48 -0700 | [diff] [blame] | 8298 | case WMA_SET_WISA_PARAMS: |
| 8299 | wma_set_wisa_params(wma_handle, |
| 8300 | (struct sir_wisa_params *)msg->bodyptr); |
| 8301 | qdf_mem_free(msg->bodyptr); |
| 8302 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8303 | case WMA_DCC_GET_STATS_CMD: |
| 8304 | wma_dcc_get_stats(wma_handle, |
| 8305 | (struct sir_dcc_get_stats *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8306 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8307 | break; |
| 8308 | case WMA_DCC_UPDATE_NDL_CMD: |
| 8309 | wma_dcc_update_ndl(wma_handle, |
| 8310 | (struct sir_dcc_update_ndl *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8311 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8312 | break; |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 8313 | case SIR_HAL_PDEV_DUAL_MAC_CFG_REQ: |
| 8314 | wma_send_pdev_set_dual_mac_config(wma_handle, |
Srinivas Girigowda | eb6ecf3 | 2018-02-15 17:04:22 -0800 | [diff] [blame] | 8315 | (struct policy_mgr_dual_mac_config *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8316 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8317 | break; |
| 8318 | case WMA_SET_IE_INFO: |
| 8319 | wma_process_set_ie_info(wma_handle, |
| 8320 | (struct vdev_ie_info *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8321 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8322 | break; |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 8323 | case SIR_HAL_SOC_ANTENNA_MODE_REQ: |
| 8324 | wma_send_pdev_set_antenna_mode(wma_handle, |
| 8325 | (struct sir_antenna_mode_param *)msg->bodyptr); |
| 8326 | qdf_mem_free(msg->bodyptr); |
| 8327 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8328 | case WMA_LRO_CONFIG_CMD: |
| 8329 | wma_lro_config_cmd(wma_handle, |
Dhanashri Atre | 09828f1 | 2016-11-13 10:36:58 -0800 | [diff] [blame] | 8330 | (struct cdp_lro_hash_config *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8331 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8332 | break; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 8333 | case WMA_GW_PARAM_UPDATE_REQ: |
| 8334 | wma_set_gateway_params(wma_handle, |
| 8335 | (struct gateway_param_update_req *)msg->bodyptr); |
Archana Ramachandran | 28ab412 | 2016-03-08 16:17:14 -0800 | [diff] [blame] | 8336 | qdf_mem_free(msg->bodyptr); |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 8337 | break; |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 8338 | case WMA_SET_ADAPT_DWELLTIME_CONF_PARAMS: |
| 8339 | wma_send_adapt_dwelltime_params(wma_handle, |
| 8340 | (struct adaptive_dwelltime_params *)msg->bodyptr); |
| 8341 | qdf_mem_free(msg->bodyptr); |
| 8342 | break; |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 8343 | case WMA_HT40_OBSS_SCAN_IND: |
| 8344 | wma_send_ht40_obss_scanind(wma_handle, |
| 8345 | (struct obss_ht40_scanind *)msg->bodyptr); |
| 8346 | qdf_mem_free(msg->bodyptr); |
| 8347 | break; |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 8348 | case WMA_ADD_BCN_FILTER_CMDID: |
| 8349 | wma_add_beacon_filter(wma_handle, msg->bodyptr); |
| 8350 | qdf_mem_free(msg->bodyptr); |
| 8351 | break; |
| 8352 | case WMA_REMOVE_BCN_FILTER_CMDID: |
| 8353 | wma_remove_beacon_filter(wma_handle, msg->bodyptr); |
| 8354 | qdf_mem_free(msg->bodyptr); |
| 8355 | break; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 8356 | case WDA_BPF_GET_CAPABILITIES_REQ: |
| 8357 | wma_get_bpf_capabilities(wma_handle); |
| 8358 | break; |
| 8359 | case WDA_BPF_SET_INSTRUCTIONS_REQ: |
| 8360 | wma_set_bpf_instructions(wma_handle, msg->bodyptr); |
| 8361 | qdf_mem_free(msg->bodyptr); |
| 8362 | break; |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 8363 | case SIR_HAL_POWER_DBG_CMD: |
| 8364 | wma_process_hal_pwr_dbg_cmd(wma_handle, |
| 8365 | msg->bodyptr); |
| 8366 | qdf_mem_free(msg->bodyptr); |
| 8367 | break; |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 8368 | case WMA_UPDATE_WEP_DEFAULT_KEY: |
| 8369 | wma_update_wep_default_key(wma_handle, |
| 8370 | (struct wep_update_default_key_idx *)msg->bodyptr); |
| 8371 | qdf_mem_free(msg->bodyptr); |
| 8372 | break; |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 8373 | case WMA_SEND_FREQ_RANGE_CONTROL_IND: |
| 8374 | wma_enable_disable_caevent_ind(wma_handle, msg->bodyval); |
| 8375 | break; |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 8376 | case SIR_HAL_UPDATE_TX_FAIL_CNT_TH: |
| 8377 | wma_update_tx_fail_cnt_th(wma_handle, msg->bodyptr); |
| 8378 | qdf_mem_free(msg->bodyptr); |
| 8379 | break; |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 8380 | case SIR_HAL_LONG_RETRY_LIMIT_CNT: |
| 8381 | wma_update_long_retry_limit(wma_handle, msg->bodyptr); |
| 8382 | qdf_mem_free(msg->bodyptr); |
| 8383 | break; |
| 8384 | case SIR_HAL_SHORT_RETRY_LIMIT_CNT: |
| 8385 | wma_update_short_retry_limit(wma_handle, msg->bodyptr); |
| 8386 | qdf_mem_free(msg->bodyptr); |
| 8387 | break; |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 8388 | case SIR_HAL_POWER_DEBUG_STATS_REQ: |
| 8389 | wma_process_power_debug_stats_req(wma_handle); |
| 8390 | break; |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 8391 | case WMA_GET_RCPI_REQ: |
| 8392 | wma_get_rcpi_req(wma_handle, |
| 8393 | (struct sme_rcpi_req *)msg->bodyptr); |
| 8394 | qdf_mem_free(msg->bodyptr); |
| 8395 | break; |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 8396 | case WMA_SET_WOW_PULSE_CMD: |
| 8397 | wma_send_wow_pulse_cmd(wma_handle, |
| 8398 | (struct wow_pulse_mode *)msg->bodyptr); |
| 8399 | qdf_mem_free(msg->bodyptr); |
| 8400 | break; |
Nitesh Shah | f9a09ff | 2017-05-22 15:46:25 +0530 | [diff] [blame] | 8401 | case WMA_SET_DBS_SCAN_SEL_CONF_PARAMS: |
| 8402 | wma_send_dbs_scan_selection_params(wma_handle, |
| 8403 | (struct wmi_dbs_scan_sel_params *)msg->bodyptr); |
| 8404 | qdf_mem_free(msg->bodyptr); |
| 8405 | break; |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 8406 | case WMA_SET_ARP_STATS_REQ: |
| 8407 | wma_set_arp_req_stats(wma_handle, |
| 8408 | (struct set_arp_stats_params *)msg->bodyptr); |
| 8409 | qdf_mem_free(msg->bodyptr); |
| 8410 | break; |
| 8411 | case WMA_GET_ARP_STATS_REQ: |
| 8412 | wma_get_arp_req_stats(wma_handle, |
| 8413 | (struct get_arp_stats_params *)msg->bodyptr); |
| 8414 | qdf_mem_free(msg->bodyptr); |
| 8415 | break; |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 8416 | case SIR_HAL_SET_DEL_PMKID_CACHE: |
| 8417 | wma_set_del_pmkid_cache(wma_handle, |
| 8418 | (struct wmi_unified_pmk_cache *) msg->bodyptr); |
| 8419 | qdf_mem_free(msg->bodyptr); |
| 8420 | break; |
| 8421 | case SIR_HAL_HLP_IE_INFO: |
| 8422 | wma_roam_scan_send_hlp(wma_handle, |
| 8423 | (struct hlp_params *)msg->bodyptr); |
| 8424 | qdf_mem_free(msg->bodyptr); |
| 8425 | break; |
Ganesh Kondabattini | 3573957 | 2017-06-21 16:26:39 +0530 | [diff] [blame] | 8426 | case WMA_SET_LIMIT_OFF_CHAN: |
| 8427 | wma_process_limit_off_chan(wma_handle, msg->bodyptr); |
| 8428 | qdf_mem_free(msg->bodyptr); |
| 8429 | break; |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 8430 | case WMA_OBSS_DETECTION_REQ: |
| 8431 | wma_send_obss_detection_cfg(wma_handle, msg->bodyptr); |
| 8432 | qdf_mem_free(msg->bodyptr); |
| 8433 | break; |
Vignesh Viswanathan | 694e28e | 2018-01-18 20:53:57 +0530 | [diff] [blame] | 8434 | case WMA_INVOKE_NEIGHBOR_REPORT: |
| 8435 | wma_send_invoke_neighbor_report(wma_handle, msg->bodyptr); |
| 8436 | qdf_mem_free(msg->bodyptr); |
| 8437 | break; |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 8438 | case WMA_OBSS_COLOR_COLLISION_REQ: |
| 8439 | wma_process_obss_color_collision_req(wma_handle, msg->bodyptr); |
| 8440 | qdf_mem_free(msg->bodyptr); |
| 8441 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8442 | default: |
Dustin Brown | 86534fb | 2017-01-24 14:28:20 -0800 | [diff] [blame] | 8443 | WMA_LOGE("Unhandled WMA message of type %d", msg->type); |
| 8444 | if (msg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8445 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8446 | } |
| 8447 | end: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8448 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8449 | } |
| 8450 | |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 8451 | QDF_STATUS wma_mc_process_handler(struct scheduler_msg *msg) |
| 8452 | { |
Jeff Johnson | 5be42ab | 2017-09-13 09:10:39 -0700 | [diff] [blame] | 8453 | return wma_mc_process_msg(msg); |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 8454 | } |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 8455 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8456 | /** |
| 8457 | * wma_log_completion_timeout() - Log completion timeout |
| 8458 | * @data: Timeout handler data |
| 8459 | * |
| 8460 | * This function is called when log completion timer expires |
| 8461 | * |
| 8462 | * Return: None |
| 8463 | */ |
| 8464 | void wma_log_completion_timeout(void *data) |
| 8465 | { |
| 8466 | tp_wma_handle wma_handle; |
| 8467 | |
Jeff Johnson | 11d7c9d | 2018-05-06 15:44:09 -0700 | [diff] [blame] | 8468 | WMA_LOGE("%s: Timeout occurred for log completion command", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8469 | |
| 8470 | wma_handle = (tp_wma_handle) data; |
| 8471 | if (!wma_handle) |
| 8472 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 8473 | |
| 8474 | /* Though we did not receive any event from FW, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 8475 | * we can flush whatever logs we have with us |
| 8476 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8477 | cds_logging_set_fw_flush_complete(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8478 | } |
| 8479 | |
| 8480 | /** |
Manishekar Chandrasekaran | b82554d | 2016-08-04 17:46:46 +0530 | [diff] [blame] | 8481 | * wma_map_pcl_weights() - Map PCL weights |
| 8482 | * @pcl_weight: Internal PCL weights |
| 8483 | * |
| 8484 | * Maps the internal weights of PCL to the weights needed by FW |
| 8485 | * |
| 8486 | * Return: Mapped channel weight of type wmi_pcl_chan_weight |
| 8487 | */ |
| 8488 | static wmi_pcl_chan_weight wma_map_pcl_weights(uint32_t pcl_weight) |
| 8489 | { |
| 8490 | switch (pcl_weight) { |
| 8491 | case WEIGHT_OF_GROUP1_PCL_CHANNELS: |
| 8492 | return WMI_PCL_WEIGHT_VERY_HIGH; |
| 8493 | case WEIGHT_OF_GROUP2_PCL_CHANNELS: |
| 8494 | return WMI_PCL_WEIGHT_HIGH; |
| 8495 | case WEIGHT_OF_GROUP3_PCL_CHANNELS: |
| 8496 | return WMI_PCL_WEIGHT_MEDIUM; |
| 8497 | case WEIGHT_OF_NON_PCL_CHANNELS: |
| 8498 | return WMI_PCL_WEIGHT_LOW; |
| 8499 | default: |
| 8500 | return WMI_PCL_WEIGHT_DISALLOW; |
| 8501 | } |
| 8502 | } |
| 8503 | |
| 8504 | /** |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8505 | * wma_send_pdev_set_pcl_cmd() - Send WMI_SOC_SET_PCL_CMDID to FW |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8506 | * @wma_handle: WMA handle |
| 8507 | * @msg: PCL structure containing the PCL and the number of channels |
| 8508 | * |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8509 | * WMI_PDEV_SET_PCL_CMDID provides a Preferred Channel List (PCL) to the WLAN |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8510 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 8511 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 8512 | * to migrate to a new channel without host driver involvement. An example of |
| 8513 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 8514 | * manage the channel selection without firmware involvement. |
| 8515 | * |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8516 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 8517 | * channel list. The weights corresponds to the channels sent in |
| 8518 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 8519 | * weightage compared to the non PCL channels. |
| 8520 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8521 | * Return: Success if the cmd is sent successfully to the firmware |
| 8522 | */ |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8523 | QDF_STATUS wma_send_pdev_set_pcl_cmd(tp_wma_handle wma_handle, |
| 8524 | struct wmi_pcl_chan_weights *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8525 | { |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8526 | uint32_t i; |
| 8527 | QDF_STATUS status; |
| 8528 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8529 | if (!wma_handle) { |
| 8530 | WMA_LOGE("%s: WMA handle is NULL. Cannot issue command", |
| 8531 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8532 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8533 | } |
| 8534 | |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8535 | for (i = 0; i < wma_handle->saved_chan.num_channels; i++) { |
| 8536 | msg->saved_chan_list[i] = |
| 8537 | wma_handle->saved_chan.channel_list[i]; |
| 8538 | } |
| 8539 | |
| 8540 | msg->saved_num_chan = wma_handle->saved_chan.num_channels; |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 8541 | status = policy_mgr_get_valid_chan_weights(wma_handle->psoc, |
| 8542 | (struct policy_mgr_pcl_chan_weights *)msg); |
Manishekar Chandrasekaran | b82554d | 2016-08-04 17:46:46 +0530 | [diff] [blame] | 8543 | |
| 8544 | for (i = 0; i < msg->saved_num_chan; i++) { |
| 8545 | msg->weighed_valid_list[i] = |
| 8546 | wma_map_pcl_weights(msg->weighed_valid_list[i]); |
Sandeep Puligilla | 819d94f | 2017-10-10 18:33:56 -0700 | [diff] [blame] | 8547 | /* Dont allow roaming on 2G when 5G_ONLY configured */ |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 8548 | if ((wma_handle->bandcapability == BAND_5G) && |
Sandeep Puligilla | 819d94f | 2017-10-10 18:33:56 -0700 | [diff] [blame] | 8549 | (msg->saved_chan_list[i] <= MAX_24GHZ_CHANNEL)) { |
| 8550 | msg->weighed_valid_list[i] = |
| 8551 | WEIGHT_OF_DISALLOWED_CHANNELS; |
| 8552 | } |
Manishekar Chandrasekaran | b82554d | 2016-08-04 17:46:46 +0530 | [diff] [blame] | 8553 | WMA_LOGD("%s: chan:%d weight[%d]=%d", __func__, |
| 8554 | msg->saved_chan_list[i], i, |
| 8555 | msg->weighed_valid_list[i]); |
| 8556 | } |
| 8557 | |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8558 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 8559 | WMA_LOGE("%s: Error in creating weighed pcl", __func__); |
| 8560 | return status; |
| 8561 | } |
| 8562 | |
| 8563 | if (wmi_unified_pdev_set_pcl_cmd(wma_handle->wmi_handle, msg)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8564 | return QDF_STATUS_E_FAILURE; |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 8565 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8566 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8567 | } |
| 8568 | |
| 8569 | /** |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 8570 | * wma_send_pdev_set_hw_mode_cmd() - Send WMI_PDEV_SET_HW_MODE_CMDID to FW |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8571 | * @wma_handle: WMA handle |
| 8572 | * @msg: Structure containing the following parameters |
| 8573 | * |
| 8574 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 8575 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 8576 | * |
| 8577 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 8578 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 8579 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 8580 | * |
| 8581 | * Return: Success if the cmd is sent successfully to the firmware |
| 8582 | */ |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 8583 | QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle, |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 8584 | struct policy_mgr_hw_mode *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8585 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8586 | struct sir_set_hw_mode_resp *param; |
Tushnim Bhattacharyya | 8629489 | 2017-10-25 16:29:11 -0700 | [diff] [blame] | 8587 | struct wma_target_req *timeout_msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8588 | |
| 8589 | if (!wma_handle) { |
| 8590 | WMA_LOGE("%s: WMA handle is NULL. Cannot issue command", |
| 8591 | __func__); |
| 8592 | /* Handle is NULL. Will not be able to send failure |
| 8593 | * response as well |
| 8594 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8595 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8596 | } |
| 8597 | |
| 8598 | if (!msg) { |
| 8599 | WMA_LOGE("%s: Set HW mode param is NULL", __func__); |
| 8600 | /* Lets try to free the active command list */ |
| 8601 | goto fail; |
| 8602 | } |
| 8603 | |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 8604 | wma_acquire_wakelock(&wma_handle->wmi_cmd_rsp_wake_lock, |
| 8605 | WMA_VDEV_HW_MODE_REQUEST_TIMEOUT); |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 8606 | if (wmi_unified_soc_set_hw_mode_cmd(wma_handle->wmi_handle, |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 8607 | msg->hw_mode_index)) { |
| 8608 | wma_release_wakelock(&wma_handle->wmi_cmd_rsp_wake_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8609 | goto fail; |
Krunal Soni | cebcc29 | 2017-06-14 19:59:20 -0700 | [diff] [blame] | 8610 | } |
Tushnim Bhattacharyya | 8629489 | 2017-10-25 16:29:11 -0700 | [diff] [blame] | 8611 | timeout_msg = wma_fill_hold_req(wma_handle, 0, |
| 8612 | SIR_HAL_PDEV_SET_HW_MODE, |
| 8613 | WMA_PDEV_SET_HW_MODE_RESP, NULL, |
| 8614 | WMA_VDEV_HW_MODE_REQUEST_TIMEOUT - 1); |
| 8615 | if (!timeout_msg) { |
| 8616 | WMA_LOGE("Failed to allocate request for SIR_HAL_PDEV_SET_HW_MODE"); |
| 8617 | wma_remove_req(wma_handle, 0, WMA_PDEV_SET_HW_MODE_RESP); |
| 8618 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8619 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8620 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8621 | fail: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8622 | param = qdf_mem_malloc(sizeof(*param)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8623 | if (!param) { |
| 8624 | WMA_LOGE("%s: Memory allocation failed", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8625 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8626 | } |
| 8627 | param->status = SET_HW_MODE_STATUS_ECANCELED; |
| 8628 | param->cfgd_hw_mode_index = 0; |
| 8629 | param->num_vdev_mac_entries = 0; |
| 8630 | WMA_LOGE("%s: Sending HW mode fail response to LIM", __func__); |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 8631 | wma_send_msg(wma_handle, SIR_HAL_PDEV_SET_HW_MODE_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8632 | (void *) param, 0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8633 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8634 | } |
| 8635 | |
| 8636 | /** |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 8637 | * wma_send_pdev_set_dual_mac_config() - Set dual mac config to FW |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8638 | * @wma_handle: WMA handle |
| 8639 | * @msg: Dual MAC config parameters |
| 8640 | * |
| 8641 | * Configures WLAN firmware with the dual MAC features |
| 8642 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8643 | * Return: QDF_STATUS. 0 on success. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8644 | */ |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 8645 | QDF_STATUS wma_send_pdev_set_dual_mac_config(tp_wma_handle wma_handle, |
Srinivas Girigowda | eb6ecf3 | 2018-02-15 17:04:22 -0800 | [diff] [blame] | 8646 | struct policy_mgr_dual_mac_config *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8647 | { |
Manishekar Chandrasekaran | 91152df | 2016-04-25 14:29:27 +0530 | [diff] [blame] | 8648 | QDF_STATUS status; |
| 8649 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8650 | if (!wma_handle) { |
| 8651 | WMA_LOGE("%s: WMA handle is NULL. Cannot issue command", |
| 8652 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8653 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8654 | } |
| 8655 | |
| 8656 | if (!msg) { |
| 8657 | WMA_LOGE("%s: Set dual mode config is NULL", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8658 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8659 | } |
| 8660 | |
Krunal Soni | a5ccb80 | 2017-07-03 12:59:40 -0700 | [diff] [blame] | 8661 | /* |
| 8662 | * aquire the wake lock here and release it in response handler function |
| 8663 | * In error condition, release the wake lock right away |
| 8664 | */ |
| 8665 | wma_acquire_wakelock(&wma_handle->wmi_cmd_rsp_wake_lock, |
| 8666 | WMA_VDEV_PLCY_MGR_CMD_TIMEOUT); |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 8667 | status = wmi_unified_pdev_set_dual_mac_config_cmd( |
| 8668 | wma_handle->wmi_handle, |
Srinivas Girigowda | eb6ecf3 | 2018-02-15 17:04:22 -0800 | [diff] [blame] | 8669 | (struct policy_mgr_dual_mac_config *)msg); |
Manishekar Chandrasekaran | 91152df | 2016-04-25 14:29:27 +0530 | [diff] [blame] | 8670 | if (QDF_IS_STATUS_ERROR(status)) { |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 8671 | WMA_LOGE("%s: Failed to send WMI_PDEV_SET_DUAL_MAC_CONFIG_CMDID: %d", |
Manishekar Chandrasekaran | 91152df | 2016-04-25 14:29:27 +0530 | [diff] [blame] | 8672 | __func__, status); |
Krunal Soni | a5ccb80 | 2017-07-03 12:59:40 -0700 | [diff] [blame] | 8673 | wma_release_wakelock(&wma_handle->wmi_cmd_rsp_wake_lock); |
Manishekar Chandrasekaran | 91152df | 2016-04-25 14:29:27 +0530 | [diff] [blame] | 8674 | return status; |
| 8675 | } |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 8676 | policy_mgr_update_dbs_req_config(wma_handle->psoc, |
| 8677 | msg->scan_config, msg->fw_mode_config); |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 8678 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8679 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8680 | } |
| 8681 | |
| 8682 | /** |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 8683 | * wma_send_pdev_set_antenna_mode() - Set antenna mode to FW |
| 8684 | * @wma_handle: WMA handle |
| 8685 | * @msg: Antenna mode parameters |
| 8686 | * |
| 8687 | * Send WMI_PDEV_SET_ANTENNA_MODE_CMDID to FW requesting to |
| 8688 | * modify the number of TX/RX chains from host |
| 8689 | * |
| 8690 | * Return: QDF_STATUS. 0 on success. |
| 8691 | */ |
| 8692 | QDF_STATUS wma_send_pdev_set_antenna_mode(tp_wma_handle wma_handle, |
| 8693 | struct sir_antenna_mode_param *msg) |
| 8694 | { |
| 8695 | wmi_pdev_set_antenna_mode_cmd_fixed_param *cmd; |
| 8696 | wmi_buf_t buf; |
| 8697 | uint32_t len; |
| 8698 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 8699 | struct sir_antenna_mode_resp *param; |
| 8700 | |
| 8701 | if (!wma_handle) { |
| 8702 | WMA_LOGE("%s: WMA handle is NULL. Cannot issue command", |
| 8703 | __func__); |
| 8704 | return QDF_STATUS_E_NULL_VALUE; |
| 8705 | } |
| 8706 | |
| 8707 | if (!msg) { |
| 8708 | WMA_LOGE("%s: Set antenna mode param is NULL", __func__); |
| 8709 | return QDF_STATUS_E_NULL_VALUE; |
| 8710 | } |
| 8711 | |
| 8712 | len = sizeof(*cmd); |
| 8713 | |
| 8714 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 8715 | if (!buf) { |
| 8716 | WMA_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8717 | status = QDF_STATUS_E_NOMEM; |
| 8718 | goto resp; |
| 8719 | } |
| 8720 | |
| 8721 | cmd = (wmi_pdev_set_antenna_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 8722 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8723 | WMITLV_TAG_STRUC_wmi_pdev_set_antenna_mode_cmd_fixed_param, |
| 8724 | WMITLV_GET_STRUCT_TLVLEN( |
| 8725 | wmi_pdev_set_antenna_mode_cmd_fixed_param)); |
| 8726 | |
| 8727 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 8728 | /* Bits 0-15 is num of RX chains 16-31 is num of TX chains */ |
| 8729 | cmd->num_txrx_chains = msg->num_rx_chains; |
| 8730 | cmd->num_txrx_chains |= (msg->num_tx_chains << 16); |
| 8731 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 8732 | WMA_LOGD("%s: Num of chains TX: %d RX: %d txrx_chains: 0x%x", |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 8733 | __func__, msg->num_tx_chains, |
| 8734 | msg->num_rx_chains, cmd->num_txrx_chains); |
| 8735 | |
| 8736 | if (wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 8737 | WMI_PDEV_SET_ANTENNA_MODE_CMDID)) { |
| 8738 | WMA_LOGE("%s: Failed to send WMI_PDEV_SET_ANTENNA_MODE_CMDID", |
| 8739 | __func__); |
| 8740 | wmi_buf_free(buf); |
| 8741 | status = QDF_STATUS_E_FAILURE; |
| 8742 | goto resp; |
| 8743 | } |
| 8744 | status = QDF_STATUS_SUCCESS; |
| 8745 | |
| 8746 | resp: |
| 8747 | param = qdf_mem_malloc(sizeof(*param)); |
| 8748 | if (!param) { |
| 8749 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 8750 | return QDF_STATUS_E_NOMEM; |
| 8751 | } |
| 8752 | param->status = (status) ? |
| 8753 | SET_ANTENNA_MODE_STATUS_ECANCELED : |
| 8754 | SET_ANTENNA_MODE_STATUS_OK; |
| 8755 | WMA_LOGE("%s: Send antenna mode resp to LIM status: %d", |
| 8756 | __func__, param->status); |
| 8757 | wma_send_msg(wma_handle, SIR_HAL_SOC_ANTENNA_MODE_RESP, |
| 8758 | (void *) param, 0); |
| 8759 | return status; |
| 8760 | } |
| 8761 | |
| 8762 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8763 | * wma_crash_inject() - sends command to FW to simulate crash |
| 8764 | * @wma_handle: pointer of WMA context |
| 8765 | * @type: subtype of the command |
| 8766 | * @delay_time_ms: time in milliseconds for FW to delay the crash |
| 8767 | * |
| 8768 | * This function will send a command to FW in order to simulate different |
| 8769 | * kinds of FW crashes. |
| 8770 | * |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 8771 | * Return: QDF_STATUS_SUCCESS for success or error code |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8772 | */ |
Yu Wang | 46082dc | 2017-09-19 12:25:38 +0800 | [diff] [blame] | 8773 | QDF_STATUS wma_crash_inject(WMA_HANDLE wma_handle, uint32_t type, |
| 8774 | uint32_t delay_time_ms) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8775 | { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 8776 | struct crash_inject param; |
Yu Wang | 46082dc | 2017-09-19 12:25:38 +0800 | [diff] [blame] | 8777 | tp_wma_handle wma = (tp_wma_handle)wma_handle; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 8778 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 8779 | param.type = type; |
| 8780 | param.delay_time_ms = delay_time_ms; |
Yu Wang | 46082dc | 2017-09-19 12:25:38 +0800 | [diff] [blame] | 8781 | return wmi_crash_inject(wma->wmi_handle, ¶m); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8782 | } |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 8783 | |
Manjunathappa Prakash | 7b0ad46 | 2018-04-15 00:37:16 -0700 | [diff] [blame] | 8784 | #ifdef RECEIVE_OFFLOAD |
Dhanashri Atre | 09828f1 | 2016-11-13 10:36:58 -0800 | [diff] [blame] | 8785 | int wma_lro_init(struct cdp_lro_hash_config *lro_config) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8786 | { |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 8787 | struct scheduler_msg msg = {0}; |
Dhanashri Atre | 09828f1 | 2016-11-13 10:36:58 -0800 | [diff] [blame] | 8788 | struct cdp_lro_hash_config *iwcmd; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8789 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8790 | iwcmd = qdf_mem_malloc(sizeof(*iwcmd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8791 | if (!iwcmd) { |
| 8792 | WMA_LOGE("memory allocation for WMA_LRO_CONFIG_CMD failed!"); |
| 8793 | return -ENOMEM; |
| 8794 | } |
| 8795 | |
| 8796 | *iwcmd = *lro_config; |
| 8797 | |
| 8798 | msg.type = WMA_LRO_CONFIG_CMD; |
| 8799 | msg.reserved = 0; |
| 8800 | msg.bodyptr = iwcmd; |
| 8801 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8802 | if (QDF_STATUS_SUCCESS != |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 8803 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8804 | WMA_LOGE("Failed to post WMA_LRO_CONFIG_CMD msg!"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8805 | qdf_mem_free(iwcmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8806 | return -EAGAIN; |
| 8807 | } |
| 8808 | |
| 8809 | WMA_LOGD("sending the LRO configuration to the fw"); |
| 8810 | return 0; |
| 8811 | } |
| 8812 | #endif |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8813 | |
| 8814 | void wma_peer_set_default_routing(void *scn_handle, uint8_t *peer_macaddr, |
| 8815 | uint8_t vdev_id, bool hash_based, uint8_t ring_num) |
| 8816 | { |
| 8817 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 8818 | struct peer_set_params param; |
| 8819 | |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 8820 | if (!wma) { |
| 8821 | WMA_LOGE("%s:wma_handle is NULL", __func__); |
| 8822 | return; |
| 8823 | } |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8824 | |
| 8825 | /* TODO: Need bit definitions for ring number and hash based routing |
| 8826 | * fields in common wmi header file |
| 8827 | */ |
| 8828 | param.param_id = WMI_HOST_PEER_SET_DEFAULT_ROUTING; |
| 8829 | param.vdev_id = vdev_id; |
| 8830 | param.param_value = ((hash_based) ? 1 : 0) | (ring_num << 1); |
Jeff Johnson | f7ca964 | 2017-10-10 16:11:49 -0700 | [diff] [blame] | 8831 | WMA_LOGD("%s: param_value 0x%x", __func__, param.param_value); |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8832 | wmi_set_peer_param_send(wma->wmi_handle, peer_macaddr, ¶m); |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8833 | } |
| 8834 | |
| 8835 | int wma_peer_rx_reorder_queue_setup(void *scn_handle, |
| 8836 | uint8_t vdev_id, uint8_t *peer_macaddr, qdf_dma_addr_t hw_qdesc, |
| 8837 | int tid, uint16_t queue_no) |
| 8838 | { |
| 8839 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 8840 | struct rx_reorder_queue_setup_params param; |
| 8841 | |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 8842 | if (!wma) { |
| 8843 | WMA_LOGE("%s:wma_handle is NULL", __func__); |
| 8844 | return QDF_STATUS_E_FAILURE; |
| 8845 | } |
| 8846 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8847 | param.tid = tid; |
| 8848 | param.vdev_id = vdev_id; |
| 8849 | param.peer_macaddr = peer_macaddr; |
| 8850 | param.hw_qdesc_paddr_lo = hw_qdesc & 0xffffffff; |
| 8851 | param.hw_qdesc_paddr_hi = (uint64_t)hw_qdesc >> 32; |
| 8852 | param.queue_no = queue_no; |
| 8853 | |
| 8854 | return wmi_unified_peer_rx_reorder_queue_setup_send(wma->wmi_handle, |
| 8855 | ¶m); |
| 8856 | } |
| 8857 | |
| 8858 | int wma_peer_rx_reorder_queue_remove(void *scn_handle, |
| 8859 | uint8_t vdev_id, uint8_t *peer_macaddr, uint32_t peer_tid_bitmap) |
| 8860 | { |
| 8861 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 8862 | struct rx_reorder_queue_remove_params param; |
| 8863 | |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 8864 | if (!wma) { |
| 8865 | WMA_LOGE("%s:wma_handle is NULL", __func__); |
| 8866 | return QDF_STATUS_E_FAILURE; |
| 8867 | } |
| 8868 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8869 | param.vdev_id = vdev_id; |
| 8870 | param.peer_macaddr = peer_macaddr; |
| 8871 | param.peer_tid_bitmap = peer_tid_bitmap; |
| 8872 | |
| 8873 | return wmi_unified_peer_rx_reorder_queue_remove_send(wma->wmi_handle, |
| 8874 | ¶m); |
| 8875 | } |
| 8876 | |
Ashish Kumar Dhanotiya | b28338c | 2017-07-21 20:12:34 +0530 | [diff] [blame] | 8877 | QDF_STATUS wma_configure_smps_params(uint32_t vdev_id, uint32_t param_id, |
| 8878 | uint32_t param_val) |
| 8879 | { |
| 8880 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 8881 | int smps_cmd_value; |
| 8882 | int status = QDF_STATUS_E_INVAL; |
| 8883 | |
| 8884 | if (!wma) { |
| 8885 | WMA_LOGE("%s: Failed to get wma", __func__); |
| 8886 | return status; |
| 8887 | } |
| 8888 | |
| 8889 | smps_cmd_value = param_id << WMI_SMPS_PARAM_VALUE_S; |
| 8890 | smps_cmd_value = smps_cmd_value | param_val; |
| 8891 | |
| 8892 | status = wma_set_smps_params(wma, vdev_id, smps_cmd_value); |
| 8893 | if (status) |
| 8894 | WMA_LOGE("Failed to set SMPS Param"); |
| 8895 | |
| 8896 | return status; |
| 8897 | } |
| 8898 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8899 | |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 8900 | void wma_ipa_uc_stat_request(wma_cli_set_cmd_t *privcmd) |
| 8901 | { |
| 8902 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 8903 | |
Sreelakshmi Konamki | 7a57408 | 2017-05-15 16:53:45 +0530 | [diff] [blame] | 8904 | if (!wma) { |
| 8905 | WMA_LOGE("%s: Failed to get wma", __func__); |
| 8906 | return; |
| 8907 | } |
| 8908 | |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 8909 | if (wma_set_priv_cfg(wma, privcmd)) |
| 8910 | WMA_LOGE("Failed to set wma priv congiuration"); |
| 8911 | } |
Nachiket Kukade | aaf8a71 | 2017-07-27 19:15:36 +0530 | [diff] [blame] | 8912 | |
| 8913 | /** |
| 8914 | * wma_config_bmiss_bcnt_params() - set bmiss config parameters |
| 8915 | * @vdev_id: virtual device for the command |
| 8916 | * @first_cnt: bmiss first value |
| 8917 | * @final_cnt: bmiss final value |
| 8918 | * |
| 8919 | * Return: QDF_STATUS_SUCCESS or non-zero on failure |
| 8920 | */ |
| 8921 | QDF_STATUS wma_config_bmiss_bcnt_params(uint32_t vdev_id, uint32_t first_cnt, |
| 8922 | uint32_t final_cnt) |
| 8923 | { |
| 8924 | tp_wma_handle wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 8925 | int status = QDF_STATUS_E_INVAL; |
| 8926 | |
| 8927 | if (!wma_handle) { |
| 8928 | WMA_LOGE("%s: Failed to get wma", __func__); |
| 8929 | return status; |
| 8930 | } |
| 8931 | |
| 8932 | status = wma_roam_scan_bmiss_cnt(wma_handle, first_cnt, final_cnt, |
| 8933 | vdev_id); |
| 8934 | |
| 8935 | if (status) |
| 8936 | WMA_LOGE("Failed to set Bmiss Param"); |
| 8937 | |
| 8938 | return status; |
| 8939 | } |
| 8940 | |