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 | aa6d55d | 2018-04-26 16:33:21 +0800 | [diff] [blame] | 2059 | #ifdef WLAN_FEATURE_HDD_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); |
| 2095 | ucfg_mc_cp_stats_get_vdev_wake_lock_stats(vdev, &stats); |
| 2096 | len += qdf_scnprintf(buf + len, *size - len, |
| 2097 | "\n" |
| 2098 | "vdev_id %d\n" |
| 2099 | "WoW Stats\n" |
| 2100 | "\tpno_match %u\n" |
| 2101 | "\tpno_complete %u\n" |
| 2102 | "\tgscan %u\n" |
| 2103 | "\tlow_rssi %u\n" |
| 2104 | "\trssi_breach %u\n" |
| 2105 | "\tucast %u\n" |
| 2106 | "\tbcast %u\n" |
| 2107 | "\ticmpv4 %u\n" |
| 2108 | "\ticmpv6 %u\n" |
| 2109 | "\tipv4_mcast %u\n" |
| 2110 | "\tipv6_mcast %u\n" |
| 2111 | "\tipv6_mcast_ra %u\n" |
| 2112 | "\tipv6_mcast_ns %u\n" |
| 2113 | "\tipv6_mcast_na %u\n" |
| 2114 | "\toem_response %u\n" |
| 2115 | "conn_state %d\n" |
| 2116 | "dtimPeriod %d\n" |
| 2117 | "chanmode %d\n" |
| 2118 | "vht_capable %d\n" |
| 2119 | "ht_capable %d\n" |
| 2120 | "chan_width %d\n" |
| 2121 | "vdev_active %d\n" |
| 2122 | "vdev_up %d\n" |
| 2123 | "aid %d\n" |
| 2124 | "rate_flags %d\n" |
| 2125 | "nss %d\n" |
| 2126 | "tx_power %d\n" |
| 2127 | "max_tx_power %d\n" |
| 2128 | "nwType %d\n" |
| 2129 | "tx_streams %d\n" |
| 2130 | "rx_streams %d\n" |
| 2131 | "chain_mask %d\n" |
| 2132 | "nss_2g %d\n" |
| 2133 | "nss_5g %d", |
| 2134 | vdev_id, |
| 2135 | stats.pno_match_wake_up_count, |
| 2136 | stats.pno_complete_wake_up_count, |
| 2137 | stats.gscan_wake_up_count, |
| 2138 | stats.low_rssi_wake_up_count, |
| 2139 | stats.rssi_breach_wake_up_count, |
| 2140 | stats.ucast_wake_up_count, |
| 2141 | stats.bcast_wake_up_count, |
| 2142 | stats.icmpv4_count, |
| 2143 | stats.icmpv6_count, |
| 2144 | stats.ipv4_mcast_wake_up_count, |
| 2145 | stats.ipv6_mcast_wake_up_count, |
| 2146 | stats.ipv6_mcast_ra_stats, |
| 2147 | stats.ipv6_mcast_ns_stats, |
| 2148 | stats.ipv6_mcast_na_stats, |
| 2149 | stats.oem_response_wake_up_count, |
| 2150 | iface->conn_state, |
| 2151 | iface->dtimPeriod, |
| 2152 | iface->chanmode, |
| 2153 | iface->vht_capable, |
| 2154 | iface->ht_capable, |
| 2155 | iface->chan_width, |
| 2156 | iface->vdev_active, |
| 2157 | wma_is_vdev_up(vdev_id), |
| 2158 | iface->aid, |
| 2159 | iface->rate_flags, |
| 2160 | iface->nss, |
| 2161 | iface->tx_power, |
| 2162 | iface->max_tx_power, |
| 2163 | iface->nwType, |
| 2164 | iface->tx_streams, |
| 2165 | iface->rx_streams, |
| 2166 | iface->chain_mask, |
| 2167 | iface->nss_2g, |
| 2168 | iface->nss_5g); |
| 2169 | } |
| 2170 | |
| 2171 | *size -= len; |
| 2172 | *buf_ptr += len; |
| 2173 | } |
| 2174 | #else /* QCA_SUPPORT_CP_STATS */ |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2175 | static void wma_state_info_dump(char **buf_ptr, uint16_t *size) |
| 2176 | { |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 2177 | t_wma_handle *wma; |
| 2178 | struct sir_vdev_wow_stats *stats; |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2179 | uint16_t len = 0; |
| 2180 | char *buf = *buf_ptr; |
| 2181 | struct wma_txrx_node *iface; |
| 2182 | uint8_t vdev_id; |
| 2183 | |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 2184 | wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 2185 | if (!wma) { |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2186 | WMA_LOGE("%s: WMA context is invald!", __func__); |
| 2187 | return; |
| 2188 | } |
| 2189 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2190 | WMA_LOGE("%s: size of buffer: %d", __func__, *size); |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2191 | |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 2192 | for (vdev_id = 0; vdev_id < wma->max_bssid; vdev_id++) { |
| 2193 | iface = &wma->interfaces[vdev_id]; |
| 2194 | if (!iface->handle) |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2195 | continue; |
| 2196 | |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 2197 | stats = &iface->wow_stats; |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2198 | len += qdf_scnprintf(buf + len, *size - len, |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 2199 | "\n" |
| 2200 | "vdev_id %d\n" |
| 2201 | "WoW Stats\n" |
| 2202 | "\tpno_match %u\n" |
| 2203 | "\tpno_complete %u\n" |
| 2204 | "\tgscan %u\n" |
| 2205 | "\tlow_rssi %u\n" |
| 2206 | "\trssi_breach %u\n" |
| 2207 | "\tucast %u\n" |
| 2208 | "\tbcast %u\n" |
| 2209 | "\ticmpv4 %u\n" |
| 2210 | "\ticmpv6 %u\n" |
| 2211 | "\tipv4_mcast %u\n" |
| 2212 | "\tipv6_mcast %u\n" |
| 2213 | "\tipv6_mcast_ra %u\n" |
| 2214 | "\tipv6_mcast_ns %u\n" |
| 2215 | "\tipv6_mcast_na %u\n" |
| 2216 | "\toem_response %u\n" |
| 2217 | "conn_state %d\n" |
| 2218 | "dtimPeriod %d\n" |
| 2219 | "chanmode %d\n" |
| 2220 | "vht_capable %d\n" |
| 2221 | "ht_capable %d\n" |
| 2222 | "chan_width %d\n" |
| 2223 | "vdev_active %d\n" |
| 2224 | "vdev_up %d\n" |
| 2225 | "aid %d\n" |
| 2226 | "rate_flags %d\n" |
| 2227 | "nss %d\n" |
| 2228 | "tx_power %d\n" |
| 2229 | "max_tx_power %d\n" |
| 2230 | "nwType %d\n" |
| 2231 | "tx_streams %d\n" |
| 2232 | "rx_streams %d\n" |
| 2233 | "chain_mask %d\n" |
| 2234 | "nss_2g %d\n" |
| 2235 | "nss_5g %d", |
| 2236 | vdev_id, |
| 2237 | stats->pno_match, |
| 2238 | stats->pno_complete, |
| 2239 | stats->gscan, |
| 2240 | stats->low_rssi, |
| 2241 | stats->rssi_breach, |
| 2242 | stats->ucast, |
| 2243 | stats->bcast, |
| 2244 | stats->icmpv4, |
| 2245 | stats->icmpv6, |
| 2246 | stats->ipv4_mcast, |
| 2247 | stats->ipv6_mcast, |
| 2248 | stats->ipv6_mcast_ra, |
| 2249 | stats->ipv6_mcast_ns, |
| 2250 | stats->ipv6_mcast_na, |
| 2251 | stats->oem_response, |
| 2252 | iface->conn_state, |
| 2253 | iface->dtimPeriod, |
| 2254 | iface->chanmode, |
| 2255 | iface->vht_capable, |
| 2256 | iface->ht_capable, |
| 2257 | iface->chan_width, |
| 2258 | iface->vdev_active, |
Mukul Sharma | f904723 | 2017-03-02 16:58:56 +0530 | [diff] [blame] | 2259 | wma_is_vdev_up(vdev_id), |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 2260 | iface->aid, |
| 2261 | iface->rate_flags, |
| 2262 | iface->nss, |
| 2263 | iface->tx_power, |
| 2264 | iface->max_tx_power, |
| 2265 | iface->nwType, |
| 2266 | iface->tx_streams, |
| 2267 | iface->rx_streams, |
| 2268 | iface->chain_mask, |
| 2269 | iface->nss_2g, |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2270 | iface->nss_5g); |
| 2271 | } |
| 2272 | |
| 2273 | *size -= len; |
| 2274 | *buf_ptr += len; |
| 2275 | } |
Naveen Rawat | 3ff5cff | 2018-01-29 14:31:16 -0800 | [diff] [blame] | 2276 | #endif /* QCA_SUPPORT_CP_STATS */ |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2277 | |
| 2278 | /** |
| 2279 | * wma_register_debug_callback() - registration function for wma layer |
| 2280 | * to print wma state information |
| 2281 | */ |
| 2282 | static void wma_register_debug_callback(void) |
| 2283 | { |
| 2284 | qdf_register_debug_callback(QDF_MODULE_ID_WMA, &wma_state_info_dump); |
| 2285 | } |
Wen Gong | aa6d55d | 2018-04-26 16:33:21 +0800 | [diff] [blame] | 2286 | #else /* WLAN_FEATURE_HDD_MEMDUMP_ENABLE */ |
| 2287 | static void wma_register_debug_callback(void) |
| 2288 | { |
| 2289 | } |
| 2290 | #endif /* WLAN_FEATURE_HDD_MEMDUMP_ENABLE */ |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2291 | /** |
| 2292 | * wma_register_tx_ops_handler() - register tx_ops of southbound |
| 2293 | * @tx_ops: tx_ops pointer in southbound |
| 2294 | * |
| 2295 | * Return: 0 on success, errno on failure |
| 2296 | */ |
| 2297 | static QDF_STATUS |
| 2298 | wma_register_tx_ops_handler(struct wlan_lmac_if_tx_ops *tx_ops) |
| 2299 | { |
| 2300 | /* |
| 2301 | * Assign tx_ops, it's up to UMAC modules to declare and define these |
| 2302 | * functions which are used to send wmi command to target. |
| 2303 | */ |
| 2304 | |
Himanshu Agarwal | ce716f8 | 2016-12-21 19:07:54 +0530 | [diff] [blame] | 2305 | if (!tx_ops) { |
| 2306 | WMA_LOGE("%s: pointer to lmac if tx ops is NULL", __func__); |
| 2307 | return QDF_STATUS_E_INVAL; |
| 2308 | } |
| 2309 | |
| 2310 | /* mgmt_txrx component's tx ops */ |
| 2311 | tx_ops->mgmt_txrx_tx_ops.mgmt_tx_send = wma_mgmt_unified_cmd_send; |
| 2312 | |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2313 | return QDF_STATUS_SUCCESS; |
| 2314 | } |
| 2315 | |
| 2316 | /** |
| 2317 | * wma_target_if_open() - Attach UMAC modules' interface with wmi layer |
| 2318 | * @wma_handle: wma handle |
| 2319 | * |
| 2320 | * Separate module defines below functions: |
| 2321 | * 1. tgt_wmi_<module>_<action> api sends wmi command, assigned to south bound |
| 2322 | * tx_ops function pointers; |
| 2323 | * 2. module's south dispatcher handles information from lower layer, assigned |
| 2324 | * to south bound rx_ops function pointers; |
| 2325 | * 3. wmi event handler deals with wmi event, extracts umac needed information, |
| 2326 | * and call rx_ops(module's dispatcher). It executes in tasklet context and |
| 2327 | * is up to dispatcher to decide the context to reside in tasklet or in |
| 2328 | * thread context. |
| 2329 | * |
| 2330 | * Return: None |
| 2331 | */ |
| 2332 | static void wma_target_if_open(tp_wma_handle wma_handle) |
| 2333 | { |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 2334 | struct wlan_objmgr_psoc *psoc = wma_handle->psoc; |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2335 | |
| 2336 | if (!psoc) |
| 2337 | return; |
| 2338 | |
Mukul Sharma | dad267e | 2017-02-04 13:25:34 +0530 | [diff] [blame] | 2339 | wlan_global_lmac_if_set_txops_registration_cb(WLAN_DEV_OL, |
| 2340 | target_if_register_tx_ops); |
| 2341 | wlan_lmac_if_set_umac_txops_registration_cb( |
| 2342 | wma_register_tx_ops_handler); |
| 2343 | wlan_global_lmac_if_open(psoc); |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2344 | |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2345 | } |
| 2346 | |
| 2347 | /** |
| 2348 | * wma_target_if_close() - Detach UMAC modules' interface with wmi layer |
| 2349 | * @wma_handle: wma handle |
| 2350 | * |
| 2351 | * Return: None |
| 2352 | */ |
| 2353 | static void wma_target_if_close(tp_wma_handle wma_handle) |
| 2354 | { |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 2355 | struct wlan_objmgr_psoc *psoc = wma_handle->psoc; |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2356 | |
| 2357 | if (!psoc) |
| 2358 | return; |
| 2359 | |
Mukul Sharma | dad267e | 2017-02-04 13:25:34 +0530 | [diff] [blame] | 2360 | wlan_global_lmac_if_close(psoc); |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2361 | } |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2362 | |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2363 | /** |
Mukul Sharma | c3e7a78 | 2017-02-03 12:16:11 +0530 | [diff] [blame] | 2364 | * wma_get_psoc_from_scn_handle() - API to get psoc from scn handle |
| 2365 | * @scn_handle: opaque wma handle |
| 2366 | * |
| 2367 | * API to get psoc from scn handle |
| 2368 | * |
| 2369 | * Return: None |
| 2370 | */ |
| 2371 | static struct wlan_objmgr_psoc *wma_get_psoc_from_scn_handle(void *scn_handle) |
| 2372 | { |
| 2373 | tp_wma_handle wma_handle; |
| 2374 | |
| 2375 | if (!scn_handle) { |
| 2376 | WMA_LOGE("invalid scn handle"); |
| 2377 | return NULL; |
| 2378 | } |
| 2379 | wma_handle = (tp_wma_handle)scn_handle; |
| 2380 | |
| 2381 | return wma_handle->psoc; |
| 2382 | } |
Himanshu Agarwal | 2228e07 | 2018-01-24 17:42:17 +0530 | [diff] [blame] | 2383 | |
| 2384 | /** |
| 2385 | * wma_get_pdev_from_scn_handle() - API to get pdev from scn handle |
| 2386 | * @scn_handle: opaque wma handle |
| 2387 | * |
| 2388 | * API to get pdev from scn handle |
| 2389 | * |
| 2390 | * Return: None |
| 2391 | */ |
| 2392 | static struct wlan_objmgr_pdev *wma_get_pdev_from_scn_handle(void *scn_handle) |
| 2393 | { |
| 2394 | tp_wma_handle wma_handle; |
| 2395 | |
| 2396 | if (!scn_handle) { |
| 2397 | WMA_LOGE("invalid scn handle"); |
| 2398 | return NULL; |
| 2399 | } |
| 2400 | wma_handle = (tp_wma_handle)scn_handle; |
| 2401 | |
| 2402 | return wma_handle->pdev; |
| 2403 | } |
| 2404 | |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2405 | /** |
| 2406 | * wma_legacy_service_ready_event_handler() - legacy (ext)service ready handler |
| 2407 | * @event_id: event_id |
| 2408 | * @handle: wma handle |
| 2409 | * @event_data: event data |
| 2410 | * @length: event length |
| 2411 | * |
| 2412 | * Return: 0 for success, negative error code for failure |
| 2413 | */ |
| 2414 | static int wma_legacy_service_ready_event_handler(uint32_t event_id, |
| 2415 | void *handle, |
| 2416 | uint8_t *event_data, |
| 2417 | uint32_t length) |
| 2418 | { |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 2419 | switch (event_id) { |
| 2420 | case wmi_service_ready_event_id: |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2421 | return wma_rx_service_ready_event(handle, event_data, length); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 2422 | case wmi_service_ready_ext_event_id: |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2423 | return wma_rx_service_ready_ext_event(handle, event_data, |
| 2424 | length); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 2425 | case wmi_ready_event_id: |
| 2426 | return wma_rx_ready_event(handle, event_data, length); |
| 2427 | default: |
| 2428 | WMA_LOGE("Legacy callback invoked with invalid event_id:%d", |
| 2429 | event_id); |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2430 | QDF_BUG(0); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 2431 | } |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2432 | |
| 2433 | return 0; |
| 2434 | } |
Mukul Sharma | c3e7a78 | 2017-02-03 12:16:11 +0530 | [diff] [blame] | 2435 | |
| 2436 | /** |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2437 | * wma_flush_complete_evt_handler() - FW log flush complete event handler |
| 2438 | * @handle: WMI handle |
| 2439 | * @event: Event recevied from FW |
| 2440 | * @len: Length of the event |
| 2441 | * |
| 2442 | */ |
| 2443 | static int wma_flush_complete_evt_handler(void *handle, |
| 2444 | u_int8_t *event, |
| 2445 | u_int32_t len) |
| 2446 | { |
| 2447 | QDF_STATUS status; |
| 2448 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 2449 | |
| 2450 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID_param_tlvs *param_buf; |
| 2451 | wmi_debug_mesg_flush_complete_fixed_param *wmi_event; |
Poddar, Siddarth | c2c0814 | 2017-09-13 17:49:56 +0530 | [diff] [blame] | 2452 | wmi_debug_mesg_fw_data_stall_param *data_stall_event; |
| 2453 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 2454 | uint8_t *buf_ptr; |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2455 | uint32_t reason_code; |
| 2456 | |
| 2457 | param_buf = (WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID_param_tlvs *) event; |
| 2458 | if (!param_buf) { |
| 2459 | WMA_LOGE("Invalid log flush complete event buffer"); |
| 2460 | return QDF_STATUS_E_FAILURE; |
| 2461 | } |
| 2462 | |
| 2463 | wmi_event = param_buf->fixed_param; |
| 2464 | reason_code = wmi_event->reserved0; |
Rajeev Kumar | dcce809 | 2018-05-02 15:48:17 -0700 | [diff] [blame] | 2465 | WMA_LOGD("Received reason code %d from FW", reason_code); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2466 | |
Poddar, Siddarth | c2c0814 | 2017-09-13 17:49:56 +0530 | [diff] [blame] | 2467 | buf_ptr = (uint8_t *)wmi_event; |
| 2468 | buf_ptr = buf_ptr + sizeof(wmi_debug_mesg_flush_complete_fixed_param) + |
| 2469 | WMI_TLV_HDR_SIZE; |
| 2470 | data_stall_event = (wmi_debug_mesg_fw_data_stall_param *) buf_ptr; |
| 2471 | |
| 2472 | if (((data_stall_event->tlv_header & 0xFFFF0000) >> 16 == |
| 2473 | WMITLV_TAG_STRUC_wmi_debug_mesg_fw_data_stall_param)) { |
| 2474 | /** |
| 2475 | * Log data stall info received from FW: |
| 2476 | * |
| 2477 | * Possible data stall recovery types: |
| 2478 | * WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_DISCONNECT |
| 2479 | * WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_MAC_PHY_RESET |
| 2480 | * WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_PDR |
| 2481 | * |
| 2482 | * Possible data stall event types: |
| 2483 | * WLAN_DBG_DATA_STALL_VDEV_PAUSE |
| 2484 | * WLAN_DBG_DATA_STALL_HWSCHED_CMD_FILTER |
| 2485 | * WLAN_DBG_DATA_STALL_HWSCHED_CMD_FLUSH |
| 2486 | * WLAN_DBG_DATA_STALL_RX_REFILL_FAILED |
| 2487 | * WLAN_DBG_DATA_STALL_RX_FCS_LEN_ERROR |
| 2488 | * |
| 2489 | * reason_code1: |
| 2490 | * The information stored in reason_code1 varies based on the |
| 2491 | * data stall type values: |
| 2492 | * |
| 2493 | * data_stall_type | reason_code1 |
| 2494 | * ----------------------------------------------------- |
| 2495 | * HWSCHED_CMD_FLUSH | flush req reason (0-40) |
| 2496 | * RX_REFILL_FAILED | ring_id (0-7) |
| 2497 | * RX_FCS_LEN_ERROR | exact error type |
| 2498 | * |
| 2499 | * reasone_code2: |
| 2500 | * on which tid/hwq stall happened |
| 2501 | * |
| 2502 | */ |
| 2503 | QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 2504 | "Data Stall event:"); |
| 2505 | QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 2506 | "data_stall_type: %x vdev_id_bitmap: %x reason_code1: %x reason_code2: %x recovery_type: %x ", |
| 2507 | data_stall_event->data_stall_type, |
| 2508 | data_stall_event->vdev_id_bitmap, |
| 2509 | data_stall_event->reason_code1, |
| 2510 | data_stall_event->reason_code2, |
| 2511 | data_stall_event->recovery_type); |
| 2512 | |
| 2513 | cdp_post_data_stall_event(soc, |
| 2514 | DATA_STALL_LOG_INDICATOR_FIRMWARE, |
| 2515 | data_stall_event->data_stall_type, |
| 2516 | 0XFF, |
| 2517 | data_stall_event->vdev_id_bitmap, |
| 2518 | data_stall_event->recovery_type); |
| 2519 | } |
| 2520 | |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2521 | /* |
| 2522 | * reason_code = 0; Flush event in response to flush command |
| 2523 | * reason_code = other value; Asynchronous flush event for fatal events |
| 2524 | */ |
| 2525 | if (!reason_code && (cds_is_log_report_in_progress() == false)) { |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 2526 | WMA_LOGD("Received WMI flush event without sending CMD"); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2527 | return -EINVAL; |
| 2528 | } else if (!reason_code && cds_is_log_report_in_progress() == true) { |
| 2529 | /* Flush event in response to flush command */ |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 2530 | WMA_LOGD("Received WMI flush event in response to flush CMD"); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2531 | status = qdf_mc_timer_stop(&wma->log_completion_timer); |
| 2532 | if (status != QDF_STATUS_SUCCESS) |
| 2533 | WMA_LOGE("Failed to stop the log completion timeout"); |
| 2534 | cds_logging_set_fw_flush_complete(); |
Zhu Jianmin | b639e9b | 2017-10-26 19:09:12 +0800 | [diff] [blame] | 2535 | return QDF_STATUS_SUCCESS; |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2536 | } else if (reason_code && cds_is_log_report_in_progress() == false) { |
| 2537 | /* Asynchronous flush event for fatal events */ |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2538 | status = cds_set_log_completion(WLAN_LOG_TYPE_FATAL, |
| 2539 | WLAN_LOG_INDICATOR_FIRMWARE, |
| 2540 | reason_code, false); |
| 2541 | if (QDF_STATUS_SUCCESS != status) { |
| 2542 | WMA_LOGE("%s: Failed to set log trigger params", |
| 2543 | __func__); |
| 2544 | return QDF_STATUS_E_FAILURE; |
| 2545 | } |
| 2546 | cds_logging_set_fw_flush_complete(); |
| 2547 | return status; |
| 2548 | } else { |
| 2549 | /* Asynchronous flush event for fatal event, |
| 2550 | * but, report in progress already |
| 2551 | */ |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 2552 | 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] | 2553 | __func__, WLAN_LOG_TYPE_FATAL, |
| 2554 | WLAN_LOG_INDICATOR_FIRMWARE, reason_code); |
| 2555 | return QDF_STATUS_E_FAILURE; |
| 2556 | } |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 2557 | /* Asynchronous flush event for fatal event, |
| 2558 | * but, report in progress already |
| 2559 | */ |
| 2560 | WMA_LOGW("%s: Bug report already in progress - dropping! type:%d, indicator=%d reason_code=%d", |
| 2561 | __func__, WLAN_LOG_TYPE_FATAL, |
| 2562 | WLAN_LOG_INDICATOR_FIRMWARE, reason_code); |
| 2563 | return QDF_STATUS_E_FAILURE; |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2564 | } |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2565 | /** |
| 2566 | * wma_extract_single_phyerr_spectral() - extract single phy error from event |
| 2567 | * @handle: wma handle |
| 2568 | * @param evt_buf: pointer to event buffer |
| 2569 | * @param datalen: data length of event buffer |
| 2570 | * @param buf_offset: Pointer to hold value of current event buffer offset |
| 2571 | * post extraction |
| 2572 | * @param phyerr: Pointer to hold phyerr |
| 2573 | * |
| 2574 | * Return: QDF_STATUS |
| 2575 | */ |
| 2576 | static QDF_STATUS wma_extract_single_phyerr_spectral(void *handle, |
| 2577 | void *evt_buf, |
| 2578 | uint16_t datalen, uint16_t *buf_offset, |
| 2579 | wmi_host_phyerr_t *phyerr) |
| 2580 | { |
| 2581 | wmi_single_phyerr_rx_event *ev; |
| 2582 | int n = *buf_offset; |
| 2583 | |
| 2584 | ev = (wmi_single_phyerr_rx_event *)((uint8_t *)evt_buf + n); |
| 2585 | |
| 2586 | if (n < datalen) { |
| 2587 | /* ensure there's at least space for the header */ |
| 2588 | if ((datalen - n) < sizeof(ev->hdr)) { |
| 2589 | WMA_LOGE("%s: not enough space? (datalen=%d, n=%d, hdr=%zu bytes", |
| 2590 | __func__, datalen, n, sizeof(ev->hdr)); |
| 2591 | return QDF_STATUS_E_FAILURE; |
| 2592 | } |
| 2593 | |
| 2594 | phyerr->bufp = ev->bufp; |
| 2595 | phyerr->buf_len = ev->hdr.buf_len; |
| 2596 | |
| 2597 | /* |
| 2598 | * Sanity check the buffer length of the event against |
| 2599 | * what we currently have. |
| 2600 | * |
| 2601 | * Since buf_len is 32 bits, we check if it overflows |
| 2602 | * a large 32 bit value. It's not 0x7fffffff because |
| 2603 | * we increase n by (buf_len + sizeof(hdr)), which would |
| 2604 | * in itself cause n to overflow. |
| 2605 | * |
| 2606 | * If "int" is 64 bits then this becomes a moot point. |
| 2607 | */ |
| 2608 | if (ev->hdr.buf_len > 0x7f000000) { |
| 2609 | WMA_LOGE("%s: buf_len is garbage? (0x%x)", |
| 2610 | __func__, ev->hdr.buf_len); |
| 2611 | return QDF_STATUS_E_FAILURE; |
| 2612 | } |
| 2613 | if (n + ev->hdr.buf_len > datalen) { |
| 2614 | WMA_LOGE("%s: buf_len exceeds available space n=%d, buf_len=%d, datalen=%d", |
| 2615 | __func__, n, ev->hdr.buf_len, datalen); |
| 2616 | return QDF_STATUS_E_FAILURE; |
| 2617 | } |
| 2618 | |
| 2619 | phyerr->phy_err_code = WMI_UNIFIED_PHYERRCODE_GET(&ev->hdr); |
| 2620 | phyerr->tsf_timestamp = ev->hdr.tsf_timestamp; |
| 2621 | |
| 2622 | #ifdef DEBUG_SPECTRAL_SCAN |
| 2623 | WMA_LOGD("%s: len=%d, tsf=0x%08x, rssi = 0x%x/0x%x/0x%x/0x%x, comb rssi = 0x%x, phycode=%d", |
| 2624 | __func__, |
| 2625 | ev->hdr.buf_len, |
| 2626 | ev->hdr.tsf_timestamp, |
| 2627 | ev->hdr.rssi_chain0, |
| 2628 | ev->hdr.rssi_chain1, |
| 2629 | ev->hdr.rssi_chain2, |
| 2630 | ev->hdr.rssi_chain3, |
| 2631 | WMI_UNIFIED_RSSI_COMB_GET(&ev->hdr), |
| 2632 | phyerr->phy_err_code); |
| 2633 | |
| 2634 | /* |
| 2635 | * For now, unroll this loop - the chain 'value' field isn't |
| 2636 | * a variable but glued together into a macro field definition. |
| 2637 | * Grr. :-) |
| 2638 | */ |
| 2639 | WMA_LOGD("%s: chain 0: raw=0x%08x; pri20=%d sec20=%d sec40=%d sec80=%d", |
| 2640 | __func__, |
| 2641 | ev->hdr.rssi_chain0, |
| 2642 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, PRI20), |
| 2643 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, SEC20), |
| 2644 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, SEC40), |
| 2645 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, SEC80)); |
| 2646 | |
| 2647 | WMA_LOGD("%s: chain 1: raw=0x%08x: pri20=%d sec20=%d sec40=%d sec80=%d", |
| 2648 | __func__, |
| 2649 | ev->hdr.rssi_chain1, |
| 2650 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, PRI20), |
| 2651 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, SEC20), |
| 2652 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, SEC40), |
| 2653 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, SEC80)); |
| 2654 | |
| 2655 | WMA_LOGD("%s: chain 2: raw=0x%08x: pri20=%d sec20=%d sec40=%d sec80=%d", |
| 2656 | __func__, |
| 2657 | ev->hdr.rssi_chain2, |
| 2658 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, PRI20), |
| 2659 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, SEC20), |
| 2660 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, SEC40), |
| 2661 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, SEC80)); |
| 2662 | |
| 2663 | WMA_LOGD("%s: chain 3: raw=0x%08x: pri20=%d sec20=%d sec40=%d sec80=%d", |
| 2664 | __func__, |
| 2665 | ev->hdr.rssi_chain3, |
| 2666 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, PRI20), |
| 2667 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, SEC20), |
| 2668 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, SEC40), |
| 2669 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, SEC80)); |
| 2670 | |
| 2671 | |
| 2672 | WMA_LOGD("%s: freq_info_1=0x%08x, freq_info_2=0x%08x", |
| 2673 | __func__, ev->hdr.freq_info_1, ev->hdr.freq_info_2); |
| 2674 | |
| 2675 | /* |
| 2676 | * The NF chain values are signed and are negative - hence |
| 2677 | * the cast evilness. |
| 2678 | */ |
| 2679 | WMA_LOGD("%s: nfval[1]=0x%08x, nfval[2]=0x%08x, nf=%d/%d/%d/%d, freq1=%d, freq2=%d, cw=%d", |
| 2680 | __func__, |
| 2681 | ev->hdr.nf_list_1, |
| 2682 | ev->hdr.nf_list_2, |
| 2683 | (int) WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 0), |
| 2684 | (int) WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 1), |
| 2685 | (int) WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 2), |
| 2686 | (int) WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 3), |
| 2687 | WMI_UNIFIED_FREQ_INFO_GET(&ev->hdr, 1), |
| 2688 | WMI_UNIFIED_FREQ_INFO_GET(&ev->hdr, 2), |
| 2689 | WMI_UNIFIED_CHWIDTH_GET(&ev->hdr)); |
| 2690 | #endif |
| 2691 | |
| 2692 | /* |
| 2693 | * If required, pass spectral events to the spectral module |
| 2694 | */ |
| 2695 | if (ev->hdr.buf_len > 0) { |
| 2696 | |
| 2697 | /* Initialize the NF values to Zero. */ |
| 2698 | phyerr->rf_info.noise_floor[0] = |
| 2699 | WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 0); |
| 2700 | phyerr->rf_info.noise_floor[1] = |
| 2701 | WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 1); |
| 2702 | phyerr->rf_info.noise_floor[2] = |
| 2703 | WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 2); |
| 2704 | phyerr->rf_info.noise_floor[3] = |
| 2705 | WMI_UNIFIED_NF_CHAIN_GET(&ev->hdr, 3); |
| 2706 | |
| 2707 | /* populate the rf info */ |
| 2708 | phyerr->rf_info.rssi_comb = |
| 2709 | WMI_UNIFIED_RSSI_COMB_GET(&ev->hdr); |
| 2710 | |
| 2711 | /* Need to unroll loop due to macro |
| 2712 | * constraints chain 0 |
| 2713 | */ |
| 2714 | phyerr->rf_info.pc_rssi_info[0].rssi_pri20 = |
| 2715 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, PRI20); |
| 2716 | phyerr->rf_info.pc_rssi_info[0].rssi_sec20 = |
| 2717 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, SEC20); |
| 2718 | phyerr->rf_info.pc_rssi_info[0].rssi_sec40 = |
| 2719 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, SEC40); |
| 2720 | phyerr->rf_info.pc_rssi_info[0].rssi_sec80 = |
| 2721 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 0, SEC80); |
| 2722 | |
| 2723 | /* chain 1 */ |
| 2724 | phyerr->rf_info.pc_rssi_info[1].rssi_pri20 = |
| 2725 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, PRI20); |
| 2726 | phyerr->rf_info.pc_rssi_info[1].rssi_sec20 = |
| 2727 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, SEC20); |
| 2728 | phyerr->rf_info.pc_rssi_info[1].rssi_sec40 = |
| 2729 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, SEC40); |
| 2730 | phyerr->rf_info.pc_rssi_info[1].rssi_sec80 = |
| 2731 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 1, SEC80); |
| 2732 | |
| 2733 | /* chain 2 */ |
| 2734 | phyerr->rf_info.pc_rssi_info[2].rssi_pri20 = |
| 2735 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, PRI20); |
| 2736 | phyerr->rf_info.pc_rssi_info[2].rssi_sec20 = |
| 2737 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, SEC20); |
| 2738 | phyerr->rf_info.pc_rssi_info[2].rssi_sec40 = |
| 2739 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, SEC40); |
| 2740 | phyerr->rf_info.pc_rssi_info[2].rssi_sec80 = |
| 2741 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 2, SEC80); |
| 2742 | |
| 2743 | /* chain 3 */ |
| 2744 | phyerr->rf_info.pc_rssi_info[3].rssi_pri20 = |
| 2745 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, PRI20); |
| 2746 | phyerr->rf_info.pc_rssi_info[3].rssi_sec20 = |
| 2747 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, SEC20); |
| 2748 | phyerr->rf_info.pc_rssi_info[3].rssi_sec40 = |
| 2749 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, SEC40); |
| 2750 | phyerr->rf_info.pc_rssi_info[3].rssi_sec80 = |
| 2751 | WMI_UNIFIED_RSSI_CHAN_GET(&ev->hdr, 3, SEC80); |
| 2752 | |
| 2753 | phyerr->chan_info.center_freq1 = |
| 2754 | WMI_UNIFIED_FREQ_INFO_GET(&ev->hdr, 1); |
| 2755 | phyerr->chan_info.center_freq2 = |
| 2756 | WMI_UNIFIED_FREQ_INFO_GET(&ev->hdr, 2); |
| 2757 | |
| 2758 | } |
| 2759 | |
| 2760 | /* |
| 2761 | * Advance the buffer pointer to the next PHY error. |
| 2762 | * buflen is the length of this payload, so we need to |
| 2763 | * advance past the current header _AND_ the payload. |
| 2764 | */ |
| 2765 | n += sizeof(*ev) + ev->hdr.buf_len; |
| 2766 | } |
| 2767 | *buf_offset += n; |
| 2768 | |
| 2769 | return QDF_STATUS_SUCCESS; |
| 2770 | } |
| 2771 | |
| 2772 | /** |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2773 | * spectral_phyerr_event_handler() - spectral phyerr event handler |
| 2774 | * @handle: wma handle |
| 2775 | * @data: data buffer |
| 2776 | * @datalen: buffer length |
| 2777 | * |
| 2778 | * Return: QDF_STATUS |
| 2779 | */ |
| 2780 | static QDF_STATUS spectral_phyerr_event_handler(void *handle, |
| 2781 | uint8_t *data, uint32_t datalen) |
| 2782 | { |
| 2783 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 2784 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2785 | uint16_t buf_offset, event_buf_len = 0; |
| 2786 | wmi_single_phyerr_rx_event *ev; |
| 2787 | wmi_host_phyerr_t phyerr; |
| 2788 | struct target_if_spectral_rfqual_info rfqual_info; |
| 2789 | struct target_if_spectral_chan_info chan_info; |
| 2790 | struct target_if_spectral_acs_stats acs_stats; |
| 2791 | |
| 2792 | if (NULL == wma) { |
| 2793 | WMA_LOGE("%s:wma handle is NULL", __func__); |
| 2794 | return QDF_STATUS_E_FAILURE; |
| 2795 | } |
| 2796 | |
| 2797 | memset(&phyerr, 0, sizeof(wmi_host_phyerr_t)); |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2798 | status = wmi_extract_comb_phyerr(wma->wmi_handle, data, datalen, |
| 2799 | &buf_offset, &phyerr); |
| 2800 | if (QDF_IS_STATUS_ERROR(status)) { |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2801 | WMA_LOGE("%s: extract comb phyerr failed", __func__); |
| 2802 | return QDF_STATUS_E_FAILURE; |
| 2803 | } |
| 2804 | |
| 2805 | ev = (wmi_single_phyerr_rx_event *)phyerr.bufp; |
| 2806 | event_buf_len = phyerr.buf_len; |
| 2807 | /* Loop over the bufp, extracting out phyerrors */ |
| 2808 | buf_offset = 0; |
| 2809 | while (buf_offset < event_buf_len) { |
| 2810 | if (wma_extract_single_phyerr_spectral(handle, ev, |
| 2811 | event_buf_len, &buf_offset, &phyerr)) { |
| 2812 | WMA_LOGE("%s: extract single phy err failed", __func__); |
| 2813 | return QDF_STATUS_E_FAILURE; |
| 2814 | } |
| 2815 | |
| 2816 | if (phyerr.buf_len > 0) { |
| 2817 | if (sizeof(phyerr.rf_info) > sizeof(rfqual_info)) |
| 2818 | qdf_mem_copy(&rfqual_info, &phyerr.rf_info, |
| 2819 | sizeof(rfqual_info)); |
| 2820 | else |
| 2821 | qdf_mem_copy(&rfqual_info, &phyerr.rf_info, |
| 2822 | sizeof(phyerr.rf_info)); |
| 2823 | |
| 2824 | if (sizeof(phyerr.chan_info) > sizeof(chan_info)) |
| 2825 | qdf_mem_copy(&chan_info, &phyerr.chan_info, |
| 2826 | sizeof(chan_info)); |
| 2827 | else |
| 2828 | qdf_mem_copy(&chan_info, &phyerr.chan_info, |
| 2829 | sizeof(phyerr.chan_info)); |
| 2830 | |
| 2831 | target_if_spectral_process_phyerr(wma->pdev, phyerr.bufp, |
| 2832 | phyerr.buf_len, |
| 2833 | &rfqual_info, |
| 2834 | &chan_info, |
| 2835 | phyerr.tsf64, |
| 2836 | &acs_stats); |
| 2837 | } |
| 2838 | } |
| 2839 | |
| 2840 | return status; |
| 2841 | } |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2842 | |
Arif Hussain | f63f7a3 | 2017-08-22 12:49:42 -0700 | [diff] [blame] | 2843 | /** |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2844 | * dfs_phyerr_event_handler() - dfs phyerr event handler |
| 2845 | * @handle: wma handle |
| 2846 | * @data: data buffer |
| 2847 | * @datalen: buffer length |
| 2848 | * @fulltsf: 64 bit event TSF |
| 2849 | * |
| 2850 | * Function to process DFS phy errors. |
| 2851 | * |
| 2852 | * Return: QDF_STATUS |
| 2853 | */ |
| 2854 | static QDF_STATUS dfs_phyerr_event_handler(tp_wma_handle handle, |
| 2855 | uint8_t *data, |
| 2856 | uint32_t datalen, |
| 2857 | uint64_t fulltsf) |
| 2858 | { |
| 2859 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2860 | struct wlan_lmac_if_dfs_rx_ops *dfs_rx_ops; |
| 2861 | wmi_host_phyerr_t phyerr; |
| 2862 | int8_t rssi_comb; |
| 2863 | uint16_t buf_offset; |
| 2864 | |
| 2865 | if (!handle->psoc) { |
| 2866 | WMA_LOGE("%s: psoc is null", __func__); |
| 2867 | return QDF_STATUS_E_INVAL; |
| 2868 | } |
| 2869 | |
| 2870 | dfs_rx_ops = wlan_lmac_if_get_dfs_rx_ops(handle->psoc); |
| 2871 | if (!dfs_rx_ops) { |
| 2872 | WMA_LOGE("%s: dfs_rx_ops is null", __func__); |
| 2873 | return QDF_STATUS_E_INVAL; |
| 2874 | } |
| 2875 | |
| 2876 | if (!dfs_rx_ops->dfs_process_phyerr) { |
| 2877 | WMA_LOGE("%s: dfs_process_phyerr handler is null", __func__); |
| 2878 | return QDF_STATUS_E_INVAL; |
| 2879 | } |
| 2880 | |
| 2881 | if (!handle->pdev) { |
| 2882 | WMA_LOGE("%s: pdev is null", __func__); |
| 2883 | return -EINVAL; |
| 2884 | } |
| 2885 | |
| 2886 | buf_offset = 0; |
| 2887 | while (buf_offset < datalen) { |
| 2888 | status = wmi_extract_single_phyerr(handle->wmi_handle, data, datalen, |
| 2889 | &buf_offset, &phyerr); |
| 2890 | if (QDF_IS_STATUS_ERROR(status)) { |
| 2891 | /* wmi_extract_single_phyerr has logs */ |
| 2892 | return status; |
| 2893 | } |
| 2894 | |
| 2895 | rssi_comb = phyerr.rf_info.rssi_comb & 0xFF; |
| 2896 | if (phyerr.buf_len > 0) |
| 2897 | dfs_rx_ops->dfs_process_phyerr(handle->pdev, |
| 2898 | &phyerr.bufp[0], |
| 2899 | phyerr.buf_len, |
| 2900 | rssi_comb, |
| 2901 | rssi_comb, |
| 2902 | phyerr.tsf_timestamp, |
| 2903 | fulltsf); |
| 2904 | } |
| 2905 | |
| 2906 | return QDF_STATUS_SUCCESS; |
| 2907 | } |
| 2908 | |
| 2909 | /** |
Arif Hussain | f63f7a3 | 2017-08-22 12:49:42 -0700 | [diff] [blame] | 2910 | * wma_unified_phyerr_rx_event_handler() - phyerr event handler |
| 2911 | * @handle: wma handle |
| 2912 | * @data: data buffer |
| 2913 | * @datalen: buffer length |
| 2914 | * |
| 2915 | * WMI Handler for WMI_PHYERR_EVENTID event from firmware. |
| 2916 | * This handler is currently handling DFS and spectral scan |
| 2917 | * phy errors. |
| 2918 | * |
| 2919 | * Return: 0 for success, other value for failure |
| 2920 | */ |
| 2921 | static int wma_unified_phyerr_rx_event_handler(void *handle, |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2922 | uint8_t *data, |
| 2923 | uint32_t datalen) |
| 2924 | { |
Arif Hussain | f63f7a3 | 2017-08-22 12:49:42 -0700 | [diff] [blame] | 2925 | /* phyerr handling is moved to cmn project |
| 2926 | * As WIN still uses handler registration in non-cmn code. |
| 2927 | * need complete testing of non offloaded DFS code before we enable |
| 2928 | * it in cmn code. |
| 2929 | **/ |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2930 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 2931 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2932 | wmi_host_phyerr_t phyerr; |
| 2933 | uint16_t buf_offset = 0; |
| 2934 | |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2935 | if (!wma) { |
| 2936 | WMA_LOGE("%s: wma handle is null", __func__); |
| 2937 | return -EINVAL; |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2938 | } |
| 2939 | |
| 2940 | /* sanity check on data length */ |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2941 | status = wmi_extract_comb_phyerr(wma->wmi_handle, data, datalen, |
| 2942 | &buf_offset, &phyerr); |
| 2943 | if (QDF_IS_STATUS_ERROR(status)) { |
| 2944 | WMA_LOGE("%s: extract phyerr failed: %d", __func__, status); |
| 2945 | return qdf_status_to_os_return(status); |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2946 | } |
| 2947 | |
| 2948 | /* handle different PHY Error conditions */ |
| 2949 | if (((phyerr.phy_err_mask0 & (WMI_PHY_ERROR_MASK0_RADAR | |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2950 | WMI_PHY_ERROR_MASK0_FALSE_RADAR_EXT | |
| 2951 | WMI_PHY_ERROR_MASK0_SPECTRAL_SCAN)) == 0)) { |
| 2952 | WMA_LOGD("%s: Unknown phy error event", __func__); |
| 2953 | return -EINVAL; |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2954 | } |
| 2955 | |
| 2956 | /* Handle Spectral or DFS PHY Error */ |
| 2957 | if (phyerr.phy_err_mask0 & (WMI_PHY_ERROR_MASK0_RADAR | |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2958 | WMI_PHY_ERROR_MASK0_FALSE_RADAR_EXT)) { |
| 2959 | if (wma->is_dfs_offloaded) { |
| 2960 | WMA_LOGD("%s: Unexpected phy error, dfs offloaded", |
| 2961 | __func__); |
| 2962 | return -EINVAL; |
| 2963 | } |
| 2964 | status = dfs_phyerr_event_handler(wma, |
| 2965 | phyerr.bufp, |
| 2966 | phyerr.buf_len, |
| 2967 | phyerr.tsf64); |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2968 | } else if (phyerr.phy_err_mask0 & (WMI_PHY_ERROR_MASK0_SPECTRAL_SCAN | |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2969 | WMI_PHY_ERROR_MASK0_FALSE_RADAR_EXT)) { |
Sandeep Puligilla | 707cea5 | 2018-01-17 23:19:41 -0800 | [diff] [blame] | 2970 | status = spectral_phyerr_event_handler(wma, data, datalen); |
| 2971 | } |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 2972 | |
| 2973 | return qdf_status_to_os_return(status); |
Arif Hussain | f63f7a3 | 2017-08-22 12:49:42 -0700 | [diff] [blame] | 2974 | } |
| 2975 | |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 2976 | void wma_vdev_init(struct wma_txrx_node *vdev) |
| 2977 | { |
| 2978 | qdf_wake_lock_create(&vdev->vdev_start_wakelock, "vdev_start"); |
| 2979 | qdf_wake_lock_create(&vdev->vdev_stop_wakelock, "vdev_stop"); |
Rajeev Kumar | 155a3e4 | 2017-10-10 15:31:17 -0700 | [diff] [blame] | 2980 | qdf_wake_lock_create(&vdev->vdev_set_key_wakelock, "vdev_set_key"); |
Naveen Rawat | d773414 | 2017-10-27 10:02:40 -0700 | [diff] [blame] | 2981 | vdev->is_waiting_for_key = false; |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 2982 | } |
| 2983 | |
| 2984 | void wma_vdev_deinit(struct wma_txrx_node *vdev) |
| 2985 | { |
| 2986 | qdf_wake_lock_destroy(&vdev->vdev_start_wakelock); |
| 2987 | qdf_wake_lock_destroy(&vdev->vdev_stop_wakelock); |
Rajeev Kumar | 155a3e4 | 2017-10-10 15:31:17 -0700 | [diff] [blame] | 2988 | qdf_wake_lock_destroy(&vdev->vdev_set_key_wakelock); |
Naveen Rawat | d773414 | 2017-10-27 10:02:40 -0700 | [diff] [blame] | 2989 | vdev->is_waiting_for_key = false; |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 2990 | } |
| 2991 | |
Kabilan Kannan | fc3a8c0 | 2018-02-21 13:36:29 -0800 | [diff] [blame] | 2992 | /** |
| 2993 | * wma_wmi_stop() - generic function to block WMI commands |
| 2994 | * @return: None |
| 2995 | */ |
| 2996 | void wma_wmi_stop(void) |
| 2997 | { |
| 2998 | tp_wma_handle wma_handle; |
| 2999 | |
| 3000 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 3001 | if (wma_handle == NULL) { |
| 3002 | QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 3003 | "wma_handle is NULL\n"); |
| 3004 | return; |
| 3005 | } |
| 3006 | wmi_stop(wma_handle->wmi_handle); |
| 3007 | } |
| 3008 | |
Naveen Rawat | e8b1b82 | 2018-01-30 09:46:16 -0800 | [diff] [blame] | 3009 | #ifdef QCA_SUPPORT_CP_STATS |
| 3010 | static void wma_register_stats_events(wmi_unified_t wmi_handle) {} |
| 3011 | #else |
| 3012 | static void wma_register_stats_events(wmi_unified_t wmi_handle) |
| 3013 | { |
| 3014 | wmi_unified_register_event_handler(wmi_handle, |
| 3015 | wmi_update_stats_event_id, |
| 3016 | wma_stats_event_handler, |
| 3017 | WMA_RX_SERIALIZER_CTX); |
| 3018 | } |
| 3019 | #endif |
| 3020 | |
Kabilan Kannan | fc3a8c0 | 2018-02-21 13:36:29 -0800 | [diff] [blame] | 3021 | /** |
| 3022 | * wma_open() - Allocate wma context and initialize it. |
| 3023 | * @cds_context: cds context |
| 3024 | * @wma_tgt_cfg_cb: tgt config callback fun |
| 3025 | * @radar_ind_cb: dfs radar indication callback |
| 3026 | * @cds_cfg: mac parameters |
| 3027 | * |
| 3028 | * Return: 0 on success, errno on failure |
| 3029 | */ |
Jeff Johnson | ff6addf | 2017-09-13 10:06:03 -0700 | [diff] [blame] | 3030 | QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3031 | wma_tgt_cfg_cb tgt_cfg_cb, |
bings | 482bae2 | 2018-01-17 16:25:31 +0800 | [diff] [blame] | 3032 | struct cds_config_info *cds_cfg, |
| 3033 | uint32_t target_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3034 | { |
| 3035 | tp_wma_handle wma_handle; |
| 3036 | HTC_HANDLE htc_handle; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3037 | qdf_device_t qdf_dev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3038 | void *wmi_handle; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3039 | QDF_STATUS qdf_status; |
Lin Bai | 04f603e | 2018-03-19 11:01:06 +0800 | [diff] [blame] | 3040 | struct wmi_unified_attach_params *params; |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 3041 | struct policy_mgr_wma_cbacks wma_cbacks; |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 3042 | struct target_psoc_info *tgt_psoc_info; |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3043 | int i; |
Jeff Johnson | ff6addf | 2017-09-13 10:06:03 -0700 | [diff] [blame] | 3044 | void *cds_context; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 3045 | target_resource_config *wlan_res_cfg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3046 | |
| 3047 | WMA_LOGD("%s: Enter", __func__); |
| 3048 | |
Jeff Johnson | ff6addf | 2017-09-13 10:06:03 -0700 | [diff] [blame] | 3049 | cds_context = cds_get_global_context(); |
| 3050 | if (!cds_context) { |
| 3051 | WMA_LOGE("%s: Invalid CDS context", __func__); |
| 3052 | return QDF_STATUS_E_INVAL; |
| 3053 | } |
| 3054 | |
Mukul Sharma | 5ff3c58 | 2016-09-12 15:23:35 +0530 | [diff] [blame] | 3055 | g_wmi_version_info.major = __WMI_VER_MAJOR_; |
| 3056 | g_wmi_version_info.minor = __WMI_VER_MINOR_; |
| 3057 | g_wmi_version_info.revision = __WMI_REVISION_; |
| 3058 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3059 | qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); |
| 3060 | htc_handle = cds_get_context(QDF_MODULE_ID_HTC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3061 | |
| 3062 | if (!htc_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3063 | WMA_LOGE("%s: Invalid HTC handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3064 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3065 | } |
| 3066 | |
| 3067 | /* Alloc memory for WMA Context */ |
Jeff Johnson | adb3b1c | 2017-09-13 10:42:36 -0700 | [diff] [blame] | 3068 | qdf_status = cds_alloc_context(QDF_MODULE_ID_WMA, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3069 | (void **)&wma_handle, |
Jeff Johnson | adb3b1c | 2017-09-13 10:42:36 -0700 | [diff] [blame] | 3070 | sizeof(*wma_handle)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3071 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3072 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3073 | WMA_LOGE("%s: Memory allocation failed for wma_handle", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3074 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3075 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3076 | } |
| 3077 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3078 | qdf_mem_zero(wma_handle, sizeof(t_wma_handle)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3079 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3080 | if (target_if_alloc_psoc_tgt_info(psoc)) { |
| 3081 | WMA_LOGE("%s target psoc info allocation failed", __func__); |
| 3082 | qdf_status = QDF_STATUS_E_NOMEM; |
| 3083 | goto err_free_wma_handle; |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 3084 | } |
| 3085 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3086 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3087 | #ifdef FEATURE_WLAN_EXTSCAN |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3088 | qdf_wake_lock_create(&wma_handle->extscan_wake_lock, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3089 | "wlan_extscan_wl"); |
| 3090 | #endif /* FEATURE_WLAN_EXTSCAN */ |
Mukul Sharma | e44d054 | 2017-05-23 21:50:56 +0530 | [diff] [blame] | 3091 | qdf_wake_lock_create(&wma_handle->wow_wake_lock, |
| 3092 | "wlan_wow_wl"); |
| 3093 | qdf_wake_lock_create(&wma_handle->wow_auth_req_wl, |
| 3094 | "wlan_auth_req_wl"); |
| 3095 | qdf_wake_lock_create(&wma_handle->wow_assoc_req_wl, |
| 3096 | "wlan_assoc_req_wl"); |
| 3097 | qdf_wake_lock_create(&wma_handle->wow_deauth_rec_wl, |
| 3098 | "wlan_deauth_rec_wl"); |
| 3099 | qdf_wake_lock_create(&wma_handle->wow_disassoc_rec_wl, |
| 3100 | "wlan_disassoc_rec_wl"); |
| 3101 | qdf_wake_lock_create(&wma_handle->wow_ap_assoc_lost_wl, |
| 3102 | "wlan_ap_assoc_lost_wl"); |
| 3103 | qdf_wake_lock_create(&wma_handle->wow_auto_shutdown_wl, |
| 3104 | "wlan_auto_shutdown_wl"); |
| 3105 | qdf_wake_lock_create(&wma_handle->roam_ho_wl, |
| 3106 | "wlan_roam_ho_wl"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3107 | } |
| 3108 | |
Selvaraj, Sridhar | 3a1823f | 2017-02-01 17:32:21 +0530 | [diff] [blame] | 3109 | qdf_status = wlan_objmgr_psoc_try_get_ref(psoc, WLAN_LEGACY_WMA_ID); |
| 3110 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 3111 | WMA_LOGE("%s: PSOC get_ref fails", __func__); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3112 | goto err_wma_handle; |
Selvaraj, Sridhar | 3a1823f | 2017-02-01 17:32:21 +0530 | [diff] [blame] | 3113 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3114 | wma_handle->psoc = psoc; |
| 3115 | |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 3116 | /* Open target_if layer and register wma callback */ |
| 3117 | wma_target_if_open(wma_handle); |
| 3118 | target_if_open(wma_get_psoc_from_scn_handle); |
| 3119 | |
Lin Bai | 04f603e | 2018-03-19 11:01:06 +0800 | [diff] [blame] | 3120 | /* |
| 3121 | * Allocate locally used params with its rx_ops member, |
| 3122 | * and free it immediately after used. |
| 3123 | */ |
| 3124 | params = qdf_mem_malloc(sizeof(*params) + sizeof(struct wmi_rx_ops)); |
| 3125 | if (!params) { |
| 3126 | WMA_LOGE("%s: failed to allocate attach params", __func__); |
| 3127 | qdf_status = QDF_STATUS_E_NOMEM; |
| 3128 | goto err_wma_handle; |
| 3129 | } |
| 3130 | |
| 3131 | params->rx_ops = (struct wmi_rx_ops *)(params + 1); |
| 3132 | params->osdev = NULL; |
| 3133 | params->target_type = WMI_TLV_TARGET; |
| 3134 | params->use_cookie = false; |
| 3135 | params->psoc = psoc; |
| 3136 | params->max_commands = WMI_MAX_CMDS; |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3137 | /* Attach mc_thread context processing function */ |
Lin Bai | 04f603e | 2018-03-19 11:01:06 +0800 | [diff] [blame] | 3138 | params->rx_ops->wma_process_fw_event_handler_cbk = |
| 3139 | wma_process_fw_event_handler; |
Surabhi Vishnoi | 75b1a81 | 2018-02-09 12:07:16 +0530 | [diff] [blame] | 3140 | |
Himanshu Agarwal | 88b16a4 | 2018-02-06 15:10:59 +0530 | [diff] [blame] | 3141 | /* initialize tlv attach */ |
| 3142 | wmi_tlv_init(); |
Surabhi Vishnoi | 75b1a81 | 2018-02-09 12:07:16 +0530 | [diff] [blame] | 3143 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3144 | /* attach the wmi */ |
Lin Bai | 04f603e | 2018-03-19 11:01:06 +0800 | [diff] [blame] | 3145 | wmi_handle = wmi_unified_attach(wma_handle, params); |
| 3146 | qdf_mem_free(params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3147 | if (!wmi_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3148 | WMA_LOGE("%s: failed to attach WMI", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3149 | qdf_status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3150 | goto err_wma_handle; |
| 3151 | } |
| 3152 | |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 3153 | target_if_register_legacy_service_ready_cb( |
| 3154 | wma_legacy_service_ready_event_handler); |
| 3155 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3156 | WMA_LOGA("WMA --> wmi_unified_attach - success"); |
Mukul Sharma | cc1f3f9 | 2017-01-30 19:56:24 +0530 | [diff] [blame] | 3157 | |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 3158 | /* store the wmi handle in tgt_if_handle */ |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3159 | tgt_psoc_info = wlan_psoc_get_tgt_if_handle(psoc); |
Mukul Sharma | cc1f3f9 | 2017-01-30 19:56:24 +0530 | [diff] [blame] | 3160 | |
bings | 6b41366 | 2018-02-06 17:51:36 +0800 | [diff] [blame] | 3161 | target_psoc_set_target_type(tgt_psoc_info, target_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3162 | /* Save the WMI & HTC handle */ |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3163 | target_psoc_set_wmi_hdl(tgt_psoc_info, wmi_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3164 | wma_handle->wmi_handle = wmi_handle; |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3165 | target_psoc_set_htc_hdl(tgt_psoc_info, htc_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3166 | wma_handle->cds_context = cds_context; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3167 | wma_handle->qdf_dev = qdf_dev; |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3168 | wma_handle->max_scan = cds_cfg->max_scan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3169 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3170 | /* Register Converged Event handlers */ |
| 3171 | init_deinit_register_tgt_psoc_ev_handlers(psoc); |
| 3172 | |
Manishekar Chandrasekaran | ebcab88 | 2016-05-04 12:55:14 +0530 | [diff] [blame] | 3173 | /* Initialize max_no_of_peers for wma_get_number_of_peers_supported() */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3174 | wma_init_max_no_of_peers(wma_handle, cds_cfg->max_station); |
Manishekar Chandrasekaran | ebcab88 | 2016-05-04 12:55:14 +0530 | [diff] [blame] | 3175 | /* Cap maxStation based on the target version */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3176 | cds_cfg->max_station = wma_get_number_of_peers_supported(wma_handle); |
Manishekar Chandrasekaran | ebcab88 | 2016-05-04 12:55:14 +0530 | [diff] [blame] | 3177 | /* Reinitialize max_no_of_peers based on the capped maxStation value */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3178 | wma_init_max_no_of_peers(wma_handle, cds_cfg->max_station); |
Manishekar Chandrasekaran | ebcab88 | 2016-05-04 12:55:14 +0530 | [diff] [blame] | 3179 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3180 | /* initialize default target config */ |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 3181 | wlan_res_cfg = target_psoc_get_wlan_res_cfg(tgt_psoc_info); |
Arif Hussain | d15902c | 2018-03-02 00:08:29 -0800 | [diff] [blame] | 3182 | if (!wlan_res_cfg) { |
| 3183 | WMA_LOGE("%s: wlan_res_cfg is null", __func__); |
| 3184 | qdf_status = QDF_STATUS_E_NOMEM; |
| 3185 | goto err_wma_handle; |
| 3186 | } |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 3187 | |
| 3188 | wma_set_default_tgt_config(wma_handle, wlan_res_cfg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3189 | |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3190 | wma_handle->tx_chain_mask_cck = cds_cfg->tx_chain_mask_cck; |
| 3191 | wma_handle->self_gen_frm_pwr = cds_cfg->self_gen_frm_pwr; |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3192 | wma_init_max_no_of_peers(wma_handle, cds_cfg->max_station); |
| 3193 | cds_cfg->max_station = wma_get_number_of_peers_supported(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3194 | |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3195 | cds_cfg->max_bssid = WMA_MAX_SUPPORTED_BSS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3196 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 3197 | wlan_res_cfg->num_keep_alive_pattern = WMA_MAXNUM_PERIODIC_TX_PTRNS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3198 | |
| 3199 | /* The current firmware implementation requires the number of |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 3200 | * offload peers should be (number of vdevs + 1). |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3201 | */ |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 3202 | wlan_res_cfg->num_offload_peers = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3203 | cds_cfg->ap_maxoffload_peers + 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_reorder_buffs = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3206 | cds_cfg->ap_maxoffload_reorderbuffs + 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3207 | |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3208 | wma_handle->max_station = cds_cfg->max_station; |
| 3209 | wma_handle->max_bssid = cds_cfg->max_bssid; |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3210 | wma_handle->driver_type = cds_cfg->driver_type; |
| 3211 | wma_handle->ssdp = cds_cfg->ssdp; |
| 3212 | wma_handle->enable_mc_list = cds_cfg->enable_mc_list; |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 3213 | wma_handle->bpf_packet_filter_enable = |
| 3214 | cds_cfg->bpf_packet_filter_enable; |
Hanumanth Reddy Pothula | e87621b | 2017-04-12 20:53:35 +0530 | [diff] [blame] | 3215 | wma_handle->active_uc_bpf_mode = cds_cfg->active_uc_bpf_mode; |
| 3216 | 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] | 3217 | wma_handle->link_stats_results = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3218 | #ifdef FEATURE_WLAN_RA_FILTERING |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3219 | wma_handle->IsRArateLimitEnabled = cds_cfg->is_ra_ratelimit_enabled; |
| 3220 | wma_handle->RArateLimitInterval = cds_cfg->ra_ratelimit_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3221 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 3222 | #ifdef WLAN_FEATURE_LPSS |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3223 | wma_handle->is_lpass_enabled = cds_cfg->is_lpass_enabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3224 | #endif |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3225 | wma_set_nan_enable(wma_handle, cds_cfg); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3226 | wma_handle->interfaces = qdf_mem_malloc(sizeof(struct wma_txrx_node) * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3227 | wma_handle->max_bssid); |
| 3228 | if (!wma_handle->interfaces) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3229 | WMA_LOGE("%s: failed to allocate interface table", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3230 | qdf_status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3231 | goto err_scn_context; |
| 3232 | } |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3233 | |
Zhu Jianmin | a2f8e8d | 2018-02-11 16:37:10 +0800 | [diff] [blame] | 3234 | for (i = 0; i < wma_handle->max_bssid; ++i) { |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3235 | wma_vdev_init(&wma_handle->interfaces[i]); |
Zhu Jianmin | a2f8e8d | 2018-02-11 16:37:10 +0800 | [diff] [blame] | 3236 | wma_handle->interfaces[i].delay_before_vdev_stop = |
| 3237 | cds_cfg->delay_before_vdev_stop; |
| 3238 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3239 | /* Register the debug print event handler */ |
| 3240 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3241 | wmi_debug_print_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3242 | wma_unified_debug_print_event_handler, |
| 3243 | WMA_RX_SERIALIZER_CTX); |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 3244 | /* Register profiling event Handler */ |
| 3245 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3246 | wmi_wlan_profile_data_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3247 | wma_profile_data_report_event_handler, |
| 3248 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3249 | |
| 3250 | wma_handle->tgt_cfg_update_cb = tgt_cfg_cb; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3251 | wma_handle->old_hw_mode_index = WMA_DEFAULT_HW_MODE_INDEX; |
| 3252 | wma_handle->new_hw_mode_index = WMA_DEFAULT_HW_MODE_INDEX; |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 3253 | wma_handle->saved_chan.num_channels = 0; |
Sandeep Puligilla | afa5289 | 2016-10-26 19:03:16 -0700 | [diff] [blame] | 3254 | wma_handle->fw_timeout_crash = cds_cfg->fw_timeout_crash; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3255 | |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 3256 | qdf_status = qdf_mc_timer_init(&wma_handle->service_ready_ext_timer, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3257 | QDF_TIMER_TYPE_SW, |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 3258 | wma_service_ready_ext_evt_timeout, |
| 3259 | wma_handle); |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3260 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 3261 | WMA_LOGE("Failed to initialize service ready ext timeout"); |
| 3262 | goto err_event_init; |
| 3263 | } |
| 3264 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3265 | qdf_status = qdf_event_create(&wma_handle->target_suspend); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3266 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3267 | WMA_LOGE("%s: target suspend event initialization failed", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3268 | __func__); |
| 3269 | goto err_event_init; |
| 3270 | } |
| 3271 | |
| 3272 | /* Init Tx Frame Complete event */ |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3273 | qdf_status = qdf_event_create(&wma_handle->tx_frm_download_comp_event); |
| 3274 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3275 | WMA_LOGE("%s: failed to init tx_frm_download_comp_event", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3276 | __func__); |
| 3277 | goto err_event_init; |
| 3278 | } |
| 3279 | |
| 3280 | /* Init tx queue empty check event */ |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3281 | qdf_status = qdf_event_create(&wma_handle->tx_queue_empty_event); |
| 3282 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3283 | WMA_LOGE("%s: failed to init tx_queue_empty_event", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3284 | goto err_event_init; |
| 3285 | } |
| 3286 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3287 | qdf_status = qdf_event_create(&wma_handle->wma_resume_event); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3288 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3289 | WMA_LOGE("%s: wma_resume_event initialization failed", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3290 | __func__); |
| 3291 | goto err_event_init; |
| 3292 | } |
| 3293 | |
Prashanth Bhatta | e675ca7 | 2016-10-20 18:42:37 -0700 | [diff] [blame] | 3294 | qdf_status = cds_shutdown_notifier_register(wma_shutdown_notifier_cb, |
| 3295 | wma_handle); |
| 3296 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3297 | WMA_LOGE("%s: Shutdown notifier register failed: %d", |
Prashanth Bhatta | e675ca7 | 2016-10-20 18:42:37 -0700 | [diff] [blame] | 3298 | __func__, qdf_status); |
| 3299 | goto err_event_init; |
| 3300 | } |
| 3301 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3302 | qdf_status = qdf_event_create(&wma_handle->runtime_suspend); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3303 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3304 | WMA_LOGE("%s: runtime_suspend event initialization failed", |
Houston Hoffman | a76591b | 2015-11-10 16:52:05 -0800 | [diff] [blame] | 3305 | __func__); |
| 3306 | goto err_event_init; |
| 3307 | } |
| 3308 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3309 | qdf_status = qdf_event_create(&wma_handle->recovery_event); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3310 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3311 | WMA_LOGE("%s: recovery event initialization failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3312 | goto err_event_init; |
| 3313 | } |
| 3314 | |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 3315 | qdf_list_create(&wma_handle->vdev_resp_queue, |
Krishna Kumaar Natarajan | a5c53bd | 2015-10-27 11:48:27 -0700 | [diff] [blame] | 3316 | MAX_ENTRY_VDEV_RESP_QUEUE); |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3317 | qdf_spinlock_create(&wma_handle->vdev_respq_lock); |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 3318 | qdf_list_create(&wma_handle->wma_hold_req_queue, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3319 | MAX_ENTRY_HOLD_REQ_QUEUE); |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3320 | qdf_spinlock_create(&wma_handle->wma_hold_req_q_lock); |
Anurag Chouhan | 8e0ccd3 | 2016-02-19 15:30:20 +0530 | [diff] [blame] | 3321 | qdf_atomic_init(&wma_handle->is_wow_bus_suspended); |
| 3322 | qdf_atomic_init(&wma_handle->scan_id_counter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3323 | |
| 3324 | /* Register vdev start response event handler */ |
| 3325 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3326 | wmi_vdev_start_resp_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3327 | wma_vdev_start_resp_handler, |
| 3328 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3329 | |
| 3330 | /* Register vdev stop response event handler */ |
| 3331 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3332 | wmi_vdev_stopped_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3333 | wma_vdev_stop_resp_handler, |
| 3334 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3335 | |
| 3336 | /* register for STA kickout function */ |
| 3337 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3338 | wmi_peer_sta_kickout_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3339 | wma_peer_sta_kickout_event_handler, |
| 3340 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3341 | |
Naveen Rawat | e8b1b82 | 2018-01-30 09:46:16 -0800 | [diff] [blame] | 3342 | /* register for stats event */ |
| 3343 | wma_register_stats_events(wma_handle->wmi_handle); |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 3344 | |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 3345 | /* register for stats response event */ |
| 3346 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3347 | wmi_get_arp_stats_req_id, |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 3348 | wma_get_arp_stats_handler, |
| 3349 | WMA_RX_SERIALIZER_CTX); |
| 3350 | |
Will Huang | a981459 | 2017-05-24 15:47:58 +0800 | [diff] [blame] | 3351 | /* register for peer info response event */ |
| 3352 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3353 | wmi_peer_stats_info_event_id, |
Will Huang | a981459 | 2017-05-24 15:47:58 +0800 | [diff] [blame] | 3354 | wma_peer_info_event_handler, |
| 3355 | WMA_RX_SERIALIZER_CTX); |
| 3356 | |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 3357 | #ifdef WLAN_POWER_DEBUGFS |
| 3358 | /* register for Chip Power stats event */ |
| 3359 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3360 | wmi_pdev_chip_power_stats_event_id, |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 3361 | wma_unified_power_debug_stats_event_handler, |
| 3362 | WMA_RX_SERIALIZER_CTX); |
| 3363 | #endif |
| 3364 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3365 | /* register for linkspeed response event */ |
| 3366 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3367 | wmi_peer_estimated_linkspeed_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3368 | wma_link_speed_event_handler, |
| 3369 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3370 | |
| 3371 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 3372 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3373 | wmi_oem_response_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3374 | wma_oem_data_response_handler, |
| 3375 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3376 | #endif /* FEATURE_OEM_DATA_SUPPORT */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3377 | |
| 3378 | /* Register peer change event handler */ |
| 3379 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3380 | wmi_peer_state_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3381 | wma_peer_state_change_event_handler, |
| 3382 | WMA_RX_WORK_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3383 | |
| 3384 | /* Register beacon tx complete event id. The event is required |
| 3385 | * for sending channel switch announcement frames |
| 3386 | */ |
| 3387 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3388 | wmi_offload_bcn_tx_status_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3389 | wma_unified_bcntx_status_event_handler, |
| 3390 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3391 | |
| 3392 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3393 | wmi_update_vdev_rate_stats_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3394 | wma_link_status_event_handler, |
| 3395 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3396 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 3397 | /* Register event handler for processing Link Layer Stats |
| 3398 | * response from the FW |
| 3399 | */ |
| 3400 | wma_register_ll_stats_event_handler(wma_handle); |
| 3401 | |
| 3402 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 3403 | |
SaidiReddy Yenuga | cc733af | 2016-11-09 17:45:42 +0530 | [diff] [blame] | 3404 | wmi_set_tgt_assert(wma_handle->wmi_handle, |
| 3405 | cds_cfg->force_target_assert_enabled); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3406 | /* Firmware debug log */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3407 | qdf_status = dbglog_init(wma_handle->wmi_handle); |
| 3408 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3409 | WMA_LOGE("%s: Firmware Dbglog initialization failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3410 | goto err_dbglog_init; |
| 3411 | } |
| 3412 | |
| 3413 | /* |
| 3414 | * Update Powersave mode |
| 3415 | * 1 - Legacy Powersave + Deepsleep Disabled |
| 3416 | * 2 - QPower + Deepsleep Disabled |
| 3417 | * 3 - Legacy Powersave + Deepsleep Enabled |
| 3418 | * 4 - QPower + Deepsleep Enabled |
| 3419 | */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3420 | wma_handle->powersave_mode = cds_cfg->powersave_offload_enabled; |
| 3421 | wma_handle->staMaxLIModDtim = cds_cfg->sta_maxlimod_dtim; |
| 3422 | wma_handle->staModDtim = cds_cfg->sta_mod_dtim; |
| 3423 | wma_handle->staDynamicDtim = cds_cfg->sta_dynamic_dtim; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3424 | |
| 3425 | /* |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3426 | * Value of cds_cfg->wow_enable can be, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3427 | * 0 - Disable both magic pattern match and pattern byte match. |
| 3428 | * 1 - Enable magic pattern match on all interfaces. |
| 3429 | * 2 - Enable pattern byte match on all interfaces. |
| 3430 | * 3 - Enable both magic patter and pattern byte match on |
| 3431 | * all interfaces. |
| 3432 | */ |
| 3433 | wma_handle->wow.magic_ptrn_enable = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3434 | (cds_cfg->wow_enable & 0x01) ? true : false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3435 | wma_handle->ptrn_match_enable_all_vdev = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 3436 | (cds_cfg->wow_enable & 0x02) ? true : false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3437 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3438 | /* register for install key completion event */ |
| 3439 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3440 | wmi_vdev_install_key_complete_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3441 | wma_vdev_install_key_complete_event_handler, |
| 3442 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3443 | #ifdef WLAN_FEATURE_NAN |
| 3444 | /* register for nan response event */ |
| 3445 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3446 | wmi_nan_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3447 | wma_nan_rsp_event_handler, |
| 3448 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3449 | #endif /* WLAN_FEATURE_NAN */ |
| 3450 | |
| 3451 | #ifdef WLAN_FEATURE_STATS_EXT |
| 3452 | /* register for extended stats event */ |
| 3453 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3454 | wmi_stats_ext_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3455 | wma_stats_ext_event_handler, |
| 3456 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3457 | #endif /* WLAN_FEATURE_STATS_EXT */ |
| 3458 | #ifdef FEATURE_WLAN_EXTSCAN |
| 3459 | wma_register_extscan_event_handler(wma_handle); |
| 3460 | #endif /* WLAN_FEATURE_STATS_EXT */ |
| 3461 | |
| 3462 | WMA_LOGD("%s: Exit", __func__); |
| 3463 | |
| 3464 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3465 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3466 | wmi_roam_synch_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3467 | wma_roam_synch_event_handler, |
| 3468 | WMA_RX_SERIALIZER_CTX); |
Padma, Santhosh Kumar | aa2433e | 2017-10-06 14:34:46 +0530 | [diff] [blame] | 3469 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3470 | wmi_roam_synch_frame_event_id, |
Padma, Santhosh Kumar | aa2433e | 2017-10-06 14:34:46 +0530 | [diff] [blame] | 3471 | wma_roam_synch_frame_event_handler, |
| 3472 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3473 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 3474 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3475 | wmi_rssi_breach_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3476 | wma_rssi_breached_event_handler, |
| 3477 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3478 | |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3479 | qdf_wake_lock_create(&wma_handle->wmi_cmd_rsp_wake_lock, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3480 | "wlan_fw_rsp_wakelock"); |
Prashanth Bhatta | 87b6dc0 | 2017-01-19 15:17:58 -0800 | [diff] [blame] | 3481 | qdf_runtime_lock_init(&wma_handle->wmi_cmd_rsp_runtime_lock); |
Sandeep Puligilla | 19ddda2 | 2016-01-05 12:18:02 -0800 | [diff] [blame] | 3482 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3483 | /* Register peer assoc conf event handler */ |
| 3484 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3485 | wmi_peer_assoc_conf_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3486 | wma_peer_assoc_conf_handler, |
| 3487 | WMA_RX_SERIALIZER_CTX); |
Sandeep Puligilla | 19ddda2 | 2016-01-05 12:18:02 -0800 | [diff] [blame] | 3488 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3489 | wmi_vdev_delete_resp_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3490 | wma_vdev_delete_handler, |
| 3491 | WMA_RX_SERIALIZER_CTX); |
Sandeep Puligilla | 19ddda2 | 2016-01-05 12:18:02 -0800 | [diff] [blame] | 3492 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3493 | wmi_peer_delete_response_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3494 | wma_peer_delete_handler, |
| 3495 | WMA_RX_SERIALIZER_CTX); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 3496 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3497 | wmi_bpf_capability_info_event_id, |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 3498 | wma_get_bpf_caps_event_handler, |
| 3499 | WMA_RX_SERIALIZER_CTX); |
Padma, Santhosh Kumar | d7cc079 | 2016-06-28 18:54:12 +0530 | [diff] [blame] | 3500 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3501 | wmi_chan_info_event_id, |
Kapil Gupta | 4f0c0c1 | 2017-02-07 15:21:15 +0530 | [diff] [blame] | 3502 | wma_chan_info_event_handler, |
| 3503 | WMA_RX_SERIALIZER_CTX); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 3504 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3505 | wmi_dbg_mesg_flush_complete_event_id, |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 3506 | wma_flush_complete_evt_handler, |
Rajeev Kumar | c3032b8 | 2017-02-14 15:56:01 -0800 | [diff] [blame] | 3507 | WMA_RX_WORK_CTX); |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 3508 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3509 | wmi_report_rx_aggr_failure_event_id, |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 3510 | wma_rx_aggr_failure_event_handler, |
| 3511 | WMA_RX_SERIALIZER_CTX); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 3512 | |
Ashish Kumar Dhanotiya | 9335d81 | 2017-06-30 16:57:20 +0530 | [diff] [blame] | 3513 | wma_handle->ito_repeat_count = cds_cfg->ito_repeat_count; |
Sandeep Puligilla | 819d94f | 2017-10-10 18:33:56 -0700 | [diff] [blame] | 3514 | wma_handle->bandcapability = cds_cfg->bandcapability; |
Ashish Kumar Dhanotiya | 9335d81 | 2017-06-30 16:57:20 +0530 | [diff] [blame] | 3515 | |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 3516 | /* Register PWR_SAVE_FAIL event only in case of recovery(1) */ |
Hanumanth Reddy Pothula | ab39595 | 2017-09-05 19:12:26 +0530 | [diff] [blame] | 3517 | if (cds_cfg->auto_power_save_fail_mode == |
| 3518 | PMO_FW_TO_SEND_WOW_IND_ON_PWR_FAILURE) { |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 3519 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3520 | wmi_pdev_chip_pwr_save_failure_detect_event_id, |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 3521 | wma_chip_power_save_failure_detected_handler, |
| 3522 | WMA_RX_WORK_CTX); |
| 3523 | } |
| 3524 | |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 3525 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 3526 | wmi_pdev_div_rssi_antid_event_id, |
| 3527 | wma_pdev_div_info_evt_handler, |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 3528 | WMA_RX_WORK_CTX); |
| 3529 | |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 3530 | |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 3531 | wma_register_debug_callback(); |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 3532 | /* Register callback with PMO so PMO can update the vdev pause bitmap*/ |
| 3533 | pmo_register_pause_bitmap_notifier(wma_handle->psoc, |
| 3534 | wma_vdev_update_pause_bitmap); |
| 3535 | pmo_register_get_pause_bitmap(wma_handle->psoc, |
| 3536 | wma_vdev_get_pause_bitmap); |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 3537 | pmo_register_is_device_in_low_pwr_mode(wma_handle->psoc, |
| 3538 | wma_vdev_is_device_in_low_pwr_mode); |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 3539 | wma_cbacks.wma_get_connection_info = wma_get_connection_info; |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 3540 | qdf_status = policy_mgr_register_wma_cb(wma_handle->psoc, &wma_cbacks); |
| 3541 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 3542 | WMA_LOGE("Failed to register wma cb with Policy Manager"); |
| 3543 | } |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 3544 | |
Arif Hussain | f63f7a3 | 2017-08-22 12:49:42 -0700 | [diff] [blame] | 3545 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3546 | wmi_phyerr_event_id, |
Arif Hussain | f63f7a3 | 2017-08-22 12:49:42 -0700 | [diff] [blame] | 3547 | wma_unified_phyerr_rx_event_handler, |
| 3548 | WMA_RX_WORK_CTX); |
| 3549 | |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 3550 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 3551 | wmi_sap_obss_detection_report_event_id, |
| 3552 | wma_vdev_obss_detection_info_handler, |
| 3553 | WMA_RX_SERIALIZER_CTX); |
| 3554 | |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 3555 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 3556 | wmi_obss_color_collision_report_event_id, |
| 3557 | wma_vdev_bss_color_collision_info_handler, |
| 3558 | WMA_RX_WORK_CTX); |
| 3559 | |
| 3560 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3561 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3562 | |
| 3563 | err_dbglog_init: |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3564 | qdf_wake_lock_destroy(&wma_handle->wmi_cmd_rsp_wake_lock); |
Prashanth Bhatta | 87b6dc0 | 2017-01-19 15:17:58 -0800 | [diff] [blame] | 3565 | qdf_runtime_lock_deinit(&wma_handle->wmi_cmd_rsp_runtime_lock); |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3566 | qdf_spinlock_destroy(&wma_handle->vdev_respq_lock); |
| 3567 | qdf_spinlock_destroy(&wma_handle->wma_hold_req_q_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3568 | err_event_init: |
| 3569 | wmi_unified_unregister_event_handler(wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 3570 | wmi_debug_print_event_id); |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3571 | |
| 3572 | for (i = 0; i < wma_handle->max_bssid; ++i) |
| 3573 | wma_vdev_deinit(&wma_handle->interfaces[i]); |
| 3574 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3575 | qdf_mem_free(wma_handle->interfaces); |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3576 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3577 | err_scn_context: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3578 | qdf_mem_free(((p_cds_contextType) cds_context)->cfg_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3579 | OS_FREE(wmi_handle); |
| 3580 | |
| 3581 | err_wma_handle: |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3582 | target_if_free_psoc_tgt_info(psoc); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3583 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3584 | #ifdef FEATURE_WLAN_EXTSCAN |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3585 | qdf_wake_lock_destroy(&wma_handle->extscan_wake_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3586 | #endif /* FEATURE_WLAN_EXTSCAN */ |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3587 | qdf_wake_lock_destroy(&wma_handle->wow_wake_lock); |
Mukul Sharma | e44d054 | 2017-05-23 21:50:56 +0530 | [diff] [blame] | 3588 | qdf_wake_lock_destroy(&wma_handle->wow_auth_req_wl); |
| 3589 | qdf_wake_lock_destroy(&wma_handle->wow_assoc_req_wl); |
| 3590 | qdf_wake_lock_destroy(&wma_handle->wow_deauth_rec_wl); |
| 3591 | qdf_wake_lock_destroy(&wma_handle->wow_disassoc_rec_wl); |
| 3592 | qdf_wake_lock_destroy(&wma_handle->wow_ap_assoc_lost_wl); |
| 3593 | qdf_wake_lock_destroy(&wma_handle->wow_auto_shutdown_wl); |
| 3594 | qdf_wake_lock_destroy(&wma_handle->roam_ho_wl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3595 | } |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3596 | err_free_wma_handle: |
Jeff Johnson | adb3b1c | 2017-09-13 10:42:36 -0700 | [diff] [blame] | 3597 | cds_free_context(QDF_MODULE_ID_WMA, wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3598 | |
| 3599 | WMA_LOGD("%s: Exit", __func__); |
| 3600 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3601 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3602 | } |
| 3603 | |
| 3604 | /** |
| 3605 | * wma_pre_start() - wma pre start |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3606 | * |
| 3607 | * Return: 0 on success, errno on failure |
| 3608 | */ |
Jeff Johnson | 8ad89c6 | 2017-09-13 08:55:55 -0700 | [diff] [blame] | 3609 | QDF_STATUS wma_pre_start(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3610 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3611 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3612 | tp_wma_handle wma_handle; |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 3613 | struct scheduler_msg wma_msg = { 0 }; |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3614 | void *htc_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3615 | |
| 3616 | WMA_LOGD("%s: Enter", __func__); |
| 3617 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3618 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3619 | |
| 3620 | /* Validate the wma_handle */ |
| 3621 | if (NULL == wma_handle) { |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3622 | WMA_LOGE("%s: invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3623 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3624 | goto end; |
| 3625 | } |
Nachiket Kukade | 8003d25 | 2017-03-30 15:55:58 +0530 | [diff] [blame] | 3626 | |
Sourav Mohapatra | cf63257 | 2018-04-02 11:01:35 +0530 | [diff] [blame^] | 3627 | htc_handle = lmac_get_htc_hdl(wma_handle->psoc); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 3628 | if (!htc_handle) { |
| 3629 | WMA_LOGE("%s: invalid htc handle", __func__); |
| 3630 | qdf_status = QDF_STATUS_E_INVAL; |
| 3631 | goto end; |
| 3632 | } |
| 3633 | |
| 3634 | /* Open endpoint for ctrl path - WMI <--> HTC */ |
| 3635 | qdf_status = wmi_unified_connect_htc_service(wma_handle->wmi_handle, |
| 3636 | htc_handle); |
| 3637 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 3638 | WMA_LOGE("%s: wmi_unified_connect_htc_service", __func__); |
Nachiket Kukade | 8003d25 | 2017-03-30 15:55:58 +0530 | [diff] [blame] | 3639 | if (!cds_is_fw_down()) |
| 3640 | QDF_BUG(0); |
| 3641 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3642 | qdf_status = QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3643 | goto end; |
| 3644 | } |
| 3645 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 3646 | WMA_LOGD("WMA --> wmi_unified_connect_htc_service - success"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3647 | |
| 3648 | /* Trigger the CFG DOWNLOAD */ |
| 3649 | wma_msg.type = WNI_CFG_DNLD_REQ; |
| 3650 | wma_msg.bodyptr = NULL; |
| 3651 | wma_msg.bodyval = 0; |
| 3652 | |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 3653 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, &wma_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3654 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3655 | WMA_LOGE("%s: Failed to post WNI_CFG_DNLD_REQ msg", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3656 | QDF_ASSERT(0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3657 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3658 | } |
| 3659 | end: |
| 3660 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3661 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3662 | } |
| 3663 | |
Abhishek Singh | 2d775fd | 2017-08-18 10:51:33 +0530 | [diff] [blame] | 3664 | void wma_send_msg_by_priority(tp_wma_handle wma_handle, uint16_t msg_type, |
| 3665 | void *body_ptr, uint32_t body_val, bool is_high_priority) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3666 | { |
Abhishek Singh | 2d775fd | 2017-08-18 10:51:33 +0530 | [diff] [blame] | 3667 | struct scheduler_msg msg = {0}; |
| 3668 | QDF_STATUS status; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3669 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3670 | msg.type = msg_type; |
| 3671 | msg.bodyval = body_val; |
| 3672 | msg.bodyptr = body_ptr; |
Will Huang | 9323e85 | 2018-02-02 17:55:15 +0800 | [diff] [blame] | 3673 | msg.flush_callback = wma_discard_fw_event; |
Abhishek Singh | 2d775fd | 2017-08-18 10:51:33 +0530 | [diff] [blame] | 3674 | |
| 3675 | status = scheduler_post_msg_by_priority(QDF_MODULE_ID_PE, |
| 3676 | &msg, is_high_priority); |
| 3677 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 3678 | WMA_LOGE("Failed to post msg %d to PE", msg_type); |
| 3679 | if (body_ptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3680 | qdf_mem_free(body_ptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3681 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3682 | } |
| 3683 | |
Abhishek Singh | 2d775fd | 2017-08-18 10:51:33 +0530 | [diff] [blame] | 3684 | |
| 3685 | void wma_send_msg(tp_wma_handle wma_handle, uint16_t msg_type, |
| 3686 | void *body_ptr, uint32_t body_val) |
| 3687 | { |
| 3688 | wma_send_msg_by_priority(wma_handle, msg_type, |
| 3689 | body_ptr, body_val, false); |
| 3690 | } |
| 3691 | |
| 3692 | void wma_send_msg_high_priority(tp_wma_handle wma_handle, uint16_t msg_type, |
| 3693 | void *body_ptr, uint32_t body_val) |
| 3694 | { |
| 3695 | wma_send_msg_by_priority(wma_handle, msg_type, |
| 3696 | body_ptr, body_val, true); |
| 3697 | } |
| 3698 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3699 | /** |
| 3700 | * wma_set_base_macaddr_indicate() - set base mac address in fw |
| 3701 | * @wma_handle: wma handle |
| 3702 | * @customAddr: base mac address |
| 3703 | * |
| 3704 | * Return: 0 for success or error code |
| 3705 | */ |
| 3706 | static int wma_set_base_macaddr_indicate(tp_wma_handle wma_handle, |
| 3707 | tSirMacAddr *customAddr) |
| 3708 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3709 | int err; |
| 3710 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 3711 | err = wmi_unified_set_base_macaddr_indicate_cmd(wma_handle->wmi_handle, |
| 3712 | (uint8_t *)customAddr); |
| 3713 | if (err) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3714 | return -EIO; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3715 | WMA_LOGD("Base MAC Addr: " MAC_ADDRESS_STR, |
| 3716 | MAC_ADDR_ARRAY((*customAddr))); |
| 3717 | |
| 3718 | return 0; |
| 3719 | } |
| 3720 | |
| 3721 | /** |
| 3722 | * wma_log_supported_evt_handler() - Enable/Disable FW diag/log events |
| 3723 | * @handle: WMA handle |
| 3724 | * @event: Event received from FW |
| 3725 | * @len: Length of the event |
| 3726 | * |
| 3727 | * Enables the low frequency events and disables the high frequency |
| 3728 | * events. Bit 17 indicates if the event if low/high frequency. |
| 3729 | * 1 - high frequency, 0 - low frequency |
| 3730 | * |
| 3731 | * Return: 0 on successfully enabling/disabling the events |
| 3732 | */ |
| 3733 | static int wma_log_supported_evt_handler(void *handle, |
| 3734 | uint8_t *event, |
| 3735 | uint32_t len) |
| 3736 | { |
| 3737 | tp_wma_handle wma = (tp_wma_handle) handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3738 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 3739 | if (wmi_unified_log_supported_evt_cmd(wma->wmi_handle, |
| 3740 | event, len)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3741 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3742 | |
| 3743 | return 0; |
| 3744 | } |
| 3745 | |
| 3746 | /** |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3747 | * 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] | 3748 | * @handle: WMI handle |
| 3749 | * @event: Event recevied from FW |
| 3750 | * @len: Length of the event |
| 3751 | * |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3752 | * Event handler for WMI_PDEV_SET_HW_MODE_RESP_EVENTID that is sent to host |
| 3753 | * driver in response to a WMI_PDEV_SET_HW_MODE_CMDID being sent to WLAN |
| 3754 | * firmware |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3755 | * |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3756 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3757 | */ |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3758 | static int wma_pdev_set_hw_mode_resp_evt_handler(void *handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3759 | uint8_t *event, |
| 3760 | uint32_t len) |
| 3761 | { |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3762 | WMI_PDEV_SET_HW_MODE_RESP_EVENTID_param_tlvs *param_buf; |
| 3763 | wmi_pdev_set_hw_mode_response_event_fixed_param *wmi_event; |
| 3764 | wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3765 | uint32_t i; |
| 3766 | struct sir_set_hw_mode_resp *hw_mode_resp; |
| 3767 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 3768 | |
| 3769 | if (!wma) { |
| 3770 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 3771 | /* Since WMA handle itself is NULL, we cannot send fail |
| 3772 | * response back to LIM here |
| 3773 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3774 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3775 | } |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3776 | |
| 3777 | wma_release_wakelock(&wma->wmi_cmd_rsp_wake_lock); |
Tushnim Bhattacharyya | 4a03db8 | 2017-11-10 17:58:28 -0800 | [diff] [blame] | 3778 | wma_remove_req(wma, 0, WMA_PDEV_SET_HW_MODE_RESP); |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 3779 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3780 | hw_mode_resp = qdf_mem_malloc(sizeof(*hw_mode_resp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3781 | if (!hw_mode_resp) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3782 | WMA_LOGE("%s: Memory allocation failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3783 | /* Since this memory allocation itself failed, we cannot |
| 3784 | * send fail response back to LIM here |
| 3785 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3786 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3787 | } |
| 3788 | |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3789 | param_buf = (WMI_PDEV_SET_HW_MODE_RESP_EVENTID_param_tlvs *) event; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3790 | if (!param_buf) { |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3791 | WMA_LOGE("Invalid WMI_PDEV_SET_HW_MODE_RESP_EVENTID event"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3792 | /* Need to send response back to upper layer to free |
| 3793 | * active command list |
| 3794 | */ |
| 3795 | goto fail; |
| 3796 | } |
Krunal Soni | 50a0554 | 2017-10-03 19:39:48 -0700 | [diff] [blame] | 3797 | if (param_buf->fixed_param->num_vdev_mac_entries >= |
| 3798 | MAX_VDEV_SUPPORTED) { |
| 3799 | WMA_LOGE("num_vdev_mac_entries crossed max value"); |
| 3800 | goto fail; |
| 3801 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3802 | |
| 3803 | wmi_event = param_buf->fixed_param; |
Abhinav Kumar | a03659c | 2017-12-28 15:18:07 +0530 | [diff] [blame] | 3804 | if (wmi_event->num_vdev_mac_entries > |
| 3805 | param_buf->num_wmi_pdev_set_hw_mode_response_vdev_mac_mapping) { |
| 3806 | WMA_LOGE("Invalid num_vdev_mac_entries: %d", |
| 3807 | wmi_event->num_vdev_mac_entries); |
| 3808 | goto fail; |
| 3809 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3810 | hw_mode_resp->status = wmi_event->status; |
| 3811 | hw_mode_resp->cfgd_hw_mode_index = wmi_event->cfgd_hw_mode_index; |
| 3812 | hw_mode_resp->num_vdev_mac_entries = wmi_event->num_vdev_mac_entries; |
| 3813 | |
Kiran Kumar Lokere | 1d411bb | 2017-11-29 15:24:05 -0800 | [diff] [blame] | 3814 | 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] | 3815 | __func__, wmi_event->status, |
| 3816 | wmi_event->cfgd_hw_mode_index, |
| 3817 | wmi_event->num_vdev_mac_entries); |
| 3818 | vdev_mac_entry = |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3819 | param_buf->wmi_pdev_set_hw_mode_response_vdev_mac_mapping; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3820 | |
| 3821 | /* Store the vdev-mac map in WMA and prepare to send to PE */ |
| 3822 | for (i = 0; i < wmi_event->num_vdev_mac_entries; i++) { |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3823 | uint32_t vdev_id, mac_id, pdev_id; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3824 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3825 | vdev_id = vdev_mac_entry[i].vdev_id; |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3826 | pdev_id = vdev_mac_entry[i].pdev_id; |
| 3827 | if (pdev_id == WMI_PDEV_ID_SOC) { |
| 3828 | WMA_LOGE("%s: soc level id received for mac id)", |
| 3829 | __func__); |
| 3830 | QDF_BUG(0); |
| 3831 | goto fail; |
| 3832 | } |
| 3833 | 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] | 3834 | |
Kiran Kumar Lokere | 1d411bb | 2017-11-29 15:24:05 -0800 | [diff] [blame] | 3835 | WMA_LOGD("%s: vdev_id:%d mac_id:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3836 | __func__, vdev_id, mac_id); |
| 3837 | |
| 3838 | hw_mode_resp->vdev_mac_map[i].vdev_id = vdev_id; |
| 3839 | hw_mode_resp->vdev_mac_map[i].mac_id = mac_id; |
| 3840 | wma_update_intf_hw_mode_params(vdev_id, mac_id, |
| 3841 | wmi_event->cfgd_hw_mode_index); |
| 3842 | } |
| 3843 | |
| 3844 | if (hw_mode_resp->status == SET_HW_MODE_STATUS_OK) { |
| 3845 | if (WMA_DEFAULT_HW_MODE_INDEX == wma->new_hw_mode_index) { |
| 3846 | wma->new_hw_mode_index = wmi_event->cfgd_hw_mode_index; |
| 3847 | } else { |
| 3848 | wma->old_hw_mode_index = wma->new_hw_mode_index; |
| 3849 | wma->new_hw_mode_index = wmi_event->cfgd_hw_mode_index; |
| 3850 | } |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 3851 | policy_mgr_update_hw_mode_index(wma->psoc, |
| 3852 | wmi_event->cfgd_hw_mode_index); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3853 | } |
| 3854 | |
Kiran Kumar Lokere | 1d411bb | 2017-11-29 15:24:05 -0800 | [diff] [blame] | 3855 | 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] | 3856 | __func__, wma->old_hw_mode_index, wma->new_hw_mode_index); |
| 3857 | |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3858 | wma_send_msg(wma, SIR_HAL_PDEV_SET_HW_MODE_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3859 | (void *) hw_mode_resp, 0); |
| 3860 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3861 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3862 | |
| 3863 | fail: |
| 3864 | WMA_LOGE("%s: Sending fail response to LIM", __func__); |
| 3865 | hw_mode_resp->status = SET_HW_MODE_STATUS_ECANCELED; |
| 3866 | hw_mode_resp->cfgd_hw_mode_index = 0; |
| 3867 | hw_mode_resp->num_vdev_mac_entries = 0; |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3868 | wma_send_msg(wma, SIR_HAL_PDEV_SET_HW_MODE_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3869 | (void *) hw_mode_resp, 0); |
| 3870 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3871 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3872 | } |
| 3873 | |
| 3874 | /** |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3875 | * wma_process_pdev_hw_mode_trans_ind() - Process HW mode transition info |
| 3876 | * |
| 3877 | * @handle: WMA handle |
| 3878 | * @fixed_param: Event fixed parameters |
| 3879 | * @vdev_mac_entry - vdev mac entry |
| 3880 | * @hw_mode_trans_ind - Buffer to store parsed information |
| 3881 | * |
| 3882 | * Parses fixed_param, vdev_mac_entry and fills in the information into |
| 3883 | * hw_mode_trans_ind and wma |
| 3884 | * |
| 3885 | * Return: None |
| 3886 | */ |
| 3887 | void wma_process_pdev_hw_mode_trans_ind(void *handle, |
| 3888 | wmi_pdev_hw_mode_transition_event_fixed_param *fixed_param, |
| 3889 | wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry, |
| 3890 | struct sir_hw_mode_trans_ind *hw_mode_trans_ind) |
| 3891 | { |
| 3892 | uint32_t i; |
| 3893 | tp_wma_handle wma = (tp_wma_handle) handle; |
gaurank kathpalia | d2967a7 | 2018-05-01 12:35:14 +0530 | [diff] [blame] | 3894 | if (fixed_param->num_vdev_mac_entries > MAX_VDEV_SUPPORTED) { |
| 3895 | WMA_LOGE("Number of Vdev mac entries %d exceeded" |
| 3896 | " max vdev supported %d", |
| 3897 | fixed_param->num_vdev_mac_entries, |
| 3898 | MAX_VDEV_SUPPORTED); |
| 3899 | return; |
| 3900 | } |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3901 | hw_mode_trans_ind->old_hw_mode_index = fixed_param->old_hw_mode_index; |
| 3902 | hw_mode_trans_ind->new_hw_mode_index = fixed_param->new_hw_mode_index; |
| 3903 | hw_mode_trans_ind->num_vdev_mac_entries = |
| 3904 | fixed_param->num_vdev_mac_entries; |
Kiran Kumar Lokere | 1d411bb | 2017-11-29 15:24:05 -0800 | [diff] [blame] | 3905 | 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] | 3906 | __func__, fixed_param->old_hw_mode_index, |
| 3907 | fixed_param->new_hw_mode_index, |
| 3908 | fixed_param->num_vdev_mac_entries); |
| 3909 | |
| 3910 | /* Store the vdev-mac map in WMA and send to policy manager */ |
| 3911 | for (i = 0; i < fixed_param->num_vdev_mac_entries; i++) { |
| 3912 | uint32_t vdev_id, mac_id, pdev_id; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3913 | |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3914 | vdev_id = vdev_mac_entry[i].vdev_id; |
| 3915 | pdev_id = vdev_mac_entry[i].pdev_id; |
| 3916 | |
| 3917 | if (pdev_id == WMI_PDEV_ID_SOC) { |
| 3918 | WMA_LOGE("%s: soc level id received for mac id)", |
| 3919 | __func__); |
| 3920 | QDF_BUG(0); |
| 3921 | return; |
| 3922 | } |
| 3923 | |
| 3924 | mac_id = WMA_PDEV_TO_MAC_MAP(vdev_mac_entry[i].pdev_id); |
| 3925 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3926 | WMA_LOGE("%s: vdev_id:%d mac_id:%d", |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3927 | __func__, vdev_id, mac_id); |
| 3928 | |
| 3929 | hw_mode_trans_ind->vdev_mac_map[i].vdev_id = vdev_id; |
| 3930 | hw_mode_trans_ind->vdev_mac_map[i].mac_id = mac_id; |
| 3931 | wma_update_intf_hw_mode_params(vdev_id, mac_id, |
| 3932 | fixed_param->new_hw_mode_index); |
| 3933 | } |
| 3934 | wma->old_hw_mode_index = fixed_param->old_hw_mode_index; |
| 3935 | wma->new_hw_mode_index = fixed_param->new_hw_mode_index; |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 3936 | policy_mgr_update_new_hw_mode_index(wma->psoc, |
| 3937 | fixed_param->new_hw_mode_index); |
| 3938 | policy_mgr_update_old_hw_mode_index(wma->psoc, |
| 3939 | fixed_param->old_hw_mode_index); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3940 | |
Kiran Kumar Lokere | 1d411bb | 2017-11-29 15:24:05 -0800 | [diff] [blame] | 3941 | 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] | 3942 | __func__, wma->old_hw_mode_index, wma->new_hw_mode_index); |
| 3943 | } |
| 3944 | |
| 3945 | /** |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3946 | * wma_pdev_hw_mode_transition_evt_handler() - HW mode transition evt handler |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3947 | * @handle: WMI handle |
| 3948 | * @event: Event recevied from FW |
| 3949 | * @len: Length of the event |
| 3950 | * |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3951 | * Event handler for WMI_PDEV_HW_MODE_TRANSITION_EVENTID that indicates an |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3952 | * asynchronous hardware mode transition. This event notifies the host driver |
| 3953 | * that firmware independently changed the hardware mode for some reason, such |
| 3954 | * as Coex, LFR 3.0, etc |
| 3955 | * |
| 3956 | * Return: Success on receiving valid params from FW |
| 3957 | */ |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3958 | static int wma_pdev_hw_mode_transition_evt_handler(void *handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3959 | uint8_t *event, |
| 3960 | uint32_t len) |
| 3961 | { |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3962 | WMI_PDEV_HW_MODE_TRANSITION_EVENTID_param_tlvs *param_buf; |
| 3963 | wmi_pdev_hw_mode_transition_event_fixed_param *wmi_event; |
| 3964 | wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3965 | struct sir_hw_mode_trans_ind *hw_mode_trans_ind; |
| 3966 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 3967 | |
| 3968 | if (!wma) { |
| 3969 | /* This is an async event. So, not sending any event to LIM */ |
| 3970 | WMA_LOGE("Invalid WMA handle"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3971 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3972 | } |
| 3973 | |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3974 | param_buf = (WMI_PDEV_HW_MODE_TRANSITION_EVENTID_param_tlvs *) event; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3975 | if (!param_buf) { |
| 3976 | /* This is an async event. So, not sending any event to LIM */ |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3977 | WMA_LOGE("Invalid WMI_PDEV_HW_MODE_TRANSITION_EVENTID event"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3978 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3979 | } |
| 3980 | |
Arif Hussain | 34f7206 | 2017-10-04 17:25:24 -0700 | [diff] [blame] | 3981 | if (param_buf->fixed_param->num_vdev_mac_entries > MAX_VDEV_SUPPORTED) { |
| 3982 | WMA_LOGE("num_vdev_mac_entries: %d crossed max value: %d", |
| 3983 | param_buf->fixed_param->num_vdev_mac_entries, |
| 3984 | MAX_VDEV_SUPPORTED); |
| 3985 | return QDF_STATUS_E_FAILURE; |
| 3986 | } |
| 3987 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3988 | hw_mode_trans_ind = qdf_mem_malloc(sizeof(*hw_mode_trans_ind)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3989 | if (!hw_mode_trans_ind) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3990 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 3991 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3992 | } |
| 3993 | |
| 3994 | wmi_event = param_buf->fixed_param; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3995 | vdev_mac_entry = |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3996 | param_buf->wmi_pdev_set_hw_mode_response_vdev_mac_mapping; |
Abhinav Kumar | a03659c | 2017-12-28 15:18:07 +0530 | [diff] [blame] | 3997 | if (wmi_event->num_vdev_mac_entries > |
| 3998 | param_buf->num_wmi_pdev_set_hw_mode_response_vdev_mac_mapping) { |
| 3999 | WMA_LOGE("Invalid num_vdev_mac_entries: %d", |
| 4000 | wmi_event->num_vdev_mac_entries); |
| 4001 | qdf_mem_free(hw_mode_trans_ind); |
| 4002 | return -EINVAL; |
| 4003 | } |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4004 | wma_process_pdev_hw_mode_trans_ind(wma, wmi_event, vdev_mac_entry, |
| 4005 | hw_mode_trans_ind); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4006 | /* Pass the message to PE */ |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 4007 | wma_send_msg(wma, SIR_HAL_PDEV_HW_MODE_TRANS_IND, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4008 | (void *) hw_mode_trans_ind, 0); |
| 4009 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4010 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4011 | } |
| 4012 | |
| 4013 | /** |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4014 | * 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] | 4015 | * @handle: WMI handle |
| 4016 | * @event: Event received from FW |
| 4017 | * @len: Length of the event |
| 4018 | * |
| 4019 | * Notifies the host driver of the completion or failure of a |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4020 | * 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] | 4021 | * the host driver once the firmware has completed a reconfiguration of the Scan |
| 4022 | * and FW mode configuration. This changes could include entering or leaving a |
| 4023 | * dual mac configuration for either scan and/or more permanent firmware mode. |
| 4024 | * |
| 4025 | * Return: Success on receiving valid params from FW |
| 4026 | */ |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4027 | 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] | 4028 | uint8_t *event, |
| 4029 | uint32_t len) |
| 4030 | { |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4031 | WMI_PDEV_SET_MAC_CONFIG_RESP_EVENTID_param_tlvs *param_buf; |
| 4032 | wmi_pdev_set_mac_config_response_event_fixed_param *wmi_event; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4033 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 4034 | struct sir_dual_mac_config_resp *dual_mac_cfg_resp; |
| 4035 | |
| 4036 | if (!wma) { |
| 4037 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 4038 | /* Since the WMA handle is NULL, we cannot send resp to LIM. |
| 4039 | * So, returning from here. |
| 4040 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4041 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4042 | } |
Krunal Soni | a5ccb80 | 2017-07-03 12:59:40 -0700 | [diff] [blame] | 4043 | wma_release_wakelock(&wma->wmi_cmd_rsp_wake_lock); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4044 | dual_mac_cfg_resp = qdf_mem_malloc(sizeof(*dual_mac_cfg_resp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4045 | if (!dual_mac_cfg_resp) { |
| 4046 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 4047 | /* Since the mem alloc failed, we cannot send resp to LIM. |
| 4048 | * So, returning from here. |
| 4049 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4050 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4051 | } |
| 4052 | |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4053 | param_buf = (WMI_PDEV_SET_MAC_CONFIG_RESP_EVENTID_param_tlvs *) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4054 | event; |
| 4055 | if (!param_buf) { |
| 4056 | WMA_LOGE("%s: Invalid event", __func__); |
| 4057 | goto fail; |
| 4058 | } |
| 4059 | |
| 4060 | wmi_event = param_buf->fixed_param; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4061 | WMA_LOGD("%s: status:%d", __func__, wmi_event->status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4062 | dual_mac_cfg_resp->status = wmi_event->status; |
| 4063 | |
| 4064 | if (SET_HW_MODE_STATUS_OK == dual_mac_cfg_resp->status) { |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 4065 | policy_mgr_update_dbs_scan_config(wma->psoc); |
| 4066 | policy_mgr_update_dbs_fw_config(wma->psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4067 | } |
| 4068 | |
| 4069 | /* Pass the message to PE */ |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4070 | wma_send_msg(wma, SIR_HAL_PDEV_MAC_CFG_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4071 | (void *) dual_mac_cfg_resp, 0); |
| 4072 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4073 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4074 | |
| 4075 | fail: |
| 4076 | WMA_LOGE("%s: Sending fail response to LIM", __func__); |
| 4077 | dual_mac_cfg_resp->status = SET_HW_MODE_STATUS_ECANCELED; |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4078 | wma_send_msg(wma, SIR_HAL_PDEV_MAC_CFG_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4079 | (void *) dual_mac_cfg_resp, 0); |
| 4080 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4081 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4082 | |
| 4083 | } |
| 4084 | |
| 4085 | /** |
gaurank kathpalia | 85f8a61 | 2018-02-21 18:55:24 +0530 | [diff] [blame] | 4086 | * wma_send_time_stamp_sync_cmd() - timer callback send timestamp to |
| 4087 | * firmware to sync with host. |
| 4088 | * @wma_handle: wma handle |
| 4089 | * |
| 4090 | * Return: void |
| 4091 | */ |
| 4092 | static void wma_send_time_stamp_sync_cmd(void *data) |
| 4093 | { |
| 4094 | tp_wma_handle wma_handle; |
| 4095 | QDF_STATUS qdf_status; |
| 4096 | |
| 4097 | wma_handle = (tp_wma_handle) data; |
| 4098 | |
| 4099 | wmi_send_time_stamp_sync_cmd_tlv(wma_handle->wmi_handle); |
| 4100 | |
| 4101 | /* Start/Restart the timer */ |
| 4102 | qdf_status = qdf_mc_timer_start(&wma_handle->wma_fw_time_sync_timer, |
| 4103 | WMA_FW_TIME_SYNC_TIMER); |
| 4104 | if (QDF_IS_STATUS_ERROR(qdf_status)) |
| 4105 | WMA_LOGE("Failed to start the firmware time sync timer"); |
| 4106 | } |
| 4107 | |
| 4108 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4109 | * wma_start() - wma start function. |
| 4110 | * Intialize event handlers and timers. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4111 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4112 | * Return: 0 on success, QDF Error on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4113 | */ |
Jeff Johnson | d489255 | 2017-09-13 08:41:31 -0700 | [diff] [blame] | 4114 | QDF_STATUS wma_start(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4115 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4116 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4117 | tp_wma_handle wma_handle; |
| 4118 | int status; |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 4119 | struct wmi_spectral_cmd_ops cmd_ops; |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4120 | struct wmi_unified *wmi_handle; |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 4121 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4122 | WMA_LOGD("%s: Enter", __func__); |
| 4123 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4124 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4125 | /* validate the wma_handle */ |
| 4126 | if (NULL == wma_handle) { |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4127 | WMA_LOGE("%s: Invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4128 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4129 | goto end; |
| 4130 | } |
Sandeep Puligilla | d698bf5 | 2017-09-15 16:07:02 -0700 | [diff] [blame] | 4131 | |
Sourav Mohapatra | cf63257 | 2018-04-02 11:01:35 +0530 | [diff] [blame^] | 4132 | wmi_handle = get_wmi_unified_hdl_from_psoc(wma_handle->psoc); |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4133 | if (!wmi_handle) { |
| 4134 | WMA_LOGE("%s: Invalid wmi handle", __func__); |
| 4135 | qdf_status = QDF_STATUS_E_INVAL; |
| 4136 | goto end; |
| 4137 | } |
| 4138 | |
| 4139 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4140 | wmi_roam_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4141 | wma_roam_event_callback, |
Padma, Santhosh Kumar | 18169ce | 2017-03-02 18:04:02 +0530 | [diff] [blame] | 4142 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4143 | if (0 != status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4144 | WMA_LOGE("%s: Failed to register Roam callback", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4145 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4146 | goto end; |
| 4147 | } |
| 4148 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4149 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4150 | wmi_wow_wakeup_host_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4151 | wma_wow_wakeup_host_event, |
| 4152 | WMA_RX_TASKLET_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4153 | if (status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4154 | WMA_LOGE("%s: Failed to register wow wakeup host event handler", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4155 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4156 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4157 | goto end; |
| 4158 | } |
| 4159 | |
Will Huang | 3cd2b7c | 2017-11-17 13:16:56 +0800 | [diff] [blame] | 4160 | if (wma_d0_wow_is_supported()) { |
| 4161 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4162 | wmi_handle, |
Will Huang | 9adefff | 2017-12-15 14:50:03 +0800 | [diff] [blame] | 4163 | wmi_d0_wow_disable_ack_event_id, |
Will Huang | 3cd2b7c | 2017-11-17 13:16:56 +0800 | [diff] [blame] | 4164 | wma_d0_wow_disable_ack_event, |
| 4165 | WMA_RX_TASKLET_CTX); |
| 4166 | if (status) { |
| 4167 | WMA_LOGE("%s: Failed to register d0wow disable ack" |
| 4168 | " event handler", __func__); |
| 4169 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4170 | goto end; |
| 4171 | } |
| 4172 | } |
| 4173 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4174 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4175 | wmi_pdev_resume_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4176 | wma_pdev_resume_event_handler, |
| 4177 | WMA_RX_TASKLET_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4178 | if (status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4179 | WMA_LOGE("%s: Failed to register PDEV resume event handler", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4180 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4181 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4182 | goto end; |
| 4183 | } |
Poddar, Siddarth | 5a91f5b | 2016-04-28 12:24:10 +0530 | [diff] [blame] | 4184 | #if defined(QCA_LL_LEGACY_TX_FLOW_CONTROL) || \ |
| 4185 | defined(QCA_LL_TX_FLOW_CONTROL_V2) || defined(CONFIG_HL_SUPPORT) |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 4186 | WMA_LOGD("MCC TX Pause Event Handler register"); |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4187 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4188 | wmi_tx_pause_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4189 | wma_mcc_vdev_tx_pause_evt_handler, |
| 4190 | WMA_RX_TASKLET_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4191 | #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ |
| 4192 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4193 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 4194 | WMA_LOGD("Registering auto shutdown handler"); |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4195 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4196 | wmi_host_auto_shutdown_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4197 | wma_auto_shutdown_event_handler, |
| 4198 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4199 | if (status) { |
| 4200 | WMA_LOGE("Failed to register WMI Auto shutdown event handler"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4201 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4202 | goto end; |
| 4203 | } |
| 4204 | #endif /* FEATURE_WLAN_AUTO_SHUTDOWN */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4205 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4206 | wmi_thermal_mgmt_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4207 | wma_thermal_mgmt_evt_handler, |
| 4208 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4209 | if (status) { |
| 4210 | WMA_LOGE("Failed to register thermal mitigation event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4211 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4212 | goto end; |
| 4213 | } |
| 4214 | |
Zhang Qian | 47e22ce | 2018-01-04 15:38:38 +0800 | [diff] [blame] | 4215 | status = wma_ocb_register_callbacks(wma_handle); |
| 4216 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 4217 | WMA_LOGE("Failed to register OCB callbacks"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4218 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4219 | goto end; |
| 4220 | } |
| 4221 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4222 | qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4223 | |
| 4224 | #ifdef QCA_WIFI_FTM |
| 4225 | /* |
| 4226 | * Tx mgmt attach requires TXRX context which is not created |
| 4227 | * in FTM mode. So skip the TX mgmt attach. |
| 4228 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4229 | if (cds_get_conparam() == QDF_GLOBAL_FTM_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4230 | goto end; |
| 4231 | #endif /* QCA_WIFI_FTM */ |
| 4232 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4233 | if (wmi_service_enabled(wmi_handle, wmi_service_rmc)) { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4234 | |
| 4235 | WMA_LOGD("FW supports cesium network, registering event handlers"); |
| 4236 | |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4237 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4238 | wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4239 | wmi_peer_info_event_id, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4240 | wma_ibss_peer_info_event_handler, |
| 4241 | WMA_RX_SERIALIZER_CTX); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4242 | if (status) { |
| 4243 | WMA_LOGE("Failed to register ibss peer info event cb"); |
| 4244 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4245 | goto end; |
| 4246 | } |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4247 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4248 | wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4249 | wmi_peer_tx_fail_cnt_thr_event_id, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4250 | wma_fast_tx_fail_event_handler, |
| 4251 | WMA_RX_SERIALIZER_CTX); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4252 | if (status) { |
| 4253 | WMA_LOGE("Failed to register peer fast tx failure event cb"); |
| 4254 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4255 | goto end; |
| 4256 | } |
| 4257 | } else { |
| 4258 | WMA_LOGE("Target does not support cesium network"); |
| 4259 | } |
| 4260 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4261 | qdf_status = wma_tx_attach(wma_handle); |
| 4262 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4263 | WMA_LOGE("%s: Failed to register tx management", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4264 | goto end; |
| 4265 | } |
| 4266 | |
gaurank kathpalia | 85f8a61 | 2018-02-21 18:55:24 +0530 | [diff] [blame] | 4267 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
| 4268 | /* Initialize firmware time stamp sync timer */ |
| 4269 | qdf_status = |
| 4270 | qdf_mc_timer_init(&wma_handle->wma_fw_time_sync_timer, |
| 4271 | QDF_TIMER_TYPE_SW, |
| 4272 | wma_send_time_stamp_sync_cmd, |
| 4273 | wma_handle); |
| 4274 | if (QDF_IS_STATUS_ERROR(qdf_status)) |
| 4275 | WMA_LOGE(FL("Failed to initialize firmware time stamp sync timer")); |
| 4276 | /* Start firmware time stamp sync timer */ |
| 4277 | wma_send_time_stamp_sync_cmd(wma_handle); |
| 4278 | } |
| 4279 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4280 | /* Initialize log completion timeout */ |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 4281 | qdf_status = qdf_mc_timer_init(&wma_handle->log_completion_timer, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4282 | QDF_TIMER_TYPE_SW, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4283 | wma_log_completion_timeout, |
| 4284 | wma_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4285 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4286 | WMA_LOGE("Failed to initialize log completion timeout"); |
| 4287 | goto end; |
| 4288 | } |
| 4289 | |
Jeff Johnson | 6136fb9 | 2017-03-30 15:21:49 -0700 | [diff] [blame] | 4290 | status = wma_fips_register_event_handlers(wma_handle); |
| 4291 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 4292 | WMA_LOGE("Failed to register FIPS event handler"); |
| 4293 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4294 | goto end; |
| 4295 | } |
| 4296 | |
Jeff Johnson | f0e54b0 | 2017-12-18 15:22:25 -0800 | [diff] [blame] | 4297 | status = wma_sar_register_event_handlers(wma_handle); |
| 4298 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 4299 | WMA_LOGE("Failed to register SAR event handlers"); |
| 4300 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4301 | goto end; |
| 4302 | } |
| 4303 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4304 | /* Initialize the get temperature event handler */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4305 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4306 | wmi_pdev_temperature_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4307 | wma_pdev_temperature_evt_handler, |
| 4308 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4309 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4310 | WMA_LOGE("Failed to register get_temperature event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4311 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4312 | goto end; |
| 4313 | } |
| 4314 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4315 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4316 | wmi_vdev_tsf_report_event_id, |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 4317 | wma_vdev_tsf_handler, |
| 4318 | WMA_RX_SERIALIZER_CTX); |
| 4319 | if (0 != status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4320 | WMA_LOGE("%s: Failed to register tsf callback", __func__); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 4321 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4322 | goto end; |
| 4323 | } |
| 4324 | |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 4325 | /* Initialize the wma_pdev_set_hw_mode_resp_evt_handler event handler */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4326 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4327 | wmi_pdev_set_hw_mode_rsp_event_id, |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 4328 | wma_pdev_set_hw_mode_resp_evt_handler, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4329 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4330 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4331 | WMA_LOGE("Failed to register set hw mode resp event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4332 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4333 | goto end; |
| 4334 | } |
| 4335 | |
| 4336 | /* Initialize the WMI_SOC_HW_MODE_TRANSITION_EVENTID event handler */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4337 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4338 | wmi_pdev_hw_mode_transition_event_id, |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 4339 | wma_pdev_hw_mode_transition_evt_handler, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4340 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4341 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4342 | WMA_LOGE("Failed to register hw mode transition event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4343 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4344 | goto end; |
| 4345 | } |
| 4346 | |
| 4347 | /* Initialize the set dual mac configuration event handler */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4348 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4349 | wmi_pdev_set_mac_config_resp_event_id, |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 4350 | wma_pdev_set_dual_mode_config_resp_evt_handler, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4351 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4352 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4353 | WMA_LOGE("Failed to register hw mode transition event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4354 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4355 | goto end; |
| 4356 | } |
| 4357 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 4358 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 4359 | wmi_coex_bt_activity_event_id, |
Vidyullatha Kanchanapally | be0ebb3 | 2017-03-23 14:36:21 +0530 | [diff] [blame] | 4360 | wma_wlan_bt_activity_evt_handler, |
| 4361 | WMA_RX_SERIALIZER_CTX); |
| 4362 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 4363 | WMA_LOGE("Failed to register coex bt activity event handler"); |
| 4364 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4365 | goto end; |
| 4366 | } |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 4367 | |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 4368 | cmd_ops.wmi_spectral_configure_cmd_send = |
| 4369 | wmi_unified_vdev_spectral_configure_cmd_send; |
| 4370 | cmd_ops.wmi_spectral_enable_cmd_send = |
| 4371 | wmi_unified_vdev_spectral_enable_cmd_send; |
| 4372 | wlan_register_wmi_spectral_cmd_ops(wma_handle->pdev, &cmd_ops); |
Vidyullatha Kanchanapally | be0ebb3 | 2017-03-23 14:36:21 +0530 | [diff] [blame] | 4373 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4374 | end: |
| 4375 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4376 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4377 | } |
| 4378 | |
| 4379 | /** |
| 4380 | * wma_stop() - wma stop function. |
| 4381 | * cleanup timers and suspend target. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4382 | * @reason: reason for wma_stop. |
| 4383 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4384 | * Return: 0 on success, QDF Error on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4385 | */ |
Jeff Johnson | acc1cc7 | 2017-09-13 08:47:49 -0700 | [diff] [blame] | 4386 | QDF_STATUS wma_stop(uint8_t reason) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4387 | { |
| 4388 | tp_wma_handle wma_handle; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4389 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | ede435f | 2015-12-01 16:16:36 +0530 | [diff] [blame] | 4390 | int i; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4391 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4392 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4393 | WMA_LOGD("%s: Enter", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4394 | /* validate the wma_handle */ |
| 4395 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4396 | WMA_LOGE("%s: Invalid handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4397 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4398 | goto end; |
| 4399 | } |
| 4400 | #ifdef QCA_WIFI_FTM |
| 4401 | /* |
| 4402 | * Tx mgmt detach requires TXRX context which is not created |
| 4403 | * in FTM mode. So skip the TX mgmt detach. |
| 4404 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4405 | if (cds_get_conparam() == QDF_GLOBAL_FTM_MODE) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4406 | qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4407 | goto end; |
| 4408 | } |
| 4409 | #endif /* QCA_WIFI_FTM */ |
| 4410 | |
| 4411 | if (wma_handle->ack_work_ctx) { |
| 4412 | cds_flush_work(&wma_handle->ack_work_ctx->ack_cmp_work); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4413 | qdf_mem_free(wma_handle->ack_work_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4414 | wma_handle->ack_work_ctx = NULL; |
| 4415 | } |
| 4416 | |
| 4417 | /* Destroy the timer for log completion */ |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 4418 | qdf_status = qdf_mc_timer_destroy(&wma_handle->log_completion_timer); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4419 | if (qdf_status != QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4420 | WMA_LOGE("Failed to destroy the log completion timer"); |
Govind Singh | ede435f | 2015-12-01 16:16:36 +0530 | [diff] [blame] | 4421 | /* clean up ll-queue for all vdev */ |
| 4422 | for (i = 0; i < wma_handle->max_bssid; i++) { |
| 4423 | if (wma_handle->interfaces[i].handle && |
Mukul Sharma | f904723 | 2017-03-02 16:58:56 +0530 | [diff] [blame] | 4424 | wma_is_vdev_up(i)) { |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 4425 | cdp_fc_vdev_flush( |
| 4426 | cds_get_context(QDF_MODULE_ID_SOC), |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 4427 | wma_handle-> |
| 4428 | interfaces[i].handle); |
Govind Singh | ede435f | 2015-12-01 16:16:36 +0530 | [diff] [blame] | 4429 | } |
| 4430 | } |
gaurank kathpalia | 85f8a61 | 2018-02-21 18:55:24 +0530 | [diff] [blame] | 4431 | |
| 4432 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
| 4433 | /* Destroy firmware time stamp sync timer */ |
| 4434 | qdf_status = qdf_mc_timer_destroy( |
| 4435 | &wma_handle->wma_fw_time_sync_timer); |
| 4436 | if (QDF_IS_STATUS_ERROR(qdf_status)) |
| 4437 | WMA_LOGE(FL("Failed to destroy the fw time sync timer")); |
| 4438 | } |
| 4439 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4440 | qdf_status = wma_tx_detach(wma_handle); |
| 4441 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4442 | WMA_LOGE("%s: Failed to deregister tx management", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4443 | goto end; |
| 4444 | } |
| 4445 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4446 | end: |
| 4447 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4448 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4449 | } |
| 4450 | |
| 4451 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4452 | * wma_wmi_service_close() - close wma wmi service interface. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4453 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4454 | * Return: 0 on success, QDF Error on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4455 | */ |
Jeff Johnson | 7b3ddc2 | 2017-09-13 09:42:44 -0700 | [diff] [blame] | 4456 | QDF_STATUS wma_wmi_service_close(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4457 | { |
Jeff Johnson | 7b3ddc2 | 2017-09-13 09:42:44 -0700 | [diff] [blame] | 4458 | void *cds_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4459 | tp_wma_handle wma_handle; |
| 4460 | struct beacon_info *bcn; |
| 4461 | int i; |
| 4462 | |
| 4463 | WMA_LOGD("%s: Enter", __func__); |
| 4464 | |
Jeff Johnson | 7b3ddc2 | 2017-09-13 09:42:44 -0700 | [diff] [blame] | 4465 | cds_ctx = cds_get_global_context(); |
| 4466 | if (!cds_ctx) { |
| 4467 | WMA_LOGE("%s: Invalid CDS context", __func__); |
| 4468 | return QDF_STATUS_E_INVAL; |
| 4469 | } |
| 4470 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4471 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4472 | |
| 4473 | /* validate the wma_handle */ |
| 4474 | if (NULL == wma_handle) { |
| 4475 | WMA_LOGE("%s: Invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4476 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4477 | } |
| 4478 | |
| 4479 | /* validate the wmi handle */ |
| 4480 | if (NULL == wma_handle->wmi_handle) { |
| 4481 | WMA_LOGE("%s: Invalid wmi handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4482 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4483 | } |
| 4484 | |
| 4485 | /* dettach the wmi serice */ |
| 4486 | WMA_LOGD("calling wmi_unified_detach"); |
| 4487 | wmi_unified_detach(wma_handle->wmi_handle); |
| 4488 | wma_handle->wmi_handle = NULL; |
| 4489 | |
| 4490 | for (i = 0; i < wma_handle->max_bssid; i++) { |
| 4491 | bcn = wma_handle->interfaces[i].beacon; |
| 4492 | |
| 4493 | if (bcn) { |
| 4494 | if (bcn->dma_mapped) |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 4495 | qdf_nbuf_unmap_single(wma_handle->qdf_dev, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4496 | bcn->buf, QDF_DMA_TO_DEVICE); |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 4497 | qdf_nbuf_free(bcn->buf); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4498 | qdf_mem_free(bcn); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4499 | wma_handle->interfaces[i].beacon = NULL; |
| 4500 | } |
| 4501 | |
| 4502 | if (wma_handle->interfaces[i].handle) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4503 | qdf_mem_free(wma_handle->interfaces[i].handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4504 | wma_handle->interfaces[i].handle = NULL; |
| 4505 | } |
Yue Ma | 664effc | 2016-01-12 18:43:54 -0800 | [diff] [blame] | 4506 | |
| 4507 | if (wma_handle->interfaces[i].addBssStaContext) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4508 | qdf_mem_free(wma_handle-> |
Yue Ma | 664effc | 2016-01-12 18:43:54 -0800 | [diff] [blame] | 4509 | interfaces[i].addBssStaContext); |
| 4510 | wma_handle->interfaces[i].addBssStaContext = NULL; |
| 4511 | } |
| 4512 | |
| 4513 | if (wma_handle->interfaces[i].del_staself_req) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4514 | qdf_mem_free(wma_handle->interfaces[i].del_staself_req); |
Yue Ma | 664effc | 2016-01-12 18:43:54 -0800 | [diff] [blame] | 4515 | wma_handle->interfaces[i].del_staself_req = NULL; |
| 4516 | } |
yeshwanth sriram guntuka | 8dd8038 | 2017-01-30 17:04:58 +0530 | [diff] [blame] | 4517 | |
| 4518 | if (wma_handle->interfaces[i].stats_rsp) { |
| 4519 | qdf_mem_free(wma_handle->interfaces[i].stats_rsp); |
| 4520 | wma_handle->interfaces[i].stats_rsp = NULL; |
| 4521 | } |
Abhishek Singh | 7e5e934 | 2017-04-12 18:22:07 +0530 | [diff] [blame] | 4522 | |
| 4523 | if (wma_handle->interfaces[i].psnr_req) { |
| 4524 | qdf_mem_free(wma_handle-> |
| 4525 | interfaces[i].psnr_req); |
| 4526 | wma_handle->interfaces[i].psnr_req = NULL; |
| 4527 | } |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 4528 | |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 4529 | if (wma_handle->interfaces[i].rcpi_req) { |
| 4530 | qdf_mem_free(wma_handle-> |
| 4531 | interfaces[i].rcpi_req); |
| 4532 | wma_handle->interfaces[i].rcpi_req = NULL; |
| 4533 | } |
| 4534 | |
Padma, Santhosh Kumar | aa2433e | 2017-10-06 14:34:46 +0530 | [diff] [blame] | 4535 | if (wma_handle->interfaces[i].roam_synch_frame_ind. |
| 4536 | bcn_probe_rsp) { |
| 4537 | qdf_mem_free(wma_handle->interfaces[i]. |
| 4538 | roam_synch_frame_ind.bcn_probe_rsp); |
| 4539 | wma_handle->interfaces[i].roam_synch_frame_ind. |
| 4540 | bcn_probe_rsp = NULL; |
| 4541 | } |
| 4542 | |
| 4543 | if (wma_handle->interfaces[i].roam_synch_frame_ind. |
| 4544 | reassoc_req) { |
| 4545 | qdf_mem_free(wma_handle->interfaces[i]. |
| 4546 | roam_synch_frame_ind.reassoc_req); |
| 4547 | wma_handle->interfaces[i].roam_synch_frame_ind. |
| 4548 | reassoc_req = NULL; |
| 4549 | } |
| 4550 | |
| 4551 | if (wma_handle->interfaces[i].roam_synch_frame_ind. |
| 4552 | reassoc_rsp) { |
| 4553 | qdf_mem_free(wma_handle->interfaces[i]. |
| 4554 | roam_synch_frame_ind.reassoc_rsp); |
| 4555 | wma_handle->interfaces[i].roam_synch_frame_ind. |
| 4556 | reassoc_rsp = NULL; |
| 4557 | } |
| 4558 | |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 4559 | wma_vdev_deinit(&wma_handle->interfaces[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4560 | } |
| 4561 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4562 | qdf_mem_free(wma_handle->interfaces); |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 4563 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4564 | /* free the wma_handle */ |
Jeff Johnson | adb3b1c | 2017-09-13 10:42:36 -0700 | [diff] [blame] | 4565 | cds_free_context(QDF_MODULE_ID_WMA, wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4566 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4567 | qdf_mem_free(((p_cds_contextType) cds_ctx)->cfg_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4568 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4569 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4570 | } |
| 4571 | |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4572 | /** |
| 4573 | * wma_wmi_work_close() - close the work queue items associated with WMI |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4574 | * |
| 4575 | * This function closes work queue items associated with WMI, but not fully |
| 4576 | * closes WMI service. |
| 4577 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4578 | * Return: QDF_STATUS_SUCCESS if work close is successful. Otherwise |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4579 | * proper error codes. |
| 4580 | */ |
Jeff Johnson | 6b8473d | 2017-09-13 09:20:53 -0700 | [diff] [blame] | 4581 | QDF_STATUS wma_wmi_work_close(void) |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4582 | { |
| 4583 | tp_wma_handle wma_handle; |
| 4584 | |
| 4585 | WMA_LOGD("%s: Enter", __func__); |
| 4586 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4587 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4588 | |
| 4589 | /* validate the wma_handle */ |
| 4590 | if (NULL == wma_handle) { |
| 4591 | WMA_LOGE("%s: Invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4592 | return QDF_STATUS_E_INVAL; |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4593 | } |
| 4594 | |
| 4595 | /* validate the wmi handle */ |
| 4596 | if (NULL == wma_handle->wmi_handle) { |
| 4597 | WMA_LOGE("%s: Invalid wmi handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4598 | return QDF_STATUS_E_INVAL; |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4599 | } |
| 4600 | |
| 4601 | /* remove the wmi work */ |
| 4602 | WMA_LOGD("calling wmi_unified_remove_work"); |
| 4603 | wmi_unified_remove_work(wma_handle->wmi_handle); |
| 4604 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4605 | return QDF_STATUS_SUCCESS; |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 4606 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4607 | |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 4608 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4609 | * wma_close() - wma close function. |
| 4610 | * cleanup resources attached with wma. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4611 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4612 | * Return: 0 on success, QDF Error on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4613 | */ |
Jeff Johnson | 542da35 | 2017-09-13 09:17:28 -0700 | [diff] [blame] | 4614 | QDF_STATUS wma_close(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4615 | { |
| 4616 | tp_wma_handle wma_handle; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4617 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4618 | |
| 4619 | WMA_LOGD("%s: Enter", __func__); |
| 4620 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4621 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4622 | |
| 4623 | /* validate the wma_handle */ |
| 4624 | if (NULL == wma_handle) { |
| 4625 | WMA_LOGE("%s: Invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4626 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4627 | } |
| 4628 | |
| 4629 | /* validate the wmi handle */ |
| 4630 | if (NULL == wma_handle->wmi_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4631 | WMA_LOGE("%s: Invalid wmi handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4632 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4633 | } |
| 4634 | |
| 4635 | /* Free DBS list */ |
| 4636 | if (wma_handle->hw_mode.hw_mode_list) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4637 | qdf_mem_free(wma_handle->hw_mode.hw_mode_list); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4638 | wma_handle->hw_mode.hw_mode_list = NULL; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4639 | WMA_LOGD("%s: DBS list is freed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4640 | } |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 4641 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4642 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4643 | #ifdef FEATURE_WLAN_EXTSCAN |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 4644 | qdf_wake_lock_destroy(&wma_handle->extscan_wake_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4645 | #endif /* FEATURE_WLAN_EXTSCAN */ |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 4646 | qdf_wake_lock_destroy(&wma_handle->wow_wake_lock); |
Mukul Sharma | e44d054 | 2017-05-23 21:50:56 +0530 | [diff] [blame] | 4647 | qdf_wake_lock_destroy(&wma_handle->wow_auth_req_wl); |
| 4648 | qdf_wake_lock_destroy(&wma_handle->wow_assoc_req_wl); |
| 4649 | qdf_wake_lock_destroy(&wma_handle->wow_deauth_rec_wl); |
| 4650 | qdf_wake_lock_destroy(&wma_handle->wow_disassoc_rec_wl); |
| 4651 | qdf_wake_lock_destroy(&wma_handle->wow_ap_assoc_lost_wl); |
| 4652 | qdf_wake_lock_destroy(&wma_handle->wow_auto_shutdown_wl); |
| 4653 | qdf_wake_lock_destroy(&wma_handle->roam_ho_wl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4654 | } |
| 4655 | |
| 4656 | /* unregister Firmware debug log */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4657 | qdf_status = dbglog_deinit(wma_handle->wmi_handle); |
| 4658 | if (qdf_status != QDF_STATUS_SUCCESS) |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4659 | WMA_LOGE("%s: dbglog_deinit failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4660 | |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 4661 | qdf_status = qdf_mc_timer_destroy(&wma_handle->service_ready_ext_timer); |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 4662 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4663 | WMA_LOGE("%s: Failed to destroy service ready ext event timer", |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 4664 | __func__); |
| 4665 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 4666 | qdf_event_destroy(&wma_handle->target_suspend); |
| 4667 | qdf_event_destroy(&wma_handle->wma_resume_event); |
| 4668 | qdf_event_destroy(&wma_handle->runtime_suspend); |
| 4669 | qdf_event_destroy(&wma_handle->recovery_event); |
Kai Liu | 27f2037 | 2016-09-28 23:52:36 +0800 | [diff] [blame] | 4670 | qdf_event_destroy(&wma_handle->tx_frm_download_comp_event); |
| 4671 | qdf_event_destroy(&wma_handle->tx_queue_empty_event); |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 4672 | wma_cleanup_vdev_resp_queue(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4673 | wma_cleanup_hold_req(wma_handle); |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 4674 | qdf_wake_lock_destroy(&wma_handle->wmi_cmd_rsp_wake_lock); |
Prashanth Bhatta | 87b6dc0 | 2017-01-19 15:17:58 -0800 | [diff] [blame] | 4675 | qdf_runtime_lock_deinit(&wma_handle->wmi_cmd_rsp_runtime_lock); |
Poddar, Siddarth | 2fb9807 | 2017-07-19 14:58:30 +0530 | [diff] [blame] | 4676 | qdf_spinlock_destroy(&wma_handle->vdev_respq_lock); |
| 4677 | qdf_spinlock_destroy(&wma_handle->wma_hold_req_q_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4678 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4679 | if (NULL != wma_handle->pGetRssiReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4680 | qdf_mem_free(wma_handle->pGetRssiReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4681 | wma_handle->pGetRssiReq = NULL; |
| 4682 | } |
Deepak Dhamdhere | bf1f9b1 | 2016-05-27 14:49:41 -0700 | [diff] [blame] | 4683 | |
yeshwanth sriram guntuka | 584c233 | 2017-07-29 12:50:25 +0530 | [diff] [blame] | 4684 | wma_unified_radio_tx_mem_free(wma_handle); |
Srinivas Girigowda | ad874a8 | 2016-10-25 14:08:00 -0700 | [diff] [blame] | 4685 | |
Kiran Kumar Lokere | f089a3a | 2017-04-20 21:39:26 -0700 | [diff] [blame] | 4686 | if (wma_handle->pdev) { |
| 4687 | wlan_objmgr_pdev_release_ref(wma_handle->pdev, |
| 4688 | WLAN_LEGACY_WMA_ID); |
| 4689 | wma_handle->pdev = NULL; |
| 4690 | } |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 4691 | |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 4692 | pmo_unregister_pause_bitmap_notifier(wma_handle->psoc, |
| 4693 | wma_vdev_update_pause_bitmap); |
| 4694 | pmo_unregister_get_pause_bitmap(wma_handle->psoc, |
| 4695 | wma_vdev_get_pause_bitmap); |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 4696 | pmo_unregister_is_device_in_low_pwr_mode(wma_handle->psoc, |
| 4697 | wma_vdev_is_device_in_low_pwr_mode); |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 4698 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 4699 | target_if_free_psoc_tgt_info(wma_handle->psoc); |
| 4700 | |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 4701 | wlan_objmgr_psoc_release_ref(wma_handle->psoc, WLAN_LEGACY_WMA_ID); |
| 4702 | wma_handle->psoc = NULL; |
| 4703 | target_if_close(); |
| 4704 | wma_target_if_close(wma_handle); |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 4705 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4706 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4707 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4708 | } |
| 4709 | |
| 4710 | /** |
| 4711 | * wma_update_fw_config() - update fw configuration |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 4712 | * @psoc: psoc to query configuration from |
| 4713 | * @tgt_hdl: target capability info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4714 | * |
| 4715 | * Return: none |
| 4716 | */ |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 4717 | static void wma_update_fw_config(struct wlan_objmgr_psoc *psoc, |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4718 | struct target_psoc_info *tgt_hdl) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4719 | { |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 4720 | target_resource_config *cfg = &tgt_hdl->info.wlan_res_cfg; |
| 4721 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4722 | /* Override the no. of max fragments as per platform configuration */ |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 4723 | cfg->max_frag_entries = QDF_MIN(QCA_OL_11AC_TX_MAX_FRAGS, |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4724 | target_if_get_max_frag_entry(tgt_hdl)); |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 4725 | target_if_set_max_frag_entry(tgt_hdl, cfg->max_frag_entries); |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4726 | |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 4727 | cfg->num_wow_filters = ucfg_pmo_get_num_wow_filters(psoc); |
| 4728 | cfg->bpf_instruction_size = ucfg_pmo_get_apf_instruction_size(psoc); |
Dustin Brown | 67d69eb | 2018-03-02 11:11:34 -0800 | [diff] [blame] | 4729 | cfg->num_packet_filters = ucfg_pmo_get_num_packet_filters(psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4730 | } |
| 4731 | |
| 4732 | /** |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame] | 4733 | * wma_set_tx_partition_base() - set TX MSDU ID partition base for IPA |
| 4734 | * @value: TX MSDU ID partition base |
| 4735 | * |
| 4736 | * Return: none |
| 4737 | */ |
| 4738 | #ifdef IPA_OFFLOAD |
| 4739 | static void wma_set_tx_partition_base(uint32_t value) |
| 4740 | { |
| 4741 | cdp_ipa_set_uc_tx_partition_base( |
| 4742 | cds_get_context(QDF_MODULE_ID_SOC), |
| 4743 | (struct cdp_cfg *)cds_get_context(QDF_MODULE_ID_CFG), |
| 4744 | value); |
| 4745 | WMA_LOGD("%s: TX_MSDU_ID_PARTITION=%d", __func__, |
| 4746 | value); |
| 4747 | } |
| 4748 | #else |
| 4749 | static void wma_set_tx_partition_base(uint32_t value) |
| 4750 | { |
| 4751 | } |
| 4752 | #endif |
| 4753 | |
| 4754 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4755 | * wma_update_target_services() - update target services from wma handle |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4756 | * @wmi_handle: Unified wmi handle |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4757 | * @cfg: target services |
| 4758 | * |
| 4759 | * Return: none |
| 4760 | */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4761 | static inline void wma_update_target_services(struct wmi_unified *wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4762 | struct wma_tgt_services *cfg) |
| 4763 | { |
| 4764 | /* STA power save */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4765 | cfg->sta_power_save = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4766 | wmi_service_sta_pwrsave); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4767 | |
| 4768 | /* Enable UAPSD */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4769 | cfg->uapsd = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4770 | wmi_service_ap_uapsd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4771 | |
| 4772 | /* Update AP DFS service */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4773 | cfg->ap_dfs = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4774 | wmi_service_ap_dfs); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4775 | |
| 4776 | /* Enable 11AC */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4777 | cfg->en_11ac = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4778 | wmi_service_11ac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4779 | if (cfg->en_11ac) |
| 4780 | g_fw_wlan_feat_caps |= (1 << DOT11AC); |
| 4781 | |
| 4782 | /* Proactive ARP response */ |
| 4783 | g_fw_wlan_feat_caps |= (1 << WLAN_PERIODIC_TX_PTRN); |
| 4784 | |
| 4785 | /* Enable WOW */ |
| 4786 | g_fw_wlan_feat_caps |= (1 << WOW); |
| 4787 | |
| 4788 | /* ARP offload */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4789 | cfg->arp_offload = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4790 | wmi_service_arpns_offload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4791 | |
| 4792 | /* Adaptive early-rx */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4793 | cfg->early_rx = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4794 | wmi_service_early_rx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4795 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 4796 | /* PNO offload */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4797 | if (wmi_service_enabled(wmi_handle, wmi_service_nlo)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4798 | cfg->pno_offload = true; |
| 4799 | #endif /* FEATURE_WLAN_SCAN_PNO */ |
| 4800 | |
| 4801 | #ifdef FEATURE_WLAN_EXTSCAN |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4802 | if (wmi_service_enabled(wmi_handle, wmi_service_extscan)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4803 | g_fw_wlan_feat_caps |= (1 << EXTENDED_SCAN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4804 | #endif /* FEATURE_WLAN_EXTSCAN */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4805 | cfg->lte_coex_ant_share = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4806 | wmi_service_lte_ant_share_support); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4807 | #ifdef FEATURE_WLAN_TDLS |
| 4808 | /* Enable TDLS */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4809 | if (wmi_service_enabled(wmi_handle, wmi_service_tdls)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4810 | cfg->en_tdls = 1; |
| 4811 | g_fw_wlan_feat_caps |= (1 << TDLS); |
| 4812 | } |
| 4813 | /* Enable advanced TDLS features */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4814 | if (wmi_service_enabled(wmi_handle, wmi_service_tdls_offchan)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4815 | cfg->en_tdls_offchan = 1; |
| 4816 | g_fw_wlan_feat_caps |= (1 << TDLS_OFF_CHANNEL); |
| 4817 | } |
| 4818 | |
| 4819 | cfg->en_tdls_uapsd_buf_sta = |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4820 | wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4821 | wmi_service_tdls_uapsd_buffer_sta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4822 | cfg->en_tdls_uapsd_sleep_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_sleep_sta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4825 | #endif /* FEATURE_WLAN_TDLS */ |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4826 | if (wmi_service_enabled |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4827 | (wmi_handle, wmi_service_beacon_offload)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4828 | cfg->beacon_offload = true; |
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_sta_pmf_offload)) |
mukul sharma | 72c8b22 | 2015-09-04 17:02:01 +0530 | [diff] [blame] | 4831 | cfg->pmf_offload = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4832 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4833 | /* Enable Roam Offload */ |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4834 | cfg->en_roam_offload = wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4835 | wmi_service_roam_ho_offload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4836 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4837 | #ifdef WLAN_FEATURE_NAN |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4838 | if (wmi_service_enabled(wmi_handle, wmi_service_nan)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4839 | g_fw_wlan_feat_caps |= (1 << NAN); |
| 4840 | #endif /* WLAN_FEATURE_NAN */ |
| 4841 | |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4842 | if (wmi_service_enabled(wmi_handle, wmi_service_rtt)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4843 | g_fw_wlan_feat_caps |= (1 << RTT); |
Yun Park | 4d968df | 2016-10-11 11:44:15 -0700 | [diff] [blame] | 4844 | |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4845 | if (wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4846 | wmi_service_tx_msdu_id_new_partition_support)) { |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame] | 4847 | 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] | 4848 | } else { |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame] | 4849 | wma_set_tx_partition_base(HTT_TX_IPA_MSDU_ID_SPACE_BEGIN); |
Yun Park | 4d968df | 2016-10-11 11:44:15 -0700 | [diff] [blame] | 4850 | } |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 4851 | |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4852 | wma_he_update_tgt_services(wmi_handle, cfg); |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 4853 | |
| 4854 | cfg->get_peer_info_enabled = |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4855 | wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 4856 | wmi_service_peer_stats_info); |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4857 | if (wmi_service_enabled(wmi_handle, wmi_service_fils_support)) |
Vignesh Viswanathan | 731186f | 2017-09-18 13:47:37 +0530 | [diff] [blame] | 4858 | cfg->is_fils_roaming_supported = true; |
Varun Reddy Yeturu | 62c3265 | 2017-10-26 15:32:35 -0700 | [diff] [blame] | 4859 | |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4860 | if (wmi_service_enabled(wmi_handle, wmi_service_mawc_support)) |
Varun Reddy Yeturu | 62c3265 | 2017-10-26 15:32:35 -0700 | [diff] [blame] | 4861 | cfg->is_fw_mawc_capable = true; |
| 4862 | |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 4863 | if (wmi_service_enabled(wmi_handle, |
| 4864 | wmi_service_11k_neighbour_report_support)) |
Vignesh Viswanathan | 694e28e | 2018-01-18 20:53:57 +0530 | [diff] [blame] | 4865 | cfg->is_11k_offload_supported = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4866 | } |
| 4867 | |
| 4868 | /** |
| 4869 | * wma_update_target_ht_cap() - update ht capabality from wma handle |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4870 | * @tgt_hdl: pointer to structure target_psoc_info |
| 4871 | * @cfg: ht capability |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4872 | * |
| 4873 | * Return: none |
| 4874 | */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4875 | static inline void |
| 4876 | wma_update_target_ht_cap(struct target_psoc_info *tgt_hdl, |
| 4877 | struct wma_tgt_ht_cap *cfg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4878 | { |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4879 | int ht_cap_info; |
| 4880 | |
| 4881 | ht_cap_info = target_if_get_ht_cap_info(tgt_hdl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4882 | /* RX STBC */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4883 | cfg->ht_rx_stbc = !!(ht_cap_info & WMI_HT_CAP_RX_STBC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4884 | |
| 4885 | /* TX STBC */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4886 | cfg->ht_tx_stbc = !!(ht_cap_info & WMI_HT_CAP_TX_STBC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4887 | |
| 4888 | /* MPDU density */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4889 | cfg->mpdu_density = ht_cap_info & WMI_HT_CAP_MPDU_DENSITY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4890 | |
| 4891 | /* HT RX LDPC */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4892 | cfg->ht_rx_ldpc = !!(ht_cap_info & WMI_HT_CAP_LDPC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4893 | |
| 4894 | /* HT SGI */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4895 | cfg->ht_sgi_20 = !!(ht_cap_info & WMI_HT_CAP_HT20_SGI); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4896 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4897 | cfg->ht_sgi_40 = !!(ht_cap_info & WMI_HT_CAP_HT40_SGI); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4898 | |
| 4899 | /* RF chains */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4900 | cfg->num_rf_chains = target_if_get_num_rf_chains(tgt_hdl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4901 | |
Jeff Johnson | 3fd2182 | 2016-11-08 11:30:37 -0800 | [diff] [blame] | 4902 | WMA_LOGD("%s: ht_cap_info - %x ht_rx_stbc - %d, ht_tx_stbc - %d\n" |
| 4903 | "mpdu_density - %d ht_rx_ldpc - %d ht_sgi_20 - %d\n" |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4904 | "ht_sgi_40 - %d num_rf_chains - %d", __func__, |
| 4905 | ht_cap_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4906 | cfg->ht_rx_stbc, cfg->ht_tx_stbc, cfg->mpdu_density, |
| 4907 | cfg->ht_rx_ldpc, cfg->ht_sgi_20, cfg->ht_sgi_40, |
| 4908 | cfg->num_rf_chains); |
| 4909 | |
| 4910 | } |
| 4911 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4912 | /** |
| 4913 | * wma_update_target_vht_cap() - update vht capabality from wma handle |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4914 | * @tgt_hdl: pointer to structure target_psoc_info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4915 | * @cfg: vht capabality |
| 4916 | * |
| 4917 | * Return: none |
| 4918 | */ |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4919 | static inline void |
| 4920 | wma_update_target_vht_cap(struct target_psoc_info *tgt_hdl, |
| 4921 | struct wma_tgt_vht_cap *cfg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4922 | { |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4923 | int vht_cap_info = target_if_get_vht_cap_info(tgt_hdl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4924 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4925 | if (vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_11454) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4926 | cfg->vht_max_mpdu = WMI_VHT_CAP_MAX_MPDU_LEN_11454; |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4927 | else if (vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_7935) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4928 | cfg->vht_max_mpdu = WMI_VHT_CAP_MAX_MPDU_LEN_7935; |
| 4929 | else |
| 4930 | cfg->vht_max_mpdu = 0; |
| 4931 | |
| 4932 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4933 | if (vht_cap_info & WMI_VHT_CAP_CH_WIDTH_80P80_160MHZ) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4934 | cfg->supp_chan_width = 1 << eHT_CHANNEL_WIDTH_80P80MHZ; |
| 4935 | cfg->supp_chan_width |= 1 << eHT_CHANNEL_WIDTH_160MHZ; |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4936 | } else if (vht_cap_info & WMI_VHT_CAP_CH_WIDTH_160MHZ) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4937 | cfg->supp_chan_width = 1 << eHT_CHANNEL_WIDTH_160MHZ; |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4938 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4939 | cfg->supp_chan_width = 1 << eHT_CHANNEL_WIDTH_80MHZ; |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4940 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4941 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4942 | cfg->vht_rx_ldpc = vht_cap_info & WMI_VHT_CAP_RX_LDPC; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4943 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4944 | cfg->vht_short_gi_80 = vht_cap_info & WMI_VHT_CAP_SGI_80MHZ; |
| 4945 | 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] | 4946 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4947 | cfg->vht_tx_stbc = vht_cap_info & WMI_VHT_CAP_TX_STBC; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4948 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4949 | cfg->vht_rx_stbc = |
| 4950 | (vht_cap_info & WMI_VHT_CAP_RX_STBC_1SS) | |
| 4951 | (vht_cap_info & WMI_VHT_CAP_RX_STBC_2SS) | |
| 4952 | (vht_cap_info & WMI_VHT_CAP_RX_STBC_3SS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4953 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4954 | cfg->vht_max_ampdu_len_exp = (vht_cap_info & |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4955 | WMI_VHT_CAP_MAX_AMPDU_LEN_EXP) |
| 4956 | >> WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT; |
| 4957 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4958 | cfg->vht_su_bformer = vht_cap_info & WMI_VHT_CAP_SU_BFORMER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4959 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4960 | cfg->vht_su_bformee = vht_cap_info & WMI_VHT_CAP_SU_BFORMEE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4961 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4962 | cfg->vht_mu_bformer = vht_cap_info & WMI_VHT_CAP_MU_BFORMER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4963 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4964 | cfg->vht_mu_bformee = vht_cap_info & WMI_VHT_CAP_MU_BFORMEE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4965 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 4966 | cfg->vht_txop_ps = vht_cap_info & WMI_VHT_CAP_TXOP_PS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4967 | |
Jeff Johnson | 3fd2182 | 2016-11-08 11:30:37 -0800 | [diff] [blame] | 4968 | WMA_LOGD("%s: max_mpdu %d supp_chan_width %x rx_ldpc %x\n" |
| 4969 | "short_gi_80 %x tx_stbc %x rx_stbc %x txop_ps %x\n" |
| 4970 | "su_bformee %x mu_bformee %x max_ampdu_len_exp %d", __func__, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4971 | cfg->vht_max_mpdu, cfg->supp_chan_width, cfg->vht_rx_ldpc, |
| 4972 | cfg->vht_short_gi_80, cfg->vht_tx_stbc, cfg->vht_rx_stbc, |
| 4973 | cfg->vht_txop_ps, cfg->vht_su_bformee, cfg->vht_mu_bformee, |
| 4974 | cfg->vht_max_ampdu_len_exp); |
| 4975 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4976 | |
| 4977 | /** |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 4978 | * wma_update_supported_bands() - update supported bands from service ready ext |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 4979 | * @supported_bands: Supported band given by FW through service ready ext params |
| 4980 | * @new_supported_bands: New supported band which needs to be updated by |
| 4981 | * this API which WMA layer understands |
| 4982 | * |
| 4983 | * This API will convert FW given supported band to enum which WMA layer |
| 4984 | * understands |
| 4985 | * |
| 4986 | * Return: QDF_STATUS |
| 4987 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 4988 | static QDF_STATUS wma_update_supported_bands( |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 4989 | WLAN_BAND_CAPABILITY supported_bands, |
| 4990 | WMI_PHY_CAPABILITY *new_supported_bands) |
| 4991 | { |
| 4992 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 4993 | |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 4994 | if (!new_supported_bands) { |
| 4995 | WMA_LOGE("%s: NULL new supported band variable", __func__); |
| 4996 | return QDF_STATUS_E_FAILURE; |
| 4997 | } |
| 4998 | switch (supported_bands) { |
| 4999 | case WLAN_2G_CAPABILITY: |
| 5000 | *new_supported_bands |= WMI_11G_CAPABILITY; |
| 5001 | break; |
| 5002 | case WLAN_5G_CAPABILITY: |
| 5003 | *new_supported_bands |= WMI_11A_CAPABILITY; |
| 5004 | break; |
| 5005 | default: |
| 5006 | WMA_LOGE("%s: wrong supported band", __func__); |
| 5007 | status = QDF_STATUS_E_FAILURE; |
| 5008 | break; |
| 5009 | } |
| 5010 | return status; |
| 5011 | } |
| 5012 | |
| 5013 | /** |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5014 | * wma_derive_ext_ht_cap() - Derive HT caps based on given value |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5015 | * @ht_cap: given pointer to HT caps which needs to be updated |
| 5016 | * @tx_chain: given tx chainmask value |
| 5017 | * @rx_chain: given rx chainmask value |
| 5018 | * @value: new HT cap info provided in form of bitmask |
| 5019 | * |
| 5020 | * This function takes the value provided in form of bitmask and decodes |
| 5021 | * it. After decoding, what ever value it gets, it takes the union(max) or |
| 5022 | * intersection(min) with previously derived values. |
| 5023 | * |
| 5024 | * Return: none |
| 5025 | * |
| 5026 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5027 | static void wma_derive_ext_ht_cap( |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5028 | struct wma_tgt_ht_cap *ht_cap, uint32_t value, |
| 5029 | uint32_t tx_chain, uint32_t rx_chain) |
| 5030 | { |
| 5031 | struct wma_tgt_ht_cap tmp = {0}; |
| 5032 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5033 | if (ht_cap == NULL) |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5034 | return; |
| 5035 | |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 5036 | 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] | 5037 | ht_cap->ht_rx_stbc = (!!(value & WMI_HT_CAP_RX_STBC)); |
| 5038 | ht_cap->ht_tx_stbc = (!!(value & WMI_HT_CAP_TX_STBC)); |
| 5039 | ht_cap->mpdu_density = (!!(value & WMI_HT_CAP_MPDU_DENSITY)); |
| 5040 | ht_cap->ht_rx_ldpc = (!!(value & WMI_HT_CAP_RX_LDPC)); |
| 5041 | ht_cap->ht_sgi_20 = (!!(value & WMI_HT_CAP_HT20_SGI)); |
| 5042 | ht_cap->ht_sgi_40 = (!!(value & WMI_HT_CAP_HT40_SGI)); |
| 5043 | ht_cap->num_rf_chains = |
| 5044 | QDF_MAX(wma_get_num_of_setbits_from_bitmask(tx_chain), |
| 5045 | wma_get_num_of_setbits_from_bitmask(rx_chain)); |
| 5046 | } else { |
| 5047 | ht_cap->ht_rx_stbc = QDF_MIN(ht_cap->ht_rx_stbc, |
| 5048 | (!!(value & WMI_HT_CAP_RX_STBC))); |
| 5049 | ht_cap->ht_tx_stbc = QDF_MAX(ht_cap->ht_tx_stbc, |
| 5050 | (!!(value & WMI_HT_CAP_TX_STBC))); |
| 5051 | ht_cap->mpdu_density = QDF_MIN(ht_cap->mpdu_density, |
| 5052 | (!!(value & WMI_HT_CAP_MPDU_DENSITY))); |
| 5053 | ht_cap->ht_rx_ldpc = QDF_MIN(ht_cap->ht_rx_ldpc, |
| 5054 | (!!(value & WMI_HT_CAP_RX_LDPC))); |
| 5055 | ht_cap->ht_sgi_20 = QDF_MIN(ht_cap->ht_sgi_20, |
| 5056 | (!!(value & WMI_HT_CAP_HT20_SGI))); |
| 5057 | ht_cap->ht_sgi_40 = QDF_MIN(ht_cap->ht_sgi_40, |
| 5058 | (!!(value & WMI_HT_CAP_HT40_SGI))); |
| 5059 | ht_cap->num_rf_chains = |
| 5060 | QDF_MAX(ht_cap->num_rf_chains, |
| 5061 | QDF_MAX(wma_get_num_of_setbits_from_bitmask( |
| 5062 | tx_chain), |
| 5063 | wma_get_num_of_setbits_from_bitmask( |
| 5064 | rx_chain))); |
| 5065 | } |
| 5066 | } |
| 5067 | |
| 5068 | /** |
| 5069 | * 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] | 5070 | * @tgt_hdl - target psoc information |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5071 | * @ht_cap: HT cap structure to be filled |
| 5072 | * |
| 5073 | * This function loop through each hardware mode and for each hardware mode |
| 5074 | * again it loop through each MAC/PHY and pull the caps 2G and 5G specific |
| 5075 | * HT caps and derives the final cap. |
| 5076 | * |
| 5077 | * Return: none |
| 5078 | * |
| 5079 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5080 | static void wma_update_target_ext_ht_cap(struct target_psoc_info *tgt_hdl, |
| 5081 | struct wma_tgt_ht_cap *ht_cap) |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5082 | { |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5083 | int i, total_mac_phy_cnt; |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5084 | uint32_t ht_2g, ht_5g; |
| 5085 | struct wma_tgt_ht_cap tmp_ht_cap = {0}, tmp_cap = {0}; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5086 | struct wlan_psoc_host_mac_phy_caps *mac_phy_cap; |
| 5087 | int num_hw_modes; |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5088 | |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5089 | 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] | 5090 | num_hw_modes = target_psoc_get_num_hw_modes(tgt_hdl); |
| 5091 | mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5092 | /* |
| 5093 | * for legacy device extended cap might not even come, so in that case |
| 5094 | * don't overwrite legacy values |
| 5095 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5096 | if (!num_hw_modes) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5097 | WMA_LOGD("%s: No extended HT cap for current SOC", __func__); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5098 | return; |
| 5099 | } |
| 5100 | |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5101 | for (i = 0; i < total_mac_phy_cnt; i++) { |
| 5102 | ht_2g = mac_phy_cap[i].ht_cap_info_2G; |
| 5103 | ht_5g = mac_phy_cap[i].ht_cap_info_5G; |
| 5104 | if (ht_2g) |
| 5105 | wma_derive_ext_ht_cap(&tmp_ht_cap, |
| 5106 | ht_2g, |
| 5107 | mac_phy_cap[i].tx_chain_mask_2G, |
| 5108 | mac_phy_cap[i].rx_chain_mask_2G); |
| 5109 | if (ht_5g) |
| 5110 | wma_derive_ext_ht_cap(&tmp_ht_cap, |
| 5111 | ht_5g, |
| 5112 | mac_phy_cap[i].tx_chain_mask_5G, |
| 5113 | mac_phy_cap[i].rx_chain_mask_5G); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5114 | } |
| 5115 | |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 5116 | if (qdf_mem_cmp(&tmp_cap, &tmp_ht_cap, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5117 | sizeof(struct wma_tgt_ht_cap))) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5118 | qdf_mem_copy(ht_cap, &tmp_ht_cap, |
| 5119 | sizeof(struct wma_tgt_ht_cap)); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5120 | } |
| 5121 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5122 | 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] | 5123 | "mpdu_density - %d ht_rx_ldpc - %d ht_sgi_20 - %d\n" |
| 5124 | "ht_sgi_40 - %d num_rf_chains - %d", __func__, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5125 | ht_cap->ht_rx_stbc, ht_cap->ht_tx_stbc, |
| 5126 | ht_cap->mpdu_density, ht_cap->ht_rx_ldpc, |
| 5127 | ht_cap->ht_sgi_20, ht_cap->ht_sgi_40, |
| 5128 | ht_cap->num_rf_chains); |
| 5129 | } |
| 5130 | |
| 5131 | /** |
| 5132 | * wma_derive_ext_vht_cap() - Derive VHT caps based on given value |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5133 | * @vht_cap: pointer to given VHT caps to be filled |
| 5134 | * @value: new VHT cap info provided in form of bitmask |
| 5135 | * |
| 5136 | * This function takes the value provided in form of bitmask and decodes |
| 5137 | * it. After decoding, what ever value it gets, it takes the union(max) or |
| 5138 | * intersection(min) with previously derived values. |
| 5139 | * |
| 5140 | * Return: none |
| 5141 | * |
| 5142 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5143 | static void wma_derive_ext_vht_cap( |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5144 | struct wma_tgt_vht_cap *vht_cap, uint32_t value) |
| 5145 | { |
| 5146 | struct wma_tgt_vht_cap tmp_cap = {0}; |
| 5147 | uint32_t tmp = 0; |
| 5148 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5149 | if (vht_cap == NULL) |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5150 | return; |
| 5151 | |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 5152 | if (!qdf_mem_cmp(vht_cap, &tmp_cap, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5153 | sizeof(struct wma_tgt_vht_cap))) { |
| 5154 | if (value & WMI_VHT_CAP_MAX_MPDU_LEN_11454) |
| 5155 | vht_cap->vht_max_mpdu = WMI_VHT_CAP_MAX_MPDU_LEN_11454; |
| 5156 | else if (value & WMI_VHT_CAP_MAX_MPDU_LEN_7935) |
| 5157 | vht_cap->vht_max_mpdu = WMI_VHT_CAP_MAX_MPDU_LEN_7935; |
| 5158 | else |
| 5159 | vht_cap->vht_max_mpdu = 0; |
| 5160 | |
| 5161 | if (value & WMI_VHT_CAP_CH_WIDTH_80P80_160MHZ) { |
| 5162 | vht_cap->supp_chan_width = |
| 5163 | 1 << eHT_CHANNEL_WIDTH_80P80MHZ; |
| 5164 | vht_cap->supp_chan_width |= |
| 5165 | 1 << eHT_CHANNEL_WIDTH_160MHZ; |
| 5166 | } else if (value & WMI_VHT_CAP_CH_WIDTH_160MHZ) { |
| 5167 | vht_cap->supp_chan_width = |
| 5168 | 1 << eHT_CHANNEL_WIDTH_160MHZ; |
| 5169 | } else { |
| 5170 | vht_cap->supp_chan_width = 1 << eHT_CHANNEL_WIDTH_80MHZ; |
| 5171 | } |
| 5172 | vht_cap->vht_rx_ldpc = value & WMI_VHT_CAP_RX_LDPC; |
| 5173 | vht_cap->vht_short_gi_80 = value & WMI_VHT_CAP_SGI_80MHZ; |
| 5174 | vht_cap->vht_short_gi_160 = value & WMI_VHT_CAP_SGI_160MHZ; |
| 5175 | vht_cap->vht_tx_stbc = value & WMI_VHT_CAP_TX_STBC; |
| 5176 | vht_cap->vht_rx_stbc = |
| 5177 | (value & WMI_VHT_CAP_RX_STBC_1SS) | |
| 5178 | (value & WMI_VHT_CAP_RX_STBC_2SS) | |
| 5179 | (value & WMI_VHT_CAP_RX_STBC_3SS); |
| 5180 | vht_cap->vht_max_ampdu_len_exp = |
| 5181 | (value & WMI_VHT_CAP_MAX_AMPDU_LEN_EXP) >> |
| 5182 | WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT; |
| 5183 | vht_cap->vht_su_bformer = value & WMI_VHT_CAP_SU_BFORMER; |
| 5184 | vht_cap->vht_su_bformee = value & WMI_VHT_CAP_SU_BFORMEE; |
| 5185 | vht_cap->vht_mu_bformer = value & WMI_VHT_CAP_MU_BFORMER; |
| 5186 | vht_cap->vht_mu_bformee = value & WMI_VHT_CAP_MU_BFORMEE; |
| 5187 | vht_cap->vht_txop_ps = value & WMI_VHT_CAP_TXOP_PS; |
| 5188 | } else { |
| 5189 | if (value & WMI_VHT_CAP_MAX_MPDU_LEN_11454) |
| 5190 | tmp = WMI_VHT_CAP_MAX_MPDU_LEN_11454; |
| 5191 | else if (value & WMI_VHT_CAP_MAX_MPDU_LEN_7935) |
| 5192 | tmp = WMI_VHT_CAP_MAX_MPDU_LEN_7935; |
| 5193 | else |
| 5194 | tmp = 0; |
| 5195 | vht_cap->vht_max_mpdu = QDF_MIN(vht_cap->vht_max_mpdu, tmp); |
| 5196 | |
| 5197 | if ((value & WMI_VHT_CAP_CH_WIDTH_80P80_160MHZ)) { |
| 5198 | tmp = (1 << eHT_CHANNEL_WIDTH_80P80MHZ) | |
| 5199 | (1 << eHT_CHANNEL_WIDTH_160MHZ); |
| 5200 | } else if (value & WMI_VHT_CAP_CH_WIDTH_160MHZ) { |
| 5201 | tmp = 1 << eHT_CHANNEL_WIDTH_160MHZ; |
| 5202 | } else { |
| 5203 | tmp = 1 << eHT_CHANNEL_WIDTH_80MHZ; |
| 5204 | } |
| 5205 | vht_cap->supp_chan_width = |
| 5206 | QDF_MAX(vht_cap->supp_chan_width, tmp); |
| 5207 | vht_cap->vht_rx_ldpc = QDF_MIN(vht_cap->vht_rx_ldpc, |
| 5208 | value & WMI_VHT_CAP_RX_LDPC); |
| 5209 | vht_cap->vht_short_gi_80 = QDF_MAX(vht_cap->vht_short_gi_80, |
| 5210 | value & WMI_VHT_CAP_SGI_80MHZ); |
| 5211 | vht_cap->vht_short_gi_160 = QDF_MAX(vht_cap->vht_short_gi_160, |
| 5212 | value & WMI_VHT_CAP_SGI_160MHZ); |
| 5213 | vht_cap->vht_tx_stbc = QDF_MAX(vht_cap->vht_tx_stbc, |
| 5214 | value & WMI_VHT_CAP_TX_STBC); |
| 5215 | vht_cap->vht_rx_stbc = QDF_MIN(vht_cap->vht_rx_stbc, |
| 5216 | (value & WMI_VHT_CAP_RX_STBC_1SS) | |
| 5217 | (value & WMI_VHT_CAP_RX_STBC_2SS) | |
| 5218 | (value & WMI_VHT_CAP_RX_STBC_3SS)); |
| 5219 | vht_cap->vht_max_ampdu_len_exp = |
| 5220 | QDF_MIN(vht_cap->vht_max_ampdu_len_exp, |
| 5221 | (value & WMI_VHT_CAP_MAX_AMPDU_LEN_EXP) >> |
| 5222 | WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT); |
| 5223 | vht_cap->vht_su_bformer = QDF_MAX(vht_cap->vht_su_bformer, |
| 5224 | value & WMI_VHT_CAP_SU_BFORMER); |
| 5225 | vht_cap->vht_su_bformee = QDF_MAX(vht_cap->vht_su_bformee, |
| 5226 | value & WMI_VHT_CAP_SU_BFORMEE); |
| 5227 | vht_cap->vht_mu_bformer = QDF_MAX(vht_cap->vht_mu_bformer, |
| 5228 | value & WMI_VHT_CAP_MU_BFORMER); |
| 5229 | vht_cap->vht_mu_bformee = QDF_MAX(vht_cap->vht_mu_bformee, |
| 5230 | value & WMI_VHT_CAP_MU_BFORMEE); |
| 5231 | vht_cap->vht_txop_ps = QDF_MIN(vht_cap->vht_txop_ps, |
| 5232 | value & WMI_VHT_CAP_TXOP_PS); |
| 5233 | } |
| 5234 | } |
| 5235 | |
| 5236 | /** |
| 5237 | * 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] | 5238 | * @tgt_hdl - target psoc information |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5239 | * @vht_cap: VHT cap structure to be filled |
| 5240 | * |
| 5241 | * This function loop through each hardware mode and for each hardware mode |
| 5242 | * again it loop through each MAC/PHY and pull the caps 2G and 5G specific |
| 5243 | * VHT caps and derives the final cap. |
| 5244 | * |
| 5245 | * Return: none |
| 5246 | * |
| 5247 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5248 | static void wma_update_target_ext_vht_cap(struct target_psoc_info *tgt_hdl, |
| 5249 | struct wma_tgt_vht_cap *vht_cap) |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5250 | { |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5251 | int i, num_hw_modes, total_mac_phy_cnt; |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5252 | uint32_t vht_cap_info_2g, vht_cap_info_5g; |
| 5253 | struct wma_tgt_vht_cap tmp_vht_cap = {0}, tmp_cap = {0}; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5254 | struct wlan_psoc_host_mac_phy_caps *mac_phy_cap; |
| 5255 | |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5256 | 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] | 5257 | num_hw_modes = target_psoc_get_num_hw_modes(tgt_hdl); |
| 5258 | mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5259 | |
| 5260 | /* |
| 5261 | * for legacy device extended cap might not even come, so in that case |
| 5262 | * don't overwrite legacy values |
| 5263 | */ |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5264 | if (!num_hw_modes) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5265 | WMA_LOGD("%s: No extended VHT cap for current SOC", __func__); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5266 | return; |
| 5267 | } |
| 5268 | |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 5269 | for (i = 0; i < total_mac_phy_cnt; i++) { |
| 5270 | vht_cap_info_2g = mac_phy_cap[i].vht_cap_info_2G; |
| 5271 | vht_cap_info_5g = mac_phy_cap[i].vht_cap_info_5G; |
| 5272 | if (vht_cap_info_2g) |
| 5273 | wma_derive_ext_vht_cap(&tmp_vht_cap, |
| 5274 | vht_cap_info_2g); |
| 5275 | if (vht_cap_info_5g) |
| 5276 | wma_derive_ext_vht_cap(&tmp_vht_cap, |
| 5277 | vht_cap_info_5g); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5278 | } |
| 5279 | |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 5280 | if (qdf_mem_cmp(&tmp_cap, &tmp_vht_cap, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5281 | sizeof(struct wma_tgt_vht_cap))) { |
| 5282 | qdf_mem_copy(vht_cap, &tmp_vht_cap, |
| 5283 | sizeof(struct wma_tgt_vht_cap)); |
| 5284 | } |
| 5285 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5286 | 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] | 5287 | "short_gi_80 %x tx_stbc %x rx_stbc %x txop_ps %x\n" |
| 5288 | "su_bformee %x mu_bformee %x max_ampdu_len_exp %d", __func__, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5289 | vht_cap->vht_max_mpdu, vht_cap->supp_chan_width, |
| 5290 | vht_cap->vht_rx_ldpc, vht_cap->vht_short_gi_80, |
| 5291 | vht_cap->vht_tx_stbc, vht_cap->vht_rx_stbc, |
| 5292 | vht_cap->vht_txop_ps, vht_cap->vht_su_bformee, |
| 5293 | vht_cap->vht_mu_bformee, vht_cap->vht_max_ampdu_len_exp); |
| 5294 | } |
| 5295 | |
| 5296 | /** |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 5297 | * wma_update_ra_rate_limit() - update wma config |
| 5298 | * @wma_handle: wma handle |
| 5299 | * @cfg: target config |
| 5300 | * |
| 5301 | * Return: none |
| 5302 | */ |
| 5303 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 5304 | static void wma_update_ra_rate_limit(tp_wma_handle wma_handle, |
| 5305 | struct wma_tgt_cfg *cfg) |
| 5306 | { |
| 5307 | cfg->is_ra_rate_limit_enabled = wma_handle->IsRArateLimitEnabled; |
| 5308 | } |
| 5309 | #else |
| 5310 | static void wma_update_ra_rate_limit(tp_wma_handle wma_handle, |
| 5311 | struct wma_tgt_cfg *cfg) |
| 5312 | { |
| 5313 | } |
| 5314 | #endif |
| 5315 | |
| 5316 | /** |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 5317 | * wma_update_hdd_band_cap() - update band cap which hdd understands |
| 5318 | * @supported_band: supported band which has been given by FW |
| 5319 | * @tgt_cfg: target configuration to be updated |
| 5320 | * |
| 5321 | * Convert WMA given supported band to enum which HDD understands |
| 5322 | * |
| 5323 | * Return: None |
| 5324 | */ |
| 5325 | static void wma_update_hdd_band_cap(WMI_PHY_CAPABILITY supported_band, |
| 5326 | struct wma_tgt_cfg *tgt_cfg) |
| 5327 | { |
| 5328 | switch (supported_band) { |
| 5329 | case WMI_11G_CAPABILITY: |
| 5330 | case WMI_11NG_CAPABILITY: |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 5331 | tgt_cfg->band_cap = BAND_2G; |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 5332 | break; |
| 5333 | case WMI_11A_CAPABILITY: |
| 5334 | case WMI_11NA_CAPABILITY: |
| 5335 | case WMI_11AC_CAPABILITY: |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 5336 | tgt_cfg->band_cap = BAND_5G; |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 5337 | break; |
| 5338 | case WMI_11AG_CAPABILITY: |
| 5339 | case WMI_11NAG_CAPABILITY: |
| 5340 | default: |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 5341 | tgt_cfg->band_cap = BAND_ALL; |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 5342 | } |
| 5343 | } |
| 5344 | |
| 5345 | /** |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 5346 | * wma_update_obss_detection_support() - update obss detection offload support |
| 5347 | * @wh: wma handle |
| 5348 | * @tgt_cfg: target configuration to be updated |
| 5349 | * |
| 5350 | * Update obss detection offload support based on service bit. |
| 5351 | * |
| 5352 | * Return: None |
| 5353 | */ |
| 5354 | static void wma_update_obss_detection_support(tp_wma_handle wh, |
| 5355 | struct wma_tgt_cfg *tgt_cfg) |
| 5356 | { |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 5357 | if (wmi_service_enabled(wh->wmi_handle, |
| 5358 | wmi_service_ap_obss_detection_offload)) |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 5359 | tgt_cfg->obss_detection_offloaded = true; |
| 5360 | else |
| 5361 | tgt_cfg->obss_detection_offloaded = false; |
| 5362 | } |
| 5363 | |
| 5364 | /** |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 5365 | * wma_update_obss_color_collision_support() - update obss color collision |
| 5366 | * offload support |
| 5367 | * @wh: wma handle |
| 5368 | * @tgt_cfg: target configuration to be updated |
| 5369 | * |
| 5370 | * Update obss color collision offload support based on service bit. |
| 5371 | * |
| 5372 | * Return: None |
| 5373 | */ |
| 5374 | static void wma_update_obss_color_collision_support(tp_wma_handle wh, |
| 5375 | struct wma_tgt_cfg *tgt_cfg) |
| 5376 | { |
| 5377 | if (wmi_service_enabled(wh->wmi_handle, wmi_service_bss_color_offload)) |
| 5378 | tgt_cfg->obss_color_collision_offloaded = true; |
| 5379 | else |
| 5380 | tgt_cfg->obss_color_collision_offloaded = false; |
| 5381 | } |
| 5382 | |
Jeff Johnson | 6ec742c | 2018-03-31 15:21:08 -0700 | [diff] [blame] | 5383 | #ifdef WLAN_SUPPORT_GREEN_AP |
| 5384 | static void wma_green_ap_register_handlers(tp_wma_handle wma_handle) |
| 5385 | { |
| 5386 | if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 5387 | WMI_SERVICE_EGAP)) |
| 5388 | target_if_green_ap_register_egap_event_handler( |
| 5389 | wma_handle->pdev); |
| 5390 | |
| 5391 | } |
| 5392 | #else |
| 5393 | static void wma_green_ap_register_handlers(tp_wma_handle wma_handle) |
| 5394 | { |
| 5395 | } |
| 5396 | #endif |
| 5397 | |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 5398 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5399 | * wma_update_hdd_cfg() - update HDD config |
| 5400 | * @wma_handle: wma handle |
| 5401 | * |
| 5402 | * Return: none |
| 5403 | */ |
| 5404 | static void wma_update_hdd_cfg(tp_wma_handle wma_handle) |
| 5405 | { |
| 5406 | struct wma_tgt_cfg tgt_cfg; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5407 | void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5408 | target_resource_config *wlan_res_cfg; |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5409 | struct wlan_psoc_host_service_ext_param *service_ext_param; |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 5410 | struct target_psoc_info *tgt_hdl; |
| 5411 | struct wmi_unified *wmi_handle; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5412 | |
| 5413 | WMA_LOGD("%s: Enter", __func__); |
| 5414 | |
| 5415 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 5416 | if (!tgt_hdl) { |
| 5417 | WMA_LOGE("%s: target psoc info is NULL", __func__); |
| 5418 | return; |
| 5419 | } |
| 5420 | |
| 5421 | wlan_res_cfg = target_psoc_get_wlan_res_cfg(tgt_hdl); |
Arif Hussain | d15902c | 2018-03-02 00:08:29 -0800 | [diff] [blame] | 5422 | if (!wlan_res_cfg) { |
| 5423 | WMA_LOGE("%s: wlan_res_cfg is null", __func__); |
| 5424 | return; |
| 5425 | } |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5426 | service_ext_param = |
| 5427 | target_psoc_get_service_ext_param(tgt_hdl); |
Sourav Mohapatra | cf63257 | 2018-04-02 11:01:35 +0530 | [diff] [blame^] | 5428 | wmi_handle = get_wmi_unified_hdl_from_psoc(wma_handle->psoc); |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 5429 | if (!wmi_handle) { |
| 5430 | WMA_LOGE("%s: wmi handle is NULL", __func__); |
| 5431 | return; |
| 5432 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5433 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5434 | qdf_mem_zero(&tgt_cfg, sizeof(struct wma_tgt_cfg)); |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 5435 | |
| 5436 | tgt_cfg.sub_20_support = wma_handle->sub_20_support; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5437 | tgt_cfg.reg_domain = wma_handle->reg_cap.eeprom_rd; |
| 5438 | tgt_cfg.eeprom_rd_ext = wma_handle->reg_cap.eeprom_rd_ext; |
| 5439 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5440 | tgt_cfg.max_intf_count = wlan_res_cfg->num_vdevs; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5441 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5442 | qdf_mem_copy(tgt_cfg.hw_macaddr.bytes, wma_handle->hwaddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5443 | ATH_MAC_LEN); |
| 5444 | |
Arunk Khandavalli | 4b44ef4 | 2018-01-25 16:45:49 +0530 | [diff] [blame] | 5445 | wma_update_target_services(wmi_handle, &tgt_cfg.services); |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5446 | wma_update_target_ht_cap(tgt_hdl, &tgt_cfg.ht_cap); |
| 5447 | wma_update_target_vht_cap(tgt_hdl, &tgt_cfg.vht_cap); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 5448 | /* |
| 5449 | * This will overwrite the structure filled by wma_update_target_ht_cap |
| 5450 | * and wma_update_target_vht_cap APIs. |
| 5451 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5452 | wma_update_target_ext_ht_cap(tgt_hdl, &tgt_cfg.ht_cap); |
| 5453 | wma_update_target_ext_vht_cap(tgt_hdl, &tgt_cfg.vht_cap); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5454 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5455 | wma_update_target_ext_he_cap(tgt_hdl, &tgt_cfg); |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 5456 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5457 | tgt_cfg.target_fw_version = target_if_get_fw_version(tgt_hdl); |
| 5458 | if (service_ext_param) |
| 5459 | tgt_cfg.target_fw_vers_ext = |
| 5460 | service_ext_param->fw_build_vers_ext; |
| 5461 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5462 | #ifdef WLAN_FEATURE_LPSS |
| 5463 | tgt_cfg.lpss_support = wma_handle->lpss_support; |
| 5464 | #endif /* WLAN_FEATURE_LPSS */ |
| 5465 | tgt_cfg.ap_arpns_support = wma_handle->ap_arpns_support; |
Rajeev Kumar | e5a1682 | 2016-07-27 13:11:42 -0700 | [diff] [blame] | 5466 | tgt_cfg.bpf_enabled = wma_handle->bpf_enabled; |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 5467 | tgt_cfg.dfs_cac_offload = wma_handle->is_dfs_offloaded; |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 5468 | tgt_cfg.rcpi_enabled = wma_handle->rcpi_enabled; |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 5469 | wma_update_ra_rate_limit(wma_handle, &tgt_cfg); |
Arunk Khandavalli | 80a6135 | 2018-01-25 12:19:37 +0530 | [diff] [blame] | 5470 | wma_update_hdd_band_cap(target_if_get_phy_capability(tgt_hdl), |
| 5471 | &tgt_cfg); |
Krishna Kumaar Natarajan | 1ae4911 | 2015-11-24 21:43:22 -0800 | [diff] [blame] | 5472 | tgt_cfg.fine_time_measurement_cap = |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5473 | target_if_get_wmi_fw_sub_feat_caps(tgt_hdl); |
Rajeev Kumar Sirasanagandla | 4787300 | 2016-09-09 13:46:09 +0530 | [diff] [blame] | 5474 | tgt_cfg.wmi_max_len = wmi_get_max_msg_len(wma_handle->wmi_handle) |
| 5475 | - WMI_TLV_HEADROOM; |
Nachiket Kukade | 8b4bfd8 | 2017-05-25 18:34:48 +0530 | [diff] [blame] | 5476 | tgt_cfg.tx_bfee_8ss_enabled = wma_handle->tx_bfee_8ss_enabled; |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 5477 | wma_update_obss_detection_support(wma_handle, &tgt_cfg); |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 5478 | wma_update_obss_color_collision_support(wma_handle, &tgt_cfg); |
Deepak Dhamdhere | 13230d3 | 2016-05-26 00:46:53 -0700 | [diff] [blame] | 5479 | wma_update_hdd_cfg_ndp(wma_handle, &tgt_cfg); |
Naveen Rawat | cb186cf | 2016-07-11 13:47:19 -0700 | [diff] [blame] | 5480 | wma_handle->tgt_cfg_update_cb(hdd_ctx, &tgt_cfg); |
Himanshu Agarwal | 2228e07 | 2018-01-24 17:42:17 +0530 | [diff] [blame] | 5481 | 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] | 5482 | target_pdev_set_wmi_handle(wma_handle->pdev->tgt_if_handle, |
| 5483 | wma_handle->wmi_handle); |
Jeff Johnson | 6ec742c | 2018-03-31 15:21:08 -0700 | [diff] [blame] | 5484 | wma_green_ap_register_handlers(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5485 | } |
| 5486 | |
| 5487 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5488 | * wma_dump_dbs_hw_mode() - Print the DBS HW modes |
| 5489 | * @wma_handle: WMA handle |
| 5490 | * |
| 5491 | * Prints the DBS HW modes sent by the FW as part |
| 5492 | * of WMI ready event |
| 5493 | * |
| 5494 | * Return: None |
| 5495 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 5496 | static void wma_dump_dbs_hw_mode(tp_wma_handle wma_handle) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5497 | { |
| 5498 | uint32_t i, param; |
| 5499 | |
| 5500 | if (!wma_handle) { |
| 5501 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 5502 | return; |
| 5503 | } |
| 5504 | |
| 5505 | for (i = 0; i < wma_handle->num_dbs_hw_modes; i++) { |
| 5506 | param = wma_handle->hw_mode.hw_mode_list[i]; |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 5507 | 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] | 5508 | __func__, i, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5509 | WMA_HW_MODE_MAC0_TX_STREAMS_GET(param), |
| 5510 | WMA_HW_MODE_MAC0_RX_STREAMS_GET(param), |
| 5511 | WMA_HW_MODE_MAC0_BANDWIDTH_GET(param)); |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 5512 | 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] | 5513 | __func__, i, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5514 | WMA_HW_MODE_MAC1_TX_STREAMS_GET(param), |
| 5515 | WMA_HW_MODE_MAC1_RX_STREAMS_GET(param), |
| 5516 | WMA_HW_MODE_MAC1_BANDWIDTH_GET(param)); |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 5517 | WMA_LOGD("%s:[%d] DBS:%d SBS:%d", __func__, i, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5518 | WMA_HW_MODE_DBS_MODE_GET(param), |
| 5519 | WMA_HW_MODE_SBS_MODE_GET(param)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5520 | } |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 5521 | policy_mgr_dump_dbs_hw_mode(wma_handle->psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5522 | } |
| 5523 | |
| 5524 | /** |
| 5525 | * wma_init_scan_fw_mode_config() - Initialize scan/fw mode config |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5526 | * @psoc: Object manager psoc |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 5527 | * @scan_config: Scam mode configuration |
| 5528 | * @fw_config: FW mode configuration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5529 | * |
| 5530 | * Enables all the valid bits of concurrent_scan_config_bits and |
| 5531 | * fw_mode_config_bits. |
| 5532 | * |
| 5533 | * Return: None |
| 5534 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5535 | 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] | 5536 | uint32_t scan_config, |
| 5537 | uint32_t fw_config) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5538 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5539 | WMA_LOGD("%s: Enter", __func__); |
| 5540 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5541 | if (!psoc) { |
| 5542 | WMA_LOGE("%s: obj psoc is NULL", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5543 | return; |
| 5544 | } |
| 5545 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5546 | policy_mgr_init_dbs_config(psoc, scan_config, fw_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5547 | } |
| 5548 | |
| 5549 | /** |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 5550 | * wma_update_ra_limit() - update ra limit based on bpf filter |
| 5551 | * enabled or not |
| 5552 | * @handle: wma handle |
| 5553 | * |
| 5554 | * Return: none |
| 5555 | */ |
| 5556 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 5557 | static void wma_update_ra_limit(tp_wma_handle wma_handle) |
| 5558 | { |
| 5559 | if (wma_handle->bpf_enabled) |
| 5560 | wma_handle->IsRArateLimitEnabled = false; |
| 5561 | } |
| 5562 | #else |
| 5563 | static void wma_update_ra__limit(tp_wma_handle handle) |
| 5564 | { |
| 5565 | } |
| 5566 | #endif |
| 5567 | |
Dustin Brown | 06259e5 | 2018-02-28 16:00:02 -0800 | [diff] [blame] | 5568 | static void wma_set_pmo_caps(struct wlan_objmgr_psoc *psoc) |
| 5569 | { |
| 5570 | QDF_STATUS status; |
| 5571 | struct pmo_device_caps caps; |
| 5572 | |
| 5573 | caps.arp_ns_offload = |
| 5574 | wma_is_service_enabled(wmi_service_arpns_offload); |
| 5575 | caps.apf = |
| 5576 | wma_is_service_enabled(wmi_service_bpf_offload); |
| 5577 | caps.packet_filter = |
| 5578 | wma_is_service_enabled(wmi_service_packet_filter_offload); |
| 5579 | caps.unified_wow = |
| 5580 | wma_is_service_enabled(wmi_service_unified_wow_capability); |
| 5581 | |
| 5582 | status = ucfg_pmo_psoc_set_caps(psoc, &caps); |
| 5583 | if (QDF_IS_STATUS_ERROR(status)) |
| 5584 | WMA_LOGE("Failed to set PMO capabilities; status:%d", status); |
| 5585 | } |
| 5586 | |
| 5587 | static void wma_set_component_caps(struct wlan_objmgr_psoc *psoc) |
| 5588 | { |
| 5589 | wma_set_pmo_caps(psoc); |
| 5590 | } |
| 5591 | |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 5592 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5593 | * wma_rx_service_ready_event() - event handler to process |
| 5594 | * wmi rx sevice ready event. |
| 5595 | * @handle: wma handle |
| 5596 | * @cmd_param_info: command params info |
| 5597 | * |
| 5598 | * Return: none |
| 5599 | */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5600 | 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] | 5601 | uint32_t length) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5602 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5603 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5604 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 5605 | wmi_service_ready_event_fixed_param *ev; |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5606 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5607 | uint32_t *ev_wlan_dbs_hw_mode_list; |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 5608 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 5609 | struct target_psoc_info *tgt_hdl; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5610 | struct wlan_psoc_target_capability_info *tgt_cap_info; |
| 5611 | target_resource_config *wlan_res_cfg; |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5612 | struct wmi_unified *wmi_handle; |
| 5613 | uint32_t *service_bitmap; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5614 | |
| 5615 | WMA_LOGD("%s: Enter", __func__); |
| 5616 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5617 | if (!handle) { |
| 5618 | WMA_LOGE("%s: wma_handle passed is NULL", __func__); |
| 5619 | return -EINVAL; |
| 5620 | } |
| 5621 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 5622 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 5623 | if (!tgt_hdl) { |
| 5624 | WMA_LOGE("%s: target psoc info is NULL", __func__); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5625 | return -EINVAL; |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 5626 | } |
| 5627 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5628 | wlan_res_cfg = target_psoc_get_wlan_res_cfg(tgt_hdl); |
| 5629 | tgt_cap_info = target_psoc_get_target_caps(tgt_hdl); |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5630 | service_bitmap = target_psoc_get_service_bitmap(tgt_hdl); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5631 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5632 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) cmd_param_info; |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5633 | if (!param_buf) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5634 | WMA_LOGE("%s: Invalid arguments", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5635 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5636 | } |
| 5637 | |
| 5638 | ev = param_buf->fixed_param; |
| 5639 | if (!ev) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5640 | WMA_LOGE("%s: Invalid buffer", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5641 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5642 | } |
| 5643 | |
Sourav Mohapatra | cf63257 | 2018-04-02 11:01:35 +0530 | [diff] [blame^] | 5644 | wmi_handle = get_wmi_unified_hdl_from_psoc(wma_handle->psoc); |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5645 | if (!wmi_handle) { |
| 5646 | WMA_LOGE("%s: wmi handle is NULL", __func__); |
| 5647 | return -EINVAL; |
| 5648 | } |
| 5649 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 5650 | WMA_LOGD("WMA <-- WMI_SERVICE_READY_EVENTID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5651 | |
Amar Singhal | 7b038ca | 2017-10-04 13:38:39 -0700 | [diff] [blame] | 5652 | if (ev->num_dbs_hw_modes > param_buf->num_wlan_dbs_hw_mode_list) { |
| 5653 | WMA_LOGE("FW dbs_hw_mode entry %d more than value %d in TLV hdr", |
| 5654 | ev->num_dbs_hw_modes, |
| 5655 | param_buf->num_wlan_dbs_hw_mode_list); |
| 5656 | return -EINVAL; |
| 5657 | } |
| 5658 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5659 | wma_handle->num_dbs_hw_modes = ev->num_dbs_hw_modes; |
| 5660 | ev_wlan_dbs_hw_mode_list = param_buf->wlan_dbs_hw_mode_list; |
| 5661 | wma_handle->hw_mode.hw_mode_list = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5662 | qdf_mem_malloc(sizeof(*wma_handle->hw_mode.hw_mode_list) * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5663 | wma_handle->num_dbs_hw_modes); |
| 5664 | if (!wma_handle->hw_mode.hw_mode_list) { |
| 5665 | WMA_LOGE("%s: Memory allocation failed for DBS", __func__); |
| 5666 | /* Continuing with the rest of the processing */ |
| 5667 | } |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5668 | |
| 5669 | if (wma_handle->hw_mode.hw_mode_list) |
| 5670 | qdf_mem_copy(wma_handle->hw_mode.hw_mode_list, |
| 5671 | ev_wlan_dbs_hw_mode_list, |
| 5672 | (sizeof(*wma_handle->hw_mode.hw_mode_list) * |
| 5673 | wma_handle->num_dbs_hw_modes)); |
| 5674 | |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 5675 | policy_mgr_init_dbs_hw_mode(wma_handle->psoc, |
| 5676 | ev->num_dbs_hw_modes, ev_wlan_dbs_hw_mode_list); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5677 | wma_dump_dbs_hw_mode(wma_handle); |
| 5678 | |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 5679 | /* Initializes the fw_mode and scan_config to zero. |
| 5680 | * If ext service ready event is present it will set |
| 5681 | * the actual values of these two params. |
| 5682 | * This is to ensure that no garbage values would be |
| 5683 | * present in the absence of ext service ready event. |
| 5684 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5685 | wma_init_scan_fw_mode_config(wma_handle->psoc, 0, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5686 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5687 | qdf_mem_copy(&wma_handle->reg_cap, param_buf->hal_reg_capabilities, |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5688 | sizeof(HAL_REG_CAPABILITIES)); |
| 5689 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5690 | wma_handle->vht_supp_mcs = ev->vht_supp_mcs; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5691 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5692 | 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] | 5693 | policy_mgr_update_new_hw_mode_index(wma_handle->psoc, |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5694 | tgt_cap_info->default_dbs_hw_mode_index); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5695 | |
| 5696 | WMA_LOGD("%s: Firmware default hw mode index : %d", |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5697 | __func__, tgt_cap_info->default_dbs_hw_mode_index); |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 5698 | WMA_LOGI("%s: Firmware build version : %08x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5699 | __func__, ev->fw_build_vers); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5700 | WMA_LOGD("FW fine time meas cap: 0x%x", |
| 5701 | tgt_cap_info->wmi_fw_sub_feat_caps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5702 | |
| 5703 | if (ev->hw_bd_id) { |
| 5704 | wma_handle->hw_bd_id = ev->hw_bd_id; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5705 | qdf_mem_copy(wma_handle->hw_bd_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5706 | ev->hw_bd_info, sizeof(ev->hw_bd_info)); |
| 5707 | |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 5708 | WMA_LOGI("%s: Board version: %x.%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5709 | __func__, |
| 5710 | wma_handle->hw_bd_info[0], wma_handle->hw_bd_info[1]); |
| 5711 | } else { |
| 5712 | wma_handle->hw_bd_id = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5713 | qdf_mem_zero(wma_handle->hw_bd_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5714 | sizeof(wma_handle->hw_bd_info)); |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 5715 | WMA_LOGW("%s: Board version is unknown!", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5716 | } |
| 5717 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5718 | /* wmi service is ready */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5719 | qdf_mem_copy(wma_handle->wmi_service_bitmap, |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5720 | service_bitmap, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5721 | sizeof(wma_handle->wmi_service_bitmap)); |
Nirav Shah | 22bf44d | 2015-12-10 15:39:48 +0530 | [diff] [blame] | 5722 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 5723 | cdp_cfg_tx_set_is_mgmt_over_wmi_enabled(soc, |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5724 | wmi_service_enabled(wmi_handle, wmi_service_mgmt_tx_wmi)); |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 5725 | cdp_set_desc_global_pool_size(soc, ev->num_msdu_desc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5726 | /* SWBA event handler for beacon transmission */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5727 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5728 | wmi_host_swba_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5729 | wma_beacon_swba_handler, |
| 5730 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5731 | if (QDF_IS_STATUS_ERROR(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5732 | WMA_LOGE("Failed to register swba beacon event cb"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5733 | goto free_hw_mode_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5734 | } |
| 5735 | #ifdef WLAN_FEATURE_LPSS |
| 5736 | wma_handle->lpss_support = |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5737 | wmi_service_enabled(wmi_handle, wmi_service_lpass); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5738 | #endif /* WLAN_FEATURE_LPSS */ |
| 5739 | |
| 5740 | /* |
| 5741 | * This Service bit is added to check for ARP/NS Offload |
| 5742 | * support for LL/HL targets |
| 5743 | */ |
| 5744 | wma_handle->ap_arpns_support = |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5745 | wmi_service_enabled(wmi_handle, wmi_service_ap_arpns_offload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5746 | |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 5747 | wma_handle->bpf_enabled = (wma_handle->bpf_packet_filter_enable && |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5748 | wmi_service_enabled(wmi_handle, wmi_service_bpf_offload)); |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 5749 | wma_update_ra_limit(wma_handle); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5750 | |
| 5751 | if (wmi_service_enabled(wmi_handle, wmi_service_csa_offload)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5752 | WMA_LOGD("%s: FW support CSA offload capability", __func__); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5753 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5754 | wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5755 | wmi_csa_handling_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5756 | wma_csa_offload_handler, |
| 5757 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5758 | if (QDF_IS_STATUS_ERROR(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5759 | WMA_LOGE("Failed to register CSA offload event cb"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5760 | goto free_hw_mode_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5761 | } |
| 5762 | } |
| 5763 | |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5764 | if (wmi_service_enabled(wmi_handle, wmi_service_mgmt_tx_wmi)) { |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 5765 | 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] | 5766 | /* |
| 5767 | * Register Tx completion event handler for MGMT Tx over WMI |
| 5768 | * case |
| 5769 | */ |
| 5770 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5771 | wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5772 | wmi_mgmt_tx_completion_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5773 | wma_mgmt_tx_completion_handler, |
| 5774 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5775 | if (QDF_IS_STATUS_ERROR(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5776 | WMA_LOGE("Failed to register MGMT over WMI completion handler"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5777 | goto free_hw_mode_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5778 | } |
| 5779 | |
Nirav Shah | 2048997 | 2016-06-16 19:20:28 +0530 | [diff] [blame] | 5780 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5781 | wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5782 | wmi_mgmt_tx_bundle_completion_event_id, |
Nirav Shah | 2048997 | 2016-06-16 19:20:28 +0530 | [diff] [blame] | 5783 | wma_mgmt_tx_bundle_completion_handler, |
| 5784 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5785 | if (QDF_IS_STATUS_ERROR(status)) { |
Nirav Shah | 2048997 | 2016-06-16 19:20:28 +0530 | [diff] [blame] | 5786 | WMA_LOGE("Failed to register MGMT over WMI completion handler"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5787 | goto free_hw_mode_list; |
Nirav Shah | 2048997 | 2016-06-16 19:20:28 +0530 | [diff] [blame] | 5788 | } |
| 5789 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5790 | } else { |
| 5791 | WMA_LOGE("FW doesnot support WMI_SERVICE_MGMT_TX_WMI, Use HTT interface for Management Tx"); |
| 5792 | } |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5793 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5794 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5795 | if (wmi_service_enabled(wmi_handle, wmi_service_gtk_offload)) { |
| 5796 | status = wmi_unified_register_event_handler( |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5797 | wma_handle->wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5798 | wmi_gtk_offload_status_event_id, |
Mukul Sharma | 3d36c39 | 2017-01-18 18:39:12 +0530 | [diff] [blame] | 5799 | target_if_pmo_gtk_offload_status_event, |
| 5800 | WMA_RX_WORK_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5801 | if (QDF_IS_STATUS_ERROR(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5802 | WMA_LOGE("Failed to register GTK offload event cb"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5803 | goto free_hw_mode_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5804 | } |
| 5805 | } |
| 5806 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
| 5807 | |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5808 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5809 | wmi_tbttoffset_update_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5810 | wma_tbttoffset_update_event_handler, |
| 5811 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5812 | if (QDF_IS_STATUS_ERROR(status)) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5813 | WMA_LOGE("Failed to register WMI_TBTTOFFSET_UPDATE_EVENTID callback"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5814 | goto free_hw_mode_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5815 | } |
| 5816 | |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 5817 | if (wmi_service_enabled(wma_handle->wmi_handle, |
| 5818 | wmi_service_rcpi_support)) { |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 5819 | /* register for rcpi response event */ |
| 5820 | status = wmi_unified_register_event_handler( |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5821 | wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5822 | wmi_update_rcpi_event_id, |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 5823 | wma_rcpi_event_handler, |
| 5824 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5825 | if (QDF_IS_STATUS_ERROR(status)) { |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 5826 | WMA_LOGE("Failed to register RCPI event handler"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5827 | goto free_hw_mode_list; |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 5828 | } |
| 5829 | wma_handle->rcpi_enabled = true; |
| 5830 | } |
| 5831 | |
Govind Singh | efc5ccd | 2016-04-25 11:11:55 +0530 | [diff] [blame] | 5832 | /* mac_id is replaced with pdev_id in converged firmware to have |
| 5833 | * multi-radio support. In order to maintain backward compatibility |
| 5834 | * with old fw, host needs to check WMI_SERVICE_DEPRECATED_REPLACE |
| 5835 | * in service bitmap from FW and host needs to set use_pdev_id in |
| 5836 | * wmi_resource_config to true. If WMI_SERVICE_DEPRECATED_REPLACE |
| 5837 | * service is not set, then host shall not expect MAC ID from FW in |
| 5838 | * VDEV START RESPONSE event and host shall use PDEV ID. |
| 5839 | */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5840 | if (wmi_service_enabled(wmi_handle, wmi_service_deprecated_replace)) |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5841 | wlan_res_cfg->use_pdev_id = true; |
Govind Singh | efc5ccd | 2016-04-25 11:11:55 +0530 | [diff] [blame] | 5842 | else |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5843 | wlan_res_cfg->use_pdev_id = false; |
Govind Singh | efc5ccd | 2016-04-25 11:11:55 +0530 | [diff] [blame] | 5844 | |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5845 | 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] | 5846 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5847 | /* Initialize the log supported event handler */ |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5848 | status = wmi_unified_register_event_handler(wmi_handle, |
Mukul Sharma | 228223a | 2017-11-03 19:25:39 +0530 | [diff] [blame] | 5849 | wmi_diag_event_id_log_supported_event_id, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5850 | wma_log_supported_evt_handler, |
| 5851 | WMA_RX_SERIALIZER_CTX); |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5852 | if (QDF_IS_STATUS_ERROR(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5853 | WMA_LOGE("Failed to register log supported event cb"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5854 | goto free_hw_mode_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5855 | } |
| 5856 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 5857 | cdp_mark_first_wakeup_packet(soc, |
Arunk Khandavalli | aaf6b14 | 2018-01-25 12:42:42 +0530 | [diff] [blame] | 5858 | wmi_service_enabled(wmi_handle, |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 5859 | wmi_service_mark_first_wakeup_packet)); |
Arif Hussain | d54b62c | 2018-03-01 13:31:37 -0800 | [diff] [blame] | 5860 | wma_handle->is_dfs_offloaded = |
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_dfs_phyerr_offload); |
Deepak Dhamdhere | 13230d3 | 2016-05-26 00:46:53 -0700 | [diff] [blame] | 5863 | wma_handle->nan_datapath_enabled = |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 5864 | wmi_service_enabled(wma_handle->wmi_handle, |
| 5865 | wmi_service_nan_data); |
Dustin Brown | 06259e5 | 2018-02-28 16:00:02 -0800 | [diff] [blame] | 5866 | |
| 5867 | wma_set_component_caps(wma_handle->psoc); |
| 5868 | |
Dustin Brown | b9987af | 2018-03-01 17:15:11 -0800 | [diff] [blame] | 5869 | wma_update_fw_config(wma_handle->psoc, tgt_hdl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5870 | |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5871 | status = wmi_unified_save_fw_version_cmd(wmi_handle, param_buf); |
| 5872 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 5873 | WMA_LOGE("Failed to send WMI_INIT_CMDID command"); |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5874 | goto free_hw_mode_list; |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 5875 | } |
| 5876 | |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5877 | status = qdf_mc_timer_start(&wma_handle->service_ready_ext_timer, |
| 5878 | WMA_SERVICE_READY_EXT_TIMEOUT); |
| 5879 | if (QDF_IS_STATUS_ERROR(status)) |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 5880 | WMA_LOGE("Failed to start the service ready ext timer"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5881 | |
Dustin Brown | 7678b6c | 2018-03-07 13:00:52 -0800 | [diff] [blame] | 5882 | wma_handle->tx_bfee_8ss_enabled = |
| 5883 | wmi_service_enabled(wmi_handle, wmi_service_8ss_tx_bfee); |
Nachiket Kukade | 8b4bfd8 | 2017-05-25 18:34:48 +0530 | [diff] [blame] | 5884 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 5885 | target_psoc_set_num_radios(tgt_hdl, 1); |
| 5886 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5887 | return 0; |
Arunk Khandavalli | cfde271 | 2018-01-25 11:27:42 +0530 | [diff] [blame] | 5888 | |
| 5889 | free_hw_mode_list: |
| 5890 | if (wma_handle->hw_mode.hw_mode_list) { |
| 5891 | qdf_mem_free(wma_handle->hw_mode.hw_mode_list); |
| 5892 | wma_handle->hw_mode.hw_mode_list = NULL; |
| 5893 | WMA_LOGD("%s: DBS list is freed", __func__); |
| 5894 | } |
| 5895 | |
| 5896 | return -EINVAL; |
| 5897 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5898 | } |
| 5899 | |
| 5900 | /** |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5901 | * wma_get_phyid_for_given_band() - to get phyid for band |
| 5902 | * |
| 5903 | * @wma_handle: Pointer to wma handle |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5904 | * @tgt_hdl: target psoc information |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5905 | * @band: enum value of for 2G or 5G band |
| 5906 | * @phyid: Pointer to phyid which needs to be filled |
| 5907 | * |
| 5908 | * This API looks in to the map to find out which particular phy supports |
| 5909 | * provided band and return the idx (also called phyid) of that phy. Caller |
| 5910 | * use this phyid to fetch various caps of that phy |
| 5911 | * |
| 5912 | * Return: QDF_STATUS |
| 5913 | */ |
| 5914 | static QDF_STATUS wma_get_phyid_for_given_band( |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5915 | tp_wma_handle wma_handle, |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5916 | struct target_psoc_info *tgt_hdl, |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5917 | enum cds_band_type band, uint8_t *phyid) |
| 5918 | { |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5919 | uint8_t idx, i, num_radios; |
| 5920 | struct wlan_psoc_host_mac_phy_caps *mac_phy_cap; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5921 | |
| 5922 | if (!wma_handle) { |
| 5923 | WMA_LOGE("Invalid wma handle"); |
| 5924 | return QDF_STATUS_E_FAILURE; |
| 5925 | } |
| 5926 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5927 | idx = 0; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5928 | *phyid = idx; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5929 | num_radios = target_psoc_get_num_radios(tgt_hdl); |
| 5930 | mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5931 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5932 | for (i = 0; i < num_radios; i++) { |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5933 | if ((band == CDS_BAND_2GHZ) && |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5934 | (WLAN_2G_CAPABILITY == mac_phy_cap[idx + i].supported_bands)) { |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5935 | *phyid = idx + i; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5936 | WMA_LOGD("Select 2G capable phyid[%d]", *phyid); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5937 | return QDF_STATUS_SUCCESS; |
| 5938 | } else if ((band == CDS_BAND_5GHZ) && |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5939 | (WLAN_5G_CAPABILITY == mac_phy_cap[idx + i].supported_bands)) { |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5940 | *phyid = idx + i; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5941 | WMA_LOGD("Select 5G capable phyid[%d]", *phyid); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5942 | return QDF_STATUS_SUCCESS; |
| 5943 | } |
| 5944 | } |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5945 | WMA_LOGD("Using default single hw mode phyid[%d]", *phyid); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5946 | return QDF_STATUS_SUCCESS; |
| 5947 | } |
| 5948 | |
| 5949 | /** |
| 5950 | * wma_get_caps_for_phyidx_hwmode() - to fetch caps for given hw mode and band |
| 5951 | * @caps_per_phy: Pointer to capabilities structure which needs to be filled |
| 5952 | * @hw_mode: Provided hardware mode |
| 5953 | * @band: Provide band i.e. 2G or 5G |
| 5954 | * |
| 5955 | * This API finds cap which suitable for provided hw mode and band. If user |
| 5956 | * is provides some invalid hw mode then it will automatically falls back to |
| 5957 | * default hw mode |
| 5958 | * |
| 5959 | * Return: QDF_STATUS |
| 5960 | */ |
| 5961 | QDF_STATUS wma_get_caps_for_phyidx_hwmode(struct wma_caps_per_phy *caps_per_phy, |
| 5962 | enum hw_mode_dbs_capab hw_mode, enum cds_band_type band) |
| 5963 | { |
| 5964 | t_wma_handle *wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5965 | struct target_psoc_info *tgt_hdl; |
| 5966 | int ht_cap_info, vht_cap_info; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5967 | uint8_t phyid, our_hw_mode = hw_mode, num_hw_modes; |
| 5968 | struct wlan_psoc_host_mac_phy_caps *mac_phy_cap; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5969 | |
| 5970 | if (!wma_handle) { |
| 5971 | WMA_LOGE("Invalid wma handle"); |
| 5972 | return QDF_STATUS_E_FAILURE; |
| 5973 | } |
| 5974 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5975 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 5976 | if (!tgt_hdl) { |
| 5977 | WMA_LOGE("%s: target psoc info is NULL", __func__); |
| 5978 | return -EINVAL; |
| 5979 | } |
| 5980 | |
| 5981 | ht_cap_info = target_if_get_ht_cap_info(tgt_hdl); |
| 5982 | vht_cap_info = target_if_get_vht_cap_info(tgt_hdl); |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5983 | num_hw_modes = target_psoc_get_num_hw_modes(tgt_hdl); |
| 5984 | mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5985 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 5986 | if (!num_hw_modes) { |
jiad | 080abce | 2017-08-08 15:17:39 +0800 | [diff] [blame] | 5987 | WMA_LOGD("Invalid number of hw modes, use legacy HT/VHT caps"); |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 5988 | caps_per_phy->ht_2g = ht_cap_info; |
| 5989 | caps_per_phy->ht_5g = ht_cap_info; |
| 5990 | caps_per_phy->vht_2g = vht_cap_info; |
| 5991 | caps_per_phy->vht_5g = vht_cap_info; |
jiad | 080abce | 2017-08-08 15:17:39 +0800 | [diff] [blame] | 5992 | /* legacy platform doesn't support HE IE */ |
| 5993 | caps_per_phy->he_2g = 0; |
| 5994 | caps_per_phy->he_5g = 0; |
| 5995 | |
| 5996 | return QDF_STATUS_SUCCESS; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5997 | } |
| 5998 | |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 5999 | if (!policy_mgr_is_dbs_enable(wma_handle->psoc)) |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6000 | our_hw_mode = HW_MODE_DBS_NONE; |
| 6001 | |
| 6002 | if (!caps_per_phy) { |
| 6003 | WMA_LOGE("Invalid caps pointer"); |
| 6004 | return QDF_STATUS_E_FAILURE; |
| 6005 | } |
| 6006 | |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6007 | if (QDF_STATUS_SUCCESS != |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6008 | wma_get_phyid_for_given_band(wma_handle, tgt_hdl, band, &phyid)) { |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6009 | WMA_LOGE("Invalid phyid"); |
| 6010 | return QDF_STATUS_E_FAILURE; |
| 6011 | } |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6012 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6013 | caps_per_phy->ht_2g = mac_phy_cap[phyid].ht_cap_info_2G; |
| 6014 | caps_per_phy->ht_5g = mac_phy_cap[phyid].ht_cap_info_5G; |
| 6015 | caps_per_phy->vht_2g = mac_phy_cap[phyid].vht_cap_info_2G; |
| 6016 | caps_per_phy->vht_5g = mac_phy_cap[phyid].vht_cap_info_5G; |
| 6017 | caps_per_phy->he_2g = mac_phy_cap[phyid].he_cap_info_2G; |
| 6018 | 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] | 6019 | |
Naveen Rawat | 9832247 | 2018-03-06 10:29:42 -0800 | [diff] [blame] | 6020 | caps_per_phy->tx_chain_mask_2G = mac_phy_cap->tx_chain_mask_2G; |
| 6021 | caps_per_phy->rx_chain_mask_2G = mac_phy_cap->rx_chain_mask_2G; |
| 6022 | caps_per_phy->tx_chain_mask_5G = mac_phy_cap->tx_chain_mask_5G; |
| 6023 | caps_per_phy->rx_chain_mask_5G = mac_phy_cap->rx_chain_mask_5G; |
| 6024 | |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6025 | return QDF_STATUS_SUCCESS; |
| 6026 | } |
| 6027 | |
| 6028 | /** |
| 6029 | * wma_is_rx_ldpc_supported_for_channel() - to find out if ldpc is supported |
| 6030 | * |
| 6031 | * @channel: Channel number for which it needs to check if rx ldpc is enabled |
| 6032 | * |
| 6033 | * This API takes channel number as argument and takes default hw mode as DBS |
| 6034 | * to check if rx LDPC support is enabled for that channel or no |
| 6035 | */ |
| 6036 | bool wma_is_rx_ldpc_supported_for_channel(uint32_t channel) |
| 6037 | { |
jiad | 080abce | 2017-08-08 15:17:39 +0800 | [diff] [blame] | 6038 | t_wma_handle *wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6039 | struct target_psoc_info *tgt_hdl; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6040 | struct wma_caps_per_phy caps_per_phy = {0}; |
| 6041 | enum cds_band_type band; |
| 6042 | bool status; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6043 | uint8_t num_hw_modes; |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6044 | |
Amar Singhal | 4c3fbb4 | 2018-01-02 13:20:28 -0800 | [diff] [blame] | 6045 | if (!wma_handle) { |
| 6046 | WMA_LOGE("Invalid wma handle"); |
| 6047 | return false; |
| 6048 | } |
| 6049 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6050 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 6051 | if (!tgt_hdl) { |
| 6052 | WMA_LOGE("Target handle is NULL"); |
| 6053 | return QDF_STATUS_E_FAILURE; |
| 6054 | } |
| 6055 | |
| 6056 | num_hw_modes = target_psoc_get_num_hw_modes(tgt_hdl); |
| 6057 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 6058 | if (!WLAN_REG_IS_24GHZ_CH(channel)) |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6059 | band = CDS_BAND_5GHZ; |
| 6060 | else |
| 6061 | band = CDS_BAND_2GHZ; |
| 6062 | |
| 6063 | if (QDF_STATUS_SUCCESS != wma_get_caps_for_phyidx_hwmode( |
| 6064 | &caps_per_phy, |
| 6065 | HW_MODE_DBS, band)) { |
| 6066 | return false; |
| 6067 | } |
jiad | 080abce | 2017-08-08 15:17:39 +0800 | [diff] [blame] | 6068 | |
| 6069 | /* |
| 6070 | * Legacy platforms like Rome set WMI_HT_CAP_LDPC to specify RX LDPC |
| 6071 | * capability. But new platforms like Helium set WMI_HT_CAP_RX_LDPC |
| 6072 | * instead. |
| 6073 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6074 | if (0 == num_hw_modes) { |
jiad | 080abce | 2017-08-08 15:17:39 +0800 | [diff] [blame] | 6075 | status = (!!(caps_per_phy.ht_2g & WMI_HT_CAP_LDPC)); |
| 6076 | } else { |
| 6077 | if (WLAN_REG_IS_24GHZ_CH(channel)) |
| 6078 | status = (!!(caps_per_phy.ht_2g & WMI_HT_CAP_RX_LDPC)); |
| 6079 | else |
| 6080 | status = (!!(caps_per_phy.ht_5g & WMI_HT_CAP_RX_LDPC)); |
| 6081 | } |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6082 | |
| 6083 | return status; |
| 6084 | } |
| 6085 | |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 6086 | /** |
| 6087 | * wma_print_mac_phy_capabilities() - Prints MAC PHY capabilities |
| 6088 | * @cap: pointer to WMI_MAC_PHY_CAPABILITIES |
| 6089 | * @index: MAC_PHY index |
| 6090 | * |
| 6091 | * Return: none |
| 6092 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6093 | static void wma_print_mac_phy_capabilities(struct wlan_psoc_host_mac_phy_caps |
| 6094 | *cap, int index) |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 6095 | { |
| 6096 | uint32_t mac_2G, mac_5G; |
| 6097 | uint32_t phy_2G[WMI_MAX_HECAP_PHY_SIZE]; |
| 6098 | uint32_t phy_5G[WMI_MAX_HECAP_PHY_SIZE]; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6099 | struct wlan_psoc_host_ppe_threshold ppet_2G, ppet_5G; |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 6100 | |
| 6101 | WMA_LOGI("\t: index [%d]", index); |
| 6102 | WMA_LOGI("\t: cap for hw_mode_id[%d]", cap->hw_mode_id); |
| 6103 | WMA_LOGI("\t: pdev_id[%d]", cap->pdev_id); |
| 6104 | WMA_LOGI("\t: phy_id[%d]", cap->phy_id); |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6105 | WMA_LOGI("\t: supports_11b[%d]", cap->supports_11b); |
| 6106 | WMA_LOGI("\t: supports_11g[%d]", cap->supports_11g); |
| 6107 | WMA_LOGI("\t: supports_11a[%d]", cap->supports_11a); |
| 6108 | WMA_LOGI("\t: supports_11n[%d]", cap->supports_11n); |
| 6109 | WMA_LOGI("\t: supports_11ac[%d]", cap->supports_11ac); |
| 6110 | WMA_LOGI("\t: supports_11ax[%d]", cap->supports_11ax); |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 6111 | WMA_LOGI("\t: supported_bands[%d]", cap->supported_bands); |
| 6112 | WMA_LOGI("\t: ampdu_density[%d]", cap->ampdu_density); |
| 6113 | WMA_LOGI("\t: max_bw_supported_2G[%d]", cap->max_bw_supported_2G); |
| 6114 | WMA_LOGI("\t: ht_cap_info_2G[%d]", cap->ht_cap_info_2G); |
| 6115 | WMA_LOGI("\t: vht_cap_info_2G[%d]", cap->vht_cap_info_2G); |
| 6116 | WMA_LOGI("\t: vht_supp_mcs_2G[%d]", cap->vht_supp_mcs_2G); |
| 6117 | WMA_LOGI("\t: tx_chain_mask_2G[%d]", cap->tx_chain_mask_2G); |
| 6118 | WMA_LOGI("\t: rx_chain_mask_2G[%d]", cap->rx_chain_mask_2G); |
| 6119 | WMA_LOGI("\t: max_bw_supported_5G[%d]", cap->max_bw_supported_5G); |
| 6120 | WMA_LOGI("\t: ht_cap_info_5G[%d]", cap->ht_cap_info_5G); |
| 6121 | WMA_LOGI("\t: vht_cap_info_5G[%d]", cap->vht_cap_info_5G); |
| 6122 | WMA_LOGI("\t: vht_supp_mcs_5G[%d]", cap->vht_supp_mcs_5G); |
| 6123 | WMA_LOGI("\t: tx_chain_mask_5G[%d]", cap->tx_chain_mask_5G); |
| 6124 | WMA_LOGI("\t: rx_chain_mask_5G[%d]", cap->rx_chain_mask_5G); |
| 6125 | WMA_LOGI("\t: he_cap_info_2G[%08x]", cap->he_cap_info_2G); |
| 6126 | WMA_LOGI("\t: he_supp_mcs_2G[%08x]", cap->he_supp_mcs_2G); |
| 6127 | WMA_LOGI("\t: he_cap_info_5G[%08x]", cap->he_cap_info_5G); |
| 6128 | WMA_LOGI("\t: he_supp_mcs_5G[%08x]", cap->he_supp_mcs_5G); |
| 6129 | mac_2G = cap->he_cap_info_2G; |
| 6130 | mac_5G = cap->he_cap_info_5G; |
| 6131 | qdf_mem_copy(phy_2G, cap->he_cap_phy_info_2G, |
| 6132 | WMI_MAX_HECAP_PHY_SIZE * 4); |
| 6133 | qdf_mem_copy(phy_5G, cap->he_cap_phy_info_5G, |
| 6134 | WMI_MAX_HECAP_PHY_SIZE * 4); |
| 6135 | ppet_2G = cap->he_ppet2G; |
| 6136 | ppet_5G = cap->he_ppet5G; |
| 6137 | |
| 6138 | wma_print_he_mac_cap(mac_2G); |
| 6139 | wma_print_he_phy_cap(phy_2G); |
| 6140 | wma_print_he_ppet(&ppet_2G); |
| 6141 | wma_print_he_mac_cap(mac_5G); |
| 6142 | wma_print_he_phy_cap(phy_5G); |
| 6143 | wma_print_he_ppet(&ppet_5G); |
| 6144 | } |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 6145 | |
| 6146 | /** |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6147 | * 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] | 6148 | * @tgt_info: target related info |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6149 | * |
| 6150 | * This function prints all the caps populater per hw mode and per PHY |
| 6151 | * |
| 6152 | * Return: none |
| 6153 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6154 | 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] | 6155 | { |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 6156 | int i, num_hw_modes, total_mac_phy_cnt; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6157 | struct wlan_psoc_host_mac_phy_caps *mac_phy_cap, *tmp; |
| 6158 | |
| 6159 | num_hw_modes = target_psoc_get_num_hw_modes(tgt_hdl); |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 6160 | 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] | 6161 | |
| 6162 | /* print number of hw modes */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6163 | 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] | 6164 | 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] | 6165 | mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6166 | WMA_LOGD("%s: <====== HW mode cap printing starts ======>", __func__); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6167 | /* print cap of each hw mode */ |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 6168 | for (i = 0; i < total_mac_phy_cnt; i++) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6169 | WMA_LOGD("====>: hw mode id[%d], phy_id map[%d]", |
Kiran Kumar Lokere | 0923ad8 | 2018-02-28 19:01:16 -0800 | [diff] [blame] | 6170 | mac_phy_cap[i].hw_mode_id, |
| 6171 | mac_phy_cap[i].phy_id); |
| 6172 | tmp = &mac_phy_cap[i]; |
| 6173 | wma_print_mac_phy_capabilities(tmp, i); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6174 | } |
| 6175 | WMA_LOGI("%s: <====== HW mode cap printing ends ======>\n", __func__); |
| 6176 | } |
| 6177 | |
| 6178 | /** |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6179 | * wma_map_wmi_channel_width_to_hw_mode_bw() - returns bandwidth |
| 6180 | * in terms of hw_mode_bandwidth |
| 6181 | * @width: bandwidth in terms of wmi_channel_width |
| 6182 | * |
| 6183 | * This function returns the bandwidth in terms of hw_mode_bandwidth. |
| 6184 | * |
| 6185 | * Return: BW in terms of hw_mode_bandwidth. |
| 6186 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6187 | 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] | 6188 | wmi_channel_width width) |
| 6189 | { |
| 6190 | switch (width) { |
| 6191 | case WMI_CHAN_WIDTH_20: |
| 6192 | return HW_MODE_20_MHZ; |
| 6193 | case WMI_CHAN_WIDTH_40: |
| 6194 | return HW_MODE_40_MHZ; |
| 6195 | case WMI_CHAN_WIDTH_80: |
| 6196 | return HW_MODE_80_MHZ; |
| 6197 | case WMI_CHAN_WIDTH_160: |
| 6198 | return HW_MODE_160_MHZ; |
| 6199 | case WMI_CHAN_WIDTH_80P80: |
| 6200 | return HW_MODE_80_PLUS_80_MHZ; |
| 6201 | case WMI_CHAN_WIDTH_5: |
| 6202 | return HW_MODE_5_MHZ; |
| 6203 | case WMI_CHAN_WIDTH_10: |
| 6204 | return HW_MODE_10_MHZ; |
| 6205 | default: |
| 6206 | return HW_MODE_BW_NONE; |
| 6207 | } |
| 6208 | |
| 6209 | return HW_MODE_BW_NONE; |
| 6210 | } |
| 6211 | |
| 6212 | /** |
| 6213 | * wma_get_hw_mode_params() - get TX-RX stream and bandwidth |
| 6214 | * supported from the capabilities. |
| 6215 | * @caps: PHY capability |
| 6216 | * @info: param to store TX-RX stream and BW information |
| 6217 | * |
| 6218 | * This function will calculate TX-RX stream and bandwidth supported |
| 6219 | * as per the PHY capability, and assign to mac_ss_bw_info. |
| 6220 | * |
| 6221 | * Return: none |
| 6222 | */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6223 | 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] | 6224 | struct mac_ss_bw_info *info) |
| 6225 | { |
| 6226 | if (!caps) { |
| 6227 | WMA_LOGE("%s: Invalid capabilities", __func__); |
| 6228 | return; |
| 6229 | } |
| 6230 | |
| 6231 | info->mac_tx_stream = wma_get_num_of_setbits_from_bitmask( |
| 6232 | QDF_MAX(caps->tx_chain_mask_2G, |
| 6233 | caps->tx_chain_mask_5G)); |
| 6234 | info->mac_rx_stream = wma_get_num_of_setbits_from_bitmask( |
| 6235 | QDF_MAX(caps->rx_chain_mask_2G, |
| 6236 | caps->rx_chain_mask_5G)); |
| 6237 | info->mac_bw = wma_map_wmi_channel_width_to_hw_mode_bw( |
| 6238 | QDF_MAX(caps->max_bw_supported_2G, |
| 6239 | caps->max_bw_supported_5G)); |
| 6240 | } |
| 6241 | |
| 6242 | /** |
| 6243 | * wma_set_hw_mode_params() - sets TX-RX stream, bandwidth and |
| 6244 | * DBS in hw_mode_list |
| 6245 | * @wma_handle: pointer to wma global structure |
| 6246 | * @mac0_ss_bw_info: TX-RX streams, BW for MAC0 |
| 6247 | * @mac1_ss_bw_info: TX-RX streams, BW for MAC1 |
| 6248 | * @pos: refers to hw_mode_index |
| 6249 | * @dbs_mode: dbs_mode for the dbs_hw_mode |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6250 | * @sbs_mode: sbs_mode for the sbs_hw_mode |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6251 | * |
| 6252 | * This function sets TX-RX stream, bandwidth and DBS mode in |
| 6253 | * hw_mode_list. |
| 6254 | * |
| 6255 | * Return: none |
| 6256 | */ |
| 6257 | static void wma_set_hw_mode_params(t_wma_handle *wma_handle, |
| 6258 | struct mac_ss_bw_info mac0_ss_bw_info, |
| 6259 | struct mac_ss_bw_info mac1_ss_bw_info, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6260 | uint32_t pos, uint32_t dbs_mode, |
| 6261 | uint32_t sbs_mode) |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6262 | { |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6263 | WMA_HW_MODE_MAC0_TX_STREAMS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6264 | wma_handle->hw_mode.hw_mode_list[pos], |
| 6265 | mac0_ss_bw_info.mac_tx_stream); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6266 | WMA_HW_MODE_MAC0_RX_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_rx_stream); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6269 | WMA_HW_MODE_MAC0_BANDWIDTH_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_bw); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6272 | WMA_HW_MODE_MAC1_TX_STREAMS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6273 | wma_handle->hw_mode.hw_mode_list[pos], |
| 6274 | mac1_ss_bw_info.mac_tx_stream); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6275 | WMA_HW_MODE_MAC1_RX_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_rx_stream); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6278 | WMA_HW_MODE_MAC1_BANDWIDTH_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_bw); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6281 | WMA_HW_MODE_DBS_MODE_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6282 | wma_handle->hw_mode.hw_mode_list[pos], |
| 6283 | dbs_mode); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6284 | WMA_HW_MODE_AGILE_DFS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6285 | wma_handle->hw_mode.hw_mode_list[pos], |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6286 | HW_MODE_AGILE_DFS_NONE); |
| 6287 | WMA_HW_MODE_SBS_MODE_SET( |
| 6288 | wma_handle->hw_mode.hw_mode_list[pos], |
| 6289 | sbs_mode); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6290 | } |
| 6291 | |
| 6292 | /** |
| 6293 | * wma_update_hw_mode_list() - updates hw_mode_list |
| 6294 | * @wma_handle: pointer to wma global structure |
Arunk Khandavalli | 80a6135 | 2018-01-25 12:19:37 +0530 | [diff] [blame] | 6295 | * @tgt_hdl - target psoc information |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6296 | * |
| 6297 | * This function updates hw_mode_list with tx_streams, rx_streams, |
| 6298 | * bandwidth, dbs and agile dfs for each hw_mode. |
| 6299 | * |
| 6300 | * Returns: 0 for success else failure. |
| 6301 | */ |
Arunk Khandavalli | 80a6135 | 2018-01-25 12:19:37 +0530 | [diff] [blame] | 6302 | static QDF_STATUS wma_update_hw_mode_list(t_wma_handle *wma_handle, |
| 6303 | struct target_psoc_info *tgt_hdl) |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6304 | { |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6305 | struct wlan_psoc_host_mac_phy_caps *tmp, *mac_phy_cap; |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6306 | uint32_t i, hw_config_type, j = 0; |
| 6307 | uint32_t dbs_mode, sbs_mode; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6308 | struct mac_ss_bw_info mac0_ss_bw_info = {0}; |
| 6309 | struct mac_ss_bw_info mac1_ss_bw_info = {0}; |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6310 | WMI_PHY_CAPABILITY new_supported_band = 0; |
| 6311 | bool supported_band_update_failure = false; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6312 | struct wlan_psoc_target_capability_info *tgt_cap_info; |
| 6313 | int num_hw_modes; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6314 | |
| 6315 | if (!wma_handle) { |
| 6316 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 6317 | return QDF_STATUS_E_FAILURE; |
| 6318 | } |
| 6319 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6320 | num_hw_modes = target_psoc_get_num_hw_modes(tgt_hdl); |
| 6321 | mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); |
| 6322 | tgt_cap_info = target_psoc_get_target_caps(tgt_hdl); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6323 | /* |
| 6324 | * This list was updated as part of service ready event. Re-populate |
| 6325 | * HW mode list from the device capabilities. |
| 6326 | */ |
| 6327 | if (wma_handle->hw_mode.hw_mode_list) { |
| 6328 | qdf_mem_free(wma_handle->hw_mode.hw_mode_list); |
| 6329 | wma_handle->hw_mode.hw_mode_list = NULL; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6330 | WMA_LOGD("%s: DBS list is freed", __func__); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6331 | } |
| 6332 | |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6333 | wma_handle->hw_mode.hw_mode_list = |
| 6334 | qdf_mem_malloc(sizeof(*wma_handle->hw_mode.hw_mode_list) * |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6335 | num_hw_modes); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6336 | if (!wma_handle->hw_mode.hw_mode_list) { |
| 6337 | WMA_LOGE("%s: Memory allocation failed for DBS", __func__); |
| 6338 | return QDF_STATUS_E_FAILURE; |
| 6339 | } |
| 6340 | |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 6341 | WMA_LOGD("%s: Updated HW mode list: Num modes:%d", |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6342 | __func__, num_hw_modes); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6343 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6344 | for (i = 0; i < num_hw_modes; i++) { |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6345 | /* Update for MAC0 */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6346 | tmp = &mac_phy_cap[j++]; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6347 | wma_get_hw_mode_params(tmp, &mac0_ss_bw_info); |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6348 | hw_config_type = mac_phy_cap[j].hw_mode_config_type; |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6349 | dbs_mode = HW_MODE_DBS_NONE; |
| 6350 | sbs_mode = HW_MODE_SBS_NONE; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6351 | mac1_ss_bw_info.mac_tx_stream = 0; |
| 6352 | mac1_ss_bw_info.mac_rx_stream = 0; |
| 6353 | mac1_ss_bw_info.mac_bw = 0; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6354 | if (wma_update_supported_bands(tmp->supported_bands, |
| 6355 | &new_supported_band) |
| 6356 | != QDF_STATUS_SUCCESS) |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6357 | supported_band_update_failure = true; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6358 | |
| 6359 | /* SBS and DBS have dual MAC. Upto 2 MACs are considered. */ |
| 6360 | if ((hw_config_type == WMI_HW_MODE_DBS) || |
| 6361 | (hw_config_type == WMI_HW_MODE_SBS_PASSIVE) || |
| 6362 | (hw_config_type == WMI_HW_MODE_SBS)) { |
| 6363 | /* Update for MAC1 */ |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6364 | tmp = &mac_phy_cap[j++]; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6365 | wma_get_hw_mode_params(tmp, &mac1_ss_bw_info); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6366 | if (hw_config_type == WMI_HW_MODE_DBS) |
| 6367 | dbs_mode = HW_MODE_DBS; |
| 6368 | if ((hw_config_type == WMI_HW_MODE_SBS_PASSIVE) || |
| 6369 | (hw_config_type == WMI_HW_MODE_SBS)) |
| 6370 | sbs_mode = HW_MODE_SBS; |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6371 | if (QDF_STATUS_SUCCESS != |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6372 | wma_update_supported_bands(tmp->supported_bands, |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6373 | &new_supported_band)) |
| 6374 | supported_band_update_failure = true; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6375 | } |
| 6376 | |
| 6377 | /* Updating HW mode list */ |
| 6378 | wma_set_hw_mode_params(wma_handle, mac0_ss_bw_info, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 6379 | mac1_ss_bw_info, i, dbs_mode, |
| 6380 | sbs_mode); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6381 | } |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 6382 | |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6383 | /* overwrite phy_capability which we got from service ready event */ |
| 6384 | if (!supported_band_update_failure) { |
| 6385 | WMA_LOGD("%s: updating supported band from old[%d] to new[%d]", |
Arunk Khandavalli | 80a6135 | 2018-01-25 12:19:37 +0530 | [diff] [blame] | 6386 | __func__, target_if_get_phy_capability(tgt_hdl), |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6387 | new_supported_band); |
Arunk Khandavalli | 80a6135 | 2018-01-25 12:19:37 +0530 | [diff] [blame] | 6388 | target_if_set_phy_capability(tgt_hdl, new_supported_band); |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6389 | } |
| 6390 | |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 6391 | if (QDF_STATUS_SUCCESS != |
Krunal Soni | ca50b45 | 2017-08-04 22:24:59 -0700 | [diff] [blame] | 6392 | policy_mgr_update_hw_mode_list(wma_handle->psoc, |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6393 | tgt_hdl)) |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 6394 | WMA_LOGE("%s: failed to update policy manager", __func__); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6395 | wma_dump_dbs_hw_mode(wma_handle); |
| 6396 | return QDF_STATUS_SUCCESS; |
| 6397 | } |
| 6398 | |
Naveen Rawat | 4efe41b | 2017-04-29 16:23:14 -0700 | [diff] [blame] | 6399 | static void wma_init_wifi_pos_dma_rings(t_wma_handle *wma_handle, |
| 6400 | uint8_t num_mac, void *buf) |
| 6401 | { |
| 6402 | struct hif_softc *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); |
Amar Singhal | 4c3fbb4 | 2018-01-02 13:20:28 -0800 | [diff] [blame] | 6403 | void *hal_soc; |
| 6404 | |
| 6405 | if (!hif_ctx) { |
| 6406 | WMA_LOGE("invalid hif context"); |
| 6407 | return; |
| 6408 | } |
| 6409 | |
| 6410 | hal_soc = hif_get_hal_handle(hif_ctx); |
Naveen Rawat | 4efe41b | 2017-04-29 16:23:14 -0700 | [diff] [blame] | 6411 | |
| 6412 | wifi_pos_init_cir_cfr_rings(wma_handle->psoc, hal_soc, num_mac, buf); |
| 6413 | } |
| 6414 | |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6415 | /** |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6416 | * wma_populate_soc_caps() - populate entire SOC's capabilities |
| 6417 | * @wma_handle: pointer to wma global structure |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6418 | * @tgt_hdl: target psoc information |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6419 | * @param_buf: pointer to param of service ready extension event from fw |
| 6420 | * |
| 6421 | * This API populates all capabilities of entire SOC. For example, |
| 6422 | * how many number of hw modes are supported by this SOC, what are the |
| 6423 | * capabilities of each phy per hw mode, what are HAL reg capabilities per |
| 6424 | * phy. |
| 6425 | * |
| 6426 | * Return: none |
| 6427 | */ |
| 6428 | static void wma_populate_soc_caps(t_wma_handle *wma_handle, |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6429 | struct target_psoc_info *tgt_hdl, |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6430 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf) |
| 6431 | { |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6432 | |
| 6433 | WMA_LOGD("%s: Enter", __func__); |
| 6434 | |
Naveen Rawat | 4efe41b | 2017-04-29 16:23:14 -0700 | [diff] [blame] | 6435 | wma_init_wifi_pos_dma_rings(wma_handle, |
| 6436 | param_buf->num_oem_dma_ring_caps, |
| 6437 | param_buf->oem_dma_ring_caps); |
| 6438 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6439 | wma_print_populate_soc_caps(tgt_hdl); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 6440 | } |
| 6441 | |
| 6442 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6443 | * wma_rx_service_ready_ext_event() - evt handler for sevice ready ext event. |
| 6444 | * @handle: wma handle |
| 6445 | * @event: params of the service ready extended event |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6446 | * @length: param length |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6447 | * |
| 6448 | * Return: none |
| 6449 | */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6450 | int wma_rx_service_ready_ext_event(void *handle, uint8_t *event, |
| 6451 | uint32_t length) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6452 | { |
| 6453 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 6454 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 6455 | wmi_service_ready_ext_event_fixed_param *ev; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6456 | QDF_STATUS ret; |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6457 | struct target_psoc_info *tgt_hdl; |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 6458 | uint32_t conc_scan_config_bits, fw_config_bits; |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6459 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6460 | WMA_LOGD("%s: Enter", __func__); |
| 6461 | |
| 6462 | if (!wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6463 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6464 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6465 | } |
| 6466 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6467 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 6468 | if (!tgt_hdl) { |
| 6469 | WMA_LOGE("%s: target psoc info is NULL", __func__); |
| 6470 | return -EINVAL; |
| 6471 | } |
| 6472 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6473 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 6474 | if (!param_buf) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6475 | WMA_LOGE("%s: Invalid event", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6476 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6477 | } |
| 6478 | |
| 6479 | ev = param_buf->fixed_param; |
| 6480 | if (!ev) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6481 | WMA_LOGE("%s: Invalid buffer", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6482 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6483 | } |
| 6484 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6485 | WMA_LOGD("WMA <-- WMI_SERVICE_READY_EXT_EVENTID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6486 | |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 6487 | fw_config_bits = target_if_get_fw_config_bits(tgt_hdl); |
| 6488 | conc_scan_config_bits = target_if_get_conc_scan_config_bits(tgt_hdl); |
| 6489 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6490 | WMA_LOGD("%s: Defaults: scan config:%x FW mode config:%x", |
Arunk Khandavalli | 2462f46 | 2018-01-25 14:41:02 +0530 | [diff] [blame] | 6491 | __func__, conc_scan_config_bits, fw_config_bits); |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 6492 | |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 6493 | ret = qdf_mc_timer_stop(&wma_handle->service_ready_ext_timer); |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 6494 | if (!QDF_IS_STATUS_SUCCESS(ret)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6495 | WMA_LOGE("Failed to stop the service ready ext timer"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6496 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6497 | } |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6498 | wma_populate_soc_caps(wma_handle, tgt_hdl, param_buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6499 | |
Arunk Khandavalli | 80a6135 | 2018-01-25 12:19:37 +0530 | [diff] [blame] | 6500 | ret = wma_update_hw_mode_list(wma_handle, tgt_hdl); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 6501 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 6502 | WMA_LOGE("Failed to update hw mode list"); |
| 6503 | return -EINVAL; |
| 6504 | } |
| 6505 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6506 | WMA_LOGD("WMA --> WMI_INIT_CMDID"); |
Mukul Sharma | b10c8c7 | 2017-11-02 17:25:59 +0530 | [diff] [blame] | 6507 | |
Arunk Khandavalli | 10af728 | 2018-02-05 16:55:48 +0530 | [diff] [blame] | 6508 | 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] | 6509 | fw_config_bits); |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6510 | |
| 6511 | target_psoc_set_num_radios(tgt_hdl, 1); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6512 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6513 | } |
| 6514 | |
| 6515 | /** |
| 6516 | * wma_rx_ready_event() - event handler to process |
| 6517 | * wmi rx ready event. |
| 6518 | * @handle: wma handle |
| 6519 | * @cmd_param_info: command params info |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6520 | * @length: param length |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6521 | * |
| 6522 | * Return: none |
| 6523 | */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6524 | int wma_rx_ready_event(void *handle, uint8_t *cmd_param_info, |
| 6525 | uint32_t length) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6526 | { |
| 6527 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 6528 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 6529 | wmi_ready_event_fixed_param *ev = NULL; |
| 6530 | |
| 6531 | WMA_LOGD("%s: Enter", __func__); |
| 6532 | |
| 6533 | param_buf = (WMI_READY_EVENTID_param_tlvs *) cmd_param_info; |
| 6534 | if (!(wma_handle && param_buf)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6535 | WMA_LOGE("%s: Invalid arguments", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6536 | QDF_ASSERT(0); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6537 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6538 | } |
| 6539 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6540 | WMA_LOGD("WMA <-- WMI_READY_EVENTID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6541 | |
| 6542 | ev = param_buf->fixed_param; |
| 6543 | /* Indicate to the waiting thread that the ready |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 6544 | * event was received |
| 6545 | */ |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 6546 | wma_handle->sub_20_support = |
Sourav Mohapatra | 89c85d1 | 2017-12-01 09:17:54 +0530 | [diff] [blame] | 6547 | wmi_service_enabled(wma_handle->wmi_handle, |
| 6548 | wmi_service_half_rate_quarter_rate_support); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6549 | wma_handle->wmi_ready = true; |
| 6550 | wma_handle->wlan_init_status = ev->status; |
| 6551 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6552 | /* copy the mac addr */ |
| 6553 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, wma_handle->myaddr); |
| 6554 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, wma_handle->hwaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6555 | wma_update_hdd_cfg(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6556 | WMA_LOGD("Exit"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6557 | |
| 6558 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6559 | } |
| 6560 | |
| 6561 | /** |
| 6562 | * wma_setneedshutdown() - setting wma needshutdown flag |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6563 | * |
| 6564 | * Return: none |
| 6565 | */ |
Jeff Johnson | 1f8d0a0 | 2017-09-13 08:09:05 -0700 | [diff] [blame] | 6566 | void wma_setneedshutdown(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6567 | { |
| 6568 | tp_wma_handle wma_handle; |
| 6569 | |
| 6570 | WMA_LOGD("%s: Enter", __func__); |
| 6571 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6572 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6573 | |
| 6574 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6575 | WMA_LOGE("%s: Invalid arguments", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6576 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6577 | return; |
| 6578 | } |
| 6579 | |
| 6580 | wma_handle->needShutdown = true; |
| 6581 | WMA_LOGD("%s: Exit", __func__); |
| 6582 | } |
| 6583 | |
| 6584 | /** |
| 6585 | * wma_needshutdown() - Is wma needs shutdown? |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6586 | * |
| 6587 | * Return: returns true/false |
| 6588 | */ |
Jeff Johnson | 1b5404e | 2017-09-13 08:04:46 -0700 | [diff] [blame] | 6589 | bool wma_needshutdown(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6590 | { |
| 6591 | tp_wma_handle wma_handle; |
| 6592 | |
| 6593 | WMA_LOGD("%s: Enter", __func__); |
| 6594 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6595 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6596 | |
| 6597 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6598 | WMA_LOGE("%s: Invalid arguments", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6599 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6600 | return false; |
| 6601 | } |
| 6602 | |
| 6603 | WMA_LOGD("%s: Exit", __func__); |
| 6604 | return wma_handle->needShutdown; |
| 6605 | } |
| 6606 | |
| 6607 | /** |
| 6608 | * wma_wait_for_ready_event() - wait for wma ready event |
| 6609 | * @handle: wma handle |
| 6610 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 6611 | * Return: 0 for success or QDF error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6612 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6613 | QDF_STATUS wma_wait_for_ready_event(WMA_HANDLE handle) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6614 | { |
| 6615 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6616 | QDF_STATUS qdf_status; |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6617 | struct target_psoc_info *tgt_hdl; |
| 6618 | int timeleft; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6619 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6620 | tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 6621 | if (!tgt_hdl) { |
| 6622 | WMA_LOGE("%s: target psoc info is NULL", __func__); |
| 6623 | return QDF_STATUS_E_INVAL; |
| 6624 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6625 | |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6626 | timeleft = qdf_wait_queue_timeout( |
| 6627 | tgt_hdl->info.event_queue, |
| 6628 | ((tgt_hdl->info.wmi_service_ready) && |
| 6629 | (tgt_hdl->info.wmi_ready)), |
| 6630 | WMA_READY_EVENTID_TIMEOUT); |
| 6631 | if (!timeleft) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6632 | WMA_LOGE("%s: Timeout waiting for ready event from FW", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6633 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6634 | qdf_status = QDF_STATUS_E_FAILURE; |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6635 | } else { |
| 6636 | WMA_LOGI("%s Ready event received from FW", __func__); |
| 6637 | qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6638 | } |
Arunk Khandavalli | a6305a3 | 2018-01-25 11:19:18 +0530 | [diff] [blame] | 6639 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6640 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6641 | } |
| 6642 | |
| 6643 | /** |
| 6644 | * wma_set_ppsconfig() - set pps config in fw |
| 6645 | * @vdev_id: vdev id |
| 6646 | * @pps_param: pps params |
| 6647 | * @val : param value |
| 6648 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 6649 | * Return: 0 for success or QDF error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6650 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6651 | 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] | 6652 | int val) |
| 6653 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6654 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6655 | int ret = -EIO; |
| 6656 | uint32_t pps_val; |
| 6657 | |
| 6658 | if (NULL == wma) { |
| 6659 | WMA_LOGE("%s: Failed to get wma", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6660 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6661 | } |
| 6662 | |
| 6663 | switch (pps_param) { |
| 6664 | case WMA_VHT_PPS_PAID_MATCH: |
| 6665 | pps_val = ((val << 31) & 0xffff0000) | |
| 6666 | (PKT_PWR_SAVE_PAID_MATCH & 0xffff); |
| 6667 | goto pkt_pwr_save_config; |
| 6668 | case WMA_VHT_PPS_GID_MATCH: |
| 6669 | pps_val = ((val << 31) & 0xffff0000) | |
| 6670 | (PKT_PWR_SAVE_GID_MATCH & 0xffff); |
| 6671 | goto pkt_pwr_save_config; |
| 6672 | case WMA_VHT_PPS_DELIM_CRC_FAIL: |
| 6673 | pps_val = ((val << 31) & 0xffff0000) | |
| 6674 | (PKT_PWR_SAVE_DELIM_CRC_FAIL & 0xffff); |
| 6675 | goto pkt_pwr_save_config; |
| 6676 | |
| 6677 | /* Enable the code below as and when the functionality |
| 6678 | * is supported/added in host. |
| 6679 | */ |
| 6680 | #ifdef NOT_YET |
| 6681 | case WMA_VHT_PPS_EARLY_TIM_CLEAR: |
| 6682 | pps_val = ((val << 31) & 0xffff0000) | |
| 6683 | (PKT_PWR_SAVE_EARLY_TIM_CLEAR & 0xffff); |
| 6684 | goto pkt_pwr_save_config; |
| 6685 | case WMA_VHT_PPS_EARLY_DTIM_CLEAR: |
| 6686 | pps_val = ((val << 31) & 0xffff0000) | |
| 6687 | (PKT_PWR_SAVE_EARLY_DTIM_CLEAR & 0xffff); |
| 6688 | goto pkt_pwr_save_config; |
| 6689 | case WMA_VHT_PPS_EOF_PAD_DELIM: |
| 6690 | pps_val = ((val << 31) & 0xffff0000) | |
| 6691 | (PKT_PWR_SAVE_EOF_PAD_DELIM & 0xffff); |
| 6692 | goto pkt_pwr_save_config; |
| 6693 | case WMA_VHT_PPS_MACADDR_MISMATCH: |
| 6694 | pps_val = ((val << 31) & 0xffff0000) | |
| 6695 | (PKT_PWR_SAVE_MACADDR_MISMATCH & 0xffff); |
| 6696 | goto pkt_pwr_save_config; |
| 6697 | case WMA_VHT_PPS_GID_NSTS_ZERO: |
| 6698 | pps_val = ((val << 31) & 0xffff0000) | |
| 6699 | (PKT_PWR_SAVE_GID_NSTS_ZERO & 0xffff); |
| 6700 | goto pkt_pwr_save_config; |
| 6701 | case WMA_VHT_PPS_RSSI_CHECK: |
| 6702 | pps_val = ((val << 31) & 0xffff0000) | |
| 6703 | (PKT_PWR_SAVE_RSSI_CHECK & 0xffff); |
| 6704 | goto pkt_pwr_save_config; |
| 6705 | #endif /* NOT_YET */ |
| 6706 | pkt_pwr_save_config: |
| 6707 | WMA_LOGD("vdev_id:%d val:0x%x pps_val:0x%x", vdev_id, |
| 6708 | val, pps_val); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6709 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 6710 | WMI_VDEV_PARAM_PACKET_POWERSAVE, |
| 6711 | pps_val); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6712 | break; |
| 6713 | default: |
| 6714 | WMA_LOGE("%s:INVALID PPS CONFIG", __func__); |
| 6715 | } |
| 6716 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6717 | return (ret) ? QDF_STATUS_E_FAILURE : QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6718 | } |
| 6719 | |
| 6720 | /** |
| 6721 | * wma_process_set_mas() - Function to enable/disable MAS |
| 6722 | * @wma: Pointer to WMA handle |
| 6723 | * @mas_val: 1-Enable MAS, 0-Disable MAS |
| 6724 | * |
| 6725 | * This function enables/disables the MAS value |
| 6726 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 6727 | * Return: QDF_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6728 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6729 | static QDF_STATUS wma_process_set_mas(tp_wma_handle wma, |
| 6730 | uint32_t *mas_val) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6731 | { |
| 6732 | uint32_t val; |
| 6733 | |
| 6734 | if (NULL == wma || NULL == mas_val) { |
| 6735 | WMA_LOGE("%s: Invalid input to enable/disable MAS", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6736 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6737 | } |
| 6738 | |
| 6739 | val = (*mas_val); |
| 6740 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6741 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6742 | wma_set_enable_disable_mcc_adaptive_scheduler(val)) { |
| 6743 | WMA_LOGE("%s: Unable to enable/disable MAS", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6744 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6745 | } |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 6746 | WMA_LOGE("%s: Value is %d", __func__, val); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6747 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6748 | } |
| 6749 | |
| 6750 | /** |
| 6751 | * wma_process_set_miracast() - Function to set miracast value in WMA |
| 6752 | * @wma: Pointer to WMA handle |
| 6753 | * @miracast_val: 0-Disabled,1-Source,2-Sink |
| 6754 | * |
| 6755 | * This function stores the miracast value in WMA |
| 6756 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 6757 | * Return: QDF_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6758 | * |
| 6759 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6760 | static QDF_STATUS wma_process_set_miracast(tp_wma_handle wma, |
| 6761 | uint32_t *miracast_val) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6762 | { |
| 6763 | if (NULL == wma || NULL == miracast_val) { |
| 6764 | WMA_LOGE("%s: Invalid input to store miracast value", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6765 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6766 | } |
| 6767 | |
| 6768 | wma->miracast_value = *miracast_val; |
| 6769 | WMA_LOGE("%s: Miracast value is %d", __func__, wma->miracast_value); |
| 6770 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6771 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6772 | } |
| 6773 | |
| 6774 | /** |
| 6775 | * wma_config_stats_factor() - Function to configure stats avg. factor |
| 6776 | * @wma: pointer to WMA handle |
| 6777 | * @avg_factor: stats. avg. factor passed down by userspace |
| 6778 | * |
| 6779 | * This function configures the avg. stats value in firmware |
| 6780 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6781 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6782 | * |
| 6783 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6784 | static QDF_STATUS wma_config_stats_factor(tp_wma_handle wma, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6785 | struct sir_stats_avg_factor *avg_factor) |
| 6786 | { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6787 | QDF_STATUS ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6788 | |
| 6789 | if (NULL == wma || NULL == avg_factor) { |
| 6790 | WMA_LOGE("%s: Invalid input of stats avg factor", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6791 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6792 | } |
| 6793 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6794 | ret = wma_vdev_set_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6795 | avg_factor->vdev_id, |
| 6796 | WMI_VDEV_PARAM_STATS_AVG_FACTOR, |
| 6797 | avg_factor->stats_avg_factor); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6798 | if (QDF_IS_STATUS_ERROR(ret)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6799 | WMA_LOGE(" failed to set avg_factor for vdev_id %d", |
| 6800 | avg_factor->vdev_id); |
| 6801 | } |
| 6802 | |
| 6803 | WMA_LOGD("%s: Set stats_avg_factor %d for vdev_id %d", __func__, |
| 6804 | avg_factor->stats_avg_factor, avg_factor->vdev_id); |
| 6805 | |
| 6806 | return ret; |
| 6807 | } |
| 6808 | |
| 6809 | /** |
| 6810 | * wma_config_guard_time() - Function to set guard time in firmware |
| 6811 | * @wma: pointer to WMA handle |
| 6812 | * @guard_time: guard time passed down by userspace |
| 6813 | * |
| 6814 | * This function configures the guard time in firmware |
| 6815 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6816 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6817 | * |
| 6818 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6819 | static QDF_STATUS wma_config_guard_time(tp_wma_handle wma, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6820 | struct sir_guard_time_request *guard_time) |
| 6821 | { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6822 | QDF_STATUS ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6823 | |
| 6824 | if (NULL == wma || NULL == guard_time) { |
| 6825 | WMA_LOGE("%s: Invalid input of guard time", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6826 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6827 | } |
| 6828 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6829 | ret = wma_vdev_set_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6830 | guard_time->vdev_id, |
| 6831 | WMI_VDEV_PARAM_RX_LEAK_WINDOW, |
| 6832 | guard_time->guard_time); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6833 | if (QDF_IS_STATUS_ERROR(ret)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6834 | WMA_LOGE(" failed to set guard time for vdev_id %d", |
| 6835 | guard_time->vdev_id); |
| 6836 | } |
| 6837 | |
| 6838 | WMA_LOGD("Set guard time %d for vdev_id %d", |
| 6839 | guard_time->guard_time, guard_time->vdev_id); |
| 6840 | |
| 6841 | return ret; |
| 6842 | } |
| 6843 | |
| 6844 | /** |
| 6845 | * wma_enable_specific_fw_logs() - Start/Stop logging of diag event/log id |
| 6846 | * @wma_handle: WMA handle |
| 6847 | * @start_log: Start logging related parameters |
| 6848 | * |
| 6849 | * Send the command to the FW based on which specific logging of diag |
| 6850 | * event/log id can be started/stopped |
| 6851 | * |
| 6852 | * Return: None |
| 6853 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6854 | static void wma_enable_specific_fw_logs(tp_wma_handle wma_handle, |
| 6855 | struct sir_wifi_start_log *start_log) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6856 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6857 | |
| 6858 | if (!start_log) { |
| 6859 | WMA_LOGE("%s: start_log pointer is NULL", __func__); |
| 6860 | return; |
| 6861 | } |
| 6862 | if (!wma_handle) { |
| 6863 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 6864 | return; |
| 6865 | } |
| 6866 | |
| 6867 | if (!((start_log->ring_id == RING_ID_CONNECTIVITY) || |
| 6868 | (start_log->ring_id == RING_ID_FIRMWARE_DEBUG))) { |
| 6869 | WMA_LOGD("%s: Not connectivity or fw debug ring: %d", |
| 6870 | __func__, start_log->ring_id); |
| 6871 | return; |
| 6872 | } |
| 6873 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 6874 | wmi_unified_enable_specific_fw_logs_cmd(wma_handle->wmi_handle, |
| 6875 | (struct wmi_wifi_start_log *)start_log); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6876 | } |
| 6877 | |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 6878 | #define MEGABYTE (1024 * 1024) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6879 | /** |
| 6880 | * wma_set_wifi_start_packet_stats() - Start/stop packet stats |
| 6881 | * @wma_handle: WMA handle |
| 6882 | * @start_log: Struture containing the start wifi logger params |
| 6883 | * |
| 6884 | * This function is used to send the WMA commands to start/stop logging |
| 6885 | * of per packet statistics |
| 6886 | * |
| 6887 | * Return: None |
| 6888 | * |
| 6889 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6890 | #ifdef REMOVE_PKT_LOG |
| 6891 | static void wma_set_wifi_start_packet_stats(void *wma_handle, |
| 6892 | struct sir_wifi_start_log *start_log) |
| 6893 | { |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6894 | } |
Venkata Sharath Chandra Manchala | 1240fc7 | 2017-10-26 17:32:29 -0700 | [diff] [blame] | 6895 | |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6896 | #else |
| 6897 | static void wma_set_wifi_start_packet_stats(void *wma_handle, |
| 6898 | struct sir_wifi_start_log *start_log) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6899 | { |
Komal Seelam | 3d20286 | 2016-02-24 18:43:24 +0530 | [diff] [blame] | 6900 | struct hif_opaque_softc *scn; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6901 | uint32_t log_state; |
| 6902 | |
| 6903 | if (!start_log) { |
| 6904 | WMA_LOGE("%s: start_log pointer is NULL", __func__); |
| 6905 | return; |
| 6906 | } |
| 6907 | if (!wma_handle) { |
| 6908 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 6909 | return; |
| 6910 | } |
| 6911 | |
| 6912 | /* No need to register for ring IDs other than packet stats */ |
| 6913 | if (start_log->ring_id != RING_ID_PER_PACKET_STATS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6914 | WMA_LOGD("%s: Ring id is not for per packet stats: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6915 | __func__, start_log->ring_id); |
| 6916 | return; |
| 6917 | } |
| 6918 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6919 | scn = cds_get_context(QDF_MODULE_ID_HIF); |
Naveen Rawat | b2109f6 | 2016-07-21 14:18:15 -0700 | [diff] [blame] | 6920 | if (scn == NULL) { |
| 6921 | WMA_LOGE("%s: Invalid HIF handle", __func__); |
| 6922 | return; |
| 6923 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6924 | |
Venkata Sharath Chandra Manchala | 1240fc7 | 2017-10-26 17:32:29 -0700 | [diff] [blame] | 6925 | #ifdef HELIUMPLUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6926 | log_state = ATH_PKTLOG_ANI | ATH_PKTLOG_RCUPDATE | ATH_PKTLOG_RCFIND | |
Nirav Shah | dcc4c87 | 2016-07-28 11:35:26 +0530 | [diff] [blame] | 6927 | ATH_PKTLOG_RX | ATH_PKTLOG_TX | |
Venkata Sharath Chandra Manchala | 2996517 | 2018-01-18 14:17:29 -0800 | [diff] [blame] | 6928 | ATH_PKTLOG_TEXT | ATH_PKTLOG_SW_EVENT; |
Venkata Sharath Chandra Manchala | 1240fc7 | 2017-10-26 17:32:29 -0700 | [diff] [blame] | 6929 | #else |
| 6930 | log_state = ATH_PKTLOG_LITE_T2H | ATH_PKTLOG_LITE_RX; |
| 6931 | #endif |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 6932 | if (start_log->size != 0) { |
| 6933 | pktlog_setsize(scn, start_log->size * MEGABYTE); |
| 6934 | return; |
Poddar, Siddarth | ab99a27 | 2017-04-10 12:53:26 +0530 | [diff] [blame] | 6935 | } else if (start_log->is_pktlog_buff_clear == true) { |
| 6936 | pktlog_clearbuff(scn, start_log->is_pktlog_buff_clear); |
| 6937 | return; |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 6938 | } |
| 6939 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6940 | if (start_log->verbose_level == WLAN_LOG_LEVEL_ACTIVE) { |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 6941 | pktlog_enable(scn, log_state, start_log->ini_triggered, |
Poddar, Siddarth | eefe348 | 2016-09-21 18:12:59 +0530 | [diff] [blame] | 6942 | start_log->user_triggered, |
| 6943 | start_log->is_iwpriv_command); |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6944 | WMA_LOGD("%s: Enabling per packet stats", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6945 | } else { |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 6946 | pktlog_enable(scn, 0, start_log->ini_triggered, |
Poddar, Siddarth | eefe348 | 2016-09-21 18:12:59 +0530 | [diff] [blame] | 6947 | start_log->user_triggered, |
| 6948 | start_log->is_iwpriv_command); |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6949 | WMA_LOGD("%s: Disabling per packet stats", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6950 | } |
| 6951 | } |
| 6952 | #endif |
| 6953 | |
| 6954 | /** |
| 6955 | * wma_send_flush_logs_to_fw() - Send log flush command to FW |
| 6956 | * @wma_handle: WMI handle |
| 6957 | * |
| 6958 | * This function is used to send the flush command to the FW, |
| 6959 | * that will flush the fw logs that are residue in the FW |
| 6960 | * |
| 6961 | * Return: None |
| 6962 | */ |
| 6963 | void wma_send_flush_logs_to_fw(tp_wma_handle wma_handle) |
| 6964 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6965 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6966 | int ret; |
| 6967 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 6968 | ret = wmi_unified_flush_logs_to_fw_cmd(wma_handle->wmi_handle); |
| 6969 | if (ret != EOK) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6970 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6971 | |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 6972 | status = qdf_mc_timer_start(&wma_handle->log_completion_timer, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6973 | WMA_LOG_COMPLETION_TIMER); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6974 | if (status != QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6975 | WMA_LOGE("Failed to start the log completion timer"); |
| 6976 | } |
| 6977 | |
| 6978 | /** |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 6979 | * wma_update_wep_default_key - To update default key id |
| 6980 | * @wma: pointer to wma handler |
| 6981 | * @update_def_key: pointer to wep_update_default_key_idx |
| 6982 | * |
| 6983 | * This function makes a copy of default key index to txrx node |
| 6984 | * |
| 6985 | * Return: Success |
| 6986 | */ |
| 6987 | static QDF_STATUS wma_update_wep_default_key(tp_wma_handle wma, |
| 6988 | struct wep_update_default_key_idx *update_def_key) |
| 6989 | { |
| 6990 | struct wma_txrx_node *iface = |
| 6991 | &wma->interfaces[update_def_key->session_id]; |
| 6992 | iface->wep_default_key_idx = update_def_key->default_idx; |
| 6993 | |
| 6994 | return QDF_STATUS_SUCCESS; |
| 6995 | } |
| 6996 | |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 6997 | /** |
| 6998 | * wma_update_tx_fail_cnt_th() - Set threshold for TX pkt fail |
| 6999 | * @wma_handle: WMA handle |
| 7000 | * @tx_fail_cnt_th: sme_tx_fail_cnt_threshold parameter |
| 7001 | * |
| 7002 | * This function is used to set Tx pkt fail count threshold, |
| 7003 | * FW will do disconnect with station once this threshold is reached. |
| 7004 | * |
| 7005 | * Return: VOS_STATUS_SUCCESS on success, error number otherwise |
| 7006 | */ |
| 7007 | 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] | 7008 | struct sme_tx_fail_cnt_threshold *tx_fail_cnt_th) |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 7009 | { |
| 7010 | u_int8_t vdev_id; |
| 7011 | u_int32_t tx_fail_disconn_th; |
| 7012 | int ret = -EIO; |
| 7013 | |
| 7014 | if (!wma || !wma->wmi_handle) { |
| 7015 | WMA_LOGE(FL("WMA is closed, can not issue Tx pkt fail count threshold")); |
| 7016 | return QDF_STATUS_E_INVAL; |
| 7017 | } |
| 7018 | vdev_id = tx_fail_cnt_th->session_id; |
| 7019 | tx_fail_disconn_th = tx_fail_cnt_th->tx_fail_cnt_threshold; |
| 7020 | WMA_LOGD("Set TX pkt fail count threshold vdevId %d count %d", |
| 7021 | vdev_id, tx_fail_disconn_th); |
| 7022 | |
| 7023 | |
| 7024 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 7025 | WMI_VDEV_PARAM_DISCONNECT_TH, |
| 7026 | tx_fail_disconn_th); |
| 7027 | |
| 7028 | if (ret) { |
| 7029 | WMA_LOGE(FL("Failed to send TX pkt fail count threshold command")); |
| 7030 | return QDF_STATUS_E_FAILURE; |
| 7031 | } |
| 7032 | |
| 7033 | return QDF_STATUS_SUCCESS; |
| 7034 | } |
| 7035 | |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 7036 | /** |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 7037 | * wma_update_short_retry_limit() - Set retry limit for short frames |
| 7038 | * @wma_handle: WMA handle |
| 7039 | * @short_retry_limit_th: retry limir count for Short frames. |
| 7040 | * |
| 7041 | * This function is used to configure the transmission retry limit at which |
| 7042 | * short frames needs to be retry. |
| 7043 | * |
| 7044 | * Return: VOS_STATUS_SUCCESS on success, error number otherwise |
| 7045 | */ |
| 7046 | static QDF_STATUS wma_update_short_retry_limit(tp_wma_handle wma, |
| 7047 | struct sme_short_retry_limit *short_retry_limit_th) |
| 7048 | { |
| 7049 | uint8_t vdev_id; |
| 7050 | uint32_t short_retry_limit; |
| 7051 | int ret; |
| 7052 | |
| 7053 | if (!wma || !wma->wmi_handle) { |
| 7054 | WMA_LOGE("WMA is closed, can not issue short retry limit threshold"); |
| 7055 | return QDF_STATUS_E_INVAL; |
| 7056 | } |
| 7057 | vdev_id = short_retry_limit_th->session_id; |
| 7058 | short_retry_limit = short_retry_limit_th->short_retry_limit; |
| 7059 | WMA_LOGD("Set short retry limit threshold vdevId %d count %d", |
| 7060 | vdev_id, short_retry_limit); |
| 7061 | |
| 7062 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 7063 | WMI_VDEV_PARAM_NON_AGG_SW_RETRY_TH, |
| 7064 | short_retry_limit); |
| 7065 | |
| 7066 | if (ret) { |
| 7067 | WMA_LOGE("Failed to send short limit threshold command"); |
| 7068 | return QDF_STATUS_E_FAILURE; |
| 7069 | } |
| 7070 | return QDF_STATUS_SUCCESS; |
| 7071 | } |
| 7072 | |
| 7073 | /** |
| 7074 | * wma_update_long_retry_limit() - Set retry limit for long frames |
| 7075 | * @wma_handle: WMA handle |
| 7076 | * @long_retry_limit_th: retry limir count for long frames |
| 7077 | * |
| 7078 | * This function is used to configure the transmission retry limit at which |
| 7079 | * long frames needs to be retry |
| 7080 | * |
| 7081 | * Return: VOS_STATUS_SUCCESS on success, error number otherwise |
| 7082 | */ |
| 7083 | static QDF_STATUS wma_update_long_retry_limit(tp_wma_handle wma, |
| 7084 | struct sme_long_retry_limit *long_retry_limit_th) |
| 7085 | { |
| 7086 | uint8_t vdev_id; |
| 7087 | uint32_t long_retry_limit; |
| 7088 | int ret; |
| 7089 | |
| 7090 | if (!wma || !wma->wmi_handle) { |
| 7091 | WMA_LOGE("WMA is closed, can not issue long retry limit threshold"); |
| 7092 | return QDF_STATUS_E_INVAL; |
| 7093 | } |
| 7094 | vdev_id = long_retry_limit_th->session_id; |
| 7095 | long_retry_limit = long_retry_limit_th->long_retry_limit; |
| 7096 | WMA_LOGD("Set TX pkt fail count threshold vdevId %d count %d", |
| 7097 | vdev_id, long_retry_limit); |
| 7098 | |
| 7099 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 7100 | WMI_VDEV_PARAM_AGG_SW_RETRY_TH, |
| 7101 | long_retry_limit); |
| 7102 | |
| 7103 | if (ret) { |
| 7104 | WMA_LOGE("Failed to send long limit threshold command"); |
| 7105 | return QDF_STATUS_E_FAILURE; |
| 7106 | } |
| 7107 | |
| 7108 | return QDF_STATUS_SUCCESS; |
| 7109 | } |
| 7110 | |
Agrawal, Ashish | 4e5fa1c | 2016-09-21 19:03:43 +0530 | [diff] [blame] | 7111 | /* |
| 7112 | * wma_update_sta_inactivity_timeout() - Set sta_inactivity_timeout to fw |
| 7113 | * @wma_handle: WMA handle |
| 7114 | * @sta_inactivity_timer: sme_sta_inactivity_timeout |
| 7115 | * |
| 7116 | * This function is used to set sta_inactivity_timeout. |
| 7117 | * If a station does not send anything in sta_inactivity_timeout seconds, an |
| 7118 | * empty data frame is sent to it in order to verify whether it is |
| 7119 | * still in range. If this frame is not ACKed, the station will be |
| 7120 | * disassociated and then deauthenticated. |
| 7121 | * |
| 7122 | * Return: None |
| 7123 | */ |
| 7124 | void wma_update_sta_inactivity_timeout(tp_wma_handle wma, |
| 7125 | struct sme_sta_inactivity_timeout *sta_inactivity_timer) |
| 7126 | { |
| 7127 | uint8_t vdev_id; |
| 7128 | uint32_t max_unresponsive_time; |
| 7129 | uint32_t min_inactive_time, max_inactive_time; |
| 7130 | |
| 7131 | if (!wma || !wma->wmi_handle) { |
| 7132 | WMA_LOGE("WMA is closed, can not issue sta_inactivity_timeout"); |
| 7133 | return; |
| 7134 | } |
| 7135 | vdev_id = sta_inactivity_timer->session_id; |
| 7136 | max_unresponsive_time = sta_inactivity_timer->sta_inactivity_timeout; |
| 7137 | max_inactive_time = max_unresponsive_time * TWO_THIRD; |
| 7138 | min_inactive_time = max_unresponsive_time - max_inactive_time; |
| 7139 | |
| 7140 | if (wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 7141 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS, |
| 7142 | min_inactive_time)) |
| 7143 | WMA_LOGE("Failed to Set AP MIN IDLE INACTIVE TIME"); |
| 7144 | |
| 7145 | if (wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 7146 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS, |
| 7147 | max_inactive_time)) |
| 7148 | WMA_LOGE("Failed to Set AP MAX IDLE INACTIVE TIME"); |
| 7149 | |
| 7150 | if (wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 7151 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS, |
| 7152 | max_unresponsive_time)) |
| 7153 | WMA_LOGE("Failed to Set MAX UNRESPONSIVE TIME"); |
| 7154 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 7155 | 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] | 7156 | __func__, vdev_id, |
| 7157 | min_inactive_time, max_inactive_time, |
| 7158 | max_unresponsive_time); |
| 7159 | } |
| 7160 | |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 7161 | #ifdef WLAN_FEATURE_WOW_PULSE |
| 7162 | |
| 7163 | |
| 7164 | #define WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM \ |
| 7165 | WMI_WOW_HOSTWAKEUP_GPIO_PIN_PATTERN_CONFIG_CMD_fixed_param |
| 7166 | |
| 7167 | |
| 7168 | #define WMITLV_TAG_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM \ |
| 7169 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_gpio_pin_pattern_config_cmd_fixed_param |
| 7170 | |
| 7171 | /** |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7172 | * wma_send_wow_pulse_cmd() - send wmi cmd of wow pulse cmd |
| 7173 | * information to fw. |
| 7174 | * @wma_handle: wma handler |
| 7175 | * @udp_response: wow_pulse_mode pointer |
| 7176 | * |
| 7177 | * Return: Return QDF_STATUS |
| 7178 | */ |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 7179 | static QDF_STATUS wma_send_wow_pulse_cmd(tp_wma_handle wma_handle, |
| 7180 | struct wow_pulse_mode *wow_pulse_cmd) |
| 7181 | { |
| 7182 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 7183 | wmi_buf_t buf; |
| 7184 | WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM *cmd; |
| 7185 | u_int16_t len; |
| 7186 | |
| 7187 | len = sizeof(*cmd); |
| 7188 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 7189 | if (!buf) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7190 | WMA_LOGE("wmi_buf_alloc failed"); |
| 7191 | return QDF_STATUS_E_NOMEM; |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 7192 | } |
| 7193 | |
| 7194 | cmd = (WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM *)wmi_buf_data(buf); |
| 7195 | qdf_mem_zero(cmd, len); |
| 7196 | |
| 7197 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7198 | WMITLV_TAG_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM, |
| 7199 | WMITLV_GET_STRUCT_TLVLEN( |
| 7200 | WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM)); |
| 7201 | |
| 7202 | cmd->enable = wow_pulse_cmd->wow_pulse_enable; |
| 7203 | cmd->pin = wow_pulse_cmd->wow_pulse_pin; |
| 7204 | cmd->interval_low = wow_pulse_cmd->wow_pulse_interval_low; |
| 7205 | cmd->interval_high = wow_pulse_cmd->wow_pulse_interval_high; |
| 7206 | cmd->repeat_cnt = WMI_WOW_PULSE_REPEAT_CNT; |
| 7207 | |
| 7208 | if (wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 7209 | WMI_WOW_HOSTWAKEUP_GPIO_PIN_PATTERN_CONFIG_CMDID)) { |
| 7210 | WMA_LOGE("Failed to send send wow pulse"); |
| 7211 | wmi_buf_free(buf); |
| 7212 | status = QDF_STATUS_E_FAILURE; |
| 7213 | } |
| 7214 | |
| 7215 | WMA_LOGD("%s: Exit", __func__); |
| 7216 | return status; |
| 7217 | } |
| 7218 | |
| 7219 | #undef WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM |
| 7220 | #undef WMITLV_TAG_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM |
| 7221 | #undef WMI_WOW_PULSE_REPEAT_CNT |
| 7222 | |
| 7223 | #else |
| 7224 | static inline QDF_STATUS wma_send_wow_pulse_cmd(tp_wma_handle wma_handle, |
| 7225 | struct wow_pulse_mode *wow_pulse_cmd) |
| 7226 | { |
| 7227 | return QDF_STATUS_E_FAILURE; |
| 7228 | } |
| 7229 | #endif |
| 7230 | |
| 7231 | |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 7232 | /** |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 7233 | * wma_process_power_debug_stats_req() - Process the Chip Power stats collect |
| 7234 | * request and pass the Power stats request to Fw |
| 7235 | * @wma_handle: WMA handle |
| 7236 | * |
| 7237 | * Return: QDF_STATUS |
| 7238 | */ |
| 7239 | #ifdef WLAN_POWER_DEBUGFS |
| 7240 | static QDF_STATUS wma_process_power_debug_stats_req(tp_wma_handle wma_handle) |
| 7241 | { |
| 7242 | wmi_pdev_get_chip_power_stats_cmd_fixed_param *cmd; |
| 7243 | int32_t len; |
| 7244 | wmi_buf_t buf; |
| 7245 | uint8_t *buf_ptr; |
| 7246 | int ret; |
| 7247 | |
| 7248 | if (!wma_handle) { |
| 7249 | WMA_LOGE("%s: input pointer is NULL", __func__); |
| 7250 | return QDF_STATUS_E_FAILURE; |
| 7251 | } |
| 7252 | |
| 7253 | len = sizeof(*cmd); |
| 7254 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 7255 | if (!buf) { |
| 7256 | WMA_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7257 | return QDF_STATUS_E_NOMEM; |
| 7258 | } |
| 7259 | |
| 7260 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 7261 | cmd = (wmi_pdev_get_chip_power_stats_cmd_fixed_param *) buf_ptr; |
| 7262 | |
| 7263 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7264 | WMITLV_TAG_STRUC_wmi_get_chip_power_stats_cmd_fixed_param, |
| 7265 | WMITLV_GET_STRUCT_TLVLEN( |
| 7266 | wmi_pdev_get_chip_power_stats_cmd_fixed_param)); |
| 7267 | cmd->pdev_id = 0; |
| 7268 | |
| 7269 | WMA_LOGD("POWER_DEBUG_STATS - Get Request Params; Pdev id - %d", |
| 7270 | cmd->pdev_id); |
| 7271 | ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 7272 | WMI_PDEV_GET_CHIP_POWER_STATS_CMDID); |
| 7273 | if (ret) { |
| 7274 | WMA_LOGE("%s: Failed to send power debug stats request", |
| 7275 | __func__); |
| 7276 | wmi_buf_free(buf); |
| 7277 | return QDF_STATUS_E_FAILURE; |
| 7278 | } |
| 7279 | return QDF_STATUS_SUCCESS; |
| 7280 | } |
| 7281 | #else |
| 7282 | static QDF_STATUS wma_process_power_debug_stats_req(tp_wma_handle wma_handle) |
| 7283 | { |
| 7284 | return QDF_STATUS_SUCCESS; |
| 7285 | } |
| 7286 | #endif |
| 7287 | |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 7288 | /** |
| 7289 | * wma_set_arp_req_stats() - process set arp stats request command to fw |
| 7290 | * @wma_handle: WMA handle |
| 7291 | * @req_buf: set srp stats request buffer |
| 7292 | * |
| 7293 | * Return: None |
| 7294 | */ |
| 7295 | static void wma_set_arp_req_stats(WMA_HANDLE handle, |
| 7296 | struct set_arp_stats_params *req_buf) |
| 7297 | { |
| 7298 | int status; |
| 7299 | struct set_arp_stats *arp_stats; |
| 7300 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 7301 | |
| 7302 | if (!wma_handle || !wma_handle->wmi_handle) { |
| 7303 | WMA_LOGE("%s: WMA is closed, cannot send per roam config", |
| 7304 | __func__); |
| 7305 | return; |
| 7306 | } |
Yeshwanth Sriram Guntuka | d5aae7f | 2017-11-27 14:33:51 +0530 | [diff] [blame] | 7307 | if (!wma_is_vdev_valid(req_buf->vdev_id)) { |
| 7308 | WMA_LOGE("vdev id not active or not valid"); |
| 7309 | return; |
| 7310 | } |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 7311 | |
| 7312 | arp_stats = (struct set_arp_stats *)req_buf; |
| 7313 | status = wmi_unified_set_arp_stats_req(wma_handle->wmi_handle, |
| 7314 | arp_stats); |
| 7315 | if (status != EOK) |
| 7316 | WMA_LOGE("%s: failed to set arp stats to FW", |
| 7317 | __func__); |
| 7318 | } |
| 7319 | |
| 7320 | /** |
| 7321 | * wma_get_arp_req_stats() - process get arp stats request command to fw |
| 7322 | * @wma_handle: WMA handle |
| 7323 | * @req_buf: get srp stats request buffer |
| 7324 | * |
| 7325 | * Return: None |
| 7326 | */ |
| 7327 | static void wma_get_arp_req_stats(WMA_HANDLE handle, |
| 7328 | struct get_arp_stats_params *req_buf) |
| 7329 | { |
| 7330 | int status; |
| 7331 | struct get_arp_stats *arp_stats; |
| 7332 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 7333 | |
| 7334 | if (!wma_handle || !wma_handle->wmi_handle) { |
| 7335 | WMA_LOGE("%s: WMA is closed, cannot send per roam config", |
| 7336 | __func__); |
| 7337 | return; |
| 7338 | } |
Yeshwanth Sriram Guntuka | 3e4d96f | 2017-12-19 14:09:04 +0530 | [diff] [blame] | 7339 | if (!wma_is_vdev_valid(req_buf->vdev_id)) { |
| 7340 | WMA_LOGE("vdev id not active or not valid"); |
| 7341 | return; |
| 7342 | } |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 7343 | |
| 7344 | arp_stats = (struct get_arp_stats *)req_buf; |
| 7345 | status = wmi_unified_get_arp_stats_req(wma_handle->wmi_handle, |
| 7346 | arp_stats); |
| 7347 | if (status != EOK) |
| 7348 | WMA_LOGE("%s: failed to send get arp stats to FW", |
| 7349 | __func__); |
| 7350 | } |
| 7351 | |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 7352 | /** |
| 7353 | * wma_set_del_pmkid_cache() - API to set/delete PMKID cache entry in fw |
| 7354 | * @handle: WMA handle |
| 7355 | * @pmk_cache: PMK cache entry |
| 7356 | * |
| 7357 | * Return: None |
| 7358 | */ |
| 7359 | static void wma_set_del_pmkid_cache(WMA_HANDLE handle, |
| 7360 | struct wmi_unified_pmk_cache *pmk_cache) |
| 7361 | { |
| 7362 | int status; |
| 7363 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 7364 | |
| 7365 | if (!wma_handle || !wma_handle->wmi_handle) { |
| 7366 | WMA_LOGE("WMA is closed, cannot send set del pmkid"); |
| 7367 | return; |
| 7368 | } |
| 7369 | |
| 7370 | status = wmi_unified_set_del_pmkid_cache(wma_handle->wmi_handle, |
| 7371 | pmk_cache); |
| 7372 | if (status != EOK) |
| 7373 | WMA_LOGE("failed to send set/del pmkid cmd to fw"); |
| 7374 | } |
| 7375 | |
Vignesh Viswanathan | 694e28e | 2018-01-18 20:53:57 +0530 | [diff] [blame] | 7376 | /** |
Vignesh Viswanathan | 694e28e | 2018-01-18 20:53:57 +0530 | [diff] [blame] | 7377 | * wma_send_invoke_neighbor_report() - API to send invoke neighbor report |
| 7378 | * command to fw |
| 7379 | * |
| 7380 | * @handle: WMA handle |
| 7381 | * @params: Pointer to invoke neighbor report params |
| 7382 | * |
| 7383 | * Return: None |
| 7384 | */ |
| 7385 | static |
| 7386 | void wma_send_invoke_neighbor_report(WMA_HANDLE handle, |
| 7387 | struct wmi_invoke_neighbor_report_params *params) |
| 7388 | { |
| 7389 | QDF_STATUS status; |
| 7390 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 7391 | |
| 7392 | if (!wma_handle || !wma_handle->wmi_handle) { |
| 7393 | WMA_LOGE("WMA is closed, cannot send invoke neighbor report"); |
| 7394 | return; |
| 7395 | } |
| 7396 | |
| 7397 | status = wmi_unified_invoke_neighbor_report_cmd(wma_handle->wmi_handle, |
| 7398 | params); |
| 7399 | |
| 7400 | if (status != QDF_STATUS_SUCCESS) |
| 7401 | WMA_LOGE("failed to send invoke neighbor report command"); |
| 7402 | } |
| 7403 | |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 7404 | QDF_STATUS wma_set_rx_reorder_timeout_val(tp_wma_handle wma_handle, |
| 7405 | struct sir_set_rx_reorder_timeout_val *reorder_timeout) |
| 7406 | { |
| 7407 | wmi_pdev_set_reorder_timeout_val_cmd_fixed_param *cmd; |
| 7408 | uint32_t len; |
| 7409 | wmi_buf_t buf; |
| 7410 | int ret; |
| 7411 | |
| 7412 | if (!reorder_timeout) { |
| 7413 | WMA_LOGE(FL("invalid pointer")); |
| 7414 | return QDF_STATUS_E_INVAL; |
| 7415 | } |
| 7416 | |
| 7417 | if (!wma_handle) { |
| 7418 | WMA_LOGE(FL("WMA context is invald!")); |
| 7419 | return QDF_STATUS_E_INVAL; |
| 7420 | } |
| 7421 | len = sizeof(*cmd); |
| 7422 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 7423 | |
| 7424 | if (!buf) { |
| 7425 | WMA_LOGE(FL("Failed allocate wmi buffer")); |
| 7426 | return QDF_STATUS_E_NOMEM; |
| 7427 | } |
| 7428 | cmd = (wmi_pdev_set_reorder_timeout_val_cmd_fixed_param *) |
| 7429 | wmi_buf_data(buf); |
| 7430 | |
| 7431 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7432 | WMITLV_TAG_STRUC_wmi_pdev_set_reorder_timeout_val_cmd_fixed_param, |
| 7433 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_reorder_timeout_val_cmd_fixed_param)); |
| 7434 | |
| 7435 | memcpy(cmd->rx_timeout_pri, reorder_timeout->rx_timeout_pri, |
| 7436 | sizeof(reorder_timeout->rx_timeout_pri)); |
| 7437 | |
| 7438 | WMA_LOGD("rx aggr record timeout: VO: %d, VI: %d, BE: %d, BK: %d", |
| 7439 | cmd->rx_timeout_pri[0], cmd->rx_timeout_pri[1], |
| 7440 | cmd->rx_timeout_pri[2], cmd->rx_timeout_pri[3]); |
| 7441 | |
| 7442 | ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 7443 | WMI_PDEV_SET_REORDER_TIMEOUT_VAL_CMDID); |
| 7444 | if (ret) { |
| 7445 | WMA_LOGE(FL("Failed to send aggregation timeout")); |
| 7446 | wmi_buf_free(buf); |
| 7447 | return QDF_STATUS_E_FAILURE; |
| 7448 | } |
| 7449 | |
| 7450 | return QDF_STATUS_SUCCESS; |
| 7451 | } |
| 7452 | |
| 7453 | QDF_STATUS wma_set_rx_blocksize(tp_wma_handle wma_handle, |
| 7454 | struct sir_peer_set_rx_blocksize *peer_rx_blocksize) |
| 7455 | { |
| 7456 | wmi_peer_set_rx_blocksize_cmd_fixed_param *cmd; |
| 7457 | int32_t len; |
| 7458 | wmi_buf_t buf; |
| 7459 | u_int8_t *buf_ptr; |
| 7460 | int ret; |
| 7461 | |
| 7462 | if (!peer_rx_blocksize) { |
| 7463 | WMA_LOGE(FL("invalid pointer")); |
| 7464 | return QDF_STATUS_E_INVAL; |
| 7465 | } |
| 7466 | |
| 7467 | if (!wma_handle) { |
| 7468 | WMA_LOGE(FL(" WMA context is invald!")); |
| 7469 | return QDF_STATUS_E_INVAL; |
| 7470 | } |
| 7471 | |
| 7472 | len = sizeof(*cmd); |
| 7473 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 7474 | |
| 7475 | if (!buf) { |
| 7476 | WMA_LOGE(FL("Failed allocate wmi buffer")); |
| 7477 | return QDF_STATUS_E_NOMEM; |
| 7478 | } |
| 7479 | |
| 7480 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 7481 | cmd = (wmi_peer_set_rx_blocksize_cmd_fixed_param *) buf_ptr; |
| 7482 | |
| 7483 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7484 | WMITLV_TAG_STRUC_wmi_peer_set_rx_blocksize_cmd_fixed_param, |
| 7485 | WMITLV_GET_STRUCT_TLVLEN(wmi_peer_set_rx_blocksize_cmd_fixed_param)); |
| 7486 | |
| 7487 | cmd->vdev_id = peer_rx_blocksize->vdev_id; |
| 7488 | cmd->rx_block_ack_win_limit = |
| 7489 | peer_rx_blocksize->rx_block_ack_win_limit; |
| 7490 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_rx_blocksize->peer_macaddr.bytes, |
| 7491 | &cmd->peer_macaddr); |
| 7492 | |
| 7493 | WMA_LOGD("rx aggr blocksize: %d", cmd->rx_block_ack_win_limit); |
| 7494 | |
| 7495 | ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 7496 | WMI_PEER_SET_RX_BLOCKSIZE_CMDID); |
| 7497 | if (ret) { |
| 7498 | WMA_LOGE(FL("Failed to send aggregation size command")); |
| 7499 | wmi_buf_free(buf); |
| 7500 | return QDF_STATUS_E_FAILURE; |
| 7501 | } |
| 7502 | |
| 7503 | return QDF_STATUS_SUCCESS; |
| 7504 | } |
| 7505 | |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7506 | QDF_STATUS wma_get_chain_rssi(tp_wma_handle wma_handle, |
| 7507 | struct get_chain_rssi_req_params *req_params) |
| 7508 | { |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7509 | wmi_pdev_div_get_rssi_antid_fixed_param *cmd; |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7510 | wmi_buf_t wmi_buf; |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7511 | uint32_t len = sizeof(wmi_pdev_div_get_rssi_antid_fixed_param); |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7512 | u_int8_t *buf_ptr; |
| 7513 | |
| 7514 | if (!wma_handle) { |
| 7515 | WMA_LOGE(FL("WMA is closed, can not issue cmd")); |
| 7516 | return QDF_STATUS_E_INVAL; |
| 7517 | } |
| 7518 | |
| 7519 | wmi_buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 7520 | if (!wmi_buf) { |
| 7521 | WMA_LOGE(FL("wmi_buf_alloc failed")); |
| 7522 | return QDF_STATUS_E_NOMEM; |
| 7523 | } |
| 7524 | |
| 7525 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 7526 | |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7527 | cmd = (wmi_pdev_div_get_rssi_antid_fixed_param *)buf_ptr; |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7528 | WMITLV_SET_HDR(&cmd->tlv_header, |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7529 | WMITLV_TAG_STRUC_wmi_pdev_div_get_rssi_antid_fixed_param, |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7530 | WMITLV_GET_STRUCT_TLVLEN( |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7531 | wmi_pdev_div_get_rssi_antid_fixed_param)); |
| 7532 | cmd->pdev_id = 0; |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7533 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req_params->peer_macaddr.bytes, |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7534 | &cmd->macaddr); |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7535 | |
| 7536 | if (wmi_unified_cmd_send(wma_handle->wmi_handle, wmi_buf, len, |
lifeng | fe6c3e2 | 2018-04-03 12:10:04 +0800 | [diff] [blame] | 7537 | WMI_PDEV_DIV_GET_RSSI_ANTID_CMDID)) { |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 7538 | WMA_LOGE(FL("failed to send get chain rssi command")); |
| 7539 | wmi_buf_free(wmi_buf); |
| 7540 | return QDF_STATUS_E_FAILURE; |
| 7541 | } |
| 7542 | |
| 7543 | return QDF_STATUS_SUCCESS; |
| 7544 | } |
| 7545 | |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 7546 | #if defined(WLAN_FEATURE_FILS_SK) |
| 7547 | /** |
| 7548 | * wma_roam_scan_send_hlp() - API to send HLP IE info to fw |
| 7549 | * @wma_handle: WMA handle |
| 7550 | * @req: HLP params |
| 7551 | * |
| 7552 | * Return: QDF_STATUS |
| 7553 | */ |
| 7554 | static QDF_STATUS wma_roam_scan_send_hlp(tp_wma_handle wma_handle, |
| 7555 | struct hlp_params *req) |
| 7556 | { |
| 7557 | struct hlp_params *params; |
| 7558 | QDF_STATUS status; |
| 7559 | |
| 7560 | params = qdf_mem_malloc(sizeof(*params)); |
| 7561 | if (!params) { |
| 7562 | WMA_LOGE("%s : Memory allocation failed", __func__); |
| 7563 | return QDF_STATUS_E_NOMEM; |
| 7564 | } |
| 7565 | |
| 7566 | params->vdev_id = req->vdev_id; |
| 7567 | params->hlp_ie_len = req->hlp_ie_len; |
| 7568 | qdf_mem_copy(params->hlp_ie, req->hlp_ie, req->hlp_ie_len); |
| 7569 | status = wmi_unified_roam_send_hlp_cmd(wma_handle->wmi_handle, params); |
| 7570 | |
| 7571 | WMA_LOGD("Send HLP status %d vdev id %d", status, params->vdev_id); |
| 7572 | qdf_trace_hex_dump(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG, |
| 7573 | params->hlp_ie, 10); |
| 7574 | |
| 7575 | qdf_mem_free(params); |
| 7576 | return status; |
| 7577 | } |
| 7578 | #else |
| 7579 | static QDF_STATUS wma_roam_scan_send_hlp(tp_wma_handle wma_handle, |
| 7580 | struct hlp_params *req) |
| 7581 | { |
| 7582 | return QDF_STATUS_SUCCESS; |
| 7583 | } |
| 7584 | #endif |
| 7585 | |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 7586 | /** |
Ganesh Kondabattini | 3573957 | 2017-06-21 16:26:39 +0530 | [diff] [blame] | 7587 | * wma_process_set_limit_off_chan() - set limit off chanel parameters |
| 7588 | * @wma_handle: pointer to wma handle |
| 7589 | * @param: pointer to sir_limit_off_chan |
| 7590 | * |
| 7591 | * Return: QDF_STATUS_SUCCESS for success or error code. |
| 7592 | */ |
| 7593 | static QDF_STATUS wma_process_limit_off_chan(tp_wma_handle wma_handle, |
| 7594 | struct sir_limit_off_chan *param) |
| 7595 | { |
| 7596 | int32_t err; |
| 7597 | struct wmi_limit_off_chan_param limit_off_chan_param; |
| 7598 | |
Rajeev Kumar | 752d64e | 2017-10-05 16:32:58 -0700 | [diff] [blame] | 7599 | if (param->vdev_id >= wma_handle->max_bssid) { |
| 7600 | WMA_LOGE(FL("Invalid vdev_id: %d"), param->vdev_id); |
| 7601 | return QDF_STATUS_E_INVAL; |
| 7602 | } |
| 7603 | if (!wma_is_vdev_up(param->vdev_id)) { |
| 7604 | WMA_LOGE("vdev %d is not up skipping limit_off_chan_param", |
| 7605 | param->vdev_id); |
| 7606 | return QDF_STATUS_E_INVAL; |
| 7607 | } |
| 7608 | |
Ganesh Kondabattini | 3573957 | 2017-06-21 16:26:39 +0530 | [diff] [blame] | 7609 | limit_off_chan_param.vdev_id = param->vdev_id; |
| 7610 | limit_off_chan_param.status = param->is_tos_active; |
| 7611 | limit_off_chan_param.max_offchan_time = param->max_off_chan_time; |
| 7612 | limit_off_chan_param.rest_time = param->rest_time; |
| 7613 | limit_off_chan_param.skip_dfs_chans = param->skip_dfs_chans; |
| 7614 | |
| 7615 | err = wmi_unified_send_limit_off_chan_cmd(wma_handle->wmi_handle, |
| 7616 | &limit_off_chan_param); |
| 7617 | if (err) { |
| 7618 | WMA_LOGE("\n failed to set limit off chan cmd"); |
| 7619 | return QDF_STATUS_E_FAILURE; |
| 7620 | } |
| 7621 | |
| 7622 | return QDF_STATUS_SUCCESS; |
| 7623 | } |
| 7624 | |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 7625 | static QDF_STATUS wma_process_obss_color_collision_req(tp_wma_handle wma_handle, |
| 7626 | struct wmi_obss_color_collision_cfg_param *cfg) |
| 7627 | { |
| 7628 | QDF_STATUS status; |
| 7629 | |
| 7630 | if (cfg->vdev_id >= wma_handle->max_bssid) { |
| 7631 | WMA_LOGE(FL("Invalid vdev_id: %d"), cfg->vdev_id); |
| 7632 | return QDF_STATUS_E_INVAL; |
| 7633 | } |
| 7634 | if (!wma_is_vdev_up(cfg->vdev_id)) { |
| 7635 | WMA_LOGE("vdev %d is not up skipping obss color collision req", |
| 7636 | cfg->vdev_id); |
| 7637 | return QDF_STATUS_E_INVAL; |
| 7638 | } |
| 7639 | |
| 7640 | status = wmi_unified_send_obss_color_collision_cfg_cmd(wma_handle-> |
| 7641 | wmi_handle, cfg); |
| 7642 | if (QDF_IS_STATUS_ERROR(status)) |
| 7643 | WMA_LOGE("Failed to send obss color collision cfg"); |
| 7644 | |
| 7645 | return status; |
| 7646 | } |
| 7647 | |
Ganesh Kondabattini | 3573957 | 2017-06-21 16:26:39 +0530 | [diff] [blame] | 7648 | /** |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 7649 | * wma_send_obss_detection_cfg() - send obss detection cfg to firmware |
| 7650 | * @wma_handle: pointer to wma handle |
| 7651 | * @cfg: obss detection configuration |
| 7652 | * |
| 7653 | * Send obss detection configuration to firmware. |
| 7654 | * |
| 7655 | * Return: None |
| 7656 | */ |
| 7657 | static void wma_send_obss_detection_cfg(tp_wma_handle wma_handle, |
| 7658 | struct wmi_obss_detection_cfg_param |
| 7659 | *cfg) |
| 7660 | { |
| 7661 | QDF_STATUS status; |
| 7662 | |
| 7663 | if (cfg->vdev_id >= wma_handle->max_bssid) { |
| 7664 | WMA_LOGE(FL("Invalid vdev_id: %d"), cfg->vdev_id); |
| 7665 | return; |
| 7666 | } |
| 7667 | if (!wma_is_vdev_up(cfg->vdev_id)) { |
| 7668 | WMA_LOGE("vdev %d is not up skipping obss detection req", |
| 7669 | cfg->vdev_id); |
| 7670 | return; |
| 7671 | } |
| 7672 | |
| 7673 | status = wmi_unified_send_obss_detection_cfg_cmd(wma_handle->wmi_handle, |
| 7674 | cfg); |
| 7675 | if (QDF_IS_STATUS_ERROR(status)) |
| 7676 | WMA_LOGE("Failed to send obss detection cfg"); |
| 7677 | |
| 7678 | return; |
| 7679 | } |
| 7680 | |
| 7681 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7682 | * wma_mc_process_msg() - process wma messages and call appropriate function. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7683 | * @msg: message |
| 7684 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 7685 | * Return: QDF_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7686 | */ |
Jeff Johnson | 5be42ab | 2017-09-13 09:10:39 -0700 | [diff] [blame] | 7687 | static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7688 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7689 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7690 | tp_wma_handle wma_handle; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 7691 | struct cdp_vdev *txrx_vdev_handle = NULL; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 7692 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7693 | extern uint8_t *mac_trace_get_wma_msg_string(uint16_t wmaMsg); |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 7694 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7695 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7696 | if (NULL == msg) { |
| 7697 | WMA_LOGE("msg is NULL"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7698 | QDF_ASSERT(0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7699 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7700 | goto end; |
| 7701 | } |
| 7702 | |
| 7703 | WMA_LOGD("msg->type = %x %s", msg->type, |
| 7704 | mac_trace_get_wma_msg_string(msg->type)); |
| 7705 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7706 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7707 | |
| 7708 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 7709 | WMA_LOGE("%s: wma_handle is NULL", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7710 | QDF_ASSERT(0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7711 | qdf_mem_free(msg->bodyptr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7712 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7713 | goto end; |
| 7714 | } |
| 7715 | |
| 7716 | switch (msg->type) { |
| 7717 | |
| 7718 | /* Message posted by wmi for all control path related |
| 7719 | * FW events to serialize through mc_thread. |
| 7720 | */ |
| 7721 | case WMA_PROCESS_FW_EVENT: |
| 7722 | wma_process_fw_event(wma_handle, |
| 7723 | (wma_process_fw_event_params *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7724 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7725 | break; |
| 7726 | |
| 7727 | #ifdef FEATURE_WLAN_ESE |
| 7728 | case WMA_TSM_STATS_REQ: |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 7729 | WMA_LOGD("McThread: WMA_TSM_STATS_REQ"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7730 | wma_process_tsm_stats_req(wma_handle, (void *)msg->bodyptr); |
| 7731 | break; |
| 7732 | #endif /* FEATURE_WLAN_ESE */ |
| 7733 | case WNI_CFG_DNLD_REQ: |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 7734 | WMA_LOGD("McThread: WNI_CFG_DNLD_REQ"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7735 | qdf_status = wma_wni_cfg_dnld(wma_handle); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7736 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) |
Jeff Johnson | f7ab814 | 2017-09-13 09:04:23 -0700 | [diff] [blame] | 7737 | cds_wma_complete_cback(); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7738 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7739 | WMA_LOGD("config download failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7740 | break; |
| 7741 | case WMA_ADD_STA_SELF_REQ: |
| 7742 | txrx_vdev_handle = |
| 7743 | wma_vdev_attach(wma_handle, |
| 7744 | (struct add_sta_self_params *) msg-> |
| 7745 | bodyptr, 1); |
| 7746 | if (!txrx_vdev_handle) { |
| 7747 | WMA_LOGE("Failed to attach vdev"); |
| 7748 | } else { |
| 7749 | /* Register with TxRx Module for Data Ack Complete Cb */ |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 7750 | if (soc) { |
| 7751 | cdp_data_tx_cb_set(soc, txrx_vdev_handle, |
| 7752 | wma_data_tx_ack_comp_hdlr, |
| 7753 | wma_handle); |
| 7754 | } else { |
| 7755 | WMA_LOGE("%s: SOC context is NULL", __func__); |
| 7756 | qdf_status = QDF_STATUS_E_FAILURE; |
| 7757 | goto end; |
| 7758 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7759 | } |
| 7760 | break; |
| 7761 | case WMA_DEL_STA_SELF_REQ: |
| 7762 | wma_vdev_detach(wma_handle, |
| 7763 | (struct del_sta_self_params *) msg->bodyptr, 1); |
| 7764 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7765 | case WMA_UPDATE_CHAN_LIST_REQ: |
| 7766 | wma_update_channel_list(wma_handle, |
| 7767 | (tSirUpdateChanList *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7768 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7769 | break; |
| 7770 | case WMA_SET_LINK_STATE: |
| 7771 | wma_set_linkstate(wma_handle, (tpLinkStateParams) msg->bodyptr); |
| 7772 | break; |
| 7773 | case WMA_CHNL_SWITCH_REQ: |
| 7774 | wma_set_channel(wma_handle, |
| 7775 | (tpSwitchChannelParams) msg->bodyptr); |
| 7776 | break; |
| 7777 | case WMA_ADD_BSS_REQ: |
| 7778 | wma_add_bss(wma_handle, (tpAddBssParams) msg->bodyptr); |
| 7779 | break; |
| 7780 | case WMA_ADD_STA_REQ: |
| 7781 | wma_add_sta(wma_handle, (tpAddStaParams) msg->bodyptr); |
| 7782 | break; |
| 7783 | case WMA_SET_BSSKEY_REQ: |
| 7784 | wma_set_bsskey(wma_handle, (tpSetBssKeyParams) msg->bodyptr); |
| 7785 | break; |
| 7786 | case WMA_SET_STAKEY_REQ: |
| 7787 | wma_set_stakey(wma_handle, (tpSetStaKeyParams) msg->bodyptr); |
| 7788 | break; |
| 7789 | case WMA_DELETE_STA_REQ: |
| 7790 | wma_delete_sta(wma_handle, (tpDeleteStaParams) msg->bodyptr); |
| 7791 | break; |
Deepak Dhamdhere | 2dae1bd | 2016-10-27 10:58:29 -0700 | [diff] [blame] | 7792 | case WMA_DELETE_BSS_HO_FAIL_REQ: |
| 7793 | wma_delete_bss_ho_fail(wma_handle, |
| 7794 | (tpDeleteBssParams) msg->bodyptr); |
| 7795 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7796 | case WMA_DELETE_BSS_REQ: |
| 7797 | wma_delete_bss(wma_handle, (tpDeleteBssParams) msg->bodyptr); |
| 7798 | break; |
| 7799 | case WMA_UPDATE_EDCA_PROFILE_IND: |
| 7800 | wma_process_update_edca_param_req(wma_handle, |
| 7801 | (tEdcaParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7802 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7803 | break; |
| 7804 | case WMA_SEND_BEACON_REQ: |
| 7805 | wma_send_beacon(wma_handle, (tpSendbeaconParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7806 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7807 | break; |
| 7808 | case WMA_SEND_PROBE_RSP_TMPL: |
| 7809 | wma_send_probe_rsp_tmpl(wma_handle, |
| 7810 | (tpSendProbeRespParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7811 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7812 | break; |
| 7813 | case WMA_CLI_SET_CMD: |
| 7814 | wma_process_cli_set_cmd(wma_handle, |
| 7815 | (wma_cli_set_cmd_t *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7816 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7817 | break; |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 7818 | case WMA_SET_PDEV_IE_REQ: |
| 7819 | wma_process_set_pdev_ie_req(wma_handle, |
| 7820 | (struct set_ie_param *)msg->bodyptr); |
| 7821 | qdf_mem_free(msg->bodyptr); |
| 7822 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7823 | #if !defined(REMOVE_PKT_LOG) |
| 7824 | case WMA_PKTLOG_ENABLE_REQ: |
| 7825 | wma_pktlog_wmi_send_cmd(wma_handle, |
| 7826 | (struct ath_pktlog_wmi_params *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7827 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7828 | break; |
| 7829 | #endif /* REMOVE_PKT_LOG */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7830 | case WMA_ENTER_PS_REQ: |
| 7831 | wma_enable_sta_ps_mode(wma_handle, |
| 7832 | (tpEnablePsParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7833 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7834 | break; |
| 7835 | case WMA_EXIT_PS_REQ: |
| 7836 | wma_disable_sta_ps_mode(wma_handle, |
| 7837 | (tpDisablePsParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7838 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7839 | break; |
| 7840 | case WMA_ENABLE_UAPSD_REQ: |
| 7841 | wma_enable_uapsd_mode(wma_handle, |
| 7842 | (tpEnableUapsdParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7843 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7844 | break; |
| 7845 | case WMA_DISABLE_UAPSD_REQ: |
| 7846 | wma_disable_uapsd_mode(wma_handle, |
| 7847 | (tpDisableUapsdParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7848 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7849 | break; |
Kiran Kumar Lokere | 6d3a30d | 2018-01-15 18:18:29 -0800 | [diff] [blame] | 7850 | case WMA_SET_DTIM_PERIOD: |
| 7851 | wma_set_dtim_period(wma_handle, |
| 7852 | (struct set_dtim_params *)msg->bodyptr); |
| 7853 | qdf_mem_free(msg->bodyptr); |
| 7854 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7855 | case WMA_SET_TX_POWER_REQ: |
| 7856 | wma_set_tx_power(wma_handle, (tpMaxTxPowerParams) msg->bodyptr); |
| 7857 | break; |
| 7858 | case WMA_SET_MAX_TX_POWER_REQ: |
| 7859 | wma_set_max_tx_power(wma_handle, |
| 7860 | (tpMaxTxPowerParams) msg->bodyptr); |
| 7861 | break; |
| 7862 | case WMA_SET_KEEP_ALIVE: |
| 7863 | wma_set_keepalive_req(wma_handle, |
| 7864 | (tSirKeepAliveReq *) msg->bodyptr); |
| 7865 | break; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 7866 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7867 | case WMA_SET_PLM_REQ: |
| 7868 | wma_config_plm(wma_handle, (tpSirPlmReq) msg->bodyptr); |
| 7869 | break; |
| 7870 | #endif |
| 7871 | case WMA_GET_STATISTICS_REQ: |
| 7872 | wma_get_stats_req(wma_handle, |
| 7873 | (tAniGetPEStatsReq *) msg->bodyptr); |
| 7874 | break; |
| 7875 | |
| 7876 | case WMA_CONFIG_PARAM_UPDATE_REQ: |
Rajeev Kumar | 156188e | 2017-01-21 17:23:52 -0800 | [diff] [blame] | 7877 | wma_update_cfg_params(wma_handle, msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7878 | break; |
| 7879 | |
| 7880 | case WMA_UPDATE_OP_MODE: |
| 7881 | wma_process_update_opmode(wma_handle, |
| 7882 | (tUpdateVHTOpMode *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7883 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7884 | break; |
| 7885 | case WMA_UPDATE_RX_NSS: |
| 7886 | wma_process_update_rx_nss(wma_handle, |
| 7887 | (tUpdateRxNss *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7888 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7889 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7890 | case WMA_UPDATE_MEMBERSHIP: |
| 7891 | wma_process_update_membership(wma_handle, |
| 7892 | (tUpdateMembership *) msg->bodyptr); |
| 7893 | break; |
| 7894 | case WMA_UPDATE_USERPOS: |
| 7895 | wma_process_update_userpos(wma_handle, |
| 7896 | (tUpdateUserPos *) msg->bodyptr); |
| 7897 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7898 | case WMA_UPDATE_BEACON_IND: |
| 7899 | wma_process_update_beacon_params(wma_handle, |
| 7900 | (tUpdateBeaconParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7901 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7902 | break; |
| 7903 | |
| 7904 | case WMA_ADD_TS_REQ: |
| 7905 | wma_add_ts_req(wma_handle, (tAddTsParams *) msg->bodyptr); |
| 7906 | break; |
| 7907 | |
| 7908 | case WMA_DEL_TS_REQ: |
| 7909 | wma_del_ts_req(wma_handle, (tDelTsParams *) msg->bodyptr); |
| 7910 | break; |
| 7911 | |
| 7912 | case WMA_AGGR_QOS_REQ: |
| 7913 | wma_aggr_qos_req(wma_handle, (tAggrAddTsParams *) msg->bodyptr); |
| 7914 | break; |
| 7915 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7916 | case WMA_8023_MULTICAST_LIST_REQ: |
| 7917 | wma_process_mcbc_set_filter_req(wma_handle, |
| 7918 | (tpSirRcvFltMcAddrList) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7919 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7920 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7921 | case WMA_ROAM_SCAN_OFFLOAD_REQ: |
| 7922 | /* |
| 7923 | * Main entry point or roaming directives from CSR. |
| 7924 | */ |
Varun Reddy Yeturu | 30bc42c | 2016-02-04 10:07:30 -0800 | [diff] [blame] | 7925 | wma_process_roaming_config(wma_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7926 | (tSirRoamOffloadScanReq *) msg->bodyptr); |
| 7927 | break; |
| 7928 | |
| 7929 | case WMA_RATE_UPDATE_IND: |
| 7930 | wma_process_rate_update_indicate(wma_handle, |
| 7931 | (tSirRateUpdateInd *) msg->bodyptr); |
| 7932 | break; |
| 7933 | |
| 7934 | #ifdef FEATURE_WLAN_TDLS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7935 | case WMA_UPDATE_TDLS_PEER_STATE: |
| 7936 | wma_update_tdls_peer_state(wma_handle, |
| 7937 | (tTdlsPeerStateParams *) msg->bodyptr); |
| 7938 | break; |
| 7939 | case WMA_TDLS_SET_OFFCHAN_MODE: |
| 7940 | wma_set_tdls_offchan_mode(wma_handle, |
| 7941 | (tdls_chan_switch_params *)msg->bodyptr); |
| 7942 | break; |
| 7943 | #endif /* FEATURE_WLAN_TDLS */ |
| 7944 | case WMA_ADD_PERIODIC_TX_PTRN_IND: |
| 7945 | wma_process_add_periodic_tx_ptrn_ind(wma_handle, |
| 7946 | (tSirAddPeriodicTxPtrn *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7947 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7948 | break; |
| 7949 | case WMA_DEL_PERIODIC_TX_PTRN_IND: |
| 7950 | wma_process_del_periodic_tx_ptrn_ind(wma_handle, |
| 7951 | (tSirDelPeriodicTxPtrn *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7952 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7953 | break; |
| 7954 | case WMA_TX_POWER_LIMIT: |
| 7955 | wma_process_tx_power_limits(wma_handle, |
| 7956 | (tSirTxPowerLimit *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7957 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7958 | break; |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 7959 | case WMA_SEND_ADDBA_REQ: |
| 7960 | wma_process_send_addba_req(wma_handle, |
| 7961 | (struct send_add_ba_req *)msg->bodyptr); |
| 7962 | break; |
| 7963 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7964 | #ifdef FEATURE_WLAN_CH_AVOID |
| 7965 | case WMA_CH_AVOID_UPDATE_REQ: |
| 7966 | wma_process_ch_avoid_update_req(wma_handle, |
| 7967 | (tSirChAvoidUpdateReq *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7968 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7969 | break; |
| 7970 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 7971 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 7972 | case WMA_SET_AUTO_SHUTDOWN_TIMER_REQ: |
| 7973 | wma_set_auto_shutdown_timer_req(wma_handle, msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7974 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7975 | break; |
| 7976 | #endif /* FEATURE_WLAN_AUTO_SHUTDOWN */ |
| 7977 | case WMA_DHCP_START_IND: |
| 7978 | case WMA_DHCP_STOP_IND: |
| 7979 | wma_process_dhcp_ind(wma_handle, (tAniDHCPInd *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7980 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7981 | break; |
| 7982 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 7983 | case WMA_IBSS_CESIUM_ENABLE_IND: |
| 7984 | wma_process_cesium_enable_ind(wma_handle); |
| 7985 | break; |
| 7986 | case WMA_GET_IBSS_PEER_INFO_REQ: |
| 7987 | wma_process_get_peer_info_req(wma_handle, |
| 7988 | (tSirIbssGetPeerInfoReqParams *) |
| 7989 | msg->bodyptr); |
| 7990 | qdf_mem_free(msg->bodyptr); |
| 7991 | break; |
| 7992 | case WMA_TX_FAIL_MONITOR_IND: |
| 7993 | wma_process_tx_fail_monitor_ind(wma_handle, |
| 7994 | (tAniTXFailMonitorInd *) msg->bodyptr); |
| 7995 | qdf_mem_free(msg->bodyptr); |
| 7996 | break; |
| 7997 | |
| 7998 | case WMA_RMC_ENABLE_IND: |
| 7999 | wma_process_rmc_enable_ind(wma_handle); |
| 8000 | break; |
| 8001 | case WMA_RMC_DISABLE_IND: |
| 8002 | wma_process_rmc_disable_ind(wma_handle); |
| 8003 | break; |
| 8004 | case WMA_RMC_ACTION_PERIOD_IND: |
| 8005 | wma_process_rmc_action_period_ind(wma_handle); |
| 8006 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8007 | case WMA_INIT_THERMAL_INFO_CMD: |
| 8008 | wma_process_init_thermal_info(wma_handle, |
| 8009 | (t_thermal_mgmt *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8010 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8011 | break; |
| 8012 | |
| 8013 | case WMA_SET_THERMAL_LEVEL: |
| 8014 | wma_process_set_thermal_level(wma_handle, msg->bodyval); |
| 8015 | break; |
Poddar, Siddarth | 5a91f5b | 2016-04-28 12:24:10 +0530 | [diff] [blame] | 8016 | #ifdef CONFIG_HL_SUPPORT |
| 8017 | case WMA_INIT_BAD_PEER_TX_CTL_INFO_CMD: |
| 8018 | wma_process_init_bad_peer_tx_ctl_info( |
| 8019 | wma_handle, |
| 8020 | (struct t_bad_peer_txtcl_config *)msg->bodyptr); |
| 8021 | qdf_mem_free(msg->bodyptr); |
| 8022 | break; |
| 8023 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8024 | case WMA_SET_MIMOPS_REQ: |
| 8025 | wma_process_set_mimops_req(wma_handle, |
| 8026 | (tSetMIMOPS *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8027 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8028 | break; |
| 8029 | case WMA_SET_SAP_INTRABSS_DIS: |
| 8030 | wma_set_vdev_intrabss_fwd(wma_handle, |
| 8031 | (tDisableIntraBssFwd *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8032 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8033 | break; |
Will Huang | a981459 | 2017-05-24 15:47:58 +0800 | [diff] [blame] | 8034 | case WMA_GET_PEER_INFO: |
| 8035 | wma_get_peer_info(wma_handle, msg->bodyptr); |
| 8036 | qdf_mem_free(msg->bodyptr); |
| 8037 | break; |
| 8038 | case WMA_GET_PEER_INFO_EXT: |
| 8039 | wma_get_peer_info_ext(wma_handle, msg->bodyptr); |
| 8040 | qdf_mem_free(msg->bodyptr); |
| 8041 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8042 | case WMA_MODEM_POWER_STATE_IND: |
| 8043 | wma_notify_modem_power_state(wma_handle, |
| 8044 | (tSirModemPowerStateInd *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8045 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8046 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8047 | #ifdef WLAN_FEATURE_STATS_EXT |
| 8048 | case WMA_STATS_EXT_REQUEST: |
| 8049 | wma_stats_ext_req(wma_handle, |
| 8050 | (tpStatsExtRequest) (msg->bodyptr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8051 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8052 | break; |
| 8053 | #endif /* WLAN_FEATURE_STATS_EXT */ |
| 8054 | case WMA_HIDDEN_SSID_VDEV_RESTART: |
| 8055 | wma_hidden_ssid_vdev_restart(wma_handle, |
| 8056 | (tHalHiddenSsidVdevRestart *) msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8057 | break; |
| 8058 | #ifdef WLAN_FEATURE_EXTWOW_SUPPORT |
| 8059 | case WMA_WLAN_EXT_WOW: |
| 8060 | wma_enable_ext_wow(wma_handle, |
| 8061 | (tSirExtWoWParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8062 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8063 | break; |
| 8064 | case WMA_WLAN_SET_APP_TYPE1_PARAMS: |
| 8065 | wma_set_app_type1_params_in_fw(wma_handle, |
| 8066 | (tSirAppType1Params *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8067 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8068 | break; |
| 8069 | case WMA_WLAN_SET_APP_TYPE2_PARAMS: |
| 8070 | wma_set_app_type2_params_in_fw(wma_handle, |
| 8071 | (tSirAppType2Params *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8072 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8073 | break; |
| 8074 | #endif /* WLAN_FEATURE_EXTWOW_SUPPORT */ |
| 8075 | #ifdef FEATURE_WLAN_EXTSCAN |
| 8076 | case WMA_EXTSCAN_START_REQ: |
| 8077 | wma_start_extscan(wma_handle, |
| 8078 | (tSirWifiScanCmdReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8079 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8080 | break; |
| 8081 | case WMA_EXTSCAN_STOP_REQ: |
| 8082 | wma_stop_extscan(wma_handle, |
| 8083 | (tSirExtScanStopReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8084 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8085 | break; |
| 8086 | case WMA_EXTSCAN_SET_BSSID_HOTLIST_REQ: |
| 8087 | wma_extscan_start_hotlist_monitor(wma_handle, |
| 8088 | (tSirExtScanSetBssidHotListReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8089 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8090 | break; |
| 8091 | case WMA_EXTSCAN_RESET_BSSID_HOTLIST_REQ: |
| 8092 | wma_extscan_stop_hotlist_monitor(wma_handle, |
| 8093 | (tSirExtScanResetBssidHotlistReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8094 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8095 | break; |
| 8096 | case WMA_EXTSCAN_SET_SIGNF_CHANGE_REQ: |
| 8097 | wma_extscan_start_change_monitor(wma_handle, |
| 8098 | (tSirExtScanSetSigChangeReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8099 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8100 | break; |
| 8101 | case WMA_EXTSCAN_RESET_SIGNF_CHANGE_REQ: |
| 8102 | wma_extscan_stop_change_monitor(wma_handle, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 8103 | (tSirExtScanResetSignificantChangeReqParams *) |
| 8104 | msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8105 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8106 | break; |
| 8107 | case WMA_EXTSCAN_GET_CACHED_RESULTS_REQ: |
| 8108 | wma_extscan_get_cached_results(wma_handle, |
| 8109 | (tSirExtScanGetCachedResultsReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8110 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8111 | break; |
| 8112 | case WMA_EXTSCAN_GET_CAPABILITIES_REQ: |
| 8113 | wma_extscan_get_capabilities(wma_handle, |
| 8114 | (tSirGetExtScanCapabilitiesReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8115 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8116 | break; |
| 8117 | case WMA_SET_EPNO_LIST_REQ: |
| 8118 | wma_set_epno_network_list(wma_handle, |
| 8119 | (struct wifi_epno_params *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8120 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8121 | break; |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 8122 | case WMA_SET_PER_ROAM_CONFIG_CMD: |
| 8123 | wma_update_per_roam_config(wma_handle, |
| 8124 | (struct wmi_per_roam_config_req *)msg->bodyptr); |
| 8125 | qdf_mem_free(msg->bodyptr); |
| 8126 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8127 | case WMA_SET_PASSPOINT_LIST_REQ: |
| 8128 | /* Issue reset passpoint network list first and clear |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 8129 | * the entries |
| 8130 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8131 | wma_reset_passpoint_network_list(wma_handle, |
| 8132 | (struct wifi_passpoint_req *)msg->bodyptr); |
| 8133 | |
| 8134 | wma_set_passpoint_network_list(wma_handle, |
| 8135 | (struct wifi_passpoint_req *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8136 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8137 | break; |
| 8138 | case WMA_RESET_PASSPOINT_LIST_REQ: |
| 8139 | wma_reset_passpoint_network_list(wma_handle, |
| 8140 | (struct wifi_passpoint_req *)msg->bodyptr); |
| 8141 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8142 | #endif /* FEATURE_WLAN_EXTSCAN */ |
| 8143 | case WMA_SET_SCAN_MAC_OUI_REQ: |
| 8144 | wma_scan_probe_setoui(wma_handle, msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8145 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8146 | break; |
| 8147 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 8148 | case WMA_LINK_LAYER_STATS_CLEAR_REQ: |
| 8149 | wma_process_ll_stats_clear_req(wma_handle, |
| 8150 | (tpSirLLStatsClearReq) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8151 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8152 | break; |
| 8153 | case WMA_LINK_LAYER_STATS_SET_REQ: |
| 8154 | wma_process_ll_stats_set_req(wma_handle, |
| 8155 | (tpSirLLStatsSetReq) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8156 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8157 | break; |
| 8158 | case WMA_LINK_LAYER_STATS_GET_REQ: |
| 8159 | wma_process_ll_stats_get_req(wma_handle, |
| 8160 | (tpSirLLStatsGetReq) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8161 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8162 | break; |
Zhang Qian | 73c348a | 2017-03-13 16:15:55 +0800 | [diff] [blame] | 8163 | case WDA_LINK_LAYER_STATS_SET_THRESHOLD: |
| 8164 | wma_config_stats_ext_threshold(wma_handle, |
| 8165 | (struct sir_ll_ext_stats_threshold *)msg->bodyptr); |
| 8166 | qdf_mem_free(msg->bodyptr); |
| 8167 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8168 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8169 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8170 | case WMA_ROAM_OFFLOAD_SYNCH_FAIL: |
| 8171 | wma_process_roam_synch_fail(wma_handle, |
| 8172 | (struct roam_offload_synch_fail *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8173 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8174 | break; |
| 8175 | case SIR_HAL_ROAM_INVOKE: |
| 8176 | wma_process_roam_invoke(wma_handle, |
| 8177 | (struct wma_roam_invoke_cmd *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8178 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8179 | break; |
| 8180 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 8181 | #ifdef WLAN_FEATURE_NAN |
| 8182 | case WMA_NAN_REQUEST: |
| 8183 | wma_nan_req(wma_handle, (tNanRequest *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8184 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8185 | break; |
| 8186 | #endif /* WLAN_FEATURE_NAN */ |
| 8187 | case SIR_HAL_SET_BASE_MACADDR_IND: |
| 8188 | wma_set_base_macaddr_indicate(wma_handle, |
| 8189 | (tSirMacAddr *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8190 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8191 | break; |
| 8192 | case WMA_LINK_STATUS_GET_REQ: |
| 8193 | wma_process_link_status_req(wma_handle, |
| 8194 | (tAniGetLinkStatus *) msg->bodyptr); |
| 8195 | break; |
| 8196 | case WMA_GET_TEMPERATURE_REQ: |
| 8197 | wma_get_temperature(wma_handle); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8198 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8199 | break; |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 8200 | case WMA_TSF_GPIO_PIN: |
| 8201 | wma_set_tsf_gpio_pin(wma_handle, msg->bodyval); |
| 8202 | break; |
| 8203 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8204 | #ifdef DHCP_SERVER_OFFLOAD |
| 8205 | case WMA_SET_DHCP_SERVER_OFFLOAD_CMD: |
| 8206 | wma_process_dhcpserver_offload(wma_handle, |
| 8207 | (tSirDhcpSrvOffloadInfo *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8208 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8209 | break; |
| 8210 | #endif /* DHCP_SERVER_OFFLOAD */ |
| 8211 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 8212 | case WMA_LED_FLASHING_REQ: |
Jeff Johnson | 5a6b660 | 2017-10-04 14:44:30 -0700 | [diff] [blame] | 8213 | wma_set_led_flashing(wma_handle, msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8214 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8215 | break; |
| 8216 | #endif /* WLAN_FEATURE_GPIO_LED_FLASHING */ |
| 8217 | case SIR_HAL_SET_MAS: |
| 8218 | wma_process_set_mas(wma_handle, |
| 8219 | (uint32_t *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8220 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8221 | break; |
| 8222 | case SIR_HAL_SET_MIRACAST: |
| 8223 | wma_process_set_miracast(wma_handle, |
| 8224 | (uint32_t *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8225 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8226 | break; |
| 8227 | case SIR_HAL_CONFIG_STATS_FACTOR: |
| 8228 | wma_config_stats_factor(wma_handle, |
| 8229 | (struct sir_stats_avg_factor *) |
| 8230 | msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8231 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8232 | break; |
| 8233 | case SIR_HAL_CONFIG_GUARD_TIME: |
| 8234 | wma_config_guard_time(wma_handle, |
| 8235 | (struct sir_guard_time_request *) |
| 8236 | msg->bodyptr); |
Vignesh Viswanathan | 9fa8fef | 2017-12-12 14:45:38 +0530 | [diff] [blame] | 8237 | qdf_mem_free(msg->bodyptr); |
| 8238 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8239 | case SIR_HAL_START_STOP_LOGGING: |
| 8240 | wma_set_wifi_start_packet_stats(wma_handle, |
| 8241 | (struct sir_wifi_start_log *)msg->bodyptr); |
| 8242 | wma_enable_specific_fw_logs(wma_handle, |
| 8243 | (struct sir_wifi_start_log *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8244 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8245 | break; |
| 8246 | case SIR_HAL_FLUSH_LOG_TO_FW: |
| 8247 | wma_send_flush_logs_to_fw(wma_handle); |
| 8248 | /* Body ptr is NULL here */ |
| 8249 | break; |
| 8250 | case WMA_SET_RSSI_MONITOR_REQ: |
| 8251 | wma_set_rssi_monitoring(wma_handle, |
| 8252 | (struct rssi_monitor_req *)msg->bodyptr); |
Prakash Dhavali | 87ddca3 | 2016-11-29 17:02:11 -0800 | [diff] [blame] | 8253 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8254 | break; |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8255 | case SIR_HAL_PDEV_SET_PCL_TO_FW: |
| 8256 | wma_send_pdev_set_pcl_cmd(wma_handle, |
| 8257 | (struct wmi_pcl_chan_weights *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8258 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8259 | break; |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 8260 | case SIR_HAL_PDEV_SET_HW_MODE: |
| 8261 | wma_send_pdev_set_hw_mode_cmd(wma_handle, |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 8262 | (struct policy_mgr_hw_mode *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8263 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8264 | break; |
| 8265 | case WMA_OCB_SET_CONFIG_CMD: |
| 8266 | wma_ocb_set_config_req(wma_handle, |
| 8267 | (struct sir_ocb_config *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8268 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8269 | break; |
| 8270 | case WMA_OCB_SET_UTC_TIME_CMD: |
| 8271 | wma_ocb_set_utc_time(wma_handle, |
| 8272 | (struct sir_ocb_utc *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8273 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8274 | break; |
| 8275 | case WMA_OCB_START_TIMING_ADVERT_CMD: |
| 8276 | wma_ocb_start_timing_advert(wma_handle, |
| 8277 | (struct sir_ocb_timing_advert *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8278 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8279 | break; |
| 8280 | case WMA_OCB_STOP_TIMING_ADVERT_CMD: |
| 8281 | wma_ocb_stop_timing_advert(wma_handle, |
| 8282 | (struct sir_ocb_timing_advert *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8283 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8284 | break; |
| 8285 | case WMA_DCC_CLEAR_STATS_CMD: |
| 8286 | wma_dcc_clear_stats(wma_handle, |
| 8287 | (struct sir_dcc_clear_stats *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8288 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8289 | break; |
| 8290 | case WMA_OCB_GET_TSF_TIMER_CMD: |
| 8291 | wma_ocb_get_tsf_timer(wma_handle, |
| 8292 | (struct sir_ocb_get_tsf_timer *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8293 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8294 | break; |
Manikandan Mohan | 80dea79 | 2016-04-28 16:36:48 -0700 | [diff] [blame] | 8295 | case WMA_SET_WISA_PARAMS: |
| 8296 | wma_set_wisa_params(wma_handle, |
| 8297 | (struct sir_wisa_params *)msg->bodyptr); |
| 8298 | qdf_mem_free(msg->bodyptr); |
| 8299 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8300 | case WMA_DCC_GET_STATS_CMD: |
| 8301 | wma_dcc_get_stats(wma_handle, |
| 8302 | (struct sir_dcc_get_stats *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8303 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8304 | break; |
| 8305 | case WMA_DCC_UPDATE_NDL_CMD: |
| 8306 | wma_dcc_update_ndl(wma_handle, |
| 8307 | (struct sir_dcc_update_ndl *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8308 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8309 | break; |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 8310 | case SIR_HAL_PDEV_DUAL_MAC_CFG_REQ: |
| 8311 | wma_send_pdev_set_dual_mac_config(wma_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8312 | (struct sir_dual_mac_config *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8313 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8314 | break; |
| 8315 | case WMA_SET_IE_INFO: |
| 8316 | wma_process_set_ie_info(wma_handle, |
| 8317 | (struct vdev_ie_info *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8318 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8319 | break; |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 8320 | case SIR_HAL_SOC_ANTENNA_MODE_REQ: |
| 8321 | wma_send_pdev_set_antenna_mode(wma_handle, |
| 8322 | (struct sir_antenna_mode_param *)msg->bodyptr); |
| 8323 | qdf_mem_free(msg->bodyptr); |
| 8324 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8325 | case WMA_LRO_CONFIG_CMD: |
| 8326 | wma_lro_config_cmd(wma_handle, |
Dhanashri Atre | 09828f1 | 2016-11-13 10:36:58 -0800 | [diff] [blame] | 8327 | (struct cdp_lro_hash_config *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8328 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8329 | break; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 8330 | case WMA_GW_PARAM_UPDATE_REQ: |
| 8331 | wma_set_gateway_params(wma_handle, |
| 8332 | (struct gateway_param_update_req *)msg->bodyptr); |
Archana Ramachandran | 28ab412 | 2016-03-08 16:17:14 -0800 | [diff] [blame] | 8333 | qdf_mem_free(msg->bodyptr); |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 8334 | break; |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 8335 | case WMA_SET_ADAPT_DWELLTIME_CONF_PARAMS: |
| 8336 | wma_send_adapt_dwelltime_params(wma_handle, |
| 8337 | (struct adaptive_dwelltime_params *)msg->bodyptr); |
| 8338 | qdf_mem_free(msg->bodyptr); |
| 8339 | break; |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 8340 | case WMA_HT40_OBSS_SCAN_IND: |
| 8341 | wma_send_ht40_obss_scanind(wma_handle, |
| 8342 | (struct obss_ht40_scanind *)msg->bodyptr); |
| 8343 | qdf_mem_free(msg->bodyptr); |
| 8344 | break; |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 8345 | case WMA_ADD_BCN_FILTER_CMDID: |
| 8346 | wma_add_beacon_filter(wma_handle, msg->bodyptr); |
| 8347 | qdf_mem_free(msg->bodyptr); |
| 8348 | break; |
| 8349 | case WMA_REMOVE_BCN_FILTER_CMDID: |
| 8350 | wma_remove_beacon_filter(wma_handle, msg->bodyptr); |
| 8351 | qdf_mem_free(msg->bodyptr); |
| 8352 | break; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 8353 | case WDA_BPF_GET_CAPABILITIES_REQ: |
| 8354 | wma_get_bpf_capabilities(wma_handle); |
| 8355 | break; |
| 8356 | case WDA_BPF_SET_INSTRUCTIONS_REQ: |
| 8357 | wma_set_bpf_instructions(wma_handle, msg->bodyptr); |
| 8358 | qdf_mem_free(msg->bodyptr); |
| 8359 | break; |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 8360 | case SIR_HAL_POWER_DBG_CMD: |
| 8361 | wma_process_hal_pwr_dbg_cmd(wma_handle, |
| 8362 | msg->bodyptr); |
| 8363 | qdf_mem_free(msg->bodyptr); |
| 8364 | break; |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 8365 | case WMA_UPDATE_WEP_DEFAULT_KEY: |
| 8366 | wma_update_wep_default_key(wma_handle, |
| 8367 | (struct wep_update_default_key_idx *)msg->bodyptr); |
| 8368 | qdf_mem_free(msg->bodyptr); |
| 8369 | break; |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 8370 | case WMA_SEND_FREQ_RANGE_CONTROL_IND: |
| 8371 | wma_enable_disable_caevent_ind(wma_handle, msg->bodyval); |
| 8372 | break; |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 8373 | case SIR_HAL_UPDATE_TX_FAIL_CNT_TH: |
| 8374 | wma_update_tx_fail_cnt_th(wma_handle, msg->bodyptr); |
| 8375 | qdf_mem_free(msg->bodyptr); |
| 8376 | break; |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 8377 | case SIR_HAL_LONG_RETRY_LIMIT_CNT: |
| 8378 | wma_update_long_retry_limit(wma_handle, msg->bodyptr); |
| 8379 | qdf_mem_free(msg->bodyptr); |
| 8380 | break; |
| 8381 | case SIR_HAL_SHORT_RETRY_LIMIT_CNT: |
| 8382 | wma_update_short_retry_limit(wma_handle, msg->bodyptr); |
| 8383 | qdf_mem_free(msg->bodyptr); |
| 8384 | break; |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 8385 | case SIR_HAL_POWER_DEBUG_STATS_REQ: |
| 8386 | wma_process_power_debug_stats_req(wma_handle); |
| 8387 | break; |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 8388 | case WMA_GET_RCPI_REQ: |
| 8389 | wma_get_rcpi_req(wma_handle, |
| 8390 | (struct sme_rcpi_req *)msg->bodyptr); |
| 8391 | qdf_mem_free(msg->bodyptr); |
| 8392 | break; |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 8393 | case WMA_SET_WOW_PULSE_CMD: |
| 8394 | wma_send_wow_pulse_cmd(wma_handle, |
| 8395 | (struct wow_pulse_mode *)msg->bodyptr); |
| 8396 | qdf_mem_free(msg->bodyptr); |
| 8397 | break; |
Nitesh Shah | f9a09ff | 2017-05-22 15:46:25 +0530 | [diff] [blame] | 8398 | case WMA_SET_DBS_SCAN_SEL_CONF_PARAMS: |
| 8399 | wma_send_dbs_scan_selection_params(wma_handle, |
| 8400 | (struct wmi_dbs_scan_sel_params *)msg->bodyptr); |
| 8401 | qdf_mem_free(msg->bodyptr); |
| 8402 | break; |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 8403 | case WMA_SET_ARP_STATS_REQ: |
| 8404 | wma_set_arp_req_stats(wma_handle, |
| 8405 | (struct set_arp_stats_params *)msg->bodyptr); |
| 8406 | qdf_mem_free(msg->bodyptr); |
| 8407 | break; |
| 8408 | case WMA_GET_ARP_STATS_REQ: |
| 8409 | wma_get_arp_req_stats(wma_handle, |
| 8410 | (struct get_arp_stats_params *)msg->bodyptr); |
| 8411 | qdf_mem_free(msg->bodyptr); |
| 8412 | break; |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 8413 | case SIR_HAL_SET_DEL_PMKID_CACHE: |
| 8414 | wma_set_del_pmkid_cache(wma_handle, |
| 8415 | (struct wmi_unified_pmk_cache *) msg->bodyptr); |
| 8416 | qdf_mem_free(msg->bodyptr); |
| 8417 | break; |
| 8418 | case SIR_HAL_HLP_IE_INFO: |
| 8419 | wma_roam_scan_send_hlp(wma_handle, |
| 8420 | (struct hlp_params *)msg->bodyptr); |
| 8421 | qdf_mem_free(msg->bodyptr); |
| 8422 | break; |
Ganesh Kondabattini | 3573957 | 2017-06-21 16:26:39 +0530 | [diff] [blame] | 8423 | case WMA_SET_LIMIT_OFF_CHAN: |
| 8424 | wma_process_limit_off_chan(wma_handle, msg->bodyptr); |
| 8425 | qdf_mem_free(msg->bodyptr); |
| 8426 | break; |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 8427 | case WMA_OBSS_DETECTION_REQ: |
| 8428 | wma_send_obss_detection_cfg(wma_handle, msg->bodyptr); |
| 8429 | qdf_mem_free(msg->bodyptr); |
| 8430 | break; |
Vignesh Viswanathan | 694e28e | 2018-01-18 20:53:57 +0530 | [diff] [blame] | 8431 | case WMA_INVOKE_NEIGHBOR_REPORT: |
| 8432 | wma_send_invoke_neighbor_report(wma_handle, msg->bodyptr); |
| 8433 | qdf_mem_free(msg->bodyptr); |
| 8434 | break; |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 8435 | case WMA_OBSS_COLOR_COLLISION_REQ: |
| 8436 | wma_process_obss_color_collision_req(wma_handle, msg->bodyptr); |
| 8437 | qdf_mem_free(msg->bodyptr); |
| 8438 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8439 | default: |
Dustin Brown | 86534fb | 2017-01-24 14:28:20 -0800 | [diff] [blame] | 8440 | WMA_LOGE("Unhandled WMA message of type %d", msg->type); |
| 8441 | if (msg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8442 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8443 | } |
| 8444 | end: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8445 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8446 | } |
| 8447 | |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 8448 | QDF_STATUS wma_mc_process_handler(struct scheduler_msg *msg) |
| 8449 | { |
Jeff Johnson | 5be42ab | 2017-09-13 09:10:39 -0700 | [diff] [blame] | 8450 | return wma_mc_process_msg(msg); |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 8451 | } |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 8452 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8453 | /** |
| 8454 | * wma_log_completion_timeout() - Log completion timeout |
| 8455 | * @data: Timeout handler data |
| 8456 | * |
| 8457 | * This function is called when log completion timer expires |
| 8458 | * |
| 8459 | * Return: None |
| 8460 | */ |
| 8461 | void wma_log_completion_timeout(void *data) |
| 8462 | { |
| 8463 | tp_wma_handle wma_handle; |
| 8464 | |
| 8465 | WMA_LOGE("%s: Timeout occured for log completion command", __func__); |
| 8466 | |
| 8467 | wma_handle = (tp_wma_handle) data; |
| 8468 | if (!wma_handle) |
| 8469 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 8470 | |
| 8471 | /* Though we did not receive any event from FW, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 8472 | * we can flush whatever logs we have with us |
| 8473 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8474 | cds_logging_set_fw_flush_complete(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8475 | } |
| 8476 | |
| 8477 | /** |
Manishekar Chandrasekaran | b82554d | 2016-08-04 17:46:46 +0530 | [diff] [blame] | 8478 | * wma_map_pcl_weights() - Map PCL weights |
| 8479 | * @pcl_weight: Internal PCL weights |
| 8480 | * |
| 8481 | * Maps the internal weights of PCL to the weights needed by FW |
| 8482 | * |
| 8483 | * Return: Mapped channel weight of type wmi_pcl_chan_weight |
| 8484 | */ |
| 8485 | static wmi_pcl_chan_weight wma_map_pcl_weights(uint32_t pcl_weight) |
| 8486 | { |
| 8487 | switch (pcl_weight) { |
| 8488 | case WEIGHT_OF_GROUP1_PCL_CHANNELS: |
| 8489 | return WMI_PCL_WEIGHT_VERY_HIGH; |
| 8490 | case WEIGHT_OF_GROUP2_PCL_CHANNELS: |
| 8491 | return WMI_PCL_WEIGHT_HIGH; |
| 8492 | case WEIGHT_OF_GROUP3_PCL_CHANNELS: |
| 8493 | return WMI_PCL_WEIGHT_MEDIUM; |
| 8494 | case WEIGHT_OF_NON_PCL_CHANNELS: |
| 8495 | return WMI_PCL_WEIGHT_LOW; |
| 8496 | default: |
| 8497 | return WMI_PCL_WEIGHT_DISALLOW; |
| 8498 | } |
| 8499 | } |
| 8500 | |
| 8501 | /** |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8502 | * 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] | 8503 | * @wma_handle: WMA handle |
| 8504 | * @msg: PCL structure containing the PCL and the number of channels |
| 8505 | * |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8506 | * 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] | 8507 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 8508 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 8509 | * to migrate to a new channel without host driver involvement. An example of |
| 8510 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 8511 | * manage the channel selection without firmware involvement. |
| 8512 | * |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8513 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 8514 | * channel list. The weights corresponds to the channels sent in |
| 8515 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 8516 | * weightage compared to the non PCL channels. |
| 8517 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8518 | * Return: Success if the cmd is sent successfully to the firmware |
| 8519 | */ |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8520 | QDF_STATUS wma_send_pdev_set_pcl_cmd(tp_wma_handle wma_handle, |
| 8521 | struct wmi_pcl_chan_weights *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8522 | { |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8523 | uint32_t i; |
| 8524 | QDF_STATUS status; |
| 8525 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8526 | if (!wma_handle) { |
| 8527 | WMA_LOGE("%s: WMA handle is NULL. Cannot issue command", |
| 8528 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8529 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8530 | } |
| 8531 | |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8532 | for (i = 0; i < wma_handle->saved_chan.num_channels; i++) { |
| 8533 | msg->saved_chan_list[i] = |
| 8534 | wma_handle->saved_chan.channel_list[i]; |
| 8535 | } |
| 8536 | |
| 8537 | msg->saved_num_chan = wma_handle->saved_chan.num_channels; |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 8538 | status = policy_mgr_get_valid_chan_weights(wma_handle->psoc, |
| 8539 | (struct policy_mgr_pcl_chan_weights *)msg); |
Manishekar Chandrasekaran | b82554d | 2016-08-04 17:46:46 +0530 | [diff] [blame] | 8540 | |
| 8541 | for (i = 0; i < msg->saved_num_chan; i++) { |
| 8542 | msg->weighed_valid_list[i] = |
| 8543 | wma_map_pcl_weights(msg->weighed_valid_list[i]); |
Sandeep Puligilla | 819d94f | 2017-10-10 18:33:56 -0700 | [diff] [blame] | 8544 | /* Dont allow roaming on 2G when 5G_ONLY configured */ |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 8545 | if ((wma_handle->bandcapability == BAND_5G) && |
Sandeep Puligilla | 819d94f | 2017-10-10 18:33:56 -0700 | [diff] [blame] | 8546 | (msg->saved_chan_list[i] <= MAX_24GHZ_CHANNEL)) { |
| 8547 | msg->weighed_valid_list[i] = |
| 8548 | WEIGHT_OF_DISALLOWED_CHANNELS; |
| 8549 | } |
Manishekar Chandrasekaran | b82554d | 2016-08-04 17:46:46 +0530 | [diff] [blame] | 8550 | WMA_LOGD("%s: chan:%d weight[%d]=%d", __func__, |
| 8551 | msg->saved_chan_list[i], i, |
| 8552 | msg->weighed_valid_list[i]); |
| 8553 | } |
| 8554 | |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 8555 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 8556 | WMA_LOGE("%s: Error in creating weighed pcl", __func__); |
| 8557 | return status; |
| 8558 | } |
| 8559 | |
| 8560 | if (wmi_unified_pdev_set_pcl_cmd(wma_handle->wmi_handle, msg)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8561 | return QDF_STATUS_E_FAILURE; |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 8562 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8563 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8564 | } |
| 8565 | |
| 8566 | /** |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 8567 | * 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] | 8568 | * @wma_handle: WMA handle |
| 8569 | * @msg: Structure containing the following parameters |
| 8570 | * |
| 8571 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 8572 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 8573 | * |
| 8574 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 8575 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 8576 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 8577 | * |
| 8578 | * Return: Success if the cmd is sent successfully to the firmware |
| 8579 | */ |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 8580 | 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] | 8581 | struct policy_mgr_hw_mode *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8582 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8583 | struct sir_set_hw_mode_resp *param; |
Tushnim Bhattacharyya | 8629489 | 2017-10-25 16:29:11 -0700 | [diff] [blame] | 8584 | struct wma_target_req *timeout_msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8585 | |
| 8586 | if (!wma_handle) { |
| 8587 | WMA_LOGE("%s: WMA handle is NULL. Cannot issue command", |
| 8588 | __func__); |
| 8589 | /* Handle is NULL. Will not be able to send failure |
| 8590 | * response as well |
| 8591 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8592 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8593 | } |
| 8594 | |
| 8595 | if (!msg) { |
| 8596 | WMA_LOGE("%s: Set HW mode param is NULL", __func__); |
| 8597 | /* Lets try to free the active command list */ |
| 8598 | goto fail; |
| 8599 | } |
| 8600 | |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 8601 | wma_acquire_wakelock(&wma_handle->wmi_cmd_rsp_wake_lock, |
| 8602 | WMA_VDEV_HW_MODE_REQUEST_TIMEOUT); |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 8603 | if (wmi_unified_soc_set_hw_mode_cmd(wma_handle->wmi_handle, |
Dustin Brown | ec2c92e | 2017-07-26 11:13:49 -0700 | [diff] [blame] | 8604 | msg->hw_mode_index)) { |
| 8605 | wma_release_wakelock(&wma_handle->wmi_cmd_rsp_wake_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8606 | goto fail; |
Krunal Soni | cebcc29 | 2017-06-14 19:59:20 -0700 | [diff] [blame] | 8607 | } |
Tushnim Bhattacharyya | 8629489 | 2017-10-25 16:29:11 -0700 | [diff] [blame] | 8608 | timeout_msg = wma_fill_hold_req(wma_handle, 0, |
| 8609 | SIR_HAL_PDEV_SET_HW_MODE, |
| 8610 | WMA_PDEV_SET_HW_MODE_RESP, NULL, |
| 8611 | WMA_VDEV_HW_MODE_REQUEST_TIMEOUT - 1); |
| 8612 | if (!timeout_msg) { |
| 8613 | WMA_LOGE("Failed to allocate request for SIR_HAL_PDEV_SET_HW_MODE"); |
| 8614 | wma_remove_req(wma_handle, 0, WMA_PDEV_SET_HW_MODE_RESP); |
| 8615 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8616 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8617 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8618 | fail: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8619 | param = qdf_mem_malloc(sizeof(*param)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8620 | if (!param) { |
| 8621 | WMA_LOGE("%s: Memory allocation failed", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8622 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8623 | } |
| 8624 | param->status = SET_HW_MODE_STATUS_ECANCELED; |
| 8625 | param->cfgd_hw_mode_index = 0; |
| 8626 | param->num_vdev_mac_entries = 0; |
| 8627 | WMA_LOGE("%s: Sending HW mode fail response to LIM", __func__); |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 8628 | wma_send_msg(wma_handle, SIR_HAL_PDEV_SET_HW_MODE_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8629 | (void *) param, 0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8630 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8631 | } |
| 8632 | |
| 8633 | /** |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 8634 | * 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] | 8635 | * @wma_handle: WMA handle |
| 8636 | * @msg: Dual MAC config parameters |
| 8637 | * |
| 8638 | * Configures WLAN firmware with the dual MAC features |
| 8639 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8640 | * Return: QDF_STATUS. 0 on success. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8641 | */ |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 8642 | QDF_STATUS wma_send_pdev_set_dual_mac_config(tp_wma_handle wma_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8643 | struct sir_dual_mac_config *msg) |
| 8644 | { |
Manishekar Chandrasekaran | 91152df | 2016-04-25 14:29:27 +0530 | [diff] [blame] | 8645 | QDF_STATUS status; |
| 8646 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8647 | if (!wma_handle) { |
| 8648 | WMA_LOGE("%s: WMA handle is NULL. Cannot issue command", |
| 8649 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8650 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8651 | } |
| 8652 | |
| 8653 | if (!msg) { |
| 8654 | WMA_LOGE("%s: Set dual mode config is NULL", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8655 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8656 | } |
| 8657 | |
Krunal Soni | a5ccb80 | 2017-07-03 12:59:40 -0700 | [diff] [blame] | 8658 | /* |
| 8659 | * aquire the wake lock here and release it in response handler function |
| 8660 | * In error condition, release the wake lock right away |
| 8661 | */ |
| 8662 | wma_acquire_wakelock(&wma_handle->wmi_cmd_rsp_wake_lock, |
| 8663 | WMA_VDEV_PLCY_MGR_CMD_TIMEOUT); |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 8664 | status = wmi_unified_pdev_set_dual_mac_config_cmd( |
| 8665 | wma_handle->wmi_handle, |
Manishekar Chandrasekaran | 91152df | 2016-04-25 14:29:27 +0530 | [diff] [blame] | 8666 | (struct wmi_dual_mac_config *)msg); |
| 8667 | if (QDF_IS_STATUS_ERROR(status)) { |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 8668 | 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] | 8669 | __func__, status); |
Krunal Soni | a5ccb80 | 2017-07-03 12:59:40 -0700 | [diff] [blame] | 8670 | wma_release_wakelock(&wma_handle->wmi_cmd_rsp_wake_lock); |
Manishekar Chandrasekaran | 91152df | 2016-04-25 14:29:27 +0530 | [diff] [blame] | 8671 | return status; |
| 8672 | } |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 8673 | policy_mgr_update_dbs_req_config(wma_handle->psoc, |
| 8674 | msg->scan_config, msg->fw_mode_config); |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 8675 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8676 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8677 | } |
| 8678 | |
| 8679 | /** |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 8680 | * wma_send_pdev_set_antenna_mode() - Set antenna mode to FW |
| 8681 | * @wma_handle: WMA handle |
| 8682 | * @msg: Antenna mode parameters |
| 8683 | * |
| 8684 | * Send WMI_PDEV_SET_ANTENNA_MODE_CMDID to FW requesting to |
| 8685 | * modify the number of TX/RX chains from host |
| 8686 | * |
| 8687 | * Return: QDF_STATUS. 0 on success. |
| 8688 | */ |
| 8689 | QDF_STATUS wma_send_pdev_set_antenna_mode(tp_wma_handle wma_handle, |
| 8690 | struct sir_antenna_mode_param *msg) |
| 8691 | { |
| 8692 | wmi_pdev_set_antenna_mode_cmd_fixed_param *cmd; |
| 8693 | wmi_buf_t buf; |
| 8694 | uint32_t len; |
| 8695 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 8696 | struct sir_antenna_mode_resp *param; |
| 8697 | |
| 8698 | if (!wma_handle) { |
| 8699 | WMA_LOGE("%s: WMA handle is NULL. Cannot issue command", |
| 8700 | __func__); |
| 8701 | return QDF_STATUS_E_NULL_VALUE; |
| 8702 | } |
| 8703 | |
| 8704 | if (!msg) { |
| 8705 | WMA_LOGE("%s: Set antenna mode param is NULL", __func__); |
| 8706 | return QDF_STATUS_E_NULL_VALUE; |
| 8707 | } |
| 8708 | |
| 8709 | len = sizeof(*cmd); |
| 8710 | |
| 8711 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 8712 | if (!buf) { |
| 8713 | WMA_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8714 | status = QDF_STATUS_E_NOMEM; |
| 8715 | goto resp; |
| 8716 | } |
| 8717 | |
| 8718 | cmd = (wmi_pdev_set_antenna_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 8719 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8720 | WMITLV_TAG_STRUC_wmi_pdev_set_antenna_mode_cmd_fixed_param, |
| 8721 | WMITLV_GET_STRUCT_TLVLEN( |
| 8722 | wmi_pdev_set_antenna_mode_cmd_fixed_param)); |
| 8723 | |
| 8724 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 8725 | /* Bits 0-15 is num of RX chains 16-31 is num of TX chains */ |
| 8726 | cmd->num_txrx_chains = msg->num_rx_chains; |
| 8727 | cmd->num_txrx_chains |= (msg->num_tx_chains << 16); |
| 8728 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 8729 | 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] | 8730 | __func__, msg->num_tx_chains, |
| 8731 | msg->num_rx_chains, cmd->num_txrx_chains); |
| 8732 | |
| 8733 | if (wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 8734 | WMI_PDEV_SET_ANTENNA_MODE_CMDID)) { |
| 8735 | WMA_LOGE("%s: Failed to send WMI_PDEV_SET_ANTENNA_MODE_CMDID", |
| 8736 | __func__); |
| 8737 | wmi_buf_free(buf); |
| 8738 | status = QDF_STATUS_E_FAILURE; |
| 8739 | goto resp; |
| 8740 | } |
| 8741 | status = QDF_STATUS_SUCCESS; |
| 8742 | |
| 8743 | resp: |
| 8744 | param = qdf_mem_malloc(sizeof(*param)); |
| 8745 | if (!param) { |
| 8746 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 8747 | return QDF_STATUS_E_NOMEM; |
| 8748 | } |
| 8749 | param->status = (status) ? |
| 8750 | SET_ANTENNA_MODE_STATUS_ECANCELED : |
| 8751 | SET_ANTENNA_MODE_STATUS_OK; |
| 8752 | WMA_LOGE("%s: Send antenna mode resp to LIM status: %d", |
| 8753 | __func__, param->status); |
| 8754 | wma_send_msg(wma_handle, SIR_HAL_SOC_ANTENNA_MODE_RESP, |
| 8755 | (void *) param, 0); |
| 8756 | return status; |
| 8757 | } |
| 8758 | |
| 8759 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8760 | * wma_crash_inject() - sends command to FW to simulate crash |
| 8761 | * @wma_handle: pointer of WMA context |
| 8762 | * @type: subtype of the command |
| 8763 | * @delay_time_ms: time in milliseconds for FW to delay the crash |
| 8764 | * |
| 8765 | * This function will send a command to FW in order to simulate different |
| 8766 | * kinds of FW crashes. |
| 8767 | * |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 8768 | * Return: QDF_STATUS_SUCCESS for success or error code |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8769 | */ |
Yu Wang | 46082dc | 2017-09-19 12:25:38 +0800 | [diff] [blame] | 8770 | QDF_STATUS wma_crash_inject(WMA_HANDLE wma_handle, uint32_t type, |
| 8771 | uint32_t delay_time_ms) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8772 | { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 8773 | struct crash_inject param; |
Yu Wang | 46082dc | 2017-09-19 12:25:38 +0800 | [diff] [blame] | 8774 | tp_wma_handle wma = (tp_wma_handle)wma_handle; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 8775 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 8776 | param.type = type; |
| 8777 | param.delay_time_ms = delay_time_ms; |
Yu Wang | 46082dc | 2017-09-19 12:25:38 +0800 | [diff] [blame] | 8778 | return wmi_crash_inject(wma->wmi_handle, ¶m); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8779 | } |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 8780 | |
Manjunathappa Prakash | 7b0ad46 | 2018-04-15 00:37:16 -0700 | [diff] [blame] | 8781 | #ifdef RECEIVE_OFFLOAD |
Dhanashri Atre | 09828f1 | 2016-11-13 10:36:58 -0800 | [diff] [blame] | 8782 | int wma_lro_init(struct cdp_lro_hash_config *lro_config) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8783 | { |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 8784 | struct scheduler_msg msg = {0}; |
Dhanashri Atre | 09828f1 | 2016-11-13 10:36:58 -0800 | [diff] [blame] | 8785 | struct cdp_lro_hash_config *iwcmd; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8786 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8787 | iwcmd = qdf_mem_malloc(sizeof(*iwcmd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8788 | if (!iwcmd) { |
| 8789 | WMA_LOGE("memory allocation for WMA_LRO_CONFIG_CMD failed!"); |
| 8790 | return -ENOMEM; |
| 8791 | } |
| 8792 | |
| 8793 | *iwcmd = *lro_config; |
| 8794 | |
| 8795 | msg.type = WMA_LRO_CONFIG_CMD; |
| 8796 | msg.reserved = 0; |
| 8797 | msg.bodyptr = iwcmd; |
| 8798 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8799 | if (QDF_STATUS_SUCCESS != |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 8800 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8801 | WMA_LOGE("Failed to post WMA_LRO_CONFIG_CMD msg!"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8802 | qdf_mem_free(iwcmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8803 | return -EAGAIN; |
| 8804 | } |
| 8805 | |
| 8806 | WMA_LOGD("sending the LRO configuration to the fw"); |
| 8807 | return 0; |
| 8808 | } |
| 8809 | #endif |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8810 | |
| 8811 | void wma_peer_set_default_routing(void *scn_handle, uint8_t *peer_macaddr, |
| 8812 | uint8_t vdev_id, bool hash_based, uint8_t ring_num) |
| 8813 | { |
| 8814 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 8815 | struct peer_set_params param; |
| 8816 | |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 8817 | if (!wma) { |
| 8818 | WMA_LOGE("%s:wma_handle is NULL", __func__); |
| 8819 | return; |
| 8820 | } |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8821 | |
| 8822 | /* TODO: Need bit definitions for ring number and hash based routing |
| 8823 | * fields in common wmi header file |
| 8824 | */ |
| 8825 | param.param_id = WMI_HOST_PEER_SET_DEFAULT_ROUTING; |
| 8826 | param.vdev_id = vdev_id; |
| 8827 | param.param_value = ((hash_based) ? 1 : 0) | (ring_num << 1); |
Jeff Johnson | f7ca964 | 2017-10-10 16:11:49 -0700 | [diff] [blame] | 8828 | WMA_LOGD("%s: param_value 0x%x", __func__, param.param_value); |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8829 | wmi_set_peer_param_send(wma->wmi_handle, peer_macaddr, ¶m); |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8830 | } |
| 8831 | |
| 8832 | int wma_peer_rx_reorder_queue_setup(void *scn_handle, |
| 8833 | uint8_t vdev_id, uint8_t *peer_macaddr, qdf_dma_addr_t hw_qdesc, |
| 8834 | int tid, uint16_t queue_no) |
| 8835 | { |
| 8836 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 8837 | struct rx_reorder_queue_setup_params param; |
| 8838 | |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 8839 | if (!wma) { |
| 8840 | WMA_LOGE("%s:wma_handle is NULL", __func__); |
| 8841 | return QDF_STATUS_E_FAILURE; |
| 8842 | } |
| 8843 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8844 | param.tid = tid; |
| 8845 | param.vdev_id = vdev_id; |
| 8846 | param.peer_macaddr = peer_macaddr; |
| 8847 | param.hw_qdesc_paddr_lo = hw_qdesc & 0xffffffff; |
| 8848 | param.hw_qdesc_paddr_hi = (uint64_t)hw_qdesc >> 32; |
| 8849 | param.queue_no = queue_no; |
| 8850 | |
| 8851 | return wmi_unified_peer_rx_reorder_queue_setup_send(wma->wmi_handle, |
| 8852 | ¶m); |
| 8853 | } |
| 8854 | |
| 8855 | int wma_peer_rx_reorder_queue_remove(void *scn_handle, |
| 8856 | uint8_t vdev_id, uint8_t *peer_macaddr, uint32_t peer_tid_bitmap) |
| 8857 | { |
| 8858 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 8859 | struct rx_reorder_queue_remove_params param; |
| 8860 | |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 8861 | if (!wma) { |
| 8862 | WMA_LOGE("%s:wma_handle is NULL", __func__); |
| 8863 | return QDF_STATUS_E_FAILURE; |
| 8864 | } |
| 8865 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8866 | param.vdev_id = vdev_id; |
| 8867 | param.peer_macaddr = peer_macaddr; |
| 8868 | param.peer_tid_bitmap = peer_tid_bitmap; |
| 8869 | |
| 8870 | return wmi_unified_peer_rx_reorder_queue_remove_send(wma->wmi_handle, |
| 8871 | ¶m); |
| 8872 | } |
| 8873 | |
Ashish Kumar Dhanotiya | b28338c | 2017-07-21 20:12:34 +0530 | [diff] [blame] | 8874 | QDF_STATUS wma_configure_smps_params(uint32_t vdev_id, uint32_t param_id, |
| 8875 | uint32_t param_val) |
| 8876 | { |
| 8877 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 8878 | int smps_cmd_value; |
| 8879 | int status = QDF_STATUS_E_INVAL; |
| 8880 | |
| 8881 | if (!wma) { |
| 8882 | WMA_LOGE("%s: Failed to get wma", __func__); |
| 8883 | return status; |
| 8884 | } |
| 8885 | |
| 8886 | smps_cmd_value = param_id << WMI_SMPS_PARAM_VALUE_S; |
| 8887 | smps_cmd_value = smps_cmd_value | param_val; |
| 8888 | |
| 8889 | status = wma_set_smps_params(wma, vdev_id, smps_cmd_value); |
| 8890 | if (status) |
| 8891 | WMA_LOGE("Failed to set SMPS Param"); |
| 8892 | |
| 8893 | return status; |
| 8894 | } |
| 8895 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 8896 | |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 8897 | void wma_ipa_uc_stat_request(wma_cli_set_cmd_t *privcmd) |
| 8898 | { |
| 8899 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 8900 | |
Sreelakshmi Konamki | 7a57408 | 2017-05-15 16:53:45 +0530 | [diff] [blame] | 8901 | if (!wma) { |
| 8902 | WMA_LOGE("%s: Failed to get wma", __func__); |
| 8903 | return; |
| 8904 | } |
| 8905 | |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 8906 | if (wma_set_priv_cfg(wma, privcmd)) |
| 8907 | WMA_LOGE("Failed to set wma priv congiuration"); |
| 8908 | } |
Nachiket Kukade | aaf8a71 | 2017-07-27 19:15:36 +0530 | [diff] [blame] | 8909 | |
| 8910 | /** |
| 8911 | * wma_config_bmiss_bcnt_params() - set bmiss config parameters |
| 8912 | * @vdev_id: virtual device for the command |
| 8913 | * @first_cnt: bmiss first value |
| 8914 | * @final_cnt: bmiss final value |
| 8915 | * |
| 8916 | * Return: QDF_STATUS_SUCCESS or non-zero on failure |
| 8917 | */ |
| 8918 | QDF_STATUS wma_config_bmiss_bcnt_params(uint32_t vdev_id, uint32_t first_cnt, |
| 8919 | uint32_t final_cnt) |
| 8920 | { |
| 8921 | tp_wma_handle wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 8922 | int status = QDF_STATUS_E_INVAL; |
| 8923 | |
| 8924 | if (!wma_handle) { |
| 8925 | WMA_LOGE("%s: Failed to get wma", __func__); |
| 8926 | return status; |
| 8927 | } |
| 8928 | |
| 8929 | status = wma_roam_scan_bmiss_cnt(wma_handle, first_cnt, final_cnt, |
| 8930 | vdev_id); |
| 8931 | |
| 8932 | if (status) |
| 8933 | WMA_LOGE("Failed to set Bmiss Param"); |
| 8934 | |
| 8935 | return status; |
| 8936 | } |
| 8937 | |