Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Jeff Johnson | 199e701 | 2016-12-16 14:55:42 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * DOC: wma_main.c |
| 30 | * |
| 31 | * This file contains wma initialization and FW exchange |
| 32 | * related functions. |
| 33 | */ |
| 34 | |
| 35 | /* Header files */ |
| 36 | |
| 37 | #include "wma.h" |
| 38 | #include "wma_api.h" |
| 39 | #include "cds_api.h" |
| 40 | #include "wmi_unified_api.h" |
| 41 | #include "wlan_qct_sys.h" |
| 42 | #include "wni_api.h" |
| 43 | #include "ani_global.h" |
| 44 | #include "wmi_unified.h" |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 45 | #include "service_ready_event_handler.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | #include "wni_cfg.h" |
| 47 | #include "cfg_api.h" |
Poddar, Siddarth | 5a91f5b | 2016-04-28 12:24:10 +0530 | [diff] [blame] | 48 | #if defined(CONFIG_HL_SUPPORT) |
| 49 | #include "wlan_tgt_def_config_hl.h" |
| 50 | #else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 51 | #include "wlan_tgt_def_config.h" |
Poddar, Siddarth | 5a91f5b | 2016-04-28 12:24:10 +0530 | [diff] [blame] | 52 | #endif |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 53 | #include "qdf_nbuf.h" |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 54 | #include "qdf_types.h" |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 55 | #include "qdf_mem.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 56 | |
| 57 | #include "wma_types.h" |
| 58 | #include "lim_api.h" |
| 59 | #include "lim_session_utils.h" |
| 60 | |
| 61 | #include "cds_utils.h" |
| 62 | |
| 63 | #if !defined(REMOVE_PKT_LOG) |
| 64 | #include "pktlog_ac.h" |
| 65 | #endif /* REMOVE_PKT_LOG */ |
| 66 | |
| 67 | #include "dbglog_host.h" |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 68 | #include "wmi_version_whitelist.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 69 | #include "csr_api.h" |
| 70 | #include "ol_fw.h" |
| 71 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 72 | #include "wma_internal.h" |
| 73 | |
| 74 | #include "wma_ocb.h" |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 75 | #include "wlan_policy_mgr_api.h" |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 76 | #include "cdp_txrx_cfg.h" |
| 77 | #include "cdp_txrx_flow_ctrl_legacy.h" |
| 78 | #include "cdp_txrx_flow_ctrl_v2.h" |
| 79 | #include "cdp_txrx_ipa.h" |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 80 | #include "cdp_txrx_misc.h" |
Jeff Johnson | 6136fb9 | 2017-03-30 15:21:49 -0700 | [diff] [blame] | 81 | #include "wma_fips_api.h" |
Deepak Dhamdhere | 13230d3 | 2016-05-26 00:46:53 -0700 | [diff] [blame] | 82 | #include "wma_nan_datapath.h" |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 83 | #include "wlan_lmac_if_def.h" |
| 84 | #include "wlan_lmac_if_api.h" |
Mukul Sharma | c3e7a78 | 2017-02-03 12:16:11 +0530 | [diff] [blame] | 85 | #include "target_if.h" |
Mukul Sharma | dad267e | 2017-02-04 13:25:34 +0530 | [diff] [blame] | 86 | #include "wlan_global_lmac_if_api.h" |
Mukul Sharma | 3d36c39 | 2017-01-18 18:39:12 +0530 | [diff] [blame] | 87 | #include "target_if_pmo.h" |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 88 | #include "wma_he.h" |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 89 | #include "wlan_pmo_obj_mgmt_api.h" |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 90 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 91 | #include "wlan_reg_tgt_api.h" |
| 92 | #include "wlan_reg_services_api.h" |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 93 | #include <cdp_txrx_handle.h> |
Tushnim Bhattacharyya | 45ed04f | 2017-03-15 10:15:05 -0700 | [diff] [blame] | 94 | #include <wlan_pmo_ucfg_api.h> |
Naveen Rawat | 4efe41b | 2017-04-29 16:23:14 -0700 | [diff] [blame] | 95 | #include "wifi_pos_api.h" |
| 96 | #include "hif_main.h" |
Tushnim Bhattacharyya | 45ed04f | 2017-03-15 10:15:05 -0700 | [diff] [blame] | 97 | |
Agrawal Ashish | b0aa075 | 2017-04-21 19:31:10 +0530 | [diff] [blame] | 98 | #define WMA_LOG_COMPLETION_TIMER 3000 /* 3 seconds */ |
Rajeev Kumar Sirasanagandla | 4787300 | 2016-09-09 13:46:09 +0530 | [diff] [blame] | 99 | #define WMI_TLV_HEADROOM 128 |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 100 | uint8_t *mac_trace_get_wma_msg_string(uint16_t wmaMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 101 | static uint32_t g_fw_wlan_feat_caps; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 102 | /** |
| 103 | * wma_get_fw_wlan_feat_caps() - get fw feature capablity |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 104 | * @feature: feature enum value |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 105 | * |
| 106 | * Return: true/false |
| 107 | */ |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 108 | bool wma_get_fw_wlan_feat_caps(enum cap_bitmap feature) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 109 | { |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 110 | return (g_fw_wlan_feat_caps & (1 << feature)) ? true : false; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * wma_set_fw_wlan_feat_caps() - set fw feature capablity |
| 115 | * @feature: feature enum value |
| 116 | * |
| 117 | * Return: None |
| 118 | */ |
| 119 | void wma_set_fw_wlan_feat_caps(enum cap_bitmap feature) |
| 120 | { |
| 121 | g_fw_wlan_feat_caps |= (1 << feature); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | /** |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 125 | * wma_service_ready_ext_evt_timeout() - Service ready extended event timeout |
| 126 | * @data: Timeout handler data |
| 127 | * |
| 128 | * This function is called when the FW fails to send WMI_SERVICE_READY_EXT_EVENT |
| 129 | * message |
| 130 | * |
| 131 | * Return: None |
| 132 | */ |
| 133 | static void wma_service_ready_ext_evt_timeout(void *data) |
| 134 | { |
| 135 | tp_wma_handle wma_handle; |
| 136 | |
| 137 | WMA_LOGA("%s: Timeout waiting for WMI_SERVICE_READY_EXT_EVENT", |
| 138 | __func__); |
| 139 | |
| 140 | wma_handle = (tp_wma_handle) data; |
| 141 | |
| 142 | if (!wma_handle) { |
| 143 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 144 | goto end; |
| 145 | } |
| 146 | |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 147 | end: |
Naveen Rawat | ac39a10 | 2016-10-07 10:58:29 -0700 | [diff] [blame] | 148 | /* Assert here. Panic is being called in insmod thread */ |
| 149 | QDF_ASSERT(0); |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | /** |
Komal Seelam | 02d0934 | 2016-02-23 18:03:19 +0530 | [diff] [blame] | 153 | * wma_get_ini_handle() - API to get WMA ini info handle |
| 154 | * @wma: WMA Handle |
| 155 | * |
| 156 | * Returns the pointer to WMA ini structure. |
| 157 | * Return: struct wma_ini_config |
| 158 | */ |
| 159 | struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma) |
| 160 | { |
| 161 | if (!wma) { |
| 162 | WMA_LOGE("%s: Invalid WMA context\n", __func__); |
| 163 | return NULL; |
| 164 | } |
| 165 | |
| 166 | return &wma->ini_config; |
| 167 | } |
| 168 | |
| 169 | #define MAX_SUPPORTED_PEERS_REV1_1 14 |
| 170 | #define MAX_SUPPORTED_PEERS_REV1_3 32 |
| 171 | #define MIN_NO_OF_PEERS 1 |
| 172 | |
| 173 | /** |
| 174 | * wma_get_number_of_peers_supported - API to query for number of peers |
| 175 | * supported |
| 176 | * @wma: WMA Handle |
| 177 | * |
| 178 | * Return: Max Number of Peers Supported |
| 179 | */ |
| 180 | static uint8_t wma_get_number_of_peers_supported(tp_wma_handle wma) |
| 181 | { |
| 182 | struct hif_target_info *tgt_info; |
| 183 | struct wma_ini_config *cfg = wma_get_ini_handle(wma); |
| 184 | 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] | 185 | struct hif_opaque_softc *scn = cds_get_context(QDF_MODULE_ID_HIF); |
Komal Seelam | 02d0934 | 2016-02-23 18:03:19 +0530 | [diff] [blame] | 186 | |
| 187 | if (!scn) { |
| 188 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 189 | return 0; |
| 190 | } |
| 191 | |
| 192 | tgt_info = hif_get_target_info_handle(scn); |
| 193 | |
| 194 | switch (tgt_info->target_version) { |
| 195 | case AR6320_REV1_1_VERSION: |
| 196 | if (max_no_of_peers > MAX_SUPPORTED_PEERS_REV1_1) |
| 197 | max_no_of_peers = MAX_SUPPORTED_PEERS_REV1_1; |
| 198 | break; |
| 199 | default: |
| 200 | if (max_no_of_peers > MAX_SUPPORTED_PEERS_REV1_3) |
| 201 | max_no_of_peers = MAX_SUPPORTED_PEERS_REV1_3; |
| 202 | break; |
| 203 | } |
| 204 | |
| 205 | return max_no_of_peers; |
| 206 | } |
| 207 | |
| 208 | /** |
bings | 6b3614e | 2017-02-21 10:18:36 +0800 | [diff] [blame] | 209 | * wma_get_number_of_tids_supported - API to query for number of tids supported |
| 210 | * @no_of_peers_supported: Number of peer supported |
| 211 | * |
| 212 | * Return: Max number of tids supported |
| 213 | */ |
| 214 | #if defined(CONFIG_HL_SUPPORT) |
| 215 | static uint32_t wma_get_number_of_tids_supported(uint8_t no_of_peers_supported) |
| 216 | { |
| 217 | return 4 * no_of_peers_supported; |
| 218 | } |
| 219 | #else |
| 220 | static uint32_t wma_get_number_of_tids_supported(uint8_t no_of_peers_supported) |
| 221 | { |
| 222 | return 2 * (no_of_peers_supported + CFG_TGT_NUM_VDEV + 2); |
| 223 | } |
| 224 | #endif |
| 225 | |
| 226 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 227 | * wma_set_default_tgt_config() - set default tgt config |
| 228 | * @wma_handle: wma handle |
| 229 | * |
| 230 | * Return: none |
| 231 | */ |
| 232 | static void wma_set_default_tgt_config(tp_wma_handle wma_handle) |
| 233 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 234 | uint8_t no_of_peers_supported; |
| 235 | wmi_resource_config tgt_cfg = { |
| 236 | 0, /* Filling zero for TLV Tag and Length fields */ |
| 237 | CFG_TGT_NUM_VDEV, |
| 238 | CFG_TGT_NUM_PEERS + CFG_TGT_NUM_VDEV + 2, |
| 239 | CFG_TGT_NUM_OFFLOAD_PEERS, |
| 240 | CFG_TGT_NUM_OFFLOAD_REORDER_BUFFS, |
| 241 | CFG_TGT_NUM_PEER_KEYS, |
| 242 | CFG_TGT_NUM_TIDS, |
| 243 | CFG_TGT_AST_SKID_LIMIT, |
| 244 | CFG_TGT_DEFAULT_TX_CHAIN_MASK, |
| 245 | CFG_TGT_DEFAULT_RX_CHAIN_MASK, |
| 246 | {CFG_TGT_RX_TIMEOUT_LO_PRI, CFG_TGT_RX_TIMEOUT_LO_PRI, |
| 247 | CFG_TGT_RX_TIMEOUT_LO_PRI, CFG_TGT_RX_TIMEOUT_HI_PRI}, |
| 248 | CFG_TGT_RX_DECAP_MODE, |
| 249 | CFG_TGT_DEFAULT_SCAN_MAX_REQS, |
| 250 | CFG_TGT_DEFAULT_BMISS_OFFLOAD_MAX_VDEV, |
| 251 | CFG_TGT_DEFAULT_ROAM_OFFLOAD_MAX_VDEV, |
| 252 | CFG_TGT_DEFAULT_ROAM_OFFLOAD_MAX_PROFILES, |
| 253 | CFG_TGT_DEFAULT_NUM_MCAST_GROUPS, |
| 254 | CFG_TGT_DEFAULT_NUM_MCAST_TABLE_ELEMS, |
| 255 | CFG_TGT_DEFAULT_MCAST2UCAST_MODE, |
| 256 | CFG_TGT_DEFAULT_TX_DBG_LOG_SIZE, |
| 257 | CFG_TGT_WDS_ENTRIES, |
| 258 | CFG_TGT_DEFAULT_DMA_BURST_SIZE, |
| 259 | CFG_TGT_DEFAULT_MAC_AGGR_DELIM, |
| 260 | CFG_TGT_DEFAULT_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK, |
| 261 | CFG_TGT_DEFAULT_VOW_CONFIG, |
| 262 | CFG_TGT_DEFAULT_GTK_OFFLOAD_MAX_VDEV, |
| 263 | CFG_TGT_NUM_MSDU_DESC, |
| 264 | CFG_TGT_MAX_FRAG_TABLE_ENTRIES, |
| 265 | CFG_TGT_NUM_TDLS_VDEVS, |
| 266 | CFG_TGT_NUM_TDLS_CONN_TABLE_ENTRIES, |
| 267 | CFG_TGT_DEFAULT_BEACON_TX_OFFLOAD_MAX_VDEV, |
| 268 | CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES, |
| 269 | 0, |
| 270 | 0, |
| 271 | 0, |
| 272 | CFG_TGT_NUM_TDLS_CONC_SLEEP_STAS, |
| 273 | CFG_TGT_NUM_TDLS_CONC_BUFFER_STAS, |
| 274 | 0, |
| 275 | CFG_TGT_NUM_OCB_VDEVS, |
| 276 | CFG_TGT_NUM_OCB_CHANNELS, |
| 277 | CFG_TGT_NUM_OCB_SCHEDULES, |
| 278 | }; |
| 279 | |
Komal Seelam | 02d0934 | 2016-02-23 18:03:19 +0530 | [diff] [blame] | 280 | no_of_peers_supported = wma_get_number_of_peers_supported(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 281 | tgt_cfg.num_peers = no_of_peers_supported + CFG_TGT_NUM_VDEV + 2; |
bings | 6b3614e | 2017-02-21 10:18:36 +0800 | [diff] [blame] | 282 | tgt_cfg.num_tids = wma_get_number_of_tids_supported( |
| 283 | no_of_peers_supported); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 284 | tgt_cfg.scan_max_pending_req = wma_handle->max_scan; |
| 285 | |
Nirav Shah | 2048997 | 2016-06-16 19:20:28 +0530 | [diff] [blame] | 286 | WMI_RSRC_CFG_FLAG_MGMT_COMP_EVT_BUNDLE_SUPPORT_SET(tgt_cfg.flag1, 1); |
Yun Park | 4d968df | 2016-10-11 11:44:15 -0700 | [diff] [blame] | 287 | WMI_RSRC_CFG_FLAG_TX_MSDU_ID_NEW_PARTITION_SUPPORT_SET(tgt_cfg.flag1, |
| 288 | 1); |
Nirav Shah | 2048997 | 2016-06-16 19:20:28 +0530 | [diff] [blame] | 289 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 290 | WMITLV_SET_HDR(&tgt_cfg.tlv_header, |
| 291 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 292 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 293 | /* reduce the peer/vdev if CFG_TGT_NUM_MSDU_DESC exceeds 1000 */ |
| 294 | #ifdef PERE_IP_HDR_ALIGNMENT_WAR |
| 295 | if (scn->host_80211_enable) { |
| 296 | /* |
| 297 | * To make the IP header begins at dword aligned address, |
| 298 | * we make the decapsulation mode as Native Wifi. |
| 299 | */ |
| 300 | tgt_cfg.rx_decap_mode = CFG_TGT_RX_DECAP_MODE_NWIFI; |
| 301 | } |
| 302 | #endif /* PERE_IP_HDR_ALIGNMENT_WAR */ |
Manjunathappa Prakash | 0e6e6b5 | 2016-04-21 11:48:48 -0700 | [diff] [blame] | 303 | if (QDF_GLOBAL_MONITOR_MODE == cds_get_conparam()) |
| 304 | tgt_cfg.rx_decap_mode = CFG_TGT_RX_DECAP_MODE_RAW; |
| 305 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 306 | wma_handle->wlan_resource_config = tgt_cfg; |
| 307 | } |
| 308 | |
| 309 | /** |
| 310 | * wma_cli_get_command() - WMA "get" command processor |
| 311 | * @vdev_id: virtual device for the command |
| 312 | * @param_id: parameter id |
| 313 | * @vpdev: parameter category |
| 314 | * |
| 315 | * Return: parameter value on success, -EINVAL on failure |
| 316 | */ |
| 317 | int wma_cli_get_command(int vdev_id, int param_id, int vpdev) |
| 318 | { |
| 319 | int ret = 0; |
| 320 | tp_wma_handle wma; |
| 321 | struct wma_txrx_node *intr = NULL; |
| 322 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 323 | wma = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 324 | |
| 325 | if (NULL == wma) { |
| 326 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 327 | return -EINVAL; |
| 328 | } |
| 329 | |
| 330 | intr = wma->interfaces; |
| 331 | |
| 332 | if (VDEV_CMD == vpdev) { |
| 333 | switch (param_id) { |
| 334 | case WMI_VDEV_PARAM_NSS: |
| 335 | ret = intr[vdev_id].config.nss; |
| 336 | break; |
| 337 | #ifdef QCA_SUPPORT_GTX |
| 338 | case WMI_VDEV_PARAM_GTX_HT_MCS: |
| 339 | ret = intr[vdev_id].config.gtx_info.gtxRTMask[0]; |
| 340 | break; |
| 341 | case WMI_VDEV_PARAM_GTX_VHT_MCS: |
| 342 | ret = intr[vdev_id].config.gtx_info.gtxRTMask[1]; |
| 343 | break; |
| 344 | case WMI_VDEV_PARAM_GTX_USR_CFG: |
| 345 | ret = intr[vdev_id].config.gtx_info.gtxUsrcfg; |
| 346 | break; |
| 347 | case WMI_VDEV_PARAM_GTX_THRE: |
| 348 | ret = intr[vdev_id].config.gtx_info.gtxPERThreshold; |
| 349 | break; |
| 350 | case WMI_VDEV_PARAM_GTX_MARGIN: |
| 351 | ret = intr[vdev_id].config.gtx_info.gtxPERMargin; |
| 352 | break; |
| 353 | case WMI_VDEV_PARAM_GTX_STEP: |
| 354 | ret = intr[vdev_id].config.gtx_info.gtxTPCstep; |
| 355 | break; |
| 356 | case WMI_VDEV_PARAM_GTX_MINTPC: |
| 357 | ret = intr[vdev_id].config.gtx_info.gtxTPCMin; |
| 358 | break; |
| 359 | case WMI_VDEV_PARAM_GTX_BW_MASK: |
| 360 | ret = intr[vdev_id].config.gtx_info.gtxBWMask; |
| 361 | break; |
| 362 | #endif /* QCA_SUPPORT_GTX */ |
| 363 | case WMI_VDEV_PARAM_LDPC: |
| 364 | ret = intr[vdev_id].config.ldpc; |
| 365 | break; |
| 366 | case WMI_VDEV_PARAM_TX_STBC: |
| 367 | ret = intr[vdev_id].config.tx_stbc; |
| 368 | break; |
| 369 | case WMI_VDEV_PARAM_RX_STBC: |
| 370 | ret = intr[vdev_id].config.rx_stbc; |
| 371 | break; |
| 372 | case WMI_VDEV_PARAM_SGI: |
| 373 | ret = intr[vdev_id].config.shortgi; |
| 374 | break; |
| 375 | case WMI_VDEV_PARAM_ENABLE_RTSCTS: |
| 376 | ret = intr[vdev_id].config.rtscts_en; |
| 377 | break; |
| 378 | case WMI_VDEV_PARAM_CHWIDTH: |
| 379 | ret = intr[vdev_id].config.chwidth; |
| 380 | break; |
| 381 | case WMI_VDEV_PARAM_FIXED_RATE: |
| 382 | ret = intr[vdev_id].config.tx_rate; |
| 383 | break; |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 384 | case WMI_VDEV_PARAM_HE_DCM: |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 385 | case WMI_VDEV_PARAM_HE_RANGE_EXT: |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 386 | ret = wma_get_he_vdev_param(&intr[vdev_id], param_id); |
| 387 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 388 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 389 | WMA_LOGE("Invalid cli_get vdev command/Not yet implemented 0x%x", |
| 390 | param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 391 | return -EINVAL; |
| 392 | } |
| 393 | } else if (PDEV_CMD == vpdev) { |
| 394 | switch (param_id) { |
| 395 | case WMI_PDEV_PARAM_ANI_ENABLE: |
| 396 | ret = wma->pdevconfig.ani_enable; |
| 397 | break; |
| 398 | case WMI_PDEV_PARAM_ANI_POLL_PERIOD: |
| 399 | ret = wma->pdevconfig.ani_poll_len; |
| 400 | break; |
| 401 | case WMI_PDEV_PARAM_ANI_LISTEN_PERIOD: |
| 402 | ret = wma->pdevconfig.ani_listen_len; |
| 403 | break; |
| 404 | case WMI_PDEV_PARAM_ANI_OFDM_LEVEL: |
| 405 | ret = wma->pdevconfig.ani_ofdm_level; |
| 406 | break; |
| 407 | case WMI_PDEV_PARAM_ANI_CCK_LEVEL: |
| 408 | ret = wma->pdevconfig.ani_cck_level; |
| 409 | break; |
| 410 | case WMI_PDEV_PARAM_DYNAMIC_BW: |
| 411 | ret = wma->pdevconfig.cwmenable; |
| 412 | break; |
| 413 | case WMI_PDEV_PARAM_CTS_CBW: |
| 414 | ret = wma->pdevconfig.cts_cbw; |
| 415 | break; |
| 416 | case WMI_PDEV_PARAM_TX_CHAIN_MASK: |
| 417 | ret = wma->pdevconfig.txchainmask; |
| 418 | break; |
| 419 | case WMI_PDEV_PARAM_RX_CHAIN_MASK: |
| 420 | ret = wma->pdevconfig.rxchainmask; |
| 421 | break; |
| 422 | case WMI_PDEV_PARAM_TXPOWER_LIMIT2G: |
| 423 | ret = wma->pdevconfig.txpow2g; |
| 424 | break; |
| 425 | case WMI_PDEV_PARAM_TXPOWER_LIMIT5G: |
| 426 | ret = wma->pdevconfig.txpow5g; |
| 427 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 428 | case WMI_PDEV_PARAM_BURST_ENABLE: |
| 429 | ret = wma->pdevconfig.burst_enable; |
| 430 | break; |
| 431 | case WMI_PDEV_PARAM_BURST_DUR: |
| 432 | ret = wma->pdevconfig.burst_dur; |
| 433 | break; |
| 434 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 435 | WMA_LOGE("Invalid cli_get pdev command/Not yet implemented 0x%x", |
| 436 | param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 437 | return -EINVAL; |
| 438 | } |
| 439 | } else if (GEN_CMD == vpdev) { |
| 440 | switch (param_id) { |
| 441 | case GEN_VDEV_PARAM_AMPDU: |
| 442 | ret = intr[vdev_id].config.ampdu; |
| 443 | break; |
| 444 | case GEN_VDEV_PARAM_AMSDU: |
| 445 | ret = intr[vdev_id].config.amsdu; |
| 446 | break; |
Varun Reddy Yeturu | 5ab4746 | 2016-05-08 18:08:11 -0700 | [diff] [blame] | 447 | case GEN_VDEV_ROAM_SYNCH_DELAY: |
| 448 | ret = intr[vdev_id].roam_synch_delay; |
| 449 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 450 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 451 | WMA_LOGE("Invalid generic vdev command/Not yet implemented 0x%x", |
| 452 | param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 453 | return -EINVAL; |
| 454 | } |
| 455 | } else if (PPS_CMD == vpdev) { |
| 456 | switch (param_id) { |
| 457 | case WMI_VDEV_PPS_PAID_MATCH: |
| 458 | ret = intr[vdev_id].config.pps_params.paid_match_enable; |
| 459 | break; |
| 460 | case WMI_VDEV_PPS_GID_MATCH: |
| 461 | ret = intr[vdev_id].config.pps_params.gid_match_enable; |
| 462 | break; |
| 463 | case WMI_VDEV_PPS_EARLY_TIM_CLEAR: |
| 464 | ret = intr[vdev_id].config.pps_params.tim_clear; |
| 465 | break; |
| 466 | case WMI_VDEV_PPS_EARLY_DTIM_CLEAR: |
| 467 | ret = intr[vdev_id].config.pps_params.dtim_clear; |
| 468 | break; |
| 469 | case WMI_VDEV_PPS_EOF_PAD_DELIM: |
| 470 | ret = intr[vdev_id].config.pps_params.eof_delim; |
| 471 | break; |
| 472 | case WMI_VDEV_PPS_MACADDR_MISMATCH: |
| 473 | ret = intr[vdev_id].config.pps_params.mac_match; |
| 474 | break; |
| 475 | case WMI_VDEV_PPS_DELIM_CRC_FAIL: |
| 476 | ret = intr[vdev_id].config.pps_params.delim_fail; |
| 477 | break; |
| 478 | case WMI_VDEV_PPS_GID_NSTS_ZERO: |
| 479 | ret = intr[vdev_id].config.pps_params.nsts_zero; |
| 480 | break; |
| 481 | case WMI_VDEV_PPS_RSSI_CHECK: |
| 482 | ret = intr[vdev_id].config.pps_params.rssi_chk; |
| 483 | break; |
| 484 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 485 | WMA_LOGE("Invalid pps vdev command/Not yet implemented 0x%x", |
| 486 | param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 487 | return -EINVAL; |
| 488 | } |
| 489 | } else if (QPOWER_CMD == vpdev) { |
| 490 | switch (param_id) { |
| 491 | case WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT: |
| 492 | ret = intr[vdev_id].config.qpower_params. |
| 493 | max_ps_poll_cnt; |
| 494 | break; |
| 495 | case WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE: |
| 496 | ret = intr[vdev_id].config.qpower_params. |
| 497 | max_tx_before_wake; |
| 498 | break; |
| 499 | case WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL: |
| 500 | ret = intr[vdev_id].config.qpower_params. |
| 501 | spec_ps_poll_wake_interval; |
| 502 | break; |
| 503 | case WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL: |
| 504 | ret = intr[vdev_id].config.qpower_params. |
| 505 | max_spec_nodata_ps_poll; |
| 506 | break; |
| 507 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 508 | WMA_LOGE("Invalid generic vdev command/Not yet implemented 0x%x", |
| 509 | param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 510 | return -EINVAL; |
| 511 | } |
| 512 | } else if (GTX_CMD == vpdev) { |
| 513 | switch (param_id) { |
| 514 | case WMI_VDEV_PARAM_GTX_HT_MCS: |
| 515 | ret = intr[vdev_id].config.gtx_info.gtxRTMask[0]; |
| 516 | break; |
| 517 | case WMI_VDEV_PARAM_GTX_VHT_MCS: |
| 518 | ret = intr[vdev_id].config.gtx_info.gtxRTMask[1]; |
| 519 | break; |
| 520 | case WMI_VDEV_PARAM_GTX_USR_CFG: |
| 521 | ret = intr[vdev_id].config.gtx_info.gtxUsrcfg; |
| 522 | break; |
| 523 | case WMI_VDEV_PARAM_GTX_THRE: |
| 524 | ret = intr[vdev_id].config.gtx_info.gtxPERThreshold; |
| 525 | break; |
| 526 | case WMI_VDEV_PARAM_GTX_MARGIN: |
| 527 | ret = intr[vdev_id].config.gtx_info.gtxPERMargin; |
| 528 | break; |
| 529 | case WMI_VDEV_PARAM_GTX_STEP: |
| 530 | ret = intr[vdev_id].config.gtx_info.gtxTPCstep; |
| 531 | break; |
| 532 | case WMI_VDEV_PARAM_GTX_MINTPC: |
| 533 | ret = intr[vdev_id].config.gtx_info.gtxTPCMin; |
| 534 | break; |
| 535 | case WMI_VDEV_PARAM_GTX_BW_MASK: |
| 536 | ret = intr[vdev_id].config.gtx_info.gtxBWMask; |
| 537 | break; |
| 538 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 539 | WMA_LOGE("Invalid generic vdev command/Not yet implemented 0x%x", |
| 540 | param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 541 | return -EINVAL; |
| 542 | } |
| 543 | } |
| 544 | return ret; |
| 545 | } |
| 546 | |
| 547 | /** |
| 548 | * wma_cli_set2_command() - WMA "set 2 params" command processor |
| 549 | * @vdev_id: virtual device for the command |
| 550 | * @param_id: parameter id |
| 551 | * @sval1: first parameter value |
| 552 | * @sval2: second parameter value |
| 553 | * @vpdev: parameter category |
| 554 | * |
| 555 | * Command handler for set operations which require 2 parameters |
| 556 | * |
| 557 | * Return: 0 on success, errno on failure |
| 558 | */ |
| 559 | int wma_cli_set2_command(int vdev_id, int param_id, int sval1, |
| 560 | int sval2, int vpdev) |
| 561 | { |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 562 | struct scheduler_msg msg = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 563 | wma_cli_set_cmd_t *iwcmd; |
| 564 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 565 | iwcmd = qdf_mem_malloc(sizeof(*iwcmd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 566 | if (!iwcmd) { |
| 567 | WMA_LOGE("%s: Failed alloc memory for iwcmd", __func__); |
| 568 | return -ENOMEM; |
| 569 | } |
| 570 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 571 | qdf_mem_zero(iwcmd, sizeof(*iwcmd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 572 | iwcmd->param_value = sval1; |
| 573 | iwcmd->param_sec_value = sval2; |
| 574 | iwcmd->param_vdev_id = vdev_id; |
| 575 | iwcmd->param_id = param_id; |
| 576 | iwcmd->param_vp_dev = vpdev; |
| 577 | msg.type = WMA_CLI_SET_CMD; |
| 578 | msg.reserved = 0; |
| 579 | msg.bodyptr = iwcmd; |
| 580 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 581 | if (QDF_STATUS_SUCCESS != |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 582 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 583 | WMA_LOGE("%s: Failed to post WMA_CLI_SET_CMD msg", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 584 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 585 | qdf_mem_free(iwcmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 586 | return -EIO; |
| 587 | } |
| 588 | return 0; |
| 589 | } |
| 590 | |
| 591 | /** |
| 592 | * wma_cli_set_command() - WMA "set" command processor |
| 593 | * @vdev_id: virtual device for the command |
| 594 | * @param_id: parameter id |
| 595 | * @sval: parameter value |
| 596 | * @vpdev: parameter category |
| 597 | * |
| 598 | * Command handler for set operations |
| 599 | * |
| 600 | * Return: 0 on success, errno on failure |
| 601 | */ |
| 602 | int wma_cli_set_command(int vdev_id, int param_id, int sval, int vpdev) |
| 603 | { |
| 604 | return wma_cli_set2_command(vdev_id, param_id, sval, 0, vpdev); |
| 605 | |
| 606 | } |
| 607 | |
| 608 | /** |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame^] | 609 | * wma_ipa_get_stat() - get IPA data path stats from FW |
| 610 | * |
| 611 | * Return: 0 on success, errno on failure |
| 612 | */ |
| 613 | #ifdef IPA_OFFLOAD |
| 614 | static int wma_ipa_get_stat(void) |
| 615 | { |
| 616 | struct cdp_pdev *pdev; |
| 617 | |
| 618 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 619 | if (!pdev) { |
| 620 | WMA_LOGE("pdev NULL for uc stat"); |
| 621 | return -EINVAL; |
| 622 | } |
| 623 | cdp_ipa_get_stat(cds_get_context(QDF_MODULE_ID_SOC), pdev); |
| 624 | |
| 625 | return 0; |
| 626 | } |
| 627 | #else |
| 628 | static int wma_ipa_get_stat(void) |
| 629 | { |
| 630 | return 0; |
| 631 | } |
| 632 | #endif |
| 633 | |
| 634 | /** |
| 635 | * wma_ipa_uc_get_share_stats() - get Tx/Rx byte stats from FW |
| 636 | * @privcmd: private command |
| 637 | * |
| 638 | * Return: 0 on success, errno on failure |
| 639 | */ |
| 640 | #if defined(IPA_OFFLOAD) && defined(FEATURE_METERING) |
| 641 | static int wma_ipa_uc_get_share_stats(wma_cli_set_cmd_t *privcmd) |
| 642 | { |
| 643 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 644 | struct cdp_pdev *pdev; |
| 645 | uint8_t reset_stats = privcmd->param_value; |
| 646 | |
| 647 | WMA_LOGD("%s: reset_stats=%d", |
| 648 | "WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID", |
| 649 | reset_stats); |
| 650 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 651 | if (!pdev) { |
| 652 | WMA_LOGE("pdev NULL for uc get share stats"); |
| 653 | return -EINVAL; |
| 654 | } |
| 655 | cdp_ipa_uc_get_share_stats(soc, pdev, reset_stats); |
| 656 | |
| 657 | return 0; |
| 658 | } |
| 659 | #else |
| 660 | static int wma_ipa_uc_get_share_stats(wma_cli_set_cmd_t *privcmd) |
| 661 | { |
| 662 | return 0; |
| 663 | } |
| 664 | #endif |
| 665 | |
| 666 | /** |
| 667 | * wma_ipa_uc_set_quota() - set quota limit to FW |
| 668 | * @privcmd: private command |
| 669 | * |
| 670 | * Return: 0 on success, errno on failure |
| 671 | */ |
| 672 | #if defined(IPA_OFFLOAD) && defined(FEATURE_METERING) |
| 673 | static int wma_ipa_uc_set_quota(wma_cli_set_cmd_t *privcmd) |
| 674 | { |
| 675 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 676 | struct cdp_pdev *pdev; |
| 677 | uint64_t quota_bytes = privcmd->param_sec_value; |
| 678 | |
| 679 | quota_bytes <<= 32; |
| 680 | quota_bytes |= privcmd->param_value; |
| 681 | |
| 682 | WMA_LOGD("%s: quota_bytes=%llu", |
| 683 | "WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID", |
| 684 | quota_bytes); |
| 685 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 686 | if (!pdev) { |
| 687 | WMA_LOGE("pdev NULL for uc set quota"); |
| 688 | return -EINVAL; |
| 689 | } |
| 690 | cdp_ipa_uc_set_quota(soc, pdev, quota_bytes); |
| 691 | |
| 692 | return 0; |
| 693 | } |
| 694 | #else |
| 695 | static int wma_ipa_uc_set_quota(wma_cli_set_cmd_t *privcmd) |
| 696 | { |
| 697 | return 0; |
| 698 | } |
| 699 | #endif |
| 700 | |
| 701 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 702 | * wma_set_priv_cfg() - set private config parameters |
| 703 | * @wma_handle: wma handle |
| 704 | * @privcmd: private command |
| 705 | * |
| 706 | * Return: 0 for success or error code |
| 707 | */ |
| 708 | static int32_t wma_set_priv_cfg(tp_wma_handle wma_handle, |
| 709 | wma_cli_set_cmd_t *privcmd) |
| 710 | { |
| 711 | int32_t ret = 0; |
| 712 | |
| 713 | switch (privcmd->param_id) { |
| 714 | case WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID: |
| 715 | ret = wma_set_txrx_fw_stats_level(wma_handle, |
| 716 | privcmd->param_vdev_id, |
| 717 | privcmd->param_value); |
| 718 | break; |
| 719 | case WMA_VDEV_TXRX_FWSTATS_RESET_CMDID: |
| 720 | ret = wma_txrx_fw_stats_reset(wma_handle, |
| 721 | privcmd->param_vdev_id, |
| 722 | privcmd->param_value); |
| 723 | break; |
| 724 | case WMI_STA_SMPS_FORCE_MODE_CMDID: |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 725 | ret = wma_set_mimops(wma_handle, |
| 726 | privcmd->param_vdev_id, |
| 727 | privcmd->param_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 728 | break; |
| 729 | case WMI_STA_SMPS_PARAM_CMDID: |
| 730 | wma_set_smps_params(wma_handle, privcmd->param_vdev_id, |
| 731 | privcmd->param_value); |
| 732 | break; |
| 733 | case WMA_VDEV_MCC_SET_TIME_LATENCY: |
| 734 | { |
| 735 | /* Extract first MCC adapter/vdev channel number and latency */ |
| 736 | uint8_t mcc_channel = privcmd->param_value & 0x000000FF; |
| 737 | uint8_t mcc_channel_latency = |
| 738 | (privcmd->param_value & 0x0000FF00) >> 8; |
| 739 | int ret = -1; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 740 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 741 | WMA_LOGD("%s: Parsed input: Channel #1:%d, latency:%dms", |
| 742 | __func__, mcc_channel, mcc_channel_latency); |
| 743 | ret = wma_set_mcc_channel_time_latency(wma_handle, |
| 744 | mcc_channel, |
| 745 | mcc_channel_latency); |
| 746 | } |
| 747 | break; |
| 748 | case WMA_VDEV_MCC_SET_TIME_QUOTA: |
| 749 | { |
| 750 | /* Extract the MCC 2 adapters/vdevs channel numbers and time |
| 751 | * quota value for the first adapter only (which is specified |
| 752 | * in iwpriv command. |
| 753 | */ |
| 754 | uint8_t adapter_2_chan_number = |
| 755 | privcmd->param_value & 0x000000FF; |
| 756 | uint8_t adapter_1_chan_number = |
| 757 | (privcmd->param_value & 0x0000FF00) >> 8; |
| 758 | uint8_t adapter_1_quota = |
| 759 | (privcmd->param_value & 0x00FF0000) >> 16; |
| 760 | int ret = -1; |
| 761 | |
| 762 | WMA_LOGD("%s: Parsed input: Channel #1:%d, Channel #2:%d, quota 1:%dms", |
| 763 | __func__, adapter_1_chan_number, |
| 764 | adapter_2_chan_number, adapter_1_quota); |
| 765 | |
| 766 | ret = wma_set_mcc_channel_time_quota(wma_handle, |
| 767 | adapter_1_chan_number, |
| 768 | adapter_1_quota, |
| 769 | adapter_2_chan_number); |
| 770 | } |
| 771 | break; |
| 772 | case WMA_VDEV_IBSS_SET_ATIM_WINDOW_SIZE: |
| 773 | { |
| 774 | wma_handle->wma_ibss_power_save_params.atimWindowLength = |
| 775 | privcmd->param_value; |
| 776 | WMA_LOGD("%s: IBSS power save ATIM Window = %d", |
| 777 | __func__, wma_handle->wma_ibss_power_save_params. |
| 778 | atimWindowLength); |
| 779 | } |
| 780 | break; |
| 781 | case WMA_VDEV_IBSS_SET_POWER_SAVE_ALLOWED: |
| 782 | { |
| 783 | wma_handle->wma_ibss_power_save_params.isPowerSaveAllowed = |
| 784 | privcmd->param_value; |
| 785 | WMA_LOGD("%s: IBSS is Power Save Allowed = %d", |
| 786 | __func__, wma_handle->wma_ibss_power_save_params. |
| 787 | isPowerSaveAllowed); |
| 788 | } |
| 789 | break; |
| 790 | case WMA_VDEV_IBSS_SET_POWER_COLLAPSE_ALLOWED: |
| 791 | { |
| 792 | wma_handle->wma_ibss_power_save_params. isPowerCollapseAllowed = |
| 793 | privcmd->param_value; |
| 794 | WMA_LOGD("%s: IBSS is Power Collapse Allowed = %d", |
| 795 | __func__, wma_handle->wma_ibss_power_save_params. |
| 796 | isPowerCollapseAllowed); |
| 797 | } |
| 798 | break; |
| 799 | case WMA_VDEV_IBSS_SET_AWAKE_ON_TX_RX: |
| 800 | { |
| 801 | wma_handle->wma_ibss_power_save_params.isAwakeonTxRxEnabled = |
| 802 | privcmd->param_value; |
| 803 | WMA_LOGD("%s: IBSS Power Save Awake on Tx/Rx Enabled = %d", |
| 804 | __func__, wma_handle->wma_ibss_power_save_params. |
| 805 | isAwakeonTxRxEnabled); |
| 806 | } |
| 807 | break; |
| 808 | case WMA_VDEV_IBSS_SET_INACTIVITY_TIME: |
| 809 | { |
| 810 | wma_handle->wma_ibss_power_save_params.inactivityCount = |
| 811 | privcmd->param_value; |
| 812 | WMA_LOGD("%s: IBSS Power Save Data Inactivity Count = %d", |
| 813 | __func__, wma_handle->wma_ibss_power_save_params. |
| 814 | inactivityCount); |
| 815 | } |
| 816 | break; |
| 817 | case WMA_VDEV_IBSS_SET_TXSP_END_INACTIVITY_TIME: |
| 818 | { |
| 819 | wma_handle->wma_ibss_power_save_params.txSPEndInactivityTime = |
| 820 | privcmd->param_value; |
| 821 | WMA_LOGD("%s: IBSS Power Save Transmit EOSP inactivity time out = %d", |
| 822 | __func__, wma_handle->wma_ibss_power_save_params. |
| 823 | txSPEndInactivityTime); |
| 824 | } |
| 825 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 826 | case WMA_VDEV_IBSS_PS_SET_WARMUP_TIME_SECS: |
| 827 | { |
| 828 | wma_handle->wma_ibss_power_save_params.ibssPsWarmupTime = |
| 829 | privcmd->param_value; |
| 830 | WMA_LOGD("%s: IBSS Power Save Warm Up Time in Seconds = %d", |
| 831 | __func__, wma_handle->wma_ibss_power_save_params. |
| 832 | ibssPsWarmupTime); |
| 833 | } |
| 834 | break; |
| 835 | case WMA_VDEV_IBSS_PS_SET_1RX_CHAIN_IN_ATIM_WINDOW: |
| 836 | { |
| 837 | wma_handle->wma_ibss_power_save_params.ibssPs1RxChainInAtimEnable |
| 838 | = privcmd->param_value; |
| 839 | WMA_LOGD("%s: IBSS Power Save single RX Chain Enable In ATIM = %d", |
| 840 | __func__, wma_handle->wma_ibss_power_save_params. |
| 841 | ibssPs1RxChainInAtimEnable); |
| 842 | } |
| 843 | break; |
| 844 | |
| 845 | case WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID: |
| 846 | { |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame^] | 847 | wma_ipa_get_stat(); |
Yun Park | 637d648 | 2016-10-05 10:51:33 -0700 | [diff] [blame] | 848 | } |
| 849 | break; |
| 850 | |
| 851 | case WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID: |
| 852 | { |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame^] | 853 | wma_ipa_uc_get_share_stats(privcmd); |
Yun Park | 637d648 | 2016-10-05 10:51:33 -0700 | [diff] [blame] | 854 | } |
| 855 | break; |
| 856 | |
| 857 | case WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID: |
| 858 | { |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame^] | 859 | wma_ipa_uc_set_quota(privcmd); |
Yun Park | 327e781 | 2017-02-14 15:18:10 -0800 | [diff] [blame] | 860 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 861 | } |
| 862 | break; |
| 863 | |
| 864 | default: |
| 865 | WMA_LOGE("Invalid wma config command id:%d", privcmd->param_id); |
| 866 | ret = -EINVAL; |
| 867 | } |
| 868 | return ret; |
| 869 | } |
| 870 | |
| 871 | /** |
Kiran Kumar Lokere | 92fe759 | 2016-09-14 20:15:45 -0700 | [diff] [blame] | 872 | * wma_set_dtim_period() - set dtim period to FW |
| 873 | * @wma: wma handle |
| 874 | * @dtim_params: dtim params |
| 875 | * |
| 876 | * Return: none |
| 877 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 878 | static void wma_set_dtim_period(tp_wma_handle wma, |
| 879 | struct set_dtim_params *dtim_params) |
Kiran Kumar Lokere | 92fe759 | 2016-09-14 20:15:45 -0700 | [diff] [blame] | 880 | { |
| 881 | QDF_STATUS ret; |
| 882 | uint8_t vdev_id = dtim_params->session_id; |
| 883 | struct wma_txrx_node *iface = |
| 884 | &wma->interfaces[vdev_id]; |
| 885 | |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 886 | WMA_LOGD("%s: set dtim_period %d", __func__, |
Kiran Kumar Lokere | 92fe759 | 2016-09-14 20:15:45 -0700 | [diff] [blame] | 887 | dtim_params->dtim_period); |
| 888 | iface->dtimPeriod = dtim_params->dtim_period; |
| 889 | ret = wma_vdev_set_param(wma->wmi_handle, |
| 890 | vdev_id, |
| 891 | WMI_VDEV_PARAM_LISTEN_INTERVAL, |
| 892 | dtim_params->dtim_period); |
| 893 | if (QDF_IS_STATUS_ERROR(ret)) |
| 894 | WMA_LOGW("Failed to set listen interval"); |
| 895 | |
| 896 | } |
| 897 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 898 | * wma_set_modulated_dtim() - function to configure modulated dtim |
| 899 | * @wma: wma handle |
| 900 | * @privcmd: structure containing parameters |
| 901 | * |
| 902 | * This function configures the modulated dtim in firmware |
| 903 | * |
| 904 | * Return: none |
| 905 | */ |
| 906 | static void wma_set_modulated_dtim(tp_wma_handle wma, |
| 907 | wma_cli_set_cmd_t *privcmd) |
| 908 | { |
| 909 | uint8_t vdev_id = privcmd->param_vdev_id; |
| 910 | struct wma_txrx_node *iface = |
| 911 | &wma->interfaces[vdev_id]; |
| 912 | bool prev_dtim_enabled; |
| 913 | uint32_t listen_interval; |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 914 | QDF_STATUS ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 915 | |
| 916 | iface->alt_modulated_dtim = privcmd->param_value; |
| 917 | |
| 918 | prev_dtim_enabled = iface->alt_modulated_dtim_enabled; |
| 919 | |
| 920 | if (1 != privcmd->param_value) |
| 921 | iface->alt_modulated_dtim_enabled = true; |
| 922 | else |
| 923 | iface->alt_modulated_dtim_enabled = false; |
| 924 | |
| 925 | if ((true == iface->alt_modulated_dtim_enabled) || |
| 926 | (true == prev_dtim_enabled)) { |
| 927 | |
| 928 | listen_interval = iface->alt_modulated_dtim |
| 929 | * iface->dtimPeriod; |
| 930 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 931 | ret = wma_vdev_set_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 932 | privcmd->param_vdev_id, |
| 933 | WMI_VDEV_PARAM_LISTEN_INTERVAL, |
| 934 | listen_interval); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 935 | if (QDF_IS_STATUS_ERROR(ret)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 936 | /* Even if it fails, continue */ |
| 937 | WMA_LOGW("Failed to set listen interval %d", |
| 938 | listen_interval); |
| 939 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 940 | ret = wma_vdev_set_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 941 | privcmd->param_vdev_id, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 942 | WMI_VDEV_PARAM_DTIM_POLICY, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 943 | NORMAL_DTIM); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 944 | if (QDF_IS_STATUS_ERROR(ret)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 945 | WMA_LOGE("Failed to Set to Normal DTIM policy"); |
| 946 | } |
| 947 | } |
| 948 | |
| 949 | |
| 950 | /** |
| 951 | * wma_process_cli_set_cmd() - set parameters to fw |
| 952 | * @wma: wma handle |
| 953 | * @privcmd: command |
| 954 | * |
| 955 | * Return: none |
| 956 | */ |
| 957 | static void wma_process_cli_set_cmd(tp_wma_handle wma, |
| 958 | wma_cli_set_cmd_t *privcmd) |
| 959 | { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 960 | int vid = privcmd->param_vdev_id, pps_val = 0; |
| 961 | QDF_STATUS ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 962 | struct wma_txrx_node *intr = wma->interfaces; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 963 | tpAniSirGlobal pMac = cds_get_context(QDF_MODULE_ID_PE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 964 | struct qpower_params *qparams = &intr[vid].config.qpower_params; |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 965 | struct pdev_params pdev_param; |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 966 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 967 | |
| 968 | WMA_LOGD("wmihandle %p", wma->wmi_handle); |
| 969 | |
| 970 | if (NULL == pMac) { |
| 971 | WMA_LOGE("%s: Failed to get pMac", __func__); |
| 972 | return; |
| 973 | } |
| 974 | |
| 975 | if (privcmd->param_id >= WMI_CMDID_MAX) { |
| 976 | /* |
| 977 | * This configuration setting is not done using any wmi |
| 978 | * command, call appropriate handler. |
| 979 | */ |
| 980 | if (wma_set_priv_cfg(wma, privcmd)) |
| 981 | WMA_LOGE("Failed to set wma priv congiuration"); |
| 982 | return; |
| 983 | } |
| 984 | |
| 985 | switch (privcmd->param_vp_dev) { |
| 986 | case VDEV_CMD: |
Bhargav Shah | a89d3b4 | 2016-04-20 13:04:56 +0530 | [diff] [blame] | 987 | if (!wma->interfaces[privcmd->param_vdev_id].is_vdev_valid) { |
| 988 | WMA_LOGE("%s Vdev id is not valid", __func__); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 989 | return; |
Bhargav Shah | a89d3b4 | 2016-04-20 13:04:56 +0530 | [diff] [blame] | 990 | } |
| 991 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 992 | WMA_LOGD("vdev id %d pid %d pval %d", privcmd->param_vdev_id, |
| 993 | privcmd->param_id, privcmd->param_value); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 994 | ret = wma_vdev_set_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 995 | privcmd->param_vdev_id, |
| 996 | privcmd->param_id, |
| 997 | privcmd->param_value); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 998 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 999 | WMA_LOGE("wma_vdev_set_param failed ret %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1000 | ret); |
| 1001 | return; |
| 1002 | } |
| 1003 | break; |
| 1004 | case PDEV_CMD: |
| 1005 | WMA_LOGD("pdev pid %d pval %d", privcmd->param_id, |
| 1006 | privcmd->param_value); |
| 1007 | if ((privcmd->param_id == WMI_PDEV_PARAM_RX_CHAIN_MASK) || |
| 1008 | (privcmd->param_id == WMI_PDEV_PARAM_TX_CHAIN_MASK)) { |
Jiachao Wu | 08719b0 | 2017-07-05 13:05:34 +0800 | [diff] [blame] | 1009 | if (QDF_STATUS_SUCCESS != |
| 1010 | wma_check_txrx_chainmask( |
| 1011 | wma->num_rf_chains, |
| 1012 | privcmd->param_value)) { |
| 1013 | WMA_LOGD("Chainmask value is invalid"); |
| 1014 | return; |
| 1015 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1016 | } |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1017 | pdev_param.param_id = privcmd->param_id; |
| 1018 | pdev_param.param_value = privcmd->param_value; |
| 1019 | ret = wmi_unified_pdev_param_send(wma->wmi_handle, |
| 1020 | &pdev_param, |
| 1021 | WMA_WILDCARD_PDEV_ID); |
| 1022 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 1023 | WMA_LOGE("wma_vdev_set_param failed ret %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1024 | ret); |
| 1025 | return; |
| 1026 | } |
| 1027 | break; |
| 1028 | case GEN_CMD: |
| 1029 | { |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1030 | struct cdp_vdev *vdev = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1031 | struct wma_txrx_node *intr = wma->interfaces; |
| 1032 | |
| 1033 | vdev = wma_find_vdev_by_id(wma, privcmd->param_vdev_id); |
| 1034 | if (!vdev) { |
| 1035 | WMA_LOGE("%s:Invalid vdev handle", __func__); |
| 1036 | return; |
| 1037 | } |
| 1038 | |
| 1039 | WMA_LOGD("gen pid %d pval %d", privcmd->param_id, |
| 1040 | privcmd->param_value); |
| 1041 | |
| 1042 | switch (privcmd->param_id) { |
| 1043 | case GEN_VDEV_PARAM_AMPDU: |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 1044 | if (soc) { |
| 1045 | ret = cdp_aggr_cfg(soc, vdev, |
| 1046 | privcmd->param_value, 0); |
| 1047 | if (ret) |
| 1048 | WMA_LOGE("cdp_aggr_cfg set ampdu failed ret %d", |
| 1049 | ret); |
| 1050 | else |
| 1051 | intr[privcmd->param_vdev_id].config. |
| 1052 | ampdu = privcmd->param_value; |
| 1053 | } else { |
| 1054 | WMA_LOGE("%s:SOC context is NULL", __func__); |
| 1055 | return; |
| 1056 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1057 | break; |
| 1058 | case GEN_VDEV_PARAM_AMSDU: |
Deepak Dhamdhere | 612392c | 2016-08-28 02:56:51 -0700 | [diff] [blame] | 1059 | /* |
| 1060 | * Firmware currently does not support set operation |
| 1061 | * for AMSDU. It may cause crash if the configuration |
| 1062 | * is sent to firmware. |
| 1063 | * Firmware enhancement will advertise a service bit |
| 1064 | * to enable AMSDU configuration through WMI. Then |
| 1065 | * add the WMI command to configure AMSDU parameter. |
| 1066 | * For the older chipset that does not advertise the |
| 1067 | * service bit, enable the following legacy code: |
| 1068 | * ol_txrx_aggr_cfg(vdev, 0, privcmd->param_value); |
| 1069 | * intr[privcmd->param_vdev_id].config.amsdu = |
| 1070 | * privcmd->param_value; |
| 1071 | */ |
| 1072 | WMA_LOGE("SET GEN_VDEV_PARAM_AMSDU command is currently not supported"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1073 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1074 | case GEN_PARAM_CRASH_INJECT: |
Rajeev Kumar | 0a9901b | 2015-12-15 15:59:19 -0800 | [diff] [blame] | 1075 | if (QDF_GLOBAL_FTM_MODE == cds_get_conparam()) |
| 1076 | WMA_LOGE("Crash inject not allowed in FTM mode"); |
| 1077 | else |
| 1078 | ret = wma_crash_inject(wma, |
| 1079 | privcmd->param_value, |
| 1080 | privcmd->param_sec_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1081 | break; |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 1082 | case GEN_PARAM_CAPTURE_TSF: |
| 1083 | ret = wma_capture_tsf(wma, privcmd->param_value); |
| 1084 | break; |
| 1085 | case GEN_PARAM_RESET_TSF_GPIO: |
| 1086 | ret = wma_reset_tsf_gpio(wma, privcmd->param_value); |
| 1087 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1088 | case GEN_PARAM_MODULATED_DTIM: |
| 1089 | wma_set_modulated_dtim(wma, privcmd); |
| 1090 | break; |
| 1091 | default: |
| 1092 | WMA_LOGE("Invalid param id 0x%x", |
| 1093 | privcmd->param_id); |
| 1094 | break; |
| 1095 | } |
| 1096 | break; |
| 1097 | } |
| 1098 | case DBG_CMD: |
| 1099 | WMA_LOGD("dbg pid %d pval %d", privcmd->param_id, |
| 1100 | privcmd->param_value); |
| 1101 | switch (privcmd->param_id) { |
| 1102 | case WMI_DBGLOG_LOG_LEVEL: |
| 1103 | ret = dbglog_set_log_lvl(wma->wmi_handle, |
| 1104 | privcmd->param_value); |
| 1105 | if (ret) |
| 1106 | WMA_LOGE("dbglog_set_log_lvl failed ret %d", |
| 1107 | ret); |
| 1108 | break; |
| 1109 | case WMI_DBGLOG_VAP_ENABLE: |
| 1110 | ret = dbglog_vap_log_enable(wma->wmi_handle, |
| 1111 | privcmd->param_value, true); |
| 1112 | if (ret) |
| 1113 | WMA_LOGE("dbglog_vap_log_enable failed ret %d", |
| 1114 | ret); |
| 1115 | break; |
| 1116 | case WMI_DBGLOG_VAP_DISABLE: |
| 1117 | ret = dbglog_vap_log_enable(wma->wmi_handle, |
| 1118 | privcmd->param_value, false); |
| 1119 | if (ret) |
| 1120 | WMA_LOGE("dbglog_vap_log_enable failed ret %d", |
| 1121 | ret); |
| 1122 | break; |
| 1123 | case WMI_DBGLOG_MODULE_ENABLE: |
| 1124 | ret = dbglog_module_log_enable(wma->wmi_handle, |
| 1125 | privcmd->param_value, true); |
| 1126 | if (ret) |
| 1127 | WMA_LOGE("dbglog_module_log_enable failed ret %d", |
| 1128 | ret); |
| 1129 | break; |
| 1130 | case WMI_DBGLOG_MODULE_DISABLE: |
| 1131 | ret = dbglog_module_log_enable(wma->wmi_handle, |
| 1132 | privcmd->param_value, false); |
| 1133 | if (ret) |
| 1134 | WMA_LOGE("dbglog_module_log_enable failed ret %d", |
| 1135 | ret); |
| 1136 | break; |
| 1137 | case WMI_DBGLOG_MOD_LOG_LEVEL: |
| 1138 | ret = dbglog_set_mod_log_lvl(wma->wmi_handle, |
| 1139 | privcmd->param_value); |
| 1140 | if (ret) |
| 1141 | WMA_LOGE("dbglog_module_log_enable failed ret %d", |
| 1142 | ret); |
| 1143 | break; |
| 1144 | case WMI_DBGLOG_TYPE: |
| 1145 | ret = dbglog_parser_type_init(wma->wmi_handle, |
| 1146 | privcmd->param_value); |
| 1147 | if (ret) |
| 1148 | WMA_LOGE("dbglog_parser_type_init failed ret %d", |
| 1149 | ret); |
| 1150 | break; |
| 1151 | case WMI_DBGLOG_REPORT_ENABLE: |
| 1152 | ret = dbglog_report_enable(wma->wmi_handle, |
| 1153 | privcmd->param_value); |
| 1154 | if (ret) |
| 1155 | WMA_LOGE("dbglog_report_enable failed ret %d", |
| 1156 | ret); |
| 1157 | break; |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1158 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 1159 | ret = wma_unified_fw_profiling_cmd(wma->wmi_handle, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1160 | WMI_WLAN_PROFILE_TRIGGER_CMDID, |
| 1161 | privcmd->param_value, 0); |
| 1162 | if (ret) |
| 1163 | WMA_LOGE("Profile cmd failed for %d ret %d", |
| 1164 | WMI_WLAN_PROFILE_TRIGGER_CMDID, ret); |
| 1165 | break; |
| 1166 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 1167 | ret = wma_unified_fw_profiling_cmd(wma->wmi_handle, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1168 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 1169 | privcmd->param_value, |
| 1170 | privcmd->param_sec_value); |
| 1171 | if (ret) |
| 1172 | WMA_LOGE("Profile cmd failed for %d ret %d", |
| 1173 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 1174 | ret); |
| 1175 | break; |
| 1176 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 1177 | ret = wma_unified_fw_profiling_cmd(wma->wmi_handle, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1178 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 1179 | privcmd->param_value, |
| 1180 | privcmd->param_sec_value); |
| 1181 | if (ret) |
| 1182 | WMA_LOGE("Profile cmd failed for %d ret %d", |
| 1183 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 1184 | ret); |
| 1185 | break; |
| 1186 | case WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID: |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 1187 | ret = wma_unified_fw_profiling_cmd(wma->wmi_handle, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1188 | WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID, |
| 1189 | 0, 0); |
| 1190 | if (ret) |
| 1191 | WMA_LOGE("Profile cmd failed for %d ret %d", |
| 1192 | WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID, |
| 1193 | ret); |
| 1194 | break; |
| 1195 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 1196 | ret = wma_unified_fw_profiling_cmd(wma->wmi_handle, |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 1197 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 1198 | 0, 0); |
| 1199 | if (ret) |
| 1200 | WMA_LOGE("Profile cmd failed for %d ret %d", |
| 1201 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 1202 | ret); |
| 1203 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1204 | case WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID: |
| 1205 | /* Set the Green AP */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1206 | ret = wmi_unified_green_ap_ps_send |
| 1207 | (wma->wmi_handle, privcmd->param_value, |
| 1208 | WMA_WILDCARD_PDEV_ID); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1209 | if (ret) { |
| 1210 | WMA_LOGE("Set GreenAP Failed val %d", |
| 1211 | privcmd->param_value); |
| 1212 | } |
| 1213 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1214 | |
| 1215 | default: |
| 1216 | WMA_LOGE("Invalid param id 0x%x", privcmd->param_id); |
| 1217 | break; |
| 1218 | } |
| 1219 | break; |
| 1220 | case PPS_CMD: |
| 1221 | WMA_LOGD("dbg pid %d pval %d", privcmd->param_id, |
| 1222 | privcmd->param_value); |
| 1223 | switch (privcmd->param_id) { |
| 1224 | |
| 1225 | case WMI_VDEV_PPS_PAID_MATCH: |
| 1226 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1227 | (PKT_PWR_SAVE_PAID_MATCH & 0xffff); |
| 1228 | intr[vid].config.pps_params.paid_match_enable = |
| 1229 | privcmd->param_value; |
| 1230 | break; |
| 1231 | case WMI_VDEV_PPS_GID_MATCH: |
| 1232 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1233 | (PKT_PWR_SAVE_GID_MATCH & 0xffff); |
| 1234 | intr[vid].config.pps_params.gid_match_enable = |
| 1235 | privcmd->param_value; |
| 1236 | break; |
| 1237 | case WMI_VDEV_PPS_EARLY_TIM_CLEAR: |
| 1238 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1239 | (PKT_PWR_SAVE_EARLY_TIM_CLEAR & 0xffff); |
| 1240 | intr[vid].config.pps_params.tim_clear = |
| 1241 | privcmd->param_value; |
| 1242 | break; |
| 1243 | case WMI_VDEV_PPS_EARLY_DTIM_CLEAR: |
| 1244 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1245 | (PKT_PWR_SAVE_EARLY_DTIM_CLEAR & 0xffff); |
| 1246 | intr[vid].config.pps_params.dtim_clear = |
| 1247 | privcmd->param_value; |
| 1248 | break; |
| 1249 | case WMI_VDEV_PPS_EOF_PAD_DELIM: |
| 1250 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1251 | (PKT_PWR_SAVE_EOF_PAD_DELIM & 0xffff); |
| 1252 | intr[vid].config.pps_params.eof_delim = |
| 1253 | privcmd->param_value; |
| 1254 | break; |
| 1255 | case WMI_VDEV_PPS_MACADDR_MISMATCH: |
| 1256 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1257 | (PKT_PWR_SAVE_MACADDR_MISMATCH & 0xffff); |
| 1258 | intr[vid].config.pps_params.mac_match = |
| 1259 | privcmd->param_value; |
| 1260 | break; |
| 1261 | case WMI_VDEV_PPS_DELIM_CRC_FAIL: |
| 1262 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1263 | (PKT_PWR_SAVE_DELIM_CRC_FAIL & 0xffff); |
| 1264 | intr[vid].config.pps_params.delim_fail = |
| 1265 | privcmd->param_value; |
| 1266 | break; |
| 1267 | case WMI_VDEV_PPS_GID_NSTS_ZERO: |
| 1268 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1269 | (PKT_PWR_SAVE_GID_NSTS_ZERO & 0xffff); |
| 1270 | intr[vid].config.pps_params.nsts_zero = |
| 1271 | privcmd->param_value; |
| 1272 | break; |
| 1273 | case WMI_VDEV_PPS_RSSI_CHECK: |
| 1274 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1275 | (PKT_PWR_SAVE_RSSI_CHECK & 0xffff); |
| 1276 | intr[vid].config.pps_params.rssi_chk = |
| 1277 | privcmd->param_value; |
| 1278 | break; |
| 1279 | case WMI_VDEV_PPS_5G_EBT: |
| 1280 | pps_val = ((privcmd->param_value << 31) & 0xffff0000) | |
| 1281 | (PKT_PWR_SAVE_5G_EBT & 0xffff); |
| 1282 | intr[vid].config.pps_params.ebt_5g = |
| 1283 | privcmd->param_value; |
| 1284 | break; |
| 1285 | default: |
| 1286 | WMA_LOGE("Invalid param id 0x%x", privcmd->param_id); |
| 1287 | break; |
| 1288 | } |
| 1289 | break; |
| 1290 | |
| 1291 | case QPOWER_CMD: |
| 1292 | WMA_LOGD("QPOWER CLI CMD pid %d pval %d", privcmd->param_id, |
| 1293 | privcmd->param_value); |
| 1294 | switch (privcmd->param_id) { |
| 1295 | case WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT: |
| 1296 | WMA_LOGD("QPOWER CLI CMD:Ps Poll Cnt val %d", |
| 1297 | privcmd->param_value); |
| 1298 | /* Set the QPower Ps Poll Count */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1299 | ret = wma_unified_set_sta_ps_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1300 | vid, WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT, |
| 1301 | privcmd->param_value); |
| 1302 | if (ret) { |
| 1303 | WMA_LOGE("Set Q-PsPollCnt Failed vdevId %d val %d", |
| 1304 | vid, privcmd->param_value); |
| 1305 | } else { |
| 1306 | qparams->max_ps_poll_cnt = privcmd->param_value; |
| 1307 | } |
| 1308 | break; |
| 1309 | case WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE: |
| 1310 | WMA_LOGD("QPOWER CLI CMD:Max Tx Before wake val %d", |
| 1311 | privcmd->param_value); |
| 1312 | /* Set the QPower Max Tx Before Wake */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1313 | ret = wma_unified_set_sta_ps_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1314 | vid, WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE, |
| 1315 | privcmd->param_value); |
| 1316 | if (ret) { |
| 1317 | WMA_LOGE("Set Q-MaxTxBefWake Failed vId %d val %d", |
| 1318 | vid, privcmd->param_value); |
| 1319 | } else { |
| 1320 | qparams->max_tx_before_wake = |
| 1321 | privcmd->param_value; |
| 1322 | } |
| 1323 | break; |
| 1324 | case WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL: |
| 1325 | WMA_LOGD("QPOWER CLI CMD:Ps Poll Wake Inv val %d", |
| 1326 | privcmd->param_value); |
| 1327 | /* Set the QPower Spec Ps Poll Wake Inv */ |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 1328 | ret = wma_unified_set_sta_ps_param(wma->wmi_handle, vid, |
| 1329 | WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1330 | privcmd->param_value); |
| 1331 | if (ret) { |
| 1332 | WMA_LOGE("Set Q-PsPoll WakeIntv Failed vId %d val %d", |
| 1333 | vid, privcmd->param_value); |
| 1334 | } else { |
| 1335 | qparams->spec_ps_poll_wake_interval = |
| 1336 | privcmd->param_value; |
| 1337 | } |
| 1338 | break; |
| 1339 | case WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL: |
| 1340 | WMA_LOGD("QPOWER CLI CMD:Spec NoData Ps Poll val %d", |
| 1341 | privcmd->param_value); |
| 1342 | /* Set the QPower Spec NoData PsPoll */ |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 1343 | ret = wma_unified_set_sta_ps_param(wma->wmi_handle, vid, |
| 1344 | WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1345 | privcmd->param_value); |
| 1346 | if (ret) { |
| 1347 | WMA_LOGE("Set Q-SpecNoDataPsPoll Failed vId %d val %d", |
| 1348 | vid, privcmd->param_value); |
| 1349 | } else { |
| 1350 | qparams->max_spec_nodata_ps_poll = |
| 1351 | privcmd->param_value; |
| 1352 | } |
| 1353 | break; |
| 1354 | |
| 1355 | default: |
| 1356 | WMA_LOGE("Invalid param id 0x%x", privcmd->param_id); |
| 1357 | break; |
| 1358 | } |
| 1359 | break; |
| 1360 | case GTX_CMD: |
| 1361 | WMA_LOGD("vdev id %d pid %d pval %d", privcmd->param_vdev_id, |
| 1362 | privcmd->param_id, privcmd->param_value); |
| 1363 | switch (privcmd->param_id) { |
| 1364 | case WMI_VDEV_PARAM_GTX_HT_MCS: |
| 1365 | intr[vid].config.gtx_info.gtxRTMask[0] = |
| 1366 | privcmd->param_value; |
| 1367 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1368 | privcmd->param_vdev_id, |
| 1369 | &intr[vid].config.gtx_info); |
| 1370 | break; |
| 1371 | case WMI_VDEV_PARAM_GTX_VHT_MCS: |
| 1372 | intr[vid].config.gtx_info.gtxRTMask[1] = |
| 1373 | privcmd->param_value; |
| 1374 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1375 | privcmd->param_vdev_id, |
| 1376 | &intr[vid].config.gtx_info); |
| 1377 | break; |
| 1378 | |
| 1379 | case WMI_VDEV_PARAM_GTX_USR_CFG: |
| 1380 | intr[vid].config.gtx_info.gtxUsrcfg = |
| 1381 | privcmd->param_value; |
| 1382 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1383 | privcmd->param_vdev_id, |
| 1384 | &intr[vid].config.gtx_info); |
| 1385 | break; |
| 1386 | |
| 1387 | case WMI_VDEV_PARAM_GTX_THRE: |
| 1388 | intr[vid].config.gtx_info.gtxPERThreshold = |
| 1389 | privcmd->param_value; |
| 1390 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1391 | privcmd->param_vdev_id, |
| 1392 | &intr[vid].config.gtx_info); |
| 1393 | break; |
| 1394 | |
| 1395 | case WMI_VDEV_PARAM_GTX_MARGIN: |
| 1396 | intr[vid].config.gtx_info.gtxPERMargin = |
| 1397 | privcmd->param_value; |
| 1398 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1399 | privcmd->param_vdev_id, |
| 1400 | &intr[vid].config.gtx_info); |
| 1401 | break; |
| 1402 | |
| 1403 | case WMI_VDEV_PARAM_GTX_STEP: |
| 1404 | intr[vid].config.gtx_info.gtxTPCstep = |
| 1405 | privcmd->param_value; |
| 1406 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1407 | privcmd->param_vdev_id, |
| 1408 | &intr[vid].config.gtx_info); |
| 1409 | break; |
| 1410 | |
| 1411 | case WMI_VDEV_PARAM_GTX_MINTPC: |
| 1412 | intr[vid].config.gtx_info.gtxTPCMin = |
| 1413 | privcmd->param_value; |
| 1414 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1415 | privcmd->param_vdev_id, |
| 1416 | &intr[vid].config.gtx_info); |
| 1417 | break; |
| 1418 | |
| 1419 | case WMI_VDEV_PARAM_GTX_BW_MASK: |
| 1420 | intr[vid].config.gtx_info.gtxBWMask = |
| 1421 | privcmd->param_value; |
| 1422 | ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, |
| 1423 | privcmd->param_vdev_id, |
| 1424 | &intr[vid].config.gtx_info); |
| 1425 | if (ret) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 1426 | WMA_LOGE("wma_vdev_set_param failed ret %d", |
| 1427 | ret); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1428 | return; |
| 1429 | } |
| 1430 | break; |
| 1431 | default: |
| 1432 | break; |
| 1433 | } |
| 1434 | break; |
| 1435 | |
| 1436 | default: |
| 1437 | WMA_LOGE("Invalid vpdev command id"); |
| 1438 | } |
| 1439 | if (1 == privcmd->param_vp_dev) { |
| 1440 | switch (privcmd->param_id) { |
| 1441 | case WMI_VDEV_PARAM_NSS: |
| 1442 | intr[vid].config.nss = privcmd->param_value; |
| 1443 | break; |
| 1444 | case WMI_VDEV_PARAM_LDPC: |
| 1445 | intr[vid].config.ldpc = privcmd->param_value; |
| 1446 | break; |
| 1447 | case WMI_VDEV_PARAM_TX_STBC: |
| 1448 | intr[vid].config.tx_stbc = privcmd->param_value; |
| 1449 | break; |
| 1450 | case WMI_VDEV_PARAM_RX_STBC: |
| 1451 | intr[vid].config.rx_stbc = privcmd->param_value; |
| 1452 | break; |
| 1453 | case WMI_VDEV_PARAM_SGI: |
| 1454 | intr[vid].config.shortgi = privcmd->param_value; |
| 1455 | break; |
| 1456 | case WMI_VDEV_PARAM_ENABLE_RTSCTS: |
| 1457 | intr[vid].config.rtscts_en = privcmd->param_value; |
| 1458 | break; |
| 1459 | case WMI_VDEV_PARAM_CHWIDTH: |
| 1460 | intr[vid].config.chwidth = privcmd->param_value; |
| 1461 | break; |
| 1462 | case WMI_VDEV_PARAM_FIXED_RATE: |
| 1463 | intr[vid].config.tx_rate = privcmd->param_value; |
| 1464 | break; |
| 1465 | case WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE: |
| 1466 | intr[vid].config.erx_adjust = privcmd->param_value; |
| 1467 | break; |
| 1468 | case WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM: |
| 1469 | intr[vid].config.erx_bmiss_num = privcmd->param_value; |
| 1470 | break; |
| 1471 | case WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE: |
| 1472 | intr[vid].config.erx_bmiss_cycle = privcmd->param_value; |
| 1473 | break; |
| 1474 | case WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP: |
| 1475 | intr[vid].config.erx_slop_step = privcmd->param_value; |
| 1476 | break; |
| 1477 | case WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP: |
| 1478 | intr[vid].config.erx_init_slop = privcmd->param_value; |
| 1479 | break; |
| 1480 | case WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE: |
| 1481 | intr[vid].config.erx_adj_pause = privcmd->param_value; |
| 1482 | break; |
| 1483 | case WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE: |
| 1484 | intr[vid].config.erx_dri_sample = privcmd->param_value; |
| 1485 | break; |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 1486 | case WMI_VDEV_PARAM_HE_DCM: |
Krishna Kumaar Natarajan | 150cd01 | 2017-03-23 12:29:10 -0700 | [diff] [blame] | 1487 | case WMI_VDEV_PARAM_HE_RANGE_EXT: |
Krishna Kumaar Natarajan | 1a71ec7 | 2017-03-23 12:26:31 -0700 | [diff] [blame] | 1488 | wma_set_he_vdev_param(&intr[vid], privcmd->param_id, |
| 1489 | privcmd->param_value); |
| 1490 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1491 | default: |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 1492 | WMA_LOGE("Invalid wma_cli_set vdev command/Not yet implemented 0x%x", |
| 1493 | privcmd->param_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1494 | break; |
| 1495 | } |
| 1496 | } else if (2 == privcmd->param_vp_dev) { |
| 1497 | switch (privcmd->param_id) { |
| 1498 | case WMI_PDEV_PARAM_ANI_ENABLE: |
| 1499 | wma->pdevconfig.ani_enable = privcmd->param_value; |
| 1500 | break; |
| 1501 | case WMI_PDEV_PARAM_ANI_POLL_PERIOD: |
| 1502 | wma->pdevconfig.ani_poll_len = privcmd->param_value; |
| 1503 | break; |
| 1504 | case WMI_PDEV_PARAM_ANI_LISTEN_PERIOD: |
| 1505 | wma->pdevconfig.ani_listen_len = privcmd->param_value; |
| 1506 | break; |
| 1507 | case WMI_PDEV_PARAM_ANI_OFDM_LEVEL: |
| 1508 | wma->pdevconfig.ani_ofdm_level = privcmd->param_value; |
| 1509 | break; |
| 1510 | case WMI_PDEV_PARAM_ANI_CCK_LEVEL: |
| 1511 | wma->pdevconfig.ani_cck_level = privcmd->param_value; |
| 1512 | break; |
| 1513 | case WMI_PDEV_PARAM_DYNAMIC_BW: |
| 1514 | wma->pdevconfig.cwmenable = privcmd->param_value; |
| 1515 | break; |
| 1516 | case WMI_PDEV_PARAM_CTS_CBW: |
| 1517 | wma->pdevconfig.cts_cbw = privcmd->param_value; |
| 1518 | break; |
| 1519 | case WMI_PDEV_PARAM_TX_CHAIN_MASK: |
| 1520 | wma->pdevconfig.txchainmask = privcmd->param_value; |
| 1521 | break; |
| 1522 | case WMI_PDEV_PARAM_RX_CHAIN_MASK: |
| 1523 | wma->pdevconfig.rxchainmask = privcmd->param_value; |
| 1524 | break; |
| 1525 | case WMI_PDEV_PARAM_BURST_ENABLE: |
| 1526 | wma->pdevconfig.burst_enable = privcmd->param_value; |
| 1527 | if ((wma->pdevconfig.burst_enable == 1) && |
| 1528 | (wma->pdevconfig.burst_dur == 0)) |
| 1529 | wma->pdevconfig.burst_dur = |
| 1530 | WMA_DEFAULT_SIFS_BURST_DURATION; |
| 1531 | else if (wma->pdevconfig.burst_enable == 0) |
| 1532 | wma->pdevconfig.burst_dur = 0; |
| 1533 | break; |
| 1534 | case WMI_PDEV_PARAM_BURST_DUR: |
| 1535 | wma->pdevconfig.burst_dur = privcmd->param_value; |
| 1536 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1537 | case WMI_PDEV_PARAM_TXPOWER_LIMIT2G: |
| 1538 | wma->pdevconfig.txpow2g = privcmd->param_value; |
| 1539 | if ((pMac->roam.configParam.bandCapability == |
| 1540 | eCSR_BAND_ALL) || |
| 1541 | (pMac->roam.configParam.bandCapability == |
| 1542 | eCSR_BAND_24)) { |
| 1543 | if (cfg_set_int(pMac, |
| 1544 | WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 1545 | privcmd->param_value) != |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 1546 | eSIR_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1547 | WMA_LOGE("could not set WNI_CFG_CURRENT_TX_POWER_LEVEL"); |
| 1548 | |
| 1549 | } else { |
| 1550 | WMA_LOGE("Current band is not 2G"); |
| 1551 | } |
| 1552 | break; |
| 1553 | case WMI_PDEV_PARAM_TXPOWER_LIMIT5G: |
| 1554 | wma->pdevconfig.txpow5g = privcmd->param_value; |
| 1555 | if ((pMac->roam.configParam.bandCapability == |
| 1556 | eCSR_BAND_ALL) || |
| 1557 | (pMac->roam.configParam.bandCapability == |
| 1558 | eCSR_BAND_5G)) { |
| 1559 | if (cfg_set_int(pMac, |
| 1560 | WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 1561 | privcmd->param_value) != |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 1562 | eSIR_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1563 | WMA_LOGE("could not set WNI_CFG_CURRENT_TX_POWER_LEVEL"); |
| 1564 | |
| 1565 | } else { |
| 1566 | WMA_LOGE("Current band is not 5G"); |
| 1567 | } |
| 1568 | break; |
| 1569 | default: |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 1570 | 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] | 1571 | privcmd->param_id); |
| 1572 | break; |
| 1573 | } |
| 1574 | } else if (5 == privcmd->param_vp_dev) { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1575 | ret = wma_vdev_set_param(wma->wmi_handle, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 1576 | privcmd->param_vdev_id, |
| 1577 | WMI_VDEV_PARAM_PACKET_POWERSAVE, |
| 1578 | pps_val); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1579 | if (ret) |
| 1580 | WMA_LOGE("Failed to send wmi packet power save cmd"); |
| 1581 | else |
| 1582 | WMA_LOGD("Sent packet power save cmd %d value %x to target", |
| 1583 | privcmd->param_id, pps_val); |
| 1584 | } |
| 1585 | } |
| 1586 | |
| 1587 | /** |
| 1588 | * wma_process_fw_event() - process any fw event |
| 1589 | * @wma: wma handle |
| 1590 | * @buf: fw event buffer |
| 1591 | * |
| 1592 | * This function process any fw event to serialize it through mc thread. |
| 1593 | * |
| 1594 | * Return: none |
| 1595 | */ |
| 1596 | static int wma_process_fw_event(tp_wma_handle wma, |
| 1597 | wma_process_fw_event_params *buf) |
| 1598 | { |
| 1599 | struct wmi_unified *wmi_handle = (struct wmi_unified *)buf->wmi_handle; |
| 1600 | |
| 1601 | wmi_process_fw_event(wmi_handle, buf->evt_buf); |
| 1602 | return 0; |
| 1603 | } |
| 1604 | |
| 1605 | /** |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1606 | * wmi_process_fw_event_tasklet_ctx() - process in tasklet context |
| 1607 | * @ctx: handle to wmi |
| 1608 | * @ev: wmi event buffer |
| 1609 | * |
| 1610 | * Event process by below function will be in tasket context, |
| 1611 | * need to use this method only for time sensitive functions. |
| 1612 | * |
| 1613 | * Return: none |
| 1614 | */ |
| 1615 | static int wma_process_fw_event_tasklet_ctx(void *ctx, void *ev) |
| 1616 | { |
| 1617 | wmi_process_fw_event(ctx, ev); |
| 1618 | |
| 1619 | return 0; |
| 1620 | } |
| 1621 | |
| 1622 | /** |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 1623 | * wma_process_hal_pwr_dbg_cmd() - send hal pwr dbg cmd to fw. |
| 1624 | * @handle: wma handle |
| 1625 | * @sir_pwr_dbg_params: unit test command |
| 1626 | * |
| 1627 | * This function send unit test command to fw. |
| 1628 | * |
| 1629 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 1630 | */ |
| 1631 | QDF_STATUS wma_process_hal_pwr_dbg_cmd(WMA_HANDLE handle, |
| 1632 | struct sir_mac_pwr_dbg_cmd * |
| 1633 | sir_pwr_dbg_params) |
| 1634 | { |
| 1635 | tp_wma_handle wma_handle = (tp_wma_handle)handle; |
| 1636 | int i; |
| 1637 | struct wmi_power_dbg_params wmi_pwr_dbg_params; |
| 1638 | QDF_STATUS status; |
| 1639 | |
| 1640 | if (!sir_pwr_dbg_params) { |
| 1641 | WMA_LOGE("%s: sir_pwr_dbg_params is null", __func__); |
| 1642 | return QDF_STATUS_E_INVAL; |
| 1643 | } |
| 1644 | wmi_pwr_dbg_params.module_id = sir_pwr_dbg_params->module_id; |
| 1645 | wmi_pwr_dbg_params.pdev_id = sir_pwr_dbg_params->pdev_id; |
| 1646 | wmi_pwr_dbg_params.num_args = sir_pwr_dbg_params->num_args; |
| 1647 | |
| 1648 | for (i = 0; i < wmi_pwr_dbg_params.num_args; i++) |
| 1649 | wmi_pwr_dbg_params.args[i] = sir_pwr_dbg_params->args[i]; |
| 1650 | |
| 1651 | status = wmi_unified_send_power_dbg_cmd(wma_handle->wmi_handle, |
| 1652 | &wmi_pwr_dbg_params); |
| 1653 | |
| 1654 | return status; |
| 1655 | } |
| 1656 | |
Houston Hoffman | b6084f1 | 2017-05-30 19:24:07 -0700 | [diff] [blame] | 1657 | static void wma_discard_fw_event(struct scheduler_msg *msg) |
| 1658 | { |
| 1659 | switch (msg->type) { |
| 1660 | case WMA_PROCESS_FW_EVENT: |
| 1661 | qdf_nbuf_free(((wma_process_fw_event_params *)msg->bodyptr) |
| 1662 | ->evt_buf); |
| 1663 | break; |
Abhishek Singh | caf6a65 | 2017-07-06 17:35:42 +0530 | [diff] [blame] | 1664 | case WMA_SET_LINK_STATE: |
| 1665 | qdf_mem_free(((tpLinkStateParams) msg->bodyptr)->callbackArg); |
| 1666 | break; |
Houston Hoffman | b6084f1 | 2017-05-30 19:24:07 -0700 | [diff] [blame] | 1667 | } |
| 1668 | if (msg->bodyptr) |
| 1669 | qdf_mem_free(msg->bodyptr); |
| 1670 | msg->bodyptr = NULL; |
| 1671 | msg->bodyval = 0; |
| 1672 | msg->type = 0; |
| 1673 | } |
| 1674 | |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 1675 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1676 | * wma_process_fw_event_handler() - common event handler to serialize |
| 1677 | * event processing through mc_thread |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1678 | * @ctx: wmi context |
| 1679 | * @ev: event buffer |
| 1680 | * @rx_ctx: rx execution context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1681 | * |
| 1682 | * Return: 0 on success, errno on failure |
| 1683 | */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1684 | 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] | 1685 | { |
| 1686 | wma_process_fw_event_params *params_buf; |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 1687 | struct scheduler_msg cds_msg = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1688 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1689 | params_buf = qdf_mem_malloc(sizeof(wma_process_fw_event_params)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1690 | if (!params_buf) { |
| 1691 | WMA_LOGE("%s: Failed alloc memory for params_buf", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1692 | qdf_nbuf_free(ev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1693 | return -ENOMEM; |
| 1694 | } |
| 1695 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1696 | params_buf->wmi_handle = (struct wmi_unified *)ctx; |
| 1697 | params_buf->evt_buf = (wmi_buf_t *)ev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1698 | |
| 1699 | cds_msg.type = WMA_PROCESS_FW_EVENT; |
| 1700 | cds_msg.bodyptr = params_buf; |
| 1701 | cds_msg.bodyval = 0; |
Houston Hoffman | b6084f1 | 2017-05-30 19:24:07 -0700 | [diff] [blame] | 1702 | cds_msg.flush_callback = wma_discard_fw_event; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1703 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1704 | if (QDF_STATUS_SUCCESS != |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 1705 | scheduler_post_msg(QDF_MODULE_ID_WMA, &cds_msg)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 1706 | WMA_LOGE("%s: Failed to post WMA_PROCESS_FW_EVENT msg", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1707 | __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1708 | qdf_nbuf_free(ev); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1709 | qdf_mem_free(params_buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1710 | return -EFAULT; |
| 1711 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1712 | return 0; |
| 1713 | |
| 1714 | } |
| 1715 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 1716 | /** |
| 1717 | * wma_process_fw_event_handler() - common event handler to serialize |
| 1718 | * event processing through mc_thread |
| 1719 | * @ctx: wmi context |
| 1720 | * @ev: event buffer |
| 1721 | * @rx_ctx: rx execution context |
| 1722 | * |
| 1723 | * Return: 0 on success, errno on failure |
| 1724 | */ |
| 1725 | int wma_process_fw_event_handler(void *ctx, void *ev, uint8_t rx_ctx) |
| 1726 | { |
| 1727 | int err = 0; |
| 1728 | |
| 1729 | if (rx_ctx == WMA_RX_SERIALIZER_CTX) { |
| 1730 | err = wma_process_fw_event_mc_thread_ctx(ctx, ev); |
| 1731 | } else if (rx_ctx == WMA_RX_TASKLET_CTX) { |
| 1732 | wma_process_fw_event_tasklet_ctx(ctx, ev); |
| 1733 | } else { |
| 1734 | WMA_LOGE("%s: invalid wmi event execution context", __func__); |
| 1735 | qdf_nbuf_free(ev); |
| 1736 | } |
| 1737 | |
| 1738 | return err; |
| 1739 | } |
| 1740 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1741 | #ifdef WLAN_FEATURE_NAN |
| 1742 | /** |
| 1743 | * wma_set_nan_enable() - set nan enable flag in WMA handle |
| 1744 | * @wma_handle: Pointer to wma handle |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 1745 | * @cds_cfg: Pointer to CDS Configuration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1746 | * |
| 1747 | * Return: none |
| 1748 | */ |
| 1749 | static void wma_set_nan_enable(tp_wma_handle wma_handle, |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 1750 | struct cds_config_info *cds_cfg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1751 | { |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 1752 | wma_handle->is_nan_enabled = cds_cfg->is_nan_enabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1753 | } |
| 1754 | #else |
| 1755 | static void wma_set_nan_enable(tp_wma_handle wma_handle, |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 1756 | struct cds_config_info *cds_cfg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1757 | { |
| 1758 | } |
| 1759 | #endif |
| 1760 | |
| 1761 | /** |
Komal Seelam | 02d0934 | 2016-02-23 18:03:19 +0530 | [diff] [blame] | 1762 | * wma_init_max_no_of_peers - API to initialize wma configuration params |
| 1763 | * @wma_handle: WMA Handle |
| 1764 | * @max_peers: Max Peers supported |
| 1765 | * |
| 1766 | * Return: void |
| 1767 | */ |
| 1768 | static void wma_init_max_no_of_peers(tp_wma_handle wma_handle, |
| 1769 | uint16_t max_peers) |
| 1770 | { |
| 1771 | struct wma_ini_config *cfg = wma_get_ini_handle(wma_handle); |
| 1772 | |
Naveen Rawat | 3580477 | 2016-06-27 15:40:28 -0700 | [diff] [blame] | 1773 | if (cfg == NULL) { |
| 1774 | WMA_LOGE("%s: NULL WMA ini handle", __func__); |
| 1775 | return; |
| 1776 | } |
| 1777 | |
Komal Seelam | 02d0934 | 2016-02-23 18:03:19 +0530 | [diff] [blame] | 1778 | cfg->max_no_of_peers = max_peers; |
| 1779 | } |
| 1780 | |
Prashanth Bhatta | e675ca7 | 2016-10-20 18:42:37 -0700 | [diff] [blame] | 1781 | /** |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1782 | * wma_cleanup_vdev_resp_queue() - cleanup vdev response queue |
| 1783 | * @wma: wma handle |
| 1784 | * |
| 1785 | * Return: none |
| 1786 | */ |
| 1787 | static void wma_cleanup_vdev_resp_queue(tp_wma_handle wma) |
| 1788 | { |
| 1789 | struct wma_target_req *req_msg = NULL; |
| 1790 | qdf_list_node_t *node1 = NULL; |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1791 | |
| 1792 | qdf_spin_lock_bh(&wma->vdev_respq_lock); |
| 1793 | if (!qdf_list_size(&wma->vdev_resp_queue)) { |
| 1794 | qdf_spin_unlock_bh(&wma->vdev_respq_lock); |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 1795 | WMA_LOGD(FL("request queue maybe empty")); |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1796 | return; |
| 1797 | } |
| 1798 | |
Wu Gao | 1eabdb6 | 2017-07-08 15:08:14 +0800 | [diff] [blame] | 1799 | while (qdf_list_remove_front(&wma->vdev_resp_queue, &node1) == |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1800 | QDF_STATUS_SUCCESS) { |
| 1801 | req_msg = qdf_container_of(node1, struct wma_target_req, node); |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1802 | qdf_spin_unlock_bh(&wma->vdev_respq_lock); |
Abhishek Singh | c614ec4 | 2017-04-25 16:17:34 +0530 | [diff] [blame] | 1803 | qdf_mc_timer_stop(&req_msg->event_timeout); |
| 1804 | wma_vdev_resp_timer(req_msg); |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1805 | qdf_spin_lock_bh(&wma->vdev_respq_lock); |
| 1806 | } |
| 1807 | qdf_spin_unlock_bh(&wma->vdev_respq_lock); |
| 1808 | } |
| 1809 | |
| 1810 | /** |
Abhishek Singh | c614ec4 | 2017-04-25 16:17:34 +0530 | [diff] [blame] | 1811 | * wma_cleanup_hold_req() - cleanup hold request queue |
| 1812 | * @wma: wma handle |
| 1813 | * |
| 1814 | * Return: none |
| 1815 | */ |
| 1816 | static void wma_cleanup_hold_req(tp_wma_handle wma) |
| 1817 | { |
| 1818 | struct wma_target_req *req_msg = NULL; |
| 1819 | qdf_list_node_t *node1 = NULL; |
| 1820 | |
| 1821 | qdf_spin_lock_bh(&wma->wma_hold_req_q_lock); |
| 1822 | if (!qdf_list_size(&wma->wma_hold_req_queue)) { |
| 1823 | qdf_spin_unlock_bh(&wma->wma_hold_req_q_lock); |
| 1824 | WMA_LOGD(FL("request queue is empty")); |
| 1825 | return; |
| 1826 | } |
| 1827 | |
| 1828 | while (QDF_STATUS_SUCCESS == |
Wu Gao | 1eabdb6 | 2017-07-08 15:08:14 +0800 | [diff] [blame] | 1829 | qdf_list_remove_front(&wma->wma_hold_req_queue, &node1)) { |
Abhishek Singh | c614ec4 | 2017-04-25 16:17:34 +0530 | [diff] [blame] | 1830 | req_msg = qdf_container_of(node1, struct wma_target_req, node); |
| 1831 | qdf_spin_unlock_bh(&wma->wma_hold_req_q_lock); |
| 1832 | /* Cleanup timeout handler */ |
| 1833 | qdf_mc_timer_stop(&req_msg->event_timeout); |
| 1834 | qdf_mc_timer_destroy(&req_msg->event_timeout); |
| 1835 | wma_hold_req_timer(req_msg); |
| 1836 | qdf_spin_lock_bh(&wma->wma_hold_req_q_lock); |
| 1837 | } |
| 1838 | qdf_spin_unlock_bh(&wma->wma_hold_req_q_lock); |
| 1839 | } |
| 1840 | |
| 1841 | /** |
Prashanth Bhatta | e675ca7 | 2016-10-20 18:42:37 -0700 | [diff] [blame] | 1842 | * wma_shutdown_notifier_cb - Shutdown notifer call back |
| 1843 | * @priv : WMA handle |
| 1844 | * |
| 1845 | * During recovery, WMA may wait for resume to complete if the crash happens |
| 1846 | * while in suspend. This may cause delays in completing the recovery. This call |
| 1847 | * back would be called during recovery and the event is completed so that if |
| 1848 | * the resume is waiting on FW to respond then it can get out of the wait so |
| 1849 | * that recovery thread can start bringing down all the modules. |
| 1850 | * |
| 1851 | * Return: None |
| 1852 | */ |
| 1853 | static void wma_shutdown_notifier_cb(void *priv) |
| 1854 | { |
| 1855 | tp_wma_handle wma_handle = priv; |
| 1856 | |
| 1857 | qdf_event_set(&wma_handle->wma_resume_event); |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 1858 | wma_cleanup_vdev_resp_queue(wma_handle); |
Abhishek Singh | c614ec4 | 2017-04-25 16:17:34 +0530 | [diff] [blame] | 1859 | wma_cleanup_hold_req(wma_handle); |
Mukul Sharma | 4c60a7e | 2017-03-06 19:42:18 +0530 | [diff] [blame] | 1860 | pmo_ucfg_psoc_wakeup_host_event_received(wma_handle->psoc); |
Prashanth Bhatta | e675ca7 | 2016-10-20 18:42:37 -0700 | [diff] [blame] | 1861 | } |
| 1862 | |
Mukul Sharma | 5ff3c58 | 2016-09-12 15:23:35 +0530 | [diff] [blame] | 1863 | struct wma_version_info g_wmi_version_info; |
| 1864 | |
Komal Seelam | 02d0934 | 2016-02-23 18:03:19 +0530 | [diff] [blame] | 1865 | /** |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 1866 | * wma_state_info_dump() - prints state information of wma layer |
| 1867 | * @buf: buffer pointer |
| 1868 | * @size: size of buffer to be filled |
| 1869 | * |
| 1870 | * This function is used to dump state information of wma layer |
| 1871 | * |
| 1872 | * Return: None |
| 1873 | */ |
| 1874 | static void wma_state_info_dump(char **buf_ptr, uint16_t *size) |
| 1875 | { |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 1876 | t_wma_handle *wma; |
| 1877 | struct sir_vdev_wow_stats *stats; |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 1878 | uint16_t len = 0; |
| 1879 | char *buf = *buf_ptr; |
| 1880 | struct wma_txrx_node *iface; |
| 1881 | uint8_t vdev_id; |
| 1882 | |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 1883 | wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 1884 | if (!wma) { |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 1885 | WMA_LOGE("%s: WMA context is invald!", __func__); |
| 1886 | return; |
| 1887 | } |
| 1888 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 1889 | WMA_LOGE("%s: size of buffer: %d", __func__, *size); |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 1890 | |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 1891 | for (vdev_id = 0; vdev_id < wma->max_bssid; vdev_id++) { |
| 1892 | iface = &wma->interfaces[vdev_id]; |
| 1893 | if (!iface->handle) |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 1894 | continue; |
| 1895 | |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 1896 | stats = &iface->wow_stats; |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 1897 | len += qdf_scnprintf(buf + len, *size - len, |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 1898 | "\n" |
| 1899 | "vdev_id %d\n" |
| 1900 | "WoW Stats\n" |
| 1901 | "\tpno_match %u\n" |
| 1902 | "\tpno_complete %u\n" |
| 1903 | "\tgscan %u\n" |
| 1904 | "\tlow_rssi %u\n" |
| 1905 | "\trssi_breach %u\n" |
| 1906 | "\tucast %u\n" |
| 1907 | "\tbcast %u\n" |
| 1908 | "\ticmpv4 %u\n" |
| 1909 | "\ticmpv6 %u\n" |
| 1910 | "\tipv4_mcast %u\n" |
| 1911 | "\tipv6_mcast %u\n" |
| 1912 | "\tipv6_mcast_ra %u\n" |
| 1913 | "\tipv6_mcast_ns %u\n" |
| 1914 | "\tipv6_mcast_na %u\n" |
| 1915 | "\toem_response %u\n" |
| 1916 | "conn_state %d\n" |
| 1917 | "dtimPeriod %d\n" |
| 1918 | "chanmode %d\n" |
| 1919 | "vht_capable %d\n" |
| 1920 | "ht_capable %d\n" |
| 1921 | "chan_width %d\n" |
| 1922 | "vdev_active %d\n" |
| 1923 | "vdev_up %d\n" |
| 1924 | "aid %d\n" |
| 1925 | "rate_flags %d\n" |
| 1926 | "nss %d\n" |
| 1927 | "tx_power %d\n" |
| 1928 | "max_tx_power %d\n" |
| 1929 | "nwType %d\n" |
| 1930 | "tx_streams %d\n" |
| 1931 | "rx_streams %d\n" |
| 1932 | "chain_mask %d\n" |
| 1933 | "nss_2g %d\n" |
| 1934 | "nss_5g %d", |
| 1935 | vdev_id, |
| 1936 | stats->pno_match, |
| 1937 | stats->pno_complete, |
| 1938 | stats->gscan, |
| 1939 | stats->low_rssi, |
| 1940 | stats->rssi_breach, |
| 1941 | stats->ucast, |
| 1942 | stats->bcast, |
| 1943 | stats->icmpv4, |
| 1944 | stats->icmpv6, |
| 1945 | stats->ipv4_mcast, |
| 1946 | stats->ipv6_mcast, |
| 1947 | stats->ipv6_mcast_ra, |
| 1948 | stats->ipv6_mcast_ns, |
| 1949 | stats->ipv6_mcast_na, |
| 1950 | stats->oem_response, |
| 1951 | iface->conn_state, |
| 1952 | iface->dtimPeriod, |
| 1953 | iface->chanmode, |
| 1954 | iface->vht_capable, |
| 1955 | iface->ht_capable, |
| 1956 | iface->chan_width, |
| 1957 | iface->vdev_active, |
Mukul Sharma | f904723 | 2017-03-02 16:58:56 +0530 | [diff] [blame] | 1958 | wma_is_vdev_up(vdev_id), |
Dustin Brown | 9d797d6 | 2017-01-11 16:39:12 -0800 | [diff] [blame] | 1959 | iface->aid, |
| 1960 | iface->rate_flags, |
| 1961 | iface->nss, |
| 1962 | iface->tx_power, |
| 1963 | iface->max_tx_power, |
| 1964 | iface->nwType, |
| 1965 | iface->tx_streams, |
| 1966 | iface->rx_streams, |
| 1967 | iface->chain_mask, |
| 1968 | iface->nss_2g, |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 1969 | iface->nss_5g); |
| 1970 | } |
| 1971 | |
| 1972 | *size -= len; |
| 1973 | *buf_ptr += len; |
| 1974 | } |
| 1975 | |
| 1976 | /** |
| 1977 | * wma_register_debug_callback() - registration function for wma layer |
| 1978 | * to print wma state information |
| 1979 | */ |
| 1980 | static void wma_register_debug_callback(void) |
| 1981 | { |
| 1982 | qdf_register_debug_callback(QDF_MODULE_ID_WMA, &wma_state_info_dump); |
| 1983 | } |
| 1984 | |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 1985 | /** |
| 1986 | * wma_register_tx_ops_handler() - register tx_ops of southbound |
| 1987 | * @tx_ops: tx_ops pointer in southbound |
| 1988 | * |
| 1989 | * Return: 0 on success, errno on failure |
| 1990 | */ |
| 1991 | static QDF_STATUS |
| 1992 | wma_register_tx_ops_handler(struct wlan_lmac_if_tx_ops *tx_ops) |
| 1993 | { |
| 1994 | /* |
| 1995 | * Assign tx_ops, it's up to UMAC modules to declare and define these |
| 1996 | * functions which are used to send wmi command to target. |
| 1997 | */ |
| 1998 | |
Himanshu Agarwal | ce716f8 | 2016-12-21 19:07:54 +0530 | [diff] [blame] | 1999 | if (!tx_ops) { |
| 2000 | WMA_LOGE("%s: pointer to lmac if tx ops is NULL", __func__); |
| 2001 | return QDF_STATUS_E_INVAL; |
| 2002 | } |
| 2003 | |
| 2004 | /* mgmt_txrx component's tx ops */ |
| 2005 | tx_ops->mgmt_txrx_tx_ops.mgmt_tx_send = wma_mgmt_unified_cmd_send; |
| 2006 | |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2007 | return QDF_STATUS_SUCCESS; |
| 2008 | } |
| 2009 | |
| 2010 | /** |
| 2011 | * wma_target_if_open() - Attach UMAC modules' interface with wmi layer |
| 2012 | * @wma_handle: wma handle |
| 2013 | * |
| 2014 | * Separate module defines below functions: |
| 2015 | * 1. tgt_wmi_<module>_<action> api sends wmi command, assigned to south bound |
| 2016 | * tx_ops function pointers; |
| 2017 | * 2. module's south dispatcher handles information from lower layer, assigned |
| 2018 | * to south bound rx_ops function pointers; |
| 2019 | * 3. wmi event handler deals with wmi event, extracts umac needed information, |
| 2020 | * and call rx_ops(module's dispatcher). It executes in tasklet context and |
| 2021 | * is up to dispatcher to decide the context to reside in tasklet or in |
| 2022 | * thread context. |
| 2023 | * |
| 2024 | * Return: None |
| 2025 | */ |
| 2026 | static void wma_target_if_open(tp_wma_handle wma_handle) |
| 2027 | { |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 2028 | struct wlan_objmgr_psoc *psoc = wma_handle->psoc; |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2029 | |
| 2030 | if (!psoc) |
| 2031 | return; |
| 2032 | |
Mukul Sharma | dad267e | 2017-02-04 13:25:34 +0530 | [diff] [blame] | 2033 | wlan_global_lmac_if_set_txops_registration_cb(WLAN_DEV_OL, |
| 2034 | target_if_register_tx_ops); |
| 2035 | wlan_lmac_if_set_umac_txops_registration_cb( |
| 2036 | wma_register_tx_ops_handler); |
| 2037 | wlan_global_lmac_if_open(psoc); |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2038 | |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2039 | } |
| 2040 | |
| 2041 | /** |
| 2042 | * wma_target_if_close() - Detach UMAC modules' interface with wmi layer |
| 2043 | * @wma_handle: wma handle |
| 2044 | * |
| 2045 | * Return: None |
| 2046 | */ |
| 2047 | static void wma_target_if_close(tp_wma_handle wma_handle) |
| 2048 | { |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 2049 | struct wlan_objmgr_psoc *psoc = wma_handle->psoc; |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2050 | |
| 2051 | if (!psoc) |
| 2052 | return; |
| 2053 | |
Mukul Sharma | dad267e | 2017-02-04 13:25:34 +0530 | [diff] [blame] | 2054 | wlan_global_lmac_if_close(psoc); |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2055 | } |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2056 | |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2057 | /** |
Mukul Sharma | c3e7a78 | 2017-02-03 12:16:11 +0530 | [diff] [blame] | 2058 | * wma_get_psoc_from_scn_handle() - API to get psoc from scn handle |
| 2059 | * @scn_handle: opaque wma handle |
| 2060 | * |
| 2061 | * API to get psoc from scn handle |
| 2062 | * |
| 2063 | * Return: None |
| 2064 | */ |
| 2065 | static struct wlan_objmgr_psoc *wma_get_psoc_from_scn_handle(void *scn_handle) |
| 2066 | { |
| 2067 | tp_wma_handle wma_handle; |
| 2068 | |
| 2069 | if (!scn_handle) { |
| 2070 | WMA_LOGE("invalid scn handle"); |
| 2071 | return NULL; |
| 2072 | } |
| 2073 | wma_handle = (tp_wma_handle)scn_handle; |
| 2074 | |
| 2075 | return wma_handle->psoc; |
| 2076 | } |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2077 | /** |
| 2078 | * wma_legacy_service_ready_event_handler() - legacy (ext)service ready handler |
| 2079 | * @event_id: event_id |
| 2080 | * @handle: wma handle |
| 2081 | * @event_data: event data |
| 2082 | * @length: event length |
| 2083 | * |
| 2084 | * Return: 0 for success, negative error code for failure |
| 2085 | */ |
| 2086 | static int wma_legacy_service_ready_event_handler(uint32_t event_id, |
| 2087 | void *handle, |
| 2088 | uint8_t *event_data, |
| 2089 | uint32_t length) |
| 2090 | { |
| 2091 | if (wmi_service_ready_event_id == event_id) |
| 2092 | return wma_rx_service_ready_event(handle, event_data, length); |
| 2093 | else if (wmi_service_ready_ext_event_id == event_id) |
| 2094 | return wma_rx_service_ready_ext_event(handle, event_data, |
| 2095 | length); |
| 2096 | else |
| 2097 | QDF_BUG(0); |
| 2098 | |
| 2099 | return 0; |
| 2100 | } |
Mukul Sharma | c3e7a78 | 2017-02-03 12:16:11 +0530 | [diff] [blame] | 2101 | |
| 2102 | /** |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2103 | * wma_flush_complete_evt_handler() - FW log flush complete event handler |
| 2104 | * @handle: WMI handle |
| 2105 | * @event: Event recevied from FW |
| 2106 | * @len: Length of the event |
| 2107 | * |
| 2108 | */ |
| 2109 | static int wma_flush_complete_evt_handler(void *handle, |
| 2110 | u_int8_t *event, |
| 2111 | u_int32_t len) |
| 2112 | { |
| 2113 | QDF_STATUS status; |
| 2114 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 2115 | |
| 2116 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID_param_tlvs *param_buf; |
| 2117 | wmi_debug_mesg_flush_complete_fixed_param *wmi_event; |
| 2118 | uint32_t reason_code; |
| 2119 | |
| 2120 | param_buf = (WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID_param_tlvs *) event; |
| 2121 | if (!param_buf) { |
| 2122 | WMA_LOGE("Invalid log flush complete event buffer"); |
| 2123 | return QDF_STATUS_E_FAILURE; |
| 2124 | } |
| 2125 | |
| 2126 | wmi_event = param_buf->fixed_param; |
| 2127 | reason_code = wmi_event->reserved0; |
| 2128 | |
| 2129 | /* |
| 2130 | * reason_code = 0; Flush event in response to flush command |
| 2131 | * reason_code = other value; Asynchronous flush event for fatal events |
| 2132 | */ |
| 2133 | if (!reason_code && (cds_is_log_report_in_progress() == false)) { |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 2134 | WMA_LOGD("Received WMI flush event without sending CMD"); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2135 | return -EINVAL; |
| 2136 | } else if (!reason_code && cds_is_log_report_in_progress() == true) { |
| 2137 | /* Flush event in response to flush command */ |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 2138 | WMA_LOGD("Received WMI flush event in response to flush CMD"); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2139 | status = qdf_mc_timer_stop(&wma->log_completion_timer); |
| 2140 | if (status != QDF_STATUS_SUCCESS) |
| 2141 | WMA_LOGE("Failed to stop the log completion timeout"); |
| 2142 | cds_logging_set_fw_flush_complete(); |
| 2143 | } else if (reason_code && cds_is_log_report_in_progress() == false) { |
| 2144 | /* Asynchronous flush event for fatal events */ |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2145 | status = cds_set_log_completion(WLAN_LOG_TYPE_FATAL, |
| 2146 | WLAN_LOG_INDICATOR_FIRMWARE, |
| 2147 | reason_code, false); |
| 2148 | if (QDF_STATUS_SUCCESS != status) { |
| 2149 | WMA_LOGE("%s: Failed to set log trigger params", |
| 2150 | __func__); |
| 2151 | return QDF_STATUS_E_FAILURE; |
| 2152 | } |
| 2153 | cds_logging_set_fw_flush_complete(); |
| 2154 | return status; |
| 2155 | } else { |
| 2156 | /* Asynchronous flush event for fatal event, |
| 2157 | * but, report in progress already |
| 2158 | */ |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 2159 | 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] | 2160 | __func__, WLAN_LOG_TYPE_FATAL, |
| 2161 | WLAN_LOG_INDICATOR_FIRMWARE, reason_code); |
| 2162 | return QDF_STATUS_E_FAILURE; |
| 2163 | } |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 2164 | /* Asynchronous flush event for fatal event, |
| 2165 | * but, report in progress already |
| 2166 | */ |
| 2167 | WMA_LOGW("%s: Bug report already in progress - dropping! type:%d, indicator=%d reason_code=%d", |
| 2168 | __func__, WLAN_LOG_TYPE_FATAL, |
| 2169 | WLAN_LOG_INDICATOR_FIRMWARE, reason_code); |
| 2170 | return QDF_STATUS_E_FAILURE; |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2171 | } |
| 2172 | |
| 2173 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2174 | * wma_open() - Allocate wma context and initialize it. |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 2175 | * @psoc: Psoc pointer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2176 | * @cds_context: cds context |
| 2177 | * @wma_tgt_cfg_cb: tgt config callback fun |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2178 | * @cds_cfg: mac parameters |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2179 | * |
| 2180 | * Return: 0 on success, errno on failure |
| 2181 | */ |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 2182 | QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, void *cds_context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2183 | wma_tgt_cfg_cb tgt_cfg_cb, |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2184 | struct cds_config_info *cds_cfg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2185 | { |
| 2186 | tp_wma_handle wma_handle; |
| 2187 | HTC_HANDLE htc_handle; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2188 | qdf_device_t qdf_dev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2189 | void *wmi_handle; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2190 | QDF_STATUS qdf_status; |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2191 | struct wmi_rx_ops ops; |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 2192 | struct policy_mgr_wma_cbacks wma_cbacks; |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 2193 | struct target_psoc_info *tgt_psoc_info; |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2194 | |
| 2195 | bool use_cookie = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2196 | |
| 2197 | WMA_LOGD("%s: Enter", __func__); |
| 2198 | |
Mukul Sharma | 5ff3c58 | 2016-09-12 15:23:35 +0530 | [diff] [blame] | 2199 | g_wmi_version_info.major = __WMI_VER_MAJOR_; |
| 2200 | g_wmi_version_info.minor = __WMI_VER_MINOR_; |
| 2201 | g_wmi_version_info.revision = __WMI_REVISION_; |
| 2202 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2203 | qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); |
| 2204 | htc_handle = cds_get_context(QDF_MODULE_ID_HTC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2205 | |
| 2206 | if (!htc_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2207 | WMA_LOGE("%s: Invalid HTC handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2208 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2209 | } |
| 2210 | |
| 2211 | /* Alloc memory for WMA Context */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2212 | qdf_status = cds_alloc_context(cds_context, QDF_MODULE_ID_WMA, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2213 | (void **)&wma_handle, |
| 2214 | sizeof(t_wma_handle)); |
| 2215 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2216 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2217 | WMA_LOGE("%s: Memory allocation failed for wma_handle", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2218 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2219 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2220 | } |
| 2221 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2222 | qdf_mem_zero(wma_handle, sizeof(t_wma_handle)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2223 | |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 2224 | tgt_psoc_info = qdf_mem_malloc(sizeof(*tgt_psoc_info)); |
| 2225 | if (!tgt_psoc_info) { |
| 2226 | WMA_LOGE("%s: failed to allocate mem for tgt info", __func__); |
| 2227 | return QDF_STATUS_E_NOMEM; |
| 2228 | } |
| 2229 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2230 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2231 | #ifdef FEATURE_WLAN_EXTSCAN |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 2232 | qdf_wake_lock_create(&wma_handle->extscan_wake_lock, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2233 | "wlan_extscan_wl"); |
| 2234 | #endif /* FEATURE_WLAN_EXTSCAN */ |
Mukul Sharma | e44d054 | 2017-05-23 21:50:56 +0530 | [diff] [blame] | 2235 | qdf_wake_lock_create(&wma_handle->wow_wake_lock, |
| 2236 | "wlan_wow_wl"); |
| 2237 | qdf_wake_lock_create(&wma_handle->wow_auth_req_wl, |
| 2238 | "wlan_auth_req_wl"); |
| 2239 | qdf_wake_lock_create(&wma_handle->wow_assoc_req_wl, |
| 2240 | "wlan_assoc_req_wl"); |
| 2241 | qdf_wake_lock_create(&wma_handle->wow_deauth_rec_wl, |
| 2242 | "wlan_deauth_rec_wl"); |
| 2243 | qdf_wake_lock_create(&wma_handle->wow_disassoc_rec_wl, |
| 2244 | "wlan_disassoc_rec_wl"); |
| 2245 | qdf_wake_lock_create(&wma_handle->wow_ap_assoc_lost_wl, |
| 2246 | "wlan_ap_assoc_lost_wl"); |
| 2247 | qdf_wake_lock_create(&wma_handle->wow_auto_shutdown_wl, |
| 2248 | "wlan_auto_shutdown_wl"); |
| 2249 | qdf_wake_lock_create(&wma_handle->roam_ho_wl, |
| 2250 | "wlan_roam_ho_wl"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2251 | } |
| 2252 | |
Selvaraj, Sridhar | 3a1823f | 2017-02-01 17:32:21 +0530 | [diff] [blame] | 2253 | qdf_status = wlan_objmgr_psoc_try_get_ref(psoc, WLAN_LEGACY_WMA_ID); |
| 2254 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2255 | WMA_LOGE("%s: PSOC get_ref fails", __func__); |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 2256 | qdf_mem_free(tgt_psoc_info); |
Selvaraj, Sridhar | 3a1823f | 2017-02-01 17:32:21 +0530 | [diff] [blame] | 2257 | return qdf_status; |
| 2258 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 2259 | wma_handle->psoc = psoc; |
| 2260 | |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2261 | /* Open target_if layer and register wma callback */ |
| 2262 | wma_target_if_open(wma_handle); |
| 2263 | target_if_open(wma_get_psoc_from_scn_handle); |
| 2264 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2265 | /* Attach mc_thread context processing function */ |
| 2266 | ops.wma_process_fw_event_handler_cbk = wma_process_fw_event_handler; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2267 | /* attach the wmi */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2268 | wmi_handle = wmi_unified_attach(wma_handle, NULL, |
Mukul Sharma | cc1f3f9 | 2017-01-30 19:56:24 +0530 | [diff] [blame] | 2269 | WMI_TLV_TARGET, use_cookie, &ops, psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2270 | if (!wmi_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2271 | WMA_LOGE("%s: failed to attach WMI", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2272 | qdf_status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2273 | goto err_wma_handle; |
| 2274 | } |
| 2275 | |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2276 | target_if_register_legacy_service_ready_cb( |
| 2277 | wma_legacy_service_ready_event_handler); |
| 2278 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2279 | WMA_LOGA("WMA --> wmi_unified_attach - success"); |
Mukul Sharma | cc1f3f9 | 2017-01-30 19:56:24 +0530 | [diff] [blame] | 2280 | |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 2281 | /* store the wmi handle in tgt_if_handle */ |
| 2282 | tgt_psoc_info->wmi_handle = wmi_handle; |
| 2283 | |
Mukul Sharma | cc1f3f9 | 2017-01-30 19:56:24 +0530 | [diff] [blame] | 2284 | wlan_psoc_obj_lock(psoc); |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 2285 | wlan_psoc_set_tgt_if_handle(psoc, tgt_psoc_info); |
Mukul Sharma | cc1f3f9 | 2017-01-30 19:56:24 +0530 | [diff] [blame] | 2286 | wlan_psoc_obj_unlock(psoc); |
| 2287 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2288 | wmi_unified_register_event_handler(wmi_handle, |
| 2289 | WMI_SERVICE_READY_EVENTID, |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2290 | init_deinit_service_ready_event_handler, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2291 | WMA_RX_SERIALIZER_CTX); |
| 2292 | wmi_unified_register_event_handler(wmi_handle, |
| 2293 | WMI_SERVICE_READY_EXT_EVENTID, |
Rajeev Kumar | da2444c | 2017-01-10 22:42:07 -0800 | [diff] [blame] | 2294 | init_deinit_service_ext_ready_event_handler, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2295 | WMA_RX_SERIALIZER_CTX); |
| 2296 | wmi_unified_register_event_handler(wmi_handle, |
| 2297 | WMI_READY_EVENTID, |
| 2298 | wma_rx_ready_event, |
| 2299 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2300 | /* Save the WMI & HTC handle */ |
| 2301 | wma_handle->wmi_handle = wmi_handle; |
| 2302 | wma_handle->htc_handle = htc_handle; |
| 2303 | wma_handle->cds_context = cds_context; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2304 | wma_handle->qdf_dev = qdf_dev; |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2305 | wma_handle->max_scan = cds_cfg->max_scan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2306 | |
Manishekar Chandrasekaran | ebcab88 | 2016-05-04 12:55:14 +0530 | [diff] [blame] | 2307 | /* Initialize max_no_of_peers for wma_get_number_of_peers_supported() */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2308 | wma_init_max_no_of_peers(wma_handle, cds_cfg->max_station); |
Manishekar Chandrasekaran | ebcab88 | 2016-05-04 12:55:14 +0530 | [diff] [blame] | 2309 | /* Cap maxStation based on the target version */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2310 | cds_cfg->max_station = wma_get_number_of_peers_supported(wma_handle); |
Manishekar Chandrasekaran | ebcab88 | 2016-05-04 12:55:14 +0530 | [diff] [blame] | 2311 | /* Reinitialize max_no_of_peers based on the capped maxStation value */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2312 | wma_init_max_no_of_peers(wma_handle, cds_cfg->max_station); |
Manishekar Chandrasekaran | ebcab88 | 2016-05-04 12:55:14 +0530 | [diff] [blame] | 2313 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2314 | /* initialize default target config */ |
| 2315 | wma_set_default_tgt_config(wma_handle); |
| 2316 | |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2317 | wma_handle->tx_chain_mask_cck = cds_cfg->tx_chain_mask_cck; |
| 2318 | wma_handle->self_gen_frm_pwr = cds_cfg->self_gen_frm_pwr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2319 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2320 | #if defined(QCA_WIFI_FTM) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2321 | if (cds_get_conparam() == QDF_GLOBAL_FTM_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2322 | wma_utf_attach(wma_handle); |
| 2323 | #endif /* QCA_WIFI_FTM */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2324 | wma_init_max_no_of_peers(wma_handle, cds_cfg->max_station); |
| 2325 | cds_cfg->max_station = wma_get_number_of_peers_supported(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2326 | |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2327 | cds_cfg->max_bssid = WMA_MAX_SUPPORTED_BSS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2328 | |
| 2329 | wma_handle->wlan_resource_config.num_wow_filters = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2330 | cds_cfg->max_wow_filters; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2331 | wma_handle->wlan_resource_config.num_keep_alive_pattern = |
| 2332 | WMA_MAXNUM_PERIODIC_TX_PTRNS; |
| 2333 | |
| 2334 | /* The current firmware implementation requires the number of |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 2335 | * offload peers should be (number of vdevs + 1). |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2336 | */ |
| 2337 | wma_handle->wlan_resource_config.num_offload_peers = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2338 | cds_cfg->ap_maxoffload_peers + 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2339 | |
| 2340 | wma_handle->wlan_resource_config.num_offload_reorder_buffs = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2341 | cds_cfg->ap_maxoffload_reorderbuffs + 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2342 | |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2343 | wma_handle->ol_ini_info = cds_cfg->ol_ini_info; |
| 2344 | wma_handle->max_station = cds_cfg->max_station; |
| 2345 | wma_handle->max_bssid = cds_cfg->max_bssid; |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2346 | wma_handle->driver_type = cds_cfg->driver_type; |
| 2347 | wma_handle->ssdp = cds_cfg->ssdp; |
| 2348 | wma_handle->enable_mc_list = cds_cfg->enable_mc_list; |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 2349 | wma_handle->bpf_packet_filter_enable = |
| 2350 | cds_cfg->bpf_packet_filter_enable; |
Hanumanth Reddy Pothula | e87621b | 2017-04-12 20:53:35 +0530 | [diff] [blame] | 2351 | wma_handle->active_uc_bpf_mode = cds_cfg->active_uc_bpf_mode; |
| 2352 | 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] | 2353 | wma_handle->link_stats_results = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2354 | #ifdef FEATURE_WLAN_RA_FILTERING |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2355 | wma_handle->IsRArateLimitEnabled = cds_cfg->is_ra_ratelimit_enabled; |
| 2356 | wma_handle->RArateLimitInterval = cds_cfg->ra_ratelimit_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2357 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 2358 | #ifdef WLAN_FEATURE_LPSS |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2359 | wma_handle->is_lpass_enabled = cds_cfg->is_lpass_enabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2360 | #endif |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2361 | wma_set_nan_enable(wma_handle, cds_cfg); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2362 | wma_handle->interfaces = qdf_mem_malloc(sizeof(struct wma_txrx_node) * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2363 | wma_handle->max_bssid); |
| 2364 | if (!wma_handle->interfaces) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2365 | WMA_LOGE("%s: failed to allocate interface table", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2366 | qdf_status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2367 | goto err_scn_context; |
| 2368 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2369 | qdf_mem_zero(wma_handle->interfaces, sizeof(struct wma_txrx_node) * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2370 | wma_handle->max_bssid); |
| 2371 | /* Register the debug print event handler */ |
| 2372 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2373 | WMI_DEBUG_PRINT_EVENTID, |
| 2374 | wma_unified_debug_print_event_handler, |
| 2375 | WMA_RX_SERIALIZER_CTX); |
Govind Singh | a471e5e | 2015-10-12 17:11:14 +0530 | [diff] [blame] | 2376 | /* Register profiling event Handler */ |
| 2377 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2378 | WMI_WLAN_PROFILE_DATA_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2379 | wma_profile_data_report_event_handler, |
| 2380 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2381 | |
| 2382 | wma_handle->tgt_cfg_update_cb = tgt_cfg_cb; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2383 | wma_handle->old_hw_mode_index = WMA_DEFAULT_HW_MODE_INDEX; |
| 2384 | wma_handle->new_hw_mode_index = WMA_DEFAULT_HW_MODE_INDEX; |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 2385 | wma_handle->saved_chan.num_channels = 0; |
Sandeep Puligilla | afa5289 | 2016-10-26 19:03:16 -0700 | [diff] [blame] | 2386 | wma_handle->fw_timeout_crash = cds_cfg->fw_timeout_crash; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2387 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 2388 | qdf_status = qdf_event_create(&wma_handle->wma_ready_event); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2389 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2390 | WMA_LOGE("%s: wma_ready_event initialization failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2391 | goto err_event_init; |
| 2392 | } |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 2393 | |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 2394 | qdf_status = qdf_mc_timer_init(&wma_handle->service_ready_ext_timer, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2395 | QDF_TIMER_TYPE_SW, |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 2396 | wma_service_ready_ext_evt_timeout, |
| 2397 | wma_handle); |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 2398 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 2399 | WMA_LOGE("Failed to initialize service ready ext timeout"); |
| 2400 | goto err_event_init; |
| 2401 | } |
| 2402 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 2403 | qdf_status = qdf_event_create(&wma_handle->target_suspend); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2404 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2405 | WMA_LOGE("%s: target suspend event initialization failed", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2406 | __func__); |
| 2407 | goto err_event_init; |
| 2408 | } |
| 2409 | |
| 2410 | /* Init Tx Frame Complete event */ |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 2411 | qdf_status = qdf_event_create(&wma_handle->tx_frm_download_comp_event); |
| 2412 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2413 | WMA_LOGE("%s: failed to init tx_frm_download_comp_event", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2414 | __func__); |
| 2415 | goto err_event_init; |
| 2416 | } |
| 2417 | |
| 2418 | /* Init tx queue empty check event */ |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 2419 | qdf_status = qdf_event_create(&wma_handle->tx_queue_empty_event); |
| 2420 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2421 | WMA_LOGE("%s: failed to init tx_queue_empty_event", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2422 | goto err_event_init; |
| 2423 | } |
| 2424 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 2425 | qdf_status = qdf_event_create(&wma_handle->wma_resume_event); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2426 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2427 | WMA_LOGE("%s: wma_resume_event initialization failed", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2428 | __func__); |
| 2429 | goto err_event_init; |
| 2430 | } |
| 2431 | |
Prashanth Bhatta | e675ca7 | 2016-10-20 18:42:37 -0700 | [diff] [blame] | 2432 | qdf_status = cds_shutdown_notifier_register(wma_shutdown_notifier_cb, |
| 2433 | wma_handle); |
| 2434 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2435 | WMA_LOGE("%s: Shutdown notifier register failed: %d", |
Prashanth Bhatta | e675ca7 | 2016-10-20 18:42:37 -0700 | [diff] [blame] | 2436 | __func__, qdf_status); |
| 2437 | goto err_event_init; |
| 2438 | } |
| 2439 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 2440 | qdf_status = qdf_event_create(&wma_handle->runtime_suspend); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2441 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2442 | WMA_LOGE("%s: runtime_suspend event initialization failed", |
Houston Hoffman | a76591b | 2015-11-10 16:52:05 -0800 | [diff] [blame] | 2443 | __func__); |
| 2444 | goto err_event_init; |
| 2445 | } |
| 2446 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 2447 | qdf_status = qdf_event_create(&wma_handle->recovery_event); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2448 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2449 | WMA_LOGE("%s: recovery event initialization failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2450 | goto err_event_init; |
| 2451 | } |
| 2452 | |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 2453 | qdf_list_create(&wma_handle->vdev_resp_queue, |
Krishna Kumaar Natarajan | a5c53bd | 2015-10-27 11:48:27 -0700 | [diff] [blame] | 2454 | MAX_ENTRY_VDEV_RESP_QUEUE); |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 2455 | qdf_spinlock_create(&wma_handle->vdev_respq_lock); |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 2456 | qdf_list_create(&wma_handle->wma_hold_req_queue, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2457 | MAX_ENTRY_HOLD_REQ_QUEUE); |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 2458 | qdf_spinlock_create(&wma_handle->wma_hold_req_q_lock); |
Anurag Chouhan | 8e0ccd3 | 2016-02-19 15:30:20 +0530 | [diff] [blame] | 2459 | qdf_atomic_init(&wma_handle->is_wow_bus_suspended); |
| 2460 | qdf_atomic_init(&wma_handle->scan_id_counter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2461 | |
| 2462 | /* Register vdev start response event handler */ |
| 2463 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2464 | WMI_VDEV_START_RESP_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2465 | wma_vdev_start_resp_handler, |
| 2466 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2467 | |
| 2468 | /* Register vdev stop response event handler */ |
| 2469 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2470 | WMI_VDEV_STOPPED_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2471 | wma_vdev_stop_resp_handler, |
| 2472 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2473 | |
| 2474 | /* register for STA kickout function */ |
| 2475 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2476 | WMI_PEER_STA_KICKOUT_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2477 | wma_peer_sta_kickout_event_handler, |
| 2478 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2479 | |
| 2480 | /* register for stats response event */ |
| 2481 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2482 | WMI_UPDATE_STATS_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2483 | wma_stats_event_handler, |
| 2484 | WMA_RX_SERIALIZER_CTX); |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 2485 | |
Will Huang | a981459 | 2017-05-24 15:47:58 +0800 | [diff] [blame] | 2486 | /* register for peer info response event */ |
| 2487 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2488 | WMI_PEER_STATS_INFO_EVENTID, |
| 2489 | wma_peer_info_event_handler, |
| 2490 | WMA_RX_SERIALIZER_CTX); |
| 2491 | |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 2492 | #ifdef WLAN_POWER_DEBUGFS |
| 2493 | /* register for Chip Power stats event */ |
| 2494 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2495 | WMI_PDEV_CHIP_POWER_STATS_EVENTID, |
| 2496 | wma_unified_power_debug_stats_event_handler, |
| 2497 | WMA_RX_SERIALIZER_CTX); |
| 2498 | #endif |
| 2499 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2500 | /* register for linkspeed response event */ |
| 2501 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2502 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2503 | wma_link_speed_event_handler, |
| 2504 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2505 | |
| 2506 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 2507 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Krishna Kumaar Natarajan | 4e9cf39 | 2015-11-20 13:35:05 -0800 | [diff] [blame] | 2508 | WMI_OEM_RESPONSE_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2509 | wma_oem_data_response_handler, |
| 2510 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2511 | #endif /* FEATURE_OEM_DATA_SUPPORT */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2512 | |
| 2513 | /* Register peer change event handler */ |
| 2514 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2515 | WMI_PEER_STATE_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2516 | wma_peer_state_change_event_handler, |
| 2517 | WMA_RX_WORK_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2518 | |
| 2519 | /* Register beacon tx complete event id. The event is required |
| 2520 | * for sending channel switch announcement frames |
| 2521 | */ |
| 2522 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2523 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID, |
| 2524 | wma_unified_bcntx_status_event_handler, |
| 2525 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2526 | |
| 2527 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2528 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2529 | wma_link_status_event_handler, |
| 2530 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2531 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 2532 | /* Register event handler for processing Link Layer Stats |
| 2533 | * response from the FW |
| 2534 | */ |
| 2535 | wma_register_ll_stats_event_handler(wma_handle); |
| 2536 | |
| 2537 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 2538 | |
| 2539 | /* |
| 2540 | * Register event handler to receive firmware mem dump |
| 2541 | * copy complete indication |
| 2542 | */ |
| 2543 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2544 | WMI_UPDATE_FW_MEM_DUMP_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2545 | wma_fw_mem_dump_event_handler, |
| 2546 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2547 | |
| 2548 | /* Firmware debug log */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2549 | qdf_status = dbglog_init(wma_handle->wmi_handle); |
| 2550 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2551 | WMA_LOGE("%s: Firmware Dbglog initialization failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2552 | goto err_dbglog_init; |
| 2553 | } |
| 2554 | |
| 2555 | /* |
| 2556 | * Update Powersave mode |
| 2557 | * 1 - Legacy Powersave + Deepsleep Disabled |
| 2558 | * 2 - QPower + Deepsleep Disabled |
| 2559 | * 3 - Legacy Powersave + Deepsleep Enabled |
| 2560 | * 4 - QPower + Deepsleep Enabled |
| 2561 | */ |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2562 | wma_handle->powersave_mode = cds_cfg->powersave_offload_enabled; |
| 2563 | wma_handle->staMaxLIModDtim = cds_cfg->sta_maxlimod_dtim; |
| 2564 | wma_handle->staModDtim = cds_cfg->sta_mod_dtim; |
| 2565 | wma_handle->staDynamicDtim = cds_cfg->sta_dynamic_dtim; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2566 | |
| 2567 | /* |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2568 | * Value of cds_cfg->wow_enable can be, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2569 | * 0 - Disable both magic pattern match and pattern byte match. |
| 2570 | * 1 - Enable magic pattern match on all interfaces. |
| 2571 | * 2 - Enable pattern byte match on all interfaces. |
| 2572 | * 3 - Enable both magic patter and pattern byte match on |
| 2573 | * all interfaces. |
| 2574 | */ |
| 2575 | wma_handle->wow.magic_ptrn_enable = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2576 | (cds_cfg->wow_enable & 0x01) ? true : false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2577 | wma_handle->ptrn_match_enable_all_vdev = |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 2578 | (cds_cfg->wow_enable & 0x02) ? true : false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2579 | |
Frank Liu | d4b2fa0 | 2017-03-29 11:46:48 +0800 | [diff] [blame] | 2580 | #if defined(FEATURE_WLAN_TDLS) && !defined(CONVERGED_TDLS_ENABLE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2581 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2582 | WMI_TDLS_PEER_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2583 | wma_tdls_event_handler, |
| 2584 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2585 | #endif /* FEATURE_WLAN_TDLS */ |
| 2586 | |
| 2587 | /* register for install key completion event */ |
| 2588 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2589 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID, |
| 2590 | wma_vdev_install_key_complete_event_handler, |
| 2591 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2592 | #ifdef WLAN_FEATURE_NAN |
| 2593 | /* register for nan response event */ |
| 2594 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2595 | WMI_NAN_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2596 | wma_nan_rsp_event_handler, |
| 2597 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2598 | #endif /* WLAN_FEATURE_NAN */ |
| 2599 | |
| 2600 | #ifdef WLAN_FEATURE_STATS_EXT |
| 2601 | /* register for extended stats event */ |
| 2602 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2603 | WMI_STATS_EXT_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2604 | wma_stats_ext_event_handler, |
| 2605 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2606 | #endif /* WLAN_FEATURE_STATS_EXT */ |
| 2607 | #ifdef FEATURE_WLAN_EXTSCAN |
| 2608 | wma_register_extscan_event_handler(wma_handle); |
| 2609 | #endif /* WLAN_FEATURE_STATS_EXT */ |
| 2610 | |
| 2611 | WMA_LOGD("%s: Exit", __func__); |
| 2612 | |
| 2613 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2614 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2615 | WMI_ROAM_SYNCH_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2616 | wma_roam_synch_event_handler, |
| 2617 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2618 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 2619 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2620 | WMI_RSSI_BREACH_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2621 | wma_rssi_breached_event_handler, |
| 2622 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2623 | |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 2624 | qdf_wake_lock_create(&wma_handle->wmi_cmd_rsp_wake_lock, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2625 | "wlan_fw_rsp_wakelock"); |
Sandeep Puligilla | 19ddda2 | 2016-01-05 12:18:02 -0800 | [diff] [blame] | 2626 | wma_handle->wmi_cmd_rsp_runtime_lock = |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 2627 | qdf_runtime_lock_init("wlan_fw_rsp_runtime_lock"); |
Sandeep Puligilla | 19ddda2 | 2016-01-05 12:18:02 -0800 | [diff] [blame] | 2628 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2629 | /* Register peer assoc conf event handler */ |
| 2630 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2631 | WMI_PEER_ASSOC_CONF_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2632 | wma_peer_assoc_conf_handler, |
| 2633 | WMA_RX_SERIALIZER_CTX); |
Sandeep Puligilla | 19ddda2 | 2016-01-05 12:18:02 -0800 | [diff] [blame] | 2634 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2635 | WMI_VDEV_DELETE_RESP_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2636 | wma_vdev_delete_handler, |
| 2637 | WMA_RX_SERIALIZER_CTX); |
Sandeep Puligilla | 19ddda2 | 2016-01-05 12:18:02 -0800 | [diff] [blame] | 2638 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2639 | WMI_PEER_DELETE_RESP_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 2640 | wma_peer_delete_handler, |
| 2641 | WMA_RX_SERIALIZER_CTX); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 2642 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2643 | WMI_BPF_CAPABILIY_INFO_EVENTID, |
| 2644 | wma_get_bpf_caps_event_handler, |
| 2645 | WMA_RX_SERIALIZER_CTX); |
Padma, Santhosh Kumar | d7cc079 | 2016-06-28 18:54:12 +0530 | [diff] [blame] | 2646 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2647 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_RESP_EVENTID, |
| 2648 | wma_encrypt_decrypt_msg_handler, |
| 2649 | WMA_RX_SERIALIZER_CTX); |
Kapil Gupta | 4f0c0c1 | 2017-02-07 15:21:15 +0530 | [diff] [blame] | 2650 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2651 | WMI_CHAN_INFO_EVENTID, |
| 2652 | wma_chan_info_event_handler, |
| 2653 | WMA_RX_SERIALIZER_CTX); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2654 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2655 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID, |
| 2656 | wma_flush_complete_evt_handler, |
Rajeev Kumar | c3032b8 | 2017-02-14 15:56:01 -0800 | [diff] [blame] | 2657 | WMA_RX_WORK_CTX); |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 2658 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2659 | WMI_REPORT_RX_AGGR_FAILURE_EVENTID, |
| 2660 | wma_rx_aggr_failure_event_handler, |
| 2661 | WMA_RX_SERIALIZER_CTX); |
Rajeev Kumar | 91ac6ac | 2017-02-14 15:49:14 -0800 | [diff] [blame] | 2662 | |
Ashish Kumar Dhanotiya | 9335d81 | 2017-06-30 16:57:20 +0530 | [diff] [blame] | 2663 | wma_handle->ito_repeat_count = cds_cfg->ito_repeat_count; |
| 2664 | |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 2665 | /* Register PWR_SAVE_FAIL event only in case of recovery(1) */ |
| 2666 | if (cds_cfg->auto_power_save_fail_mode) { |
| 2667 | wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 2668 | WMI_PDEV_CHIP_POWER_SAVE_FAILURE_DETECTED_EVENTID, |
| 2669 | wma_chip_power_save_failure_detected_handler, |
| 2670 | WMA_RX_WORK_CTX); |
| 2671 | } |
| 2672 | |
Deepak Dhamdhere | bf1f9b1 | 2016-05-27 14:49:41 -0700 | [diff] [blame] | 2673 | wma_ndp_register_all_event_handlers(wma_handle); |
Frank Liu | 65b17d9 | 2016-11-23 15:58:44 +0800 | [diff] [blame] | 2674 | |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2675 | wma_register_debug_callback(); |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 2676 | /* Register callback with PMO so PMO can update the vdev pause bitmap*/ |
| 2677 | pmo_register_pause_bitmap_notifier(wma_handle->psoc, |
| 2678 | wma_vdev_update_pause_bitmap); |
| 2679 | pmo_register_get_pause_bitmap(wma_handle->psoc, |
| 2680 | wma_vdev_get_pause_bitmap); |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 2681 | pmo_register_is_device_in_low_pwr_mode(wma_handle->psoc, |
| 2682 | wma_vdev_is_device_in_low_pwr_mode); |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 2683 | wma_cbacks.wma_get_connection_info = wma_get_connection_info; |
| 2684 | wma_cbacks.wma_is_service_enabled = wma_is_service_enabled; |
| 2685 | qdf_status = policy_mgr_register_wma_cb(wma_handle->psoc, &wma_cbacks); |
| 2686 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 2687 | WMA_LOGE("Failed to register wma cb with Policy Manager"); |
| 2688 | } |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 2689 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2690 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2691 | |
| 2692 | err_dbglog_init: |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 2693 | qdf_wake_lock_destroy(&wma_handle->wmi_cmd_rsp_wake_lock); |
| 2694 | qdf_runtime_lock_deinit(wma_handle->wmi_cmd_rsp_runtime_lock); |
| 2695 | qdf_spinlock_destroy(&wma_handle->vdev_respq_lock); |
| 2696 | qdf_spinlock_destroy(&wma_handle->wma_hold_req_q_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2697 | err_event_init: |
| 2698 | wmi_unified_unregister_event_handler(wma_handle->wmi_handle, |
| 2699 | WMI_DEBUG_PRINT_EVENTID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2700 | qdf_mem_free(wma_handle->interfaces); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2701 | err_scn_context: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2702 | #if defined(QCA_WIFI_FTM) |
| 2703 | wma_utf_detach(wma_handle); |
| 2704 | #endif /* QCA_WIFI_FTM */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2705 | qdf_mem_free(((p_cds_contextType) cds_context)->cfg_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2706 | OS_FREE(wmi_handle); |
| 2707 | |
| 2708 | err_wma_handle: |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 2709 | qdf_mem_free(tgt_psoc_info); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2710 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2711 | #ifdef FEATURE_WLAN_EXTSCAN |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 2712 | qdf_wake_lock_destroy(&wma_handle->extscan_wake_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2713 | #endif /* FEATURE_WLAN_EXTSCAN */ |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 2714 | qdf_wake_lock_destroy(&wma_handle->wow_wake_lock); |
Mukul Sharma | e44d054 | 2017-05-23 21:50:56 +0530 | [diff] [blame] | 2715 | qdf_wake_lock_destroy(&wma_handle->wow_auth_req_wl); |
| 2716 | qdf_wake_lock_destroy(&wma_handle->wow_assoc_req_wl); |
| 2717 | qdf_wake_lock_destroy(&wma_handle->wow_deauth_rec_wl); |
| 2718 | qdf_wake_lock_destroy(&wma_handle->wow_disassoc_rec_wl); |
| 2719 | qdf_wake_lock_destroy(&wma_handle->wow_ap_assoc_lost_wl); |
| 2720 | qdf_wake_lock_destroy(&wma_handle->wow_auto_shutdown_wl); |
| 2721 | qdf_wake_lock_destroy(&wma_handle->roam_ho_wl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2722 | } |
Houston Hoffman | c45db89 | 2015-11-13 19:59:25 -0800 | [diff] [blame] | 2723 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2724 | cds_free_context(cds_context, QDF_MODULE_ID_WMA, wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2725 | |
| 2726 | WMA_LOGD("%s: Exit", __func__); |
| 2727 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2728 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2729 | } |
| 2730 | |
| 2731 | /** |
| 2732 | * wma_pre_start() - wma pre start |
| 2733 | * @cds_ctx: cds context |
| 2734 | * |
| 2735 | * Return: 0 on success, errno on failure |
| 2736 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2737 | QDF_STATUS wma_pre_start(void *cds_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2738 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2739 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2740 | A_STATUS status = A_OK; |
| 2741 | tp_wma_handle wma_handle; |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 2742 | struct scheduler_msg wma_msg = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2743 | |
| 2744 | WMA_LOGD("%s: Enter", __func__); |
| 2745 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2746 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2747 | |
| 2748 | /* Validate the wma_handle */ |
| 2749 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2750 | WMA_LOGE("%s: invalid argument", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2751 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2752 | goto end; |
| 2753 | } |
| 2754 | /* Open endpoint for ctrl path - WMI <--> HTC */ |
| 2755 | status = wmi_unified_connect_htc_service(wma_handle->wmi_handle, |
| 2756 | wma_handle->htc_handle); |
| 2757 | if (A_OK != status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2758 | WMA_LOGE("%s: wmi_unified_connect_htc_service", __func__); |
Nachiket Kukade | 8003d25 | 2017-03-30 15:55:58 +0530 | [diff] [blame] | 2759 | |
| 2760 | if (!cds_is_fw_down()) |
| 2761 | QDF_BUG(0); |
| 2762 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2763 | qdf_status = QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2764 | goto end; |
| 2765 | } |
| 2766 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 2767 | WMA_LOGD("WMA --> wmi_unified_connect_htc_service - success"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2768 | |
| 2769 | /* Trigger the CFG DOWNLOAD */ |
| 2770 | wma_msg.type = WNI_CFG_DNLD_REQ; |
| 2771 | wma_msg.bodyptr = NULL; |
| 2772 | wma_msg.bodyval = 0; |
| 2773 | |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 2774 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, &wma_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2775 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2776 | WMA_LOGE("%s: Failed to post WNI_CFG_DNLD_REQ msg", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2777 | QDF_ASSERT(0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2778 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2779 | } |
| 2780 | end: |
| 2781 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2782 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2783 | } |
| 2784 | |
| 2785 | /** |
| 2786 | * wma_send_msg() - Send wma message to PE. |
| 2787 | * @wma_handle: wma handle |
| 2788 | * @msg_type: message type |
| 2789 | * @body_ptr: message body ptr |
| 2790 | * @body_val: message body value |
| 2791 | * |
| 2792 | * Return: none |
| 2793 | */ |
| 2794 | void wma_send_msg(tp_wma_handle wma_handle, uint16_t msg_type, |
| 2795 | void *body_ptr, uint32_t body_val) |
| 2796 | { |
Rajeev Kumar | 416b73f | 2017-01-21 16:45:21 -0800 | [diff] [blame] | 2797 | struct scheduler_msg msg = { 0 }; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2798 | uint32_t status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2799 | tpAniSirGlobal pMac = cds_get_context(QDF_MODULE_ID_PE); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 2800 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2801 | msg.type = msg_type; |
| 2802 | msg.bodyval = body_val; |
| 2803 | msg.bodyptr = body_ptr; |
| 2804 | status = lim_post_msg_api(pMac, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2805 | if (QDF_STATUS_SUCCESS != status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2806 | if (NULL != body_ptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2807 | qdf_mem_free(body_ptr); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2808 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2809 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2810 | } |
| 2811 | |
| 2812 | /** |
| 2813 | * wma_set_base_macaddr_indicate() - set base mac address in fw |
| 2814 | * @wma_handle: wma handle |
| 2815 | * @customAddr: base mac address |
| 2816 | * |
| 2817 | * Return: 0 for success or error code |
| 2818 | */ |
| 2819 | static int wma_set_base_macaddr_indicate(tp_wma_handle wma_handle, |
| 2820 | tSirMacAddr *customAddr) |
| 2821 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2822 | int err; |
| 2823 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 2824 | err = wmi_unified_set_base_macaddr_indicate_cmd(wma_handle->wmi_handle, |
| 2825 | (uint8_t *)customAddr); |
| 2826 | if (err) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2827 | return -EIO; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2828 | WMA_LOGD("Base MAC Addr: " MAC_ADDRESS_STR, |
| 2829 | MAC_ADDR_ARRAY((*customAddr))); |
| 2830 | |
| 2831 | return 0; |
| 2832 | } |
| 2833 | |
| 2834 | /** |
| 2835 | * wma_log_supported_evt_handler() - Enable/Disable FW diag/log events |
| 2836 | * @handle: WMA handle |
| 2837 | * @event: Event received from FW |
| 2838 | * @len: Length of the event |
| 2839 | * |
| 2840 | * Enables the low frequency events and disables the high frequency |
| 2841 | * events. Bit 17 indicates if the event if low/high frequency. |
| 2842 | * 1 - high frequency, 0 - low frequency |
| 2843 | * |
| 2844 | * Return: 0 on successfully enabling/disabling the events |
| 2845 | */ |
| 2846 | static int wma_log_supported_evt_handler(void *handle, |
| 2847 | uint8_t *event, |
| 2848 | uint32_t len) |
| 2849 | { |
| 2850 | tp_wma_handle wma = (tp_wma_handle) handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2851 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 2852 | if (wmi_unified_log_supported_evt_cmd(wma->wmi_handle, |
| 2853 | event, len)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2854 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2855 | |
| 2856 | return 0; |
| 2857 | } |
| 2858 | |
| 2859 | /** |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 2860 | * 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] | 2861 | * @handle: WMI handle |
| 2862 | * @event: Event recevied from FW |
| 2863 | * @len: Length of the event |
| 2864 | * |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 2865 | * Event handler for WMI_PDEV_SET_HW_MODE_RESP_EVENTID that is sent to host |
| 2866 | * driver in response to a WMI_PDEV_SET_HW_MODE_CMDID being sent to WLAN |
| 2867 | * firmware |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2868 | * |
| 2869 | * Return: Success on receiving valid params from FW |
| 2870 | */ |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 2871 | static int wma_pdev_set_hw_mode_resp_evt_handler(void *handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2872 | uint8_t *event, |
| 2873 | uint32_t len) |
| 2874 | { |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 2875 | WMI_PDEV_SET_HW_MODE_RESP_EVENTID_param_tlvs *param_buf; |
| 2876 | wmi_pdev_set_hw_mode_response_event_fixed_param *wmi_event; |
| 2877 | wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2878 | uint32_t i; |
| 2879 | struct sir_set_hw_mode_resp *hw_mode_resp; |
| 2880 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 2881 | |
| 2882 | if (!wma) { |
| 2883 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 2884 | /* Since WMA handle itself is NULL, we cannot send fail |
| 2885 | * response back to LIM here |
| 2886 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2887 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2888 | } |
Krunal Soni | cebcc29 | 2017-06-14 19:59:20 -0700 | [diff] [blame] | 2889 | wma_release_wmi_resp_wakelock(wma); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2890 | hw_mode_resp = qdf_mem_malloc(sizeof(*hw_mode_resp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2891 | if (!hw_mode_resp) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2892 | WMA_LOGE("%s: Memory allocation failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2893 | /* Since this memory allocation itself failed, we cannot |
| 2894 | * send fail response back to LIM here |
| 2895 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2896 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2897 | } |
| 2898 | |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 2899 | param_buf = (WMI_PDEV_SET_HW_MODE_RESP_EVENTID_param_tlvs *) event; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2900 | if (!param_buf) { |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 2901 | WMA_LOGE("Invalid WMI_PDEV_SET_HW_MODE_RESP_EVENTID event"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2902 | /* Need to send response back to upper layer to free |
| 2903 | * active command list |
| 2904 | */ |
| 2905 | goto fail; |
| 2906 | } |
| 2907 | |
| 2908 | wmi_event = param_buf->fixed_param; |
| 2909 | hw_mode_resp->status = wmi_event->status; |
| 2910 | hw_mode_resp->cfgd_hw_mode_index = wmi_event->cfgd_hw_mode_index; |
| 2911 | hw_mode_resp->num_vdev_mac_entries = wmi_event->num_vdev_mac_entries; |
| 2912 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2913 | WMA_LOGE("%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] | 2914 | __func__, wmi_event->status, |
| 2915 | wmi_event->cfgd_hw_mode_index, |
| 2916 | wmi_event->num_vdev_mac_entries); |
| 2917 | vdev_mac_entry = |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 2918 | param_buf->wmi_pdev_set_hw_mode_response_vdev_mac_mapping; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2919 | |
| 2920 | /* Store the vdev-mac map in WMA and prepare to send to PE */ |
| 2921 | for (i = 0; i < wmi_event->num_vdev_mac_entries; i++) { |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 2922 | uint32_t vdev_id, mac_id, pdev_id; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 2923 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2924 | vdev_id = vdev_mac_entry[i].vdev_id; |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 2925 | pdev_id = vdev_mac_entry[i].pdev_id; |
| 2926 | if (pdev_id == WMI_PDEV_ID_SOC) { |
| 2927 | WMA_LOGE("%s: soc level id received for mac id)", |
| 2928 | __func__); |
| 2929 | QDF_BUG(0); |
| 2930 | goto fail; |
| 2931 | } |
| 2932 | 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] | 2933 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2934 | WMA_LOGE("%s: vdev_id:%d mac_id:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2935 | __func__, vdev_id, mac_id); |
| 2936 | |
| 2937 | hw_mode_resp->vdev_mac_map[i].vdev_id = vdev_id; |
| 2938 | hw_mode_resp->vdev_mac_map[i].mac_id = mac_id; |
| 2939 | wma_update_intf_hw_mode_params(vdev_id, mac_id, |
| 2940 | wmi_event->cfgd_hw_mode_index); |
| 2941 | } |
| 2942 | |
| 2943 | if (hw_mode_resp->status == SET_HW_MODE_STATUS_OK) { |
| 2944 | if (WMA_DEFAULT_HW_MODE_INDEX == wma->new_hw_mode_index) { |
| 2945 | wma->new_hw_mode_index = wmi_event->cfgd_hw_mode_index; |
| 2946 | } else { |
| 2947 | wma->old_hw_mode_index = wma->new_hw_mode_index; |
| 2948 | wma->new_hw_mode_index = wmi_event->cfgd_hw_mode_index; |
| 2949 | } |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 2950 | policy_mgr_update_hw_mode_index(wma->psoc, |
| 2951 | wmi_event->cfgd_hw_mode_index); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2952 | } |
| 2953 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2954 | WMA_LOGE("%s: Updated: old_hw_mode_index:%d new_hw_mode_index:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2955 | __func__, wma->old_hw_mode_index, wma->new_hw_mode_index); |
| 2956 | |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 2957 | wma_send_msg(wma, SIR_HAL_PDEV_SET_HW_MODE_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2958 | (void *) hw_mode_resp, 0); |
| 2959 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2960 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2961 | |
| 2962 | fail: |
| 2963 | WMA_LOGE("%s: Sending fail response to LIM", __func__); |
| 2964 | hw_mode_resp->status = SET_HW_MODE_STATUS_ECANCELED; |
| 2965 | hw_mode_resp->cfgd_hw_mode_index = 0; |
| 2966 | hw_mode_resp->num_vdev_mac_entries = 0; |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 2967 | wma_send_msg(wma, SIR_HAL_PDEV_SET_HW_MODE_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2968 | (void *) hw_mode_resp, 0); |
| 2969 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2970 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2971 | } |
| 2972 | |
| 2973 | /** |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 2974 | * wma_process_pdev_hw_mode_trans_ind() - Process HW mode transition info |
| 2975 | * |
| 2976 | * @handle: WMA handle |
| 2977 | * @fixed_param: Event fixed parameters |
| 2978 | * @vdev_mac_entry - vdev mac entry |
| 2979 | * @hw_mode_trans_ind - Buffer to store parsed information |
| 2980 | * |
| 2981 | * Parses fixed_param, vdev_mac_entry and fills in the information into |
| 2982 | * hw_mode_trans_ind and wma |
| 2983 | * |
| 2984 | * Return: None |
| 2985 | */ |
| 2986 | void wma_process_pdev_hw_mode_trans_ind(void *handle, |
| 2987 | wmi_pdev_hw_mode_transition_event_fixed_param *fixed_param, |
| 2988 | wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry, |
| 2989 | struct sir_hw_mode_trans_ind *hw_mode_trans_ind) |
| 2990 | { |
| 2991 | uint32_t i; |
| 2992 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 2993 | |
| 2994 | hw_mode_trans_ind->old_hw_mode_index = fixed_param->old_hw_mode_index; |
| 2995 | hw_mode_trans_ind->new_hw_mode_index = fixed_param->new_hw_mode_index; |
| 2996 | hw_mode_trans_ind->num_vdev_mac_entries = |
| 2997 | fixed_param->num_vdev_mac_entries; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 2998 | WMA_LOGE("%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] | 2999 | __func__, fixed_param->old_hw_mode_index, |
| 3000 | fixed_param->new_hw_mode_index, |
| 3001 | fixed_param->num_vdev_mac_entries); |
| 3002 | |
| 3003 | /* Store the vdev-mac map in WMA and send to policy manager */ |
| 3004 | for (i = 0; i < fixed_param->num_vdev_mac_entries; i++) { |
| 3005 | uint32_t vdev_id, mac_id, pdev_id; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3006 | |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3007 | vdev_id = vdev_mac_entry[i].vdev_id; |
| 3008 | pdev_id = vdev_mac_entry[i].pdev_id; |
| 3009 | |
| 3010 | if (pdev_id == WMI_PDEV_ID_SOC) { |
| 3011 | WMA_LOGE("%s: soc level id received for mac id)", |
| 3012 | __func__); |
| 3013 | QDF_BUG(0); |
| 3014 | return; |
| 3015 | } |
| 3016 | |
| 3017 | mac_id = WMA_PDEV_TO_MAC_MAP(vdev_mac_entry[i].pdev_id); |
| 3018 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3019 | WMA_LOGE("%s: vdev_id:%d mac_id:%d", |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3020 | __func__, vdev_id, mac_id); |
| 3021 | |
| 3022 | hw_mode_trans_ind->vdev_mac_map[i].vdev_id = vdev_id; |
| 3023 | hw_mode_trans_ind->vdev_mac_map[i].mac_id = mac_id; |
| 3024 | wma_update_intf_hw_mode_params(vdev_id, mac_id, |
| 3025 | fixed_param->new_hw_mode_index); |
| 3026 | } |
| 3027 | wma->old_hw_mode_index = fixed_param->old_hw_mode_index; |
| 3028 | wma->new_hw_mode_index = fixed_param->new_hw_mode_index; |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 3029 | policy_mgr_update_new_hw_mode_index(wma->psoc, |
| 3030 | fixed_param->new_hw_mode_index); |
| 3031 | policy_mgr_update_old_hw_mode_index(wma->psoc, |
| 3032 | fixed_param->old_hw_mode_index); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3033 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3034 | WMA_LOGE("%s: Updated: old_hw_mode_index:%d new_hw_mode_index:%d", |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3035 | __func__, wma->old_hw_mode_index, wma->new_hw_mode_index); |
| 3036 | } |
| 3037 | |
| 3038 | /** |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3039 | * wma_pdev_hw_mode_transition_evt_handler() - HW mode transition evt handler |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3040 | * @handle: WMI handle |
| 3041 | * @event: Event recevied from FW |
| 3042 | * @len: Length of the event |
| 3043 | * |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3044 | * Event handler for WMI_PDEV_HW_MODE_TRANSITION_EVENTID that indicates an |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3045 | * asynchronous hardware mode transition. This event notifies the host driver |
| 3046 | * that firmware independently changed the hardware mode for some reason, such |
| 3047 | * as Coex, LFR 3.0, etc |
| 3048 | * |
| 3049 | * Return: Success on receiving valid params from FW |
| 3050 | */ |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3051 | static int wma_pdev_hw_mode_transition_evt_handler(void *handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3052 | uint8_t *event, |
| 3053 | uint32_t len) |
| 3054 | { |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3055 | WMI_PDEV_HW_MODE_TRANSITION_EVENTID_param_tlvs *param_buf; |
| 3056 | wmi_pdev_hw_mode_transition_event_fixed_param *wmi_event; |
| 3057 | wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3058 | struct sir_hw_mode_trans_ind *hw_mode_trans_ind; |
| 3059 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 3060 | |
| 3061 | if (!wma) { |
| 3062 | /* This is an async event. So, not sending any event to LIM */ |
| 3063 | WMA_LOGE("Invalid WMA handle"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3064 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3065 | } |
| 3066 | |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3067 | param_buf = (WMI_PDEV_HW_MODE_TRANSITION_EVENTID_param_tlvs *) event; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3068 | if (!param_buf) { |
| 3069 | /* This is an async event. So, not sending any event to LIM */ |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3070 | WMA_LOGE("Invalid WMI_PDEV_HW_MODE_TRANSITION_EVENTID event"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3071 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3072 | } |
| 3073 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3074 | hw_mode_trans_ind = qdf_mem_malloc(sizeof(*hw_mode_trans_ind)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3075 | if (!hw_mode_trans_ind) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3076 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 3077 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3078 | } |
| 3079 | |
| 3080 | wmi_event = param_buf->fixed_param; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3081 | vdev_mac_entry = |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3082 | param_buf->wmi_pdev_set_hw_mode_response_vdev_mac_mapping; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 3083 | wma_process_pdev_hw_mode_trans_ind(wma, wmi_event, vdev_mac_entry, |
| 3084 | hw_mode_trans_ind); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3085 | /* Pass the message to PE */ |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3086 | wma_send_msg(wma, SIR_HAL_PDEV_HW_MODE_TRANS_IND, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3087 | (void *) hw_mode_trans_ind, 0); |
| 3088 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3089 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3090 | } |
| 3091 | |
| 3092 | /** |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 3093 | * 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] | 3094 | * @handle: WMI handle |
| 3095 | * @event: Event received from FW |
| 3096 | * @len: Length of the event |
| 3097 | * |
| 3098 | * Notifies the host driver of the completion or failure of a |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 3099 | * 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] | 3100 | * the host driver once the firmware has completed a reconfiguration of the Scan |
| 3101 | * and FW mode configuration. This changes could include entering or leaving a |
| 3102 | * dual mac configuration for either scan and/or more permanent firmware mode. |
| 3103 | * |
| 3104 | * Return: Success on receiving valid params from FW |
| 3105 | */ |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 3106 | 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] | 3107 | uint8_t *event, |
| 3108 | uint32_t len) |
| 3109 | { |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 3110 | WMI_PDEV_SET_MAC_CONFIG_RESP_EVENTID_param_tlvs *param_buf; |
| 3111 | wmi_pdev_set_mac_config_response_event_fixed_param *wmi_event; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3112 | tp_wma_handle wma = (tp_wma_handle) handle; |
| 3113 | struct sir_dual_mac_config_resp *dual_mac_cfg_resp; |
| 3114 | |
| 3115 | if (!wma) { |
| 3116 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 3117 | /* Since the WMA handle is NULL, we cannot send resp to LIM. |
| 3118 | * So, returning from here. |
| 3119 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3120 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3121 | } |
| 3122 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3123 | dual_mac_cfg_resp = qdf_mem_malloc(sizeof(*dual_mac_cfg_resp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3124 | if (!dual_mac_cfg_resp) { |
| 3125 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 3126 | /* Since the mem alloc failed, we cannot send resp to LIM. |
| 3127 | * So, returning from here. |
| 3128 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3129 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3130 | } |
| 3131 | |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 3132 | param_buf = (WMI_PDEV_SET_MAC_CONFIG_RESP_EVENTID_param_tlvs *) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3133 | event; |
| 3134 | if (!param_buf) { |
| 3135 | WMA_LOGE("%s: Invalid event", __func__); |
| 3136 | goto fail; |
| 3137 | } |
| 3138 | |
| 3139 | wmi_event = param_buf->fixed_param; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3140 | WMA_LOGD("%s: status:%d", __func__, wmi_event->status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3141 | dual_mac_cfg_resp->status = wmi_event->status; |
| 3142 | |
| 3143 | if (SET_HW_MODE_STATUS_OK == dual_mac_cfg_resp->status) { |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 3144 | policy_mgr_update_dbs_scan_config(wma->psoc); |
| 3145 | policy_mgr_update_dbs_fw_config(wma->psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3146 | } |
| 3147 | |
| 3148 | /* Pass the message to PE */ |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 3149 | wma_send_msg(wma, SIR_HAL_PDEV_MAC_CFG_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3150 | (void *) dual_mac_cfg_resp, 0); |
| 3151 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3152 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3153 | |
| 3154 | fail: |
| 3155 | WMA_LOGE("%s: Sending fail response to LIM", __func__); |
| 3156 | dual_mac_cfg_resp->status = SET_HW_MODE_STATUS_ECANCELED; |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 3157 | wma_send_msg(wma, SIR_HAL_PDEV_MAC_CFG_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3158 | (void *) dual_mac_cfg_resp, 0); |
| 3159 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3160 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3161 | |
| 3162 | } |
| 3163 | |
| 3164 | /** |
| 3165 | * wma_start() - wma start function. |
| 3166 | * Intialize event handlers and timers. |
| 3167 | * @cds_ctx: cds context |
| 3168 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 3169 | * Return: 0 on success, QDF Error on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3170 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3171 | QDF_STATUS wma_start(void *cds_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3172 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3173 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3174 | tp_wma_handle wma_handle; |
| 3175 | int status; |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 3176 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3177 | WMA_LOGD("%s: Enter", __func__); |
| 3178 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3179 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3180 | /* validate the wma_handle */ |
| 3181 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3182 | WMA_LOGE("%s: Invalid handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3183 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3184 | goto end; |
| 3185 | } |
Sandeep Puligilla | d000421 | 2017-02-26 18:34:56 -0800 | [diff] [blame] | 3186 | #ifndef NAPIER_SCAN |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3187 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 3188 | WMI_SCAN_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3189 | wma_scan_event_callback, |
| 3190 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3191 | if (0 != status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3192 | WMA_LOGE("%s: Failed to register scan callback", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3193 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3194 | goto end; |
| 3195 | } |
Sandeep Puligilla | d000421 | 2017-02-26 18:34:56 -0800 | [diff] [blame] | 3196 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3197 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 3198 | WMI_ROAM_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3199 | wma_roam_event_callback, |
Padma, Santhosh Kumar | 18169ce | 2017-03-02 18:04:02 +0530 | [diff] [blame] | 3200 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3201 | if (0 != status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3202 | WMA_LOGE("%s: Failed to register Roam callback", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3203 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3204 | goto end; |
| 3205 | } |
| 3206 | |
| 3207 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 3208 | WMI_WOW_WAKEUP_HOST_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3209 | wma_wow_wakeup_host_event, |
| 3210 | WMA_RX_TASKLET_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3211 | if (status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3212 | WMA_LOGE("%s: Failed to register wow wakeup host event handler", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3213 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3214 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3215 | goto end; |
| 3216 | } |
| 3217 | |
| 3218 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 3219 | WMI_PDEV_RESUME_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3220 | wma_pdev_resume_event_handler, |
| 3221 | WMA_RX_TASKLET_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3222 | if (status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3223 | WMA_LOGE("%s: Failed to register PDEV resume event handler", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3224 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3225 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3226 | goto end; |
| 3227 | } |
Poddar, Siddarth | 5a91f5b | 2016-04-28 12:24:10 +0530 | [diff] [blame] | 3228 | #if defined(QCA_LL_LEGACY_TX_FLOW_CONTROL) || \ |
| 3229 | defined(QCA_LL_TX_FLOW_CONTROL_V2) || defined(CONFIG_HL_SUPPORT) |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 3230 | WMA_LOGD("MCC TX Pause Event Handler register"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3231 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3232 | WMI_TX_PAUSE_EVENTID, |
| 3233 | wma_mcc_vdev_tx_pause_evt_handler, |
| 3234 | WMA_RX_TASKLET_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3235 | #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ |
| 3236 | |
| 3237 | #ifdef FEATURE_WLAN_CH_AVOID |
| 3238 | WMA_LOGD("Registering channel to avoid handler"); |
| 3239 | |
| 3240 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3241 | WMI_WLAN_FREQ_AVOID_EVENTID, |
| 3242 | wma_channel_avoid_evt_handler, |
| 3243 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3244 | if (status) { |
| 3245 | WMA_LOGE("Failed to register channel to avoid event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3246 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3247 | goto end; |
| 3248 | } |
| 3249 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 3250 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 3251 | WMA_LOGD("Registering auto shutdown handler"); |
| 3252 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3253 | WMI_HOST_AUTO_SHUTDOWN_EVENTID, |
| 3254 | wma_auto_shutdown_event_handler, |
| 3255 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3256 | if (status) { |
| 3257 | WMA_LOGE("Failed to register WMI Auto shutdown event handler"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3258 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3259 | goto end; |
| 3260 | } |
| 3261 | #endif /* FEATURE_WLAN_AUTO_SHUTDOWN */ |
| 3262 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3263 | WMI_THERMAL_MGMT_EVENTID, |
| 3264 | wma_thermal_mgmt_evt_handler, |
| 3265 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3266 | if (status) { |
| 3267 | WMA_LOGE("Failed to register thermal mitigation event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3268 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3269 | goto end; |
| 3270 | } |
| 3271 | |
| 3272 | status = wma_ocb_register_event_handlers(wma_handle); |
| 3273 | if (status) { |
| 3274 | WMA_LOGE("Failed to register ocb event handlers"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3275 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3276 | goto end; |
| 3277 | } |
| 3278 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3279 | qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3280 | |
| 3281 | #ifdef QCA_WIFI_FTM |
| 3282 | /* |
| 3283 | * Tx mgmt attach requires TXRX context which is not created |
| 3284 | * in FTM mode. So skip the TX mgmt attach. |
| 3285 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3286 | if (cds_get_conparam() == QDF_GLOBAL_FTM_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3287 | goto end; |
| 3288 | #endif /* QCA_WIFI_FTM */ |
| 3289 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3290 | if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 3291 | WMI_SERVICE_RMC)) { |
| 3292 | |
| 3293 | WMA_LOGD("FW supports cesium network, registering event handlers"); |
| 3294 | |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3295 | status = wmi_unified_register_event_handler( |
| 3296 | wma_handle->wmi_handle, |
| 3297 | WMI_PEER_INFO_EVENTID, |
| 3298 | wma_ibss_peer_info_event_handler, |
| 3299 | WMA_RX_SERIALIZER_CTX); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3300 | if (status) { |
| 3301 | WMA_LOGE("Failed to register ibss peer info event cb"); |
| 3302 | qdf_status = QDF_STATUS_E_FAILURE; |
| 3303 | goto end; |
| 3304 | } |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3305 | status = wmi_unified_register_event_handler( |
| 3306 | wma_handle->wmi_handle, |
| 3307 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID, |
| 3308 | wma_fast_tx_fail_event_handler, |
| 3309 | WMA_RX_SERIALIZER_CTX); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 3310 | if (status) { |
| 3311 | WMA_LOGE("Failed to register peer fast tx failure event cb"); |
| 3312 | qdf_status = QDF_STATUS_E_FAILURE; |
| 3313 | goto end; |
| 3314 | } |
| 3315 | } else { |
| 3316 | WMA_LOGE("Target does not support cesium network"); |
| 3317 | } |
| 3318 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3319 | qdf_status = wma_tx_attach(wma_handle); |
| 3320 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3321 | WMA_LOGE("%s: Failed to register tx management", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3322 | goto end; |
| 3323 | } |
| 3324 | |
| 3325 | /* Initialize log completion timeout */ |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 3326 | qdf_status = qdf_mc_timer_init(&wma_handle->log_completion_timer, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3327 | QDF_TIMER_TYPE_SW, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3328 | wma_log_completion_timeout, |
| 3329 | wma_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3330 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3331 | WMA_LOGE("Failed to initialize log completion timeout"); |
| 3332 | goto end; |
| 3333 | } |
| 3334 | |
Jeff Johnson | 6136fb9 | 2017-03-30 15:21:49 -0700 | [diff] [blame] | 3335 | status = wma_fips_register_event_handlers(wma_handle); |
| 3336 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 3337 | WMA_LOGE("Failed to register FIPS event handler"); |
| 3338 | qdf_status = QDF_STATUS_E_FAILURE; |
| 3339 | goto end; |
| 3340 | } |
| 3341 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3342 | /* Initialize the get temperature event handler */ |
| 3343 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3344 | WMI_PDEV_TEMPERATURE_EVENTID, |
| 3345 | wma_pdev_temperature_evt_handler, |
| 3346 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3347 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3348 | WMA_LOGE("Failed to register get_temperature event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3349 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3350 | goto end; |
| 3351 | } |
| 3352 | |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 3353 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 3354 | WMI_VDEV_TSF_REPORT_EVENTID, |
| 3355 | wma_vdev_tsf_handler, |
| 3356 | WMA_RX_SERIALIZER_CTX); |
| 3357 | if (0 != status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3358 | WMA_LOGE("%s: Failed to register tsf callback", __func__); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 3359 | qdf_status = QDF_STATUS_E_FAILURE; |
| 3360 | goto end; |
| 3361 | } |
| 3362 | |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3363 | /* Initialize the wma_pdev_set_hw_mode_resp_evt_handler event handler */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3364 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 3365 | WMI_PDEV_SET_HW_MODE_RESP_EVENTID, |
| 3366 | wma_pdev_set_hw_mode_resp_evt_handler, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3367 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3368 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3369 | WMA_LOGE("Failed to register set hw mode resp event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3370 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3371 | goto end; |
| 3372 | } |
| 3373 | |
| 3374 | /* Initialize the WMI_SOC_HW_MODE_TRANSITION_EVENTID event handler */ |
| 3375 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Manishekar Chandrasekaran | 05fd267 | 2016-04-27 12:59:20 +0530 | [diff] [blame] | 3376 | WMI_PDEV_HW_MODE_TRANSITION_EVENTID, |
| 3377 | wma_pdev_hw_mode_transition_evt_handler, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3378 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3379 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3380 | WMA_LOGE("Failed to register hw mode transition event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3381 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3382 | goto end; |
| 3383 | } |
| 3384 | |
| 3385 | /* Initialize the set dual mac configuration event handler */ |
| 3386 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 3387 | WMI_PDEV_SET_MAC_CONFIG_RESP_EVENTID, |
| 3388 | wma_pdev_set_dual_mode_config_resp_evt_handler, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 3389 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3390 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3391 | WMA_LOGE("Failed to register hw mode transition event cb"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3392 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3393 | goto end; |
| 3394 | } |
| 3395 | |
Wu Gao | 9a704f4 | 2017-03-10 18:42:11 +0800 | [diff] [blame] | 3396 | #ifndef CONVERGED_P2P_ENABLE |
Peng Xu | 8fdaa49 | 2016-06-22 10:20:47 -0700 | [diff] [blame] | 3397 | /* Initialize the P2P Listen Offload event handler */ |
| 3398 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 3399 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID, |
| 3400 | wma_p2p_lo_event_handler, |
| 3401 | WMA_RX_SERIALIZER_CTX); |
| 3402 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 3403 | WMA_LOGE("Failed to register p2p lo event cb"); |
| 3404 | qdf_status = QDF_STATUS_E_FAILURE; |
| 3405 | goto end; |
| 3406 | } |
Wu Gao | 9a704f4 | 2017-03-10 18:42:11 +0800 | [diff] [blame] | 3407 | #endif |
Peng Xu | 8fdaa49 | 2016-06-22 10:20:47 -0700 | [diff] [blame] | 3408 | |
Vidyullatha Kanchanapally | be0ebb3 | 2017-03-23 14:36:21 +0530 | [diff] [blame] | 3409 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 3410 | WMI_WLAN_COEX_BT_ACTIVITY_EVENTID, |
| 3411 | wma_wlan_bt_activity_evt_handler, |
| 3412 | WMA_RX_SERIALIZER_CTX); |
| 3413 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 3414 | WMA_LOGE("Failed to register coex bt activity event handler"); |
| 3415 | qdf_status = QDF_STATUS_E_FAILURE; |
| 3416 | goto end; |
| 3417 | } |
| 3418 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3419 | end: |
| 3420 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3421 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3422 | } |
| 3423 | |
| 3424 | /** |
| 3425 | * wma_stop() - wma stop function. |
| 3426 | * cleanup timers and suspend target. |
| 3427 | * @cds_ctx: cds context |
| 3428 | * @reason: reason for wma_stop. |
| 3429 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 3430 | * Return: 0 on success, QDF Error on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3431 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3432 | QDF_STATUS wma_stop(void *cds_ctx, uint8_t reason) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3433 | { |
| 3434 | tp_wma_handle wma_handle; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3435 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | ede435f | 2015-12-01 16:16:36 +0530 | [diff] [blame] | 3436 | int i; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3437 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3438 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3439 | WMA_LOGD("%s: Enter", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3440 | /* validate the wma_handle */ |
| 3441 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3442 | WMA_LOGE("%s: Invalid handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3443 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3444 | goto end; |
| 3445 | } |
| 3446 | #ifdef QCA_WIFI_FTM |
| 3447 | /* |
| 3448 | * Tx mgmt detach requires TXRX context which is not created |
| 3449 | * in FTM mode. So skip the TX mgmt detach. |
| 3450 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3451 | if (cds_get_conparam() == QDF_GLOBAL_FTM_MODE) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3452 | qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3453 | goto end; |
| 3454 | } |
| 3455 | #endif /* QCA_WIFI_FTM */ |
| 3456 | |
| 3457 | if (wma_handle->ack_work_ctx) { |
| 3458 | cds_flush_work(&wma_handle->ack_work_ctx->ack_cmp_work); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3459 | qdf_mem_free(wma_handle->ack_work_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3460 | wma_handle->ack_work_ctx = NULL; |
| 3461 | } |
| 3462 | |
| 3463 | /* Destroy the timer for log completion */ |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 3464 | qdf_status = qdf_mc_timer_destroy(&wma_handle->log_completion_timer); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3465 | if (qdf_status != QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3466 | WMA_LOGE("Failed to destroy the log completion timer"); |
Govind Singh | ede435f | 2015-12-01 16:16:36 +0530 | [diff] [blame] | 3467 | /* clean up ll-queue for all vdev */ |
| 3468 | for (i = 0; i < wma_handle->max_bssid; i++) { |
| 3469 | if (wma_handle->interfaces[i].handle && |
Mukul Sharma | f904723 | 2017-03-02 16:58:56 +0530 | [diff] [blame] | 3470 | wma_is_vdev_up(i)) { |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 3471 | cdp_fc_vdev_flush( |
| 3472 | cds_get_context(QDF_MODULE_ID_SOC), |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3473 | wma_handle-> |
| 3474 | interfaces[i].handle); |
Govind Singh | ede435f | 2015-12-01 16:16:36 +0530 | [diff] [blame] | 3475 | } |
| 3476 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3477 | qdf_status = wma_tx_detach(wma_handle); |
| 3478 | if (qdf_status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3479 | WMA_LOGE("%s: Failed to deregister tx management", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3480 | goto end; |
| 3481 | } |
| 3482 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3483 | end: |
| 3484 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3485 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3486 | } |
| 3487 | |
| 3488 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3489 | * wma_wmi_service_close() - close wma wmi service interface. |
| 3490 | * @cds_ctx: cds context |
| 3491 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 3492 | * Return: 0 on success, QDF Error on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3493 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3494 | QDF_STATUS wma_wmi_service_close(void *cds_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3495 | { |
| 3496 | tp_wma_handle wma_handle; |
| 3497 | struct beacon_info *bcn; |
| 3498 | int i; |
| 3499 | |
| 3500 | WMA_LOGD("%s: Enter", __func__); |
| 3501 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3502 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3503 | |
| 3504 | /* validate the wma_handle */ |
| 3505 | if (NULL == wma_handle) { |
| 3506 | WMA_LOGE("%s: Invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3507 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3508 | } |
| 3509 | |
| 3510 | /* validate the wmi handle */ |
| 3511 | if (NULL == wma_handle->wmi_handle) { |
| 3512 | WMA_LOGE("%s: Invalid wmi handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3513 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3514 | } |
| 3515 | |
| 3516 | /* dettach the wmi serice */ |
| 3517 | WMA_LOGD("calling wmi_unified_detach"); |
| 3518 | wmi_unified_detach(wma_handle->wmi_handle); |
| 3519 | wma_handle->wmi_handle = NULL; |
| 3520 | |
| 3521 | for (i = 0; i < wma_handle->max_bssid; i++) { |
| 3522 | bcn = wma_handle->interfaces[i].beacon; |
| 3523 | |
| 3524 | if (bcn) { |
| 3525 | if (bcn->dma_mapped) |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 3526 | qdf_nbuf_unmap_single(wma_handle->qdf_dev, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3527 | bcn->buf, QDF_DMA_TO_DEVICE); |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 3528 | qdf_nbuf_free(bcn->buf); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3529 | qdf_mem_free(bcn); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3530 | wma_handle->interfaces[i].beacon = NULL; |
| 3531 | } |
| 3532 | |
| 3533 | if (wma_handle->interfaces[i].handle) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3534 | qdf_mem_free(wma_handle->interfaces[i].handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3535 | wma_handle->interfaces[i].handle = NULL; |
| 3536 | } |
Yue Ma | 664effc | 2016-01-12 18:43:54 -0800 | [diff] [blame] | 3537 | |
| 3538 | if (wma_handle->interfaces[i].addBssStaContext) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3539 | qdf_mem_free(wma_handle-> |
Yue Ma | 664effc | 2016-01-12 18:43:54 -0800 | [diff] [blame] | 3540 | interfaces[i].addBssStaContext); |
| 3541 | wma_handle->interfaces[i].addBssStaContext = NULL; |
| 3542 | } |
| 3543 | |
| 3544 | if (wma_handle->interfaces[i].del_staself_req) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3545 | qdf_mem_free(wma_handle->interfaces[i].del_staself_req); |
Yue Ma | 664effc | 2016-01-12 18:43:54 -0800 | [diff] [blame] | 3546 | wma_handle->interfaces[i].del_staself_req = NULL; |
| 3547 | } |
yeshwanth sriram guntuka | 8dd8038 | 2017-01-30 17:04:58 +0530 | [diff] [blame] | 3548 | |
| 3549 | if (wma_handle->interfaces[i].stats_rsp) { |
| 3550 | qdf_mem_free(wma_handle->interfaces[i].stats_rsp); |
| 3551 | wma_handle->interfaces[i].stats_rsp = NULL; |
| 3552 | } |
Abhishek Singh | 7e5e934 | 2017-04-12 18:22:07 +0530 | [diff] [blame] | 3553 | |
| 3554 | if (wma_handle->interfaces[i].psnr_req) { |
| 3555 | qdf_mem_free(wma_handle-> |
| 3556 | interfaces[i].psnr_req); |
| 3557 | wma_handle->interfaces[i].psnr_req = NULL; |
| 3558 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3559 | } |
| 3560 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3561 | qdf_mem_free(wma_handle->interfaces); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3562 | /* free the wma_handle */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3563 | cds_free_context(wma_handle->cds_context, QDF_MODULE_ID_WMA, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3564 | wma_handle); |
| 3565 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3566 | qdf_mem_free(((p_cds_contextType) cds_ctx)->cfg_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3567 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3568 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3569 | } |
| 3570 | |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 3571 | /** |
| 3572 | * wma_wmi_work_close() - close the work queue items associated with WMI |
| 3573 | * @cds_ctx: Pointer to cds context |
| 3574 | * |
| 3575 | * This function closes work queue items associated with WMI, but not fully |
| 3576 | * closes WMI service. |
| 3577 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3578 | * Return: QDF_STATUS_SUCCESS if work close is successful. Otherwise |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 3579 | * proper error codes. |
| 3580 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3581 | QDF_STATUS wma_wmi_work_close(void *cds_ctx) |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 3582 | { |
| 3583 | tp_wma_handle wma_handle; |
| 3584 | |
| 3585 | WMA_LOGD("%s: Enter", __func__); |
| 3586 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3587 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 3588 | |
| 3589 | /* validate the wma_handle */ |
| 3590 | if (NULL == wma_handle) { |
| 3591 | WMA_LOGE("%s: Invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3592 | return QDF_STATUS_E_INVAL; |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 3593 | } |
| 3594 | |
| 3595 | /* validate the wmi handle */ |
| 3596 | if (NULL == wma_handle->wmi_handle) { |
| 3597 | WMA_LOGE("%s: Invalid wmi handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3598 | return QDF_STATUS_E_INVAL; |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 3599 | } |
| 3600 | |
| 3601 | /* remove the wmi work */ |
| 3602 | WMA_LOGD("calling wmi_unified_remove_work"); |
| 3603 | wmi_unified_remove_work(wma_handle->wmi_handle); |
| 3604 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3605 | return QDF_STATUS_SUCCESS; |
Xun Luo | a858a47 | 2015-11-10 08:24:45 -0800 | [diff] [blame] | 3606 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3607 | |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 3608 | /** |
| 3609 | * wma_cleanup_dbs_phy_caps() - release memory allocated for holding ext cap |
| 3610 | * @wma_handle: pointer to wma handle |
| 3611 | * |
| 3612 | * This function releases all the memory created for holding extended |
| 3613 | * capabilities per hardware mode and per PHY |
| 3614 | * |
| 3615 | * Return: void |
| 3616 | */ |
| 3617 | static void wma_cleanup_dbs_phy_caps(t_wma_handle *wma_handle) |
| 3618 | { |
| 3619 | if (NULL == wma_handle) { |
| 3620 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 3621 | return; |
| 3622 | } |
| 3623 | |
| 3624 | if (wma_handle->phy_caps.hw_mode_to_mac_cap_map) { |
| 3625 | qdf_mem_free(wma_handle->phy_caps.hw_mode_to_mac_cap_map); |
| 3626 | wma_handle->phy_caps.hw_mode_to_mac_cap_map = NULL; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3627 | WMA_LOGD("%s: hw_mode_to_mac_cap_map freed", __func__); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 3628 | } |
| 3629 | |
| 3630 | if (wma_handle->phy_caps.each_hw_mode_cap) { |
| 3631 | qdf_mem_free(wma_handle->phy_caps.each_hw_mode_cap); |
| 3632 | wma_handle->phy_caps.each_hw_mode_cap = NULL; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3633 | WMA_LOGD("%s: each_hw_mode_cap freed", __func__); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 3634 | } |
| 3635 | |
| 3636 | if (wma_handle->phy_caps.each_phy_cap_per_hwmode) { |
| 3637 | qdf_mem_free(wma_handle->phy_caps.each_phy_cap_per_hwmode); |
| 3638 | wma_handle->phy_caps.each_phy_cap_per_hwmode = NULL; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3639 | WMA_LOGD("%s: each_phy_cap_per_hwmode freed", __func__); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 3640 | } |
| 3641 | |
| 3642 | if (wma_handle->phy_caps.each_phy_hal_reg_cap) { |
| 3643 | qdf_mem_free(wma_handle->phy_caps.each_phy_hal_reg_cap); |
| 3644 | wma_handle->phy_caps.each_phy_hal_reg_cap = NULL; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3645 | WMA_LOGD("%s: each_phy_hal_reg_cap freed", __func__); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 3646 | } |
| 3647 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3648 | |
| 3649 | /** |
| 3650 | * wma_close() - wma close function. |
| 3651 | * cleanup resources attached with wma. |
| 3652 | * @cds_ctx: cds context |
| 3653 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 3654 | * Return: 0 on success, QDF Error on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3655 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3656 | QDF_STATUS wma_close(void *cds_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3657 | { |
| 3658 | tp_wma_handle wma_handle; |
| 3659 | uint32_t idx; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3660 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 3661 | struct target_psoc_info *tgt_psoc_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3662 | |
| 3663 | WMA_LOGD("%s: Enter", __func__); |
| 3664 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3665 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3666 | |
| 3667 | /* validate the wma_handle */ |
| 3668 | if (NULL == wma_handle) { |
| 3669 | WMA_LOGE("%s: Invalid wma handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3670 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3671 | } |
| 3672 | |
| 3673 | /* validate the wmi handle */ |
| 3674 | if (NULL == wma_handle->wmi_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3675 | WMA_LOGE("%s: Invalid wmi handle", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3676 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3677 | } |
| 3678 | |
| 3679 | /* Free DBS list */ |
| 3680 | if (wma_handle->hw_mode.hw_mode_list) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3681 | qdf_mem_free(wma_handle->hw_mode.hw_mode_list); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3682 | wma_handle->hw_mode.hw_mode_list = NULL; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3683 | WMA_LOGD("%s: DBS list is freed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3684 | } |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 3685 | wma_cleanup_dbs_phy_caps(wma_handle); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3686 | if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3687 | #ifdef FEATURE_WLAN_EXTSCAN |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3688 | qdf_wake_lock_destroy(&wma_handle->extscan_wake_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3689 | #endif /* FEATURE_WLAN_EXTSCAN */ |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3690 | qdf_wake_lock_destroy(&wma_handle->wow_wake_lock); |
Mukul Sharma | e44d054 | 2017-05-23 21:50:56 +0530 | [diff] [blame] | 3691 | qdf_wake_lock_destroy(&wma_handle->wow_auth_req_wl); |
| 3692 | qdf_wake_lock_destroy(&wma_handle->wow_assoc_req_wl); |
| 3693 | qdf_wake_lock_destroy(&wma_handle->wow_deauth_rec_wl); |
| 3694 | qdf_wake_lock_destroy(&wma_handle->wow_disassoc_rec_wl); |
| 3695 | qdf_wake_lock_destroy(&wma_handle->wow_ap_assoc_lost_wl); |
| 3696 | qdf_wake_lock_destroy(&wma_handle->wow_auto_shutdown_wl); |
| 3697 | qdf_wake_lock_destroy(&wma_handle->roam_ho_wl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3698 | } |
| 3699 | |
| 3700 | /* unregister Firmware debug log */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3701 | qdf_status = dbglog_deinit(wma_handle->wmi_handle); |
| 3702 | if (qdf_status != QDF_STATUS_SUCCESS) |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3703 | WMA_LOGE("%s: dbglog_deinit failed", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3704 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 3705 | /* close the qdf events */ |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3706 | qdf_event_destroy(&wma_handle->wma_ready_event); |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 3707 | qdf_status = qdf_mc_timer_destroy(&wma_handle->service_ready_ext_timer); |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3708 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 3709 | WMA_LOGE("%s: Failed to destroy service ready ext event timer", |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 3710 | __func__); |
| 3711 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 3712 | qdf_event_destroy(&wma_handle->target_suspend); |
| 3713 | qdf_event_destroy(&wma_handle->wma_resume_event); |
| 3714 | qdf_event_destroy(&wma_handle->runtime_suspend); |
| 3715 | qdf_event_destroy(&wma_handle->recovery_event); |
Kai Liu | 27f2037 | 2016-09-28 23:52:36 +0800 | [diff] [blame] | 3716 | qdf_event_destroy(&wma_handle->tx_frm_download_comp_event); |
| 3717 | qdf_event_destroy(&wma_handle->tx_queue_empty_event); |
Manikandan Mohan | b0932ab | 2017-02-12 16:30:55 -0800 | [diff] [blame] | 3718 | wma_cleanup_vdev_resp_queue(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3719 | wma_cleanup_hold_req(wma_handle); |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3720 | qdf_wake_lock_destroy(&wma_handle->wmi_cmd_rsp_wake_lock); |
| 3721 | qdf_runtime_lock_deinit(wma_handle->wmi_cmd_rsp_runtime_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3722 | for (idx = 0; idx < wma_handle->num_mem_chunks; ++idx) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3723 | qdf_mem_free_consistent(wma_handle->qdf_dev, |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 3724 | wma_handle->qdf_dev->dev, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3725 | wma_handle->mem_chunks[idx].len, |
| 3726 | wma_handle->mem_chunks[idx].vaddr, |
| 3727 | wma_handle->mem_chunks[idx].paddr, |
| 3728 | qdf_get_dma_mem_context( |
| 3729 | (&(wma_handle->mem_chunks[idx])), |
| 3730 | memctx)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3731 | } |
| 3732 | |
| 3733 | #if defined(QCA_WIFI_FTM) |
| 3734 | /* Detach UTF and unregister the handler */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3735 | if (cds_get_conparam() == QDF_GLOBAL_FTM_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3736 | wma_utf_detach(wma_handle); |
| 3737 | #endif /* QCA_WIFI_FTM */ |
| 3738 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3739 | if (NULL != wma_handle->pGetRssiReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3740 | qdf_mem_free(wma_handle->pGetRssiReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3741 | wma_handle->pGetRssiReq = NULL; |
| 3742 | } |
Deepak Dhamdhere | bf1f9b1 | 2016-05-27 14:49:41 -0700 | [diff] [blame] | 3743 | |
yeshwanth sriram guntuka | 584c233 | 2017-07-29 12:50:25 +0530 | [diff] [blame] | 3744 | wma_unified_radio_tx_mem_free(wma_handle); |
Srinivas Girigowda | ad874a8 | 2016-10-25 14:08:00 -0700 | [diff] [blame] | 3745 | |
Deepak Dhamdhere | bf1f9b1 | 2016-05-27 14:49:41 -0700 | [diff] [blame] | 3746 | wma_ndp_unregister_all_event_handlers(wma_handle); |
Kiran Kumar Lokere | f089a3a | 2017-04-20 21:39:26 -0700 | [diff] [blame] | 3747 | if (wma_handle->pdev) { |
| 3748 | wlan_objmgr_pdev_release_ref(wma_handle->pdev, |
| 3749 | WLAN_LEGACY_WMA_ID); |
| 3750 | wma_handle->pdev = NULL; |
| 3751 | } |
Frank Liu | 00d73fe | 2017-05-19 22:11:28 +0800 | [diff] [blame] | 3752 | |
| 3753 | tgt_psoc_info = wlan_psoc_get_tgt_if_handle(wma_handle->psoc); |
| 3754 | if (tgt_psoc_info) { |
| 3755 | qdf_mem_free(tgt_psoc_info); |
| 3756 | wlan_psoc_set_tgt_if_handle(wma_handle->psoc, NULL); |
| 3757 | } |
| 3758 | |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 3759 | pmo_unregister_pause_bitmap_notifier(wma_handle->psoc, |
| 3760 | wma_vdev_update_pause_bitmap); |
| 3761 | pmo_unregister_get_pause_bitmap(wma_handle->psoc, |
| 3762 | wma_vdev_get_pause_bitmap); |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 3763 | pmo_unregister_is_device_in_low_pwr_mode(wma_handle->psoc, |
| 3764 | wma_vdev_is_device_in_low_pwr_mode); |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 3765 | |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 3766 | wlan_objmgr_psoc_release_ref(wma_handle->psoc, WLAN_LEGACY_WMA_ID); |
| 3767 | wma_handle->psoc = NULL; |
| 3768 | target_if_close(); |
| 3769 | wma_target_if_close(wma_handle); |
Mukul Sharma | 6411bb8 | 2017-03-01 15:57:07 +0530 | [diff] [blame] | 3770 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3771 | WMA_LOGD("%s: Exit", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3772 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3773 | } |
| 3774 | |
| 3775 | /** |
| 3776 | * wma_update_fw_config() - update fw configuration |
| 3777 | * @wma_handle: wma handle |
| 3778 | * @tgt_cap: target capabality |
| 3779 | * |
| 3780 | * Return: none |
| 3781 | */ |
| 3782 | static void wma_update_fw_config(tp_wma_handle wma_handle, |
| 3783 | struct wma_target_cap *tgt_cap) |
| 3784 | { |
| 3785 | /* |
| 3786 | * tgt_cap contains default target resource configuration |
| 3787 | * which can be modified here, if required |
| 3788 | */ |
| 3789 | /* Override the no. of max fragments as per platform configuration */ |
| 3790 | tgt_cap->wlan_resource_config.max_frag_entries = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3791 | QDF_MIN(QCA_OL_11AC_TX_MAX_FRAGS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3792 | wma_handle->max_frag_entry); |
| 3793 | wma_handle->max_frag_entry = |
| 3794 | tgt_cap->wlan_resource_config.max_frag_entries; |
Arun Khandavalli | 3dd06de | 2016-08-17 10:20:29 +0530 | [diff] [blame] | 3795 | |
| 3796 | /* Update no. of maxWoWFilters depending on BPF service */ |
| 3797 | if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 3798 | WMI_SERVICE_BPF_OFFLOAD)) |
| 3799 | tgt_cap->wlan_resource_config.num_wow_filters = |
Arun Khandavalli | d454d42 | 2016-08-17 12:47:05 +0530 | [diff] [blame] | 3800 | WMA_STA_WOW_DEFAULT_PTRN_MAX; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3801 | } |
| 3802 | |
| 3803 | /** |
| 3804 | * wma_alloc_host_mem_chunk() - allocate host memory |
| 3805 | * @wma_handle: wma handle |
| 3806 | * @req_id: request id |
| 3807 | * @idx: index |
| 3808 | * @num_units: number of units |
| 3809 | * @unit_len: unit length |
| 3810 | * |
| 3811 | * allocate a chunk of memory at the index indicated and |
| 3812 | * if allocation fail allocate smallest size possiblr and |
| 3813 | * return number of units allocated. |
| 3814 | * |
| 3815 | * Return: number of units or 0 for error. |
| 3816 | */ |
| 3817 | static uint32_t wma_alloc_host_mem_chunk(tp_wma_handle wma_handle, |
| 3818 | uint32_t req_id, uint32_t idx, |
| 3819 | uint32_t num_units, uint32_t unit_len) |
| 3820 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3821 | qdf_dma_addr_t paddr; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3822 | |
| 3823 | if (!num_units || !unit_len) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3824 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3825 | wma_handle->mem_chunks[idx].vaddr = NULL; |
| 3826 | /** reduce the requested allocation by half until allocation succeeds */ |
| 3827 | while (wma_handle->mem_chunks[idx].vaddr == NULL && num_units) { |
| 3828 | wma_handle->mem_chunks[idx].vaddr = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3829 | qdf_mem_alloc_consistent(wma_handle->qdf_dev, |
| 3830 | wma_handle->qdf_dev->dev, |
| 3831 | num_units * unit_len, |
| 3832 | &paddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3833 | if (wma_handle->mem_chunks[idx].vaddr == NULL) { |
| 3834 | num_units = (num_units >> 1);/* reduce length by half */ |
| 3835 | } else { |
| 3836 | wma_handle->mem_chunks[idx].paddr = paddr; |
| 3837 | wma_handle->mem_chunks[idx].len = num_units * unit_len; |
| 3838 | wma_handle->mem_chunks[idx].req_id = req_id; |
| 3839 | } |
| 3840 | } |
| 3841 | return num_units; |
| 3842 | } |
| 3843 | |
| 3844 | #define HOST_MEM_SIZE_UNIT 4 |
| 3845 | /** |
| 3846 | * wma_alloc_host_mem() - allocate amount of memory requested by FW. |
| 3847 | * @wma_handle: wma handle |
| 3848 | * @req_id: request id |
| 3849 | * @num_units: number of units |
| 3850 | * @unit_len: unit length |
| 3851 | * |
| 3852 | * Return: none |
| 3853 | */ |
| 3854 | static void wma_alloc_host_mem(tp_wma_handle wma_handle, uint32_t req_id, |
| 3855 | uint32_t num_units, uint32_t unit_len) |
| 3856 | { |
| 3857 | uint32_t remaining_units, allocated_units, idx; |
| 3858 | |
| 3859 | /* adjust the length to nearest multiple of unit size */ |
| 3860 | unit_len = (unit_len + (HOST_MEM_SIZE_UNIT - 1)) & |
| 3861 | (~(HOST_MEM_SIZE_UNIT - 1)); |
| 3862 | idx = wma_handle->num_mem_chunks; |
| 3863 | remaining_units = num_units; |
| 3864 | while (remaining_units) { |
| 3865 | allocated_units = wma_alloc_host_mem_chunk(wma_handle, req_id, |
| 3866 | idx, remaining_units, |
| 3867 | unit_len); |
| 3868 | if (allocated_units == 0) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3869 | WMA_LOGE("FAILED TO ALLOCATED memory unit len %d units requested %d units allocated %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3870 | unit_len, num_units, |
| 3871 | (num_units - remaining_units)); |
| 3872 | wma_handle->num_mem_chunks = idx; |
| 3873 | break; |
| 3874 | } |
| 3875 | remaining_units -= allocated_units; |
| 3876 | ++idx; |
| 3877 | if (idx == MAX_MEM_CHUNKS) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3878 | WMA_LOGE("RWACHED MAX CHUNK LIMIT for memory units %d unit len %d requested by FW, only allocated %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3879 | num_units, unit_len, |
| 3880 | (num_units - remaining_units)); |
| 3881 | wma_handle->num_mem_chunks = idx; |
| 3882 | break; |
| 3883 | } |
| 3884 | } |
| 3885 | wma_handle->num_mem_chunks = idx; |
| 3886 | } |
| 3887 | |
| 3888 | /** |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame^] | 3889 | * wma_set_tx_partition_base() - set TX MSDU ID partition base for IPA |
| 3890 | * @value: TX MSDU ID partition base |
| 3891 | * |
| 3892 | * Return: none |
| 3893 | */ |
| 3894 | #ifdef IPA_OFFLOAD |
| 3895 | static void wma_set_tx_partition_base(uint32_t value) |
| 3896 | { |
| 3897 | cdp_ipa_set_uc_tx_partition_base( |
| 3898 | cds_get_context(QDF_MODULE_ID_SOC), |
| 3899 | (struct cdp_cfg *)cds_get_context(QDF_MODULE_ID_CFG), |
| 3900 | value); |
| 3901 | WMA_LOGD("%s: TX_MSDU_ID_PARTITION=%d", __func__, |
| 3902 | value); |
| 3903 | } |
| 3904 | #else |
| 3905 | static void wma_set_tx_partition_base(uint32_t value) |
| 3906 | { |
| 3907 | } |
| 3908 | #endif |
| 3909 | |
| 3910 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3911 | * wma_update_target_services() - update target services from wma handle |
| 3912 | * @wh: wma handle |
| 3913 | * @cfg: target services |
| 3914 | * |
| 3915 | * Return: none |
| 3916 | */ |
| 3917 | static inline void wma_update_target_services(tp_wma_handle wh, |
| 3918 | struct wma_tgt_services *cfg) |
| 3919 | { |
| 3920 | /* STA power save */ |
| 3921 | cfg->sta_power_save = WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, |
| 3922 | WMI_SERVICE_STA_PWRSAVE); |
| 3923 | |
| 3924 | /* Enable UAPSD */ |
| 3925 | cfg->uapsd = WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, |
| 3926 | WMI_SERVICE_AP_UAPSD); |
| 3927 | |
| 3928 | /* Update AP DFS service */ |
| 3929 | cfg->ap_dfs = WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, |
| 3930 | WMI_SERVICE_AP_DFS); |
| 3931 | |
| 3932 | /* Enable 11AC */ |
| 3933 | cfg->en_11ac = WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, |
| 3934 | WMI_SERVICE_11AC); |
| 3935 | if (cfg->en_11ac) |
| 3936 | g_fw_wlan_feat_caps |= (1 << DOT11AC); |
| 3937 | |
| 3938 | /* Proactive ARP response */ |
| 3939 | g_fw_wlan_feat_caps |= (1 << WLAN_PERIODIC_TX_PTRN); |
| 3940 | |
| 3941 | /* Enable WOW */ |
| 3942 | g_fw_wlan_feat_caps |= (1 << WOW); |
| 3943 | |
| 3944 | /* ARP offload */ |
| 3945 | cfg->arp_offload = WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, |
| 3946 | WMI_SERVICE_ARPNS_OFFLOAD); |
| 3947 | |
| 3948 | /* Adaptive early-rx */ |
| 3949 | cfg->early_rx = WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, |
| 3950 | WMI_SERVICE_EARLY_RX); |
| 3951 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 3952 | /* PNO offload */ |
| 3953 | if (WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, WMI_SERVICE_NLO)) |
| 3954 | cfg->pno_offload = true; |
| 3955 | #endif /* FEATURE_WLAN_SCAN_PNO */ |
| 3956 | |
| 3957 | #ifdef FEATURE_WLAN_EXTSCAN |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3958 | if (WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, WMI_SERVICE_EXTSCAN)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3959 | g_fw_wlan_feat_caps |= (1 << EXTENDED_SCAN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3960 | #endif /* FEATURE_WLAN_EXTSCAN */ |
| 3961 | cfg->lte_coex_ant_share = WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, |
| 3962 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT); |
| 3963 | #ifdef FEATURE_WLAN_TDLS |
| 3964 | /* Enable TDLS */ |
| 3965 | if (WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, WMI_SERVICE_TDLS)) { |
| 3966 | cfg->en_tdls = 1; |
| 3967 | g_fw_wlan_feat_caps |= (1 << TDLS); |
| 3968 | } |
| 3969 | /* Enable advanced TDLS features */ |
| 3970 | if (WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, |
| 3971 | WMI_SERVICE_TDLS_OFFCHAN)) { |
| 3972 | cfg->en_tdls_offchan = 1; |
| 3973 | g_fw_wlan_feat_caps |= (1 << TDLS_OFF_CHANNEL); |
| 3974 | } |
| 3975 | |
| 3976 | cfg->en_tdls_uapsd_buf_sta = |
| 3977 | WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, |
| 3978 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA); |
| 3979 | cfg->en_tdls_uapsd_sleep_sta = |
| 3980 | WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, |
| 3981 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA); |
| 3982 | #endif /* FEATURE_WLAN_TDLS */ |
| 3983 | if (WMI_SERVICE_IS_ENABLED |
| 3984 | (wh->wmi_service_bitmap, WMI_SERVICE_BEACON_OFFLOAD)) |
| 3985 | cfg->beacon_offload = true; |
mukul sharma | 72c8b22 | 2015-09-04 17:02:01 +0530 | [diff] [blame] | 3986 | if (WMI_SERVICE_IS_ENABLED |
| 3987 | (wh->wmi_service_bitmap, WMI_SERVICE_STA_PMF_OFFLOAD)) |
| 3988 | cfg->pmf_offload = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3989 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3990 | /* Enable Roam Offload */ |
| 3991 | cfg->en_roam_offload = WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 3992 | WMI_SERVICE_ROAM_HO_OFFLOAD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3993 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 3994 | #ifdef WLAN_FEATURE_NAN |
| 3995 | if (WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, WMI_SERVICE_NAN)) |
| 3996 | g_fw_wlan_feat_caps |= (1 << NAN); |
| 3997 | #endif /* WLAN_FEATURE_NAN */ |
| 3998 | |
| 3999 | if (WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, WMI_SERVICE_RTT)) |
| 4000 | g_fw_wlan_feat_caps |= (1 << RTT); |
Yun Park | 4d968df | 2016-10-11 11:44:15 -0700 | [diff] [blame] | 4001 | |
| 4002 | if (WMI_SERVICE_IS_ENABLED(wh->wmi_service_bitmap, |
| 4003 | WMI_SERVICE_TX_MSDU_ID_NEW_PARTITION_SUPPORT)) { |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame^] | 4004 | 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] | 4005 | } else { |
Yun Park | b4f591d | 2017-03-29 15:51:01 -0700 | [diff] [blame^] | 4006 | wma_set_tx_partition_base(HTT_TX_IPA_MSDU_ID_SPACE_BEGIN); |
Yun Park | 4d968df | 2016-10-11 11:44:15 -0700 | [diff] [blame] | 4007 | } |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 4008 | |
| 4009 | wma_he_update_tgt_services(wh, cfg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4010 | } |
| 4011 | |
| 4012 | /** |
| 4013 | * wma_update_target_ht_cap() - update ht capabality from wma handle |
| 4014 | * @wh: wma handle |
| 4015 | * @cfg: ht capabality |
| 4016 | * |
| 4017 | * Return: none |
| 4018 | */ |
| 4019 | static inline void wma_update_target_ht_cap(tp_wma_handle wh, |
| 4020 | struct wma_tgt_ht_cap *cfg) |
| 4021 | { |
| 4022 | /* RX STBC */ |
| 4023 | cfg->ht_rx_stbc = !!(wh->ht_cap_info & WMI_HT_CAP_RX_STBC); |
| 4024 | |
| 4025 | /* TX STBC */ |
| 4026 | cfg->ht_tx_stbc = !!(wh->ht_cap_info & WMI_HT_CAP_TX_STBC); |
| 4027 | |
| 4028 | /* MPDU density */ |
| 4029 | cfg->mpdu_density = wh->ht_cap_info & WMI_HT_CAP_MPDU_DENSITY; |
| 4030 | |
| 4031 | /* HT RX LDPC */ |
| 4032 | cfg->ht_rx_ldpc = !!(wh->ht_cap_info & WMI_HT_CAP_LDPC); |
| 4033 | |
| 4034 | /* HT SGI */ |
| 4035 | cfg->ht_sgi_20 = !!(wh->ht_cap_info & WMI_HT_CAP_HT20_SGI); |
| 4036 | |
| 4037 | cfg->ht_sgi_40 = !!(wh->ht_cap_info & WMI_HT_CAP_HT40_SGI); |
| 4038 | |
| 4039 | /* RF chains */ |
| 4040 | cfg->num_rf_chains = wh->num_rf_chains; |
| 4041 | |
Jeff Johnson | 3fd2182 | 2016-11-08 11:30:37 -0800 | [diff] [blame] | 4042 | WMA_LOGD("%s: ht_cap_info - %x ht_rx_stbc - %d, ht_tx_stbc - %d\n" |
| 4043 | "mpdu_density - %d ht_rx_ldpc - %d ht_sgi_20 - %d\n" |
| 4044 | "ht_sgi_40 - %d num_rf_chains - %d", __func__, wh->ht_cap_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4045 | cfg->ht_rx_stbc, cfg->ht_tx_stbc, cfg->mpdu_density, |
| 4046 | cfg->ht_rx_ldpc, cfg->ht_sgi_20, cfg->ht_sgi_40, |
| 4047 | cfg->num_rf_chains); |
| 4048 | |
| 4049 | } |
| 4050 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4051 | /** |
| 4052 | * wma_update_target_vht_cap() - update vht capabality from wma handle |
| 4053 | * @wh: wma handle |
| 4054 | * @cfg: vht capabality |
| 4055 | * |
| 4056 | * Return: none |
| 4057 | */ |
| 4058 | static inline void wma_update_target_vht_cap(tp_wma_handle wh, |
| 4059 | struct wma_tgt_vht_cap *cfg) |
| 4060 | { |
| 4061 | |
| 4062 | if (wh->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_11454) |
| 4063 | cfg->vht_max_mpdu = WMI_VHT_CAP_MAX_MPDU_LEN_11454; |
| 4064 | else if (wh->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_7935) |
| 4065 | cfg->vht_max_mpdu = WMI_VHT_CAP_MAX_MPDU_LEN_7935; |
| 4066 | else |
| 4067 | cfg->vht_max_mpdu = 0; |
| 4068 | |
| 4069 | |
| 4070 | if (wh->vht_cap_info & WMI_VHT_CAP_CH_WIDTH_80P80_160MHZ) { |
| 4071 | cfg->supp_chan_width = 1 << eHT_CHANNEL_WIDTH_80P80MHZ; |
| 4072 | cfg->supp_chan_width |= 1 << eHT_CHANNEL_WIDTH_160MHZ; |
| 4073 | } else if (wh->vht_cap_info & WMI_VHT_CAP_CH_WIDTH_160MHZ) |
| 4074 | cfg->supp_chan_width = 1 << eHT_CHANNEL_WIDTH_160MHZ; |
| 4075 | else |
| 4076 | cfg->supp_chan_width = 1 << eHT_CHANNEL_WIDTH_80MHZ; |
| 4077 | |
| 4078 | cfg->vht_rx_ldpc = wh->vht_cap_info & WMI_VHT_CAP_RX_LDPC; |
| 4079 | |
| 4080 | cfg->vht_short_gi_80 = wh->vht_cap_info & WMI_VHT_CAP_SGI_80MHZ; |
| 4081 | cfg->vht_short_gi_160 = wh->vht_cap_info & WMI_VHT_CAP_SGI_160MHZ; |
| 4082 | |
| 4083 | cfg->vht_tx_stbc = wh->vht_cap_info & WMI_VHT_CAP_TX_STBC; |
| 4084 | |
| 4085 | cfg->vht_rx_stbc = (wh->vht_cap_info & WMI_VHT_CAP_RX_STBC_1SS) | |
| 4086 | (wh->vht_cap_info & WMI_VHT_CAP_RX_STBC_2SS) | |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4087 | (wh->vht_cap_info & WMI_VHT_CAP_RX_STBC_3SS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4088 | |
| 4089 | cfg->vht_max_ampdu_len_exp = (wh->vht_cap_info & |
| 4090 | WMI_VHT_CAP_MAX_AMPDU_LEN_EXP) |
| 4091 | >> WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT; |
| 4092 | |
| 4093 | cfg->vht_su_bformer = wh->vht_cap_info & WMI_VHT_CAP_SU_BFORMER; |
| 4094 | |
| 4095 | cfg->vht_su_bformee = wh->vht_cap_info & WMI_VHT_CAP_SU_BFORMEE; |
| 4096 | |
| 4097 | cfg->vht_mu_bformer = wh->vht_cap_info & WMI_VHT_CAP_MU_BFORMER; |
| 4098 | |
| 4099 | cfg->vht_mu_bformee = wh->vht_cap_info & WMI_VHT_CAP_MU_BFORMEE; |
| 4100 | |
| 4101 | cfg->vht_txop_ps = wh->vht_cap_info & WMI_VHT_CAP_TXOP_PS; |
| 4102 | |
Jeff Johnson | 3fd2182 | 2016-11-08 11:30:37 -0800 | [diff] [blame] | 4103 | WMA_LOGD("%s: max_mpdu %d supp_chan_width %x rx_ldpc %x\n" |
| 4104 | "short_gi_80 %x tx_stbc %x rx_stbc %x txop_ps %x\n" |
| 4105 | "su_bformee %x mu_bformee %x max_ampdu_len_exp %d", __func__, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4106 | cfg->vht_max_mpdu, cfg->supp_chan_width, cfg->vht_rx_ldpc, |
| 4107 | cfg->vht_short_gi_80, cfg->vht_tx_stbc, cfg->vht_rx_stbc, |
| 4108 | cfg->vht_txop_ps, cfg->vht_su_bformee, cfg->vht_mu_bformee, |
| 4109 | cfg->vht_max_ampdu_len_exp); |
| 4110 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4111 | |
| 4112 | /** |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 4113 | * wma_derive_ext_ht_cap() - Derive HT caps based on given value |
| 4114 | * @wma_handle: pointer to wma_handle |
| 4115 | * @ht_cap: given pointer to HT caps which needs to be updated |
| 4116 | * @tx_chain: given tx chainmask value |
| 4117 | * @rx_chain: given rx chainmask value |
| 4118 | * @value: new HT cap info provided in form of bitmask |
| 4119 | * |
| 4120 | * This function takes the value provided in form of bitmask and decodes |
| 4121 | * it. After decoding, what ever value it gets, it takes the union(max) or |
| 4122 | * intersection(min) with previously derived values. |
| 4123 | * |
| 4124 | * Return: none |
| 4125 | * |
| 4126 | */ |
| 4127 | static void wma_derive_ext_ht_cap(tp_wma_handle wma_handle, |
| 4128 | struct wma_tgt_ht_cap *ht_cap, uint32_t value, |
| 4129 | uint32_t tx_chain, uint32_t rx_chain) |
| 4130 | { |
| 4131 | struct wma_tgt_ht_cap tmp = {0}; |
| 4132 | |
| 4133 | if (NULL == wma_handle || NULL == ht_cap) |
| 4134 | return; |
| 4135 | |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 4136 | 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] | 4137 | ht_cap->ht_rx_stbc = (!!(value & WMI_HT_CAP_RX_STBC)); |
| 4138 | ht_cap->ht_tx_stbc = (!!(value & WMI_HT_CAP_TX_STBC)); |
| 4139 | ht_cap->mpdu_density = (!!(value & WMI_HT_CAP_MPDU_DENSITY)); |
| 4140 | ht_cap->ht_rx_ldpc = (!!(value & WMI_HT_CAP_RX_LDPC)); |
| 4141 | ht_cap->ht_sgi_20 = (!!(value & WMI_HT_CAP_HT20_SGI)); |
| 4142 | ht_cap->ht_sgi_40 = (!!(value & WMI_HT_CAP_HT40_SGI)); |
| 4143 | ht_cap->num_rf_chains = |
| 4144 | QDF_MAX(wma_get_num_of_setbits_from_bitmask(tx_chain), |
| 4145 | wma_get_num_of_setbits_from_bitmask(rx_chain)); |
| 4146 | } else { |
| 4147 | ht_cap->ht_rx_stbc = QDF_MIN(ht_cap->ht_rx_stbc, |
| 4148 | (!!(value & WMI_HT_CAP_RX_STBC))); |
| 4149 | ht_cap->ht_tx_stbc = QDF_MAX(ht_cap->ht_tx_stbc, |
| 4150 | (!!(value & WMI_HT_CAP_TX_STBC))); |
| 4151 | ht_cap->mpdu_density = QDF_MIN(ht_cap->mpdu_density, |
| 4152 | (!!(value & WMI_HT_CAP_MPDU_DENSITY))); |
| 4153 | ht_cap->ht_rx_ldpc = QDF_MIN(ht_cap->ht_rx_ldpc, |
| 4154 | (!!(value & WMI_HT_CAP_RX_LDPC))); |
| 4155 | ht_cap->ht_sgi_20 = QDF_MIN(ht_cap->ht_sgi_20, |
| 4156 | (!!(value & WMI_HT_CAP_HT20_SGI))); |
| 4157 | ht_cap->ht_sgi_40 = QDF_MIN(ht_cap->ht_sgi_40, |
| 4158 | (!!(value & WMI_HT_CAP_HT40_SGI))); |
| 4159 | ht_cap->num_rf_chains = |
| 4160 | QDF_MAX(ht_cap->num_rf_chains, |
| 4161 | QDF_MAX(wma_get_num_of_setbits_from_bitmask( |
| 4162 | tx_chain), |
| 4163 | wma_get_num_of_setbits_from_bitmask( |
| 4164 | rx_chain))); |
| 4165 | } |
| 4166 | } |
| 4167 | |
| 4168 | /** |
| 4169 | * wma_update_target_ext_ht_cap() - Update HT caps with given extended cap |
| 4170 | * @wma_handle: pointer to wma_handle |
| 4171 | * @ht_cap: HT cap structure to be filled |
| 4172 | * |
| 4173 | * This function loop through each hardware mode and for each hardware mode |
| 4174 | * again it loop through each MAC/PHY and pull the caps 2G and 5G specific |
| 4175 | * HT caps and derives the final cap. |
| 4176 | * |
| 4177 | * Return: none |
| 4178 | * |
| 4179 | */ |
| 4180 | static void wma_update_target_ext_ht_cap(tp_wma_handle wma_handle, |
| 4181 | struct wma_tgt_ht_cap *ht_cap) |
| 4182 | { |
| 4183 | int i, j = 0, max_mac; |
| 4184 | uint32_t ht_2g, ht_5g; |
| 4185 | struct wma_tgt_ht_cap tmp_ht_cap = {0}, tmp_cap = {0}; |
| 4186 | struct extended_caps *phy_caps; |
| 4187 | WMI_MAC_PHY_CAPABILITIES *mac_cap; |
| 4188 | |
| 4189 | /* |
| 4190 | * for legacy device extended cap might not even come, so in that case |
| 4191 | * don't overwrite legacy values |
| 4192 | */ |
| 4193 | if (!wma_handle || |
| 4194 | (0 == wma_handle->phy_caps.num_hw_modes.num_hw_modes)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4195 | WMA_LOGD("%s: No extended HT cap for current SOC", __func__); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 4196 | return; |
| 4197 | } |
| 4198 | |
| 4199 | phy_caps = &wma_handle->phy_caps; |
| 4200 | for (i = 0; i < phy_caps->num_hw_modes.num_hw_modes; i++) { |
| 4201 | if (phy_caps->each_hw_mode_cap[i].phy_id_map == PHY1_PHY2) |
| 4202 | max_mac = j + 2; |
| 4203 | else |
| 4204 | max_mac = j + 1; |
| 4205 | for ( ; j < max_mac; j++) { |
| 4206 | mac_cap = &phy_caps->each_phy_cap_per_hwmode[j]; |
| 4207 | ht_2g = mac_cap->ht_cap_info_2G; |
| 4208 | ht_5g = mac_cap->ht_cap_info_5G; |
| 4209 | if (ht_2g) |
| 4210 | wma_derive_ext_ht_cap(wma_handle, &tmp_ht_cap, |
| 4211 | ht_2g, mac_cap->tx_chain_mask_2G, |
| 4212 | mac_cap->rx_chain_mask_2G); |
| 4213 | if (ht_5g) |
| 4214 | wma_derive_ext_ht_cap(wma_handle, &tmp_ht_cap, |
| 4215 | ht_5g, mac_cap->tx_chain_mask_5G, |
| 4216 | mac_cap->rx_chain_mask_5G); |
| 4217 | } |
| 4218 | } |
| 4219 | |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 4220 | if (qdf_mem_cmp(&tmp_cap, &tmp_ht_cap, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 4221 | sizeof(struct wma_tgt_ht_cap))) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4222 | qdf_mem_copy(ht_cap, &tmp_ht_cap, |
| 4223 | sizeof(struct wma_tgt_ht_cap)); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 4224 | } |
| 4225 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4226 | 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] | 4227 | "mpdu_density - %d ht_rx_ldpc - %d ht_sgi_20 - %d\n" |
| 4228 | "ht_sgi_40 - %d num_rf_chains - %d", __func__, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 4229 | ht_cap->ht_rx_stbc, ht_cap->ht_tx_stbc, |
| 4230 | ht_cap->mpdu_density, ht_cap->ht_rx_ldpc, |
| 4231 | ht_cap->ht_sgi_20, ht_cap->ht_sgi_40, |
| 4232 | ht_cap->num_rf_chains); |
| 4233 | } |
| 4234 | |
| 4235 | /** |
| 4236 | * wma_derive_ext_vht_cap() - Derive VHT caps based on given value |
| 4237 | * @wma_handle: pointer to wma_handle |
| 4238 | * @vht_cap: pointer to given VHT caps to be filled |
| 4239 | * @value: new VHT cap info provided in form of bitmask |
| 4240 | * |
| 4241 | * This function takes the value provided in form of bitmask and decodes |
| 4242 | * it. After decoding, what ever value it gets, it takes the union(max) or |
| 4243 | * intersection(min) with previously derived values. |
| 4244 | * |
| 4245 | * Return: none |
| 4246 | * |
| 4247 | */ |
| 4248 | static void wma_derive_ext_vht_cap(t_wma_handle *wma_handle, |
| 4249 | struct wma_tgt_vht_cap *vht_cap, uint32_t value) |
| 4250 | { |
| 4251 | struct wma_tgt_vht_cap tmp_cap = {0}; |
| 4252 | uint32_t tmp = 0; |
| 4253 | |
| 4254 | if (NULL == wma_handle || NULL == vht_cap) |
| 4255 | return; |
| 4256 | |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 4257 | if (!qdf_mem_cmp(vht_cap, &tmp_cap, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 4258 | sizeof(struct wma_tgt_vht_cap))) { |
| 4259 | if (value & WMI_VHT_CAP_MAX_MPDU_LEN_11454) |
| 4260 | vht_cap->vht_max_mpdu = WMI_VHT_CAP_MAX_MPDU_LEN_11454; |
| 4261 | else if (value & WMI_VHT_CAP_MAX_MPDU_LEN_7935) |
| 4262 | vht_cap->vht_max_mpdu = WMI_VHT_CAP_MAX_MPDU_LEN_7935; |
| 4263 | else |
| 4264 | vht_cap->vht_max_mpdu = 0; |
| 4265 | |
| 4266 | if (value & WMI_VHT_CAP_CH_WIDTH_80P80_160MHZ) { |
| 4267 | vht_cap->supp_chan_width = |
| 4268 | 1 << eHT_CHANNEL_WIDTH_80P80MHZ; |
| 4269 | vht_cap->supp_chan_width |= |
| 4270 | 1 << eHT_CHANNEL_WIDTH_160MHZ; |
| 4271 | } else if (value & WMI_VHT_CAP_CH_WIDTH_160MHZ) { |
| 4272 | vht_cap->supp_chan_width = |
| 4273 | 1 << eHT_CHANNEL_WIDTH_160MHZ; |
| 4274 | } else { |
| 4275 | vht_cap->supp_chan_width = 1 << eHT_CHANNEL_WIDTH_80MHZ; |
| 4276 | } |
| 4277 | vht_cap->vht_rx_ldpc = value & WMI_VHT_CAP_RX_LDPC; |
| 4278 | vht_cap->vht_short_gi_80 = value & WMI_VHT_CAP_SGI_80MHZ; |
| 4279 | vht_cap->vht_short_gi_160 = value & WMI_VHT_CAP_SGI_160MHZ; |
| 4280 | vht_cap->vht_tx_stbc = value & WMI_VHT_CAP_TX_STBC; |
| 4281 | vht_cap->vht_rx_stbc = |
| 4282 | (value & WMI_VHT_CAP_RX_STBC_1SS) | |
| 4283 | (value & WMI_VHT_CAP_RX_STBC_2SS) | |
| 4284 | (value & WMI_VHT_CAP_RX_STBC_3SS); |
| 4285 | vht_cap->vht_max_ampdu_len_exp = |
| 4286 | (value & WMI_VHT_CAP_MAX_AMPDU_LEN_EXP) >> |
| 4287 | WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT; |
| 4288 | vht_cap->vht_su_bformer = value & WMI_VHT_CAP_SU_BFORMER; |
| 4289 | vht_cap->vht_su_bformee = value & WMI_VHT_CAP_SU_BFORMEE; |
| 4290 | vht_cap->vht_mu_bformer = value & WMI_VHT_CAP_MU_BFORMER; |
| 4291 | vht_cap->vht_mu_bformee = value & WMI_VHT_CAP_MU_BFORMEE; |
| 4292 | vht_cap->vht_txop_ps = value & WMI_VHT_CAP_TXOP_PS; |
| 4293 | } else { |
| 4294 | if (value & WMI_VHT_CAP_MAX_MPDU_LEN_11454) |
| 4295 | tmp = WMI_VHT_CAP_MAX_MPDU_LEN_11454; |
| 4296 | else if (value & WMI_VHT_CAP_MAX_MPDU_LEN_7935) |
| 4297 | tmp = WMI_VHT_CAP_MAX_MPDU_LEN_7935; |
| 4298 | else |
| 4299 | tmp = 0; |
| 4300 | vht_cap->vht_max_mpdu = QDF_MIN(vht_cap->vht_max_mpdu, tmp); |
| 4301 | |
| 4302 | if ((value & WMI_VHT_CAP_CH_WIDTH_80P80_160MHZ)) { |
| 4303 | tmp = (1 << eHT_CHANNEL_WIDTH_80P80MHZ) | |
| 4304 | (1 << eHT_CHANNEL_WIDTH_160MHZ); |
| 4305 | } else if (value & WMI_VHT_CAP_CH_WIDTH_160MHZ) { |
| 4306 | tmp = 1 << eHT_CHANNEL_WIDTH_160MHZ; |
| 4307 | } else { |
| 4308 | tmp = 1 << eHT_CHANNEL_WIDTH_80MHZ; |
| 4309 | } |
| 4310 | vht_cap->supp_chan_width = |
| 4311 | QDF_MAX(vht_cap->supp_chan_width, tmp); |
| 4312 | vht_cap->vht_rx_ldpc = QDF_MIN(vht_cap->vht_rx_ldpc, |
| 4313 | value & WMI_VHT_CAP_RX_LDPC); |
| 4314 | vht_cap->vht_short_gi_80 = QDF_MAX(vht_cap->vht_short_gi_80, |
| 4315 | value & WMI_VHT_CAP_SGI_80MHZ); |
| 4316 | vht_cap->vht_short_gi_160 = QDF_MAX(vht_cap->vht_short_gi_160, |
| 4317 | value & WMI_VHT_CAP_SGI_160MHZ); |
| 4318 | vht_cap->vht_tx_stbc = QDF_MAX(vht_cap->vht_tx_stbc, |
| 4319 | value & WMI_VHT_CAP_TX_STBC); |
| 4320 | vht_cap->vht_rx_stbc = QDF_MIN(vht_cap->vht_rx_stbc, |
| 4321 | (value & WMI_VHT_CAP_RX_STBC_1SS) | |
| 4322 | (value & WMI_VHT_CAP_RX_STBC_2SS) | |
| 4323 | (value & WMI_VHT_CAP_RX_STBC_3SS)); |
| 4324 | vht_cap->vht_max_ampdu_len_exp = |
| 4325 | QDF_MIN(vht_cap->vht_max_ampdu_len_exp, |
| 4326 | (value & WMI_VHT_CAP_MAX_AMPDU_LEN_EXP) >> |
| 4327 | WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT); |
| 4328 | vht_cap->vht_su_bformer = QDF_MAX(vht_cap->vht_su_bformer, |
| 4329 | value & WMI_VHT_CAP_SU_BFORMER); |
| 4330 | vht_cap->vht_su_bformee = QDF_MAX(vht_cap->vht_su_bformee, |
| 4331 | value & WMI_VHT_CAP_SU_BFORMEE); |
| 4332 | vht_cap->vht_mu_bformer = QDF_MAX(vht_cap->vht_mu_bformer, |
| 4333 | value & WMI_VHT_CAP_MU_BFORMER); |
| 4334 | vht_cap->vht_mu_bformee = QDF_MAX(vht_cap->vht_mu_bformee, |
| 4335 | value & WMI_VHT_CAP_MU_BFORMEE); |
| 4336 | vht_cap->vht_txop_ps = QDF_MIN(vht_cap->vht_txop_ps, |
| 4337 | value & WMI_VHT_CAP_TXOP_PS); |
| 4338 | } |
| 4339 | } |
| 4340 | |
| 4341 | /** |
| 4342 | * wma_update_target_ext_vht_cap() - Update VHT caps with given extended cap |
| 4343 | * @wma_handle: pointer to wma_handle |
| 4344 | * @vht_cap: VHT cap structure to be filled |
| 4345 | * |
| 4346 | * This function loop through each hardware mode and for each hardware mode |
| 4347 | * again it loop through each MAC/PHY and pull the caps 2G and 5G specific |
| 4348 | * VHT caps and derives the final cap. |
| 4349 | * |
| 4350 | * Return: none |
| 4351 | * |
| 4352 | */ |
| 4353 | static void wma_update_target_ext_vht_cap(t_wma_handle *wma_handle, |
| 4354 | struct wma_tgt_vht_cap *vht_cap) |
| 4355 | { |
| 4356 | int i, j = 0, max_mac; |
| 4357 | uint32_t vht_cap_info_2g, vht_cap_info_5g; |
| 4358 | struct wma_tgt_vht_cap tmp_vht_cap = {0}, tmp_cap = {0}; |
| 4359 | struct extended_caps *phy_caps; |
| 4360 | WMI_MAC_PHY_CAPABILITIES *mac_cap; |
| 4361 | |
| 4362 | /* |
| 4363 | * for legacy device extended cap might not even come, so in that case |
| 4364 | * don't overwrite legacy values |
| 4365 | */ |
| 4366 | if (!wma_handle || |
| 4367 | (0 == wma_handle->phy_caps.num_hw_modes.num_hw_modes)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4368 | WMA_LOGD("%s: No extended VHT cap for current SOC", __func__); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 4369 | return; |
| 4370 | } |
| 4371 | |
| 4372 | phy_caps = &wma_handle->phy_caps; |
| 4373 | for (i = 0; i < phy_caps->num_hw_modes.num_hw_modes; i++) { |
| 4374 | if (phy_caps->each_hw_mode_cap[i].phy_id_map == PHY1_PHY2) |
| 4375 | max_mac = j + 2; |
| 4376 | else |
| 4377 | max_mac = j + 1; |
| 4378 | for ( ; j < max_mac; j++) { |
| 4379 | mac_cap = &phy_caps->each_phy_cap_per_hwmode[j]; |
| 4380 | vht_cap_info_2g = mac_cap->vht_cap_info_2G; |
| 4381 | vht_cap_info_5g = mac_cap->vht_cap_info_5G; |
| 4382 | if (vht_cap_info_2g) |
| 4383 | wma_derive_ext_vht_cap(wma_handle, &tmp_vht_cap, |
| 4384 | vht_cap_info_2g); |
| 4385 | if (vht_cap_info_5g) |
| 4386 | wma_derive_ext_vht_cap(wma_handle, &tmp_vht_cap, |
| 4387 | vht_cap_info_5g); |
| 4388 | } |
| 4389 | } |
| 4390 | |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 4391 | if (qdf_mem_cmp(&tmp_cap, &tmp_vht_cap, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 4392 | sizeof(struct wma_tgt_vht_cap))) { |
| 4393 | qdf_mem_copy(vht_cap, &tmp_vht_cap, |
| 4394 | sizeof(struct wma_tgt_vht_cap)); |
| 4395 | } |
| 4396 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4397 | 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] | 4398 | "short_gi_80 %x tx_stbc %x rx_stbc %x txop_ps %x\n" |
| 4399 | "su_bformee %x mu_bformee %x max_ampdu_len_exp %d", __func__, |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 4400 | vht_cap->vht_max_mpdu, vht_cap->supp_chan_width, |
| 4401 | vht_cap->vht_rx_ldpc, vht_cap->vht_short_gi_80, |
| 4402 | vht_cap->vht_tx_stbc, vht_cap->vht_rx_stbc, |
| 4403 | vht_cap->vht_txop_ps, vht_cap->vht_su_bformee, |
| 4404 | vht_cap->vht_mu_bformee, vht_cap->vht_max_ampdu_len_exp); |
| 4405 | } |
| 4406 | |
| 4407 | /** |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 4408 | * wma_update_ra_rate_limit() - update wma config |
| 4409 | * @wma_handle: wma handle |
| 4410 | * @cfg: target config |
| 4411 | * |
| 4412 | * Return: none |
| 4413 | */ |
| 4414 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 4415 | static void wma_update_ra_rate_limit(tp_wma_handle wma_handle, |
| 4416 | struct wma_tgt_cfg *cfg) |
| 4417 | { |
| 4418 | cfg->is_ra_rate_limit_enabled = wma_handle->IsRArateLimitEnabled; |
| 4419 | } |
| 4420 | #else |
| 4421 | static void wma_update_ra_rate_limit(tp_wma_handle wma_handle, |
| 4422 | struct wma_tgt_cfg *cfg) |
| 4423 | { |
| 4424 | } |
| 4425 | #endif |
| 4426 | |
| 4427 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4428 | * wma_update_hdd_cfg() - update HDD config |
| 4429 | * @wma_handle: wma handle |
| 4430 | * |
| 4431 | * Return: none |
| 4432 | */ |
| 4433 | static void wma_update_hdd_cfg(tp_wma_handle wma_handle) |
| 4434 | { |
| 4435 | struct wma_tgt_cfg tgt_cfg; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4436 | void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4437 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4438 | qdf_mem_zero(&tgt_cfg, sizeof(struct wma_tgt_cfg)); |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 4439 | |
| 4440 | tgt_cfg.sub_20_support = wma_handle->sub_20_support; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4441 | tgt_cfg.reg_domain = wma_handle->reg_cap.eeprom_rd; |
| 4442 | tgt_cfg.eeprom_rd_ext = wma_handle->reg_cap.eeprom_rd_ext; |
| 4443 | |
| 4444 | switch (wma_handle->phy_capability) { |
| 4445 | case WMI_11G_CAPABILITY: |
| 4446 | case WMI_11NG_CAPABILITY: |
| 4447 | tgt_cfg.band_cap = eCSR_BAND_24; |
| 4448 | break; |
| 4449 | case WMI_11A_CAPABILITY: |
| 4450 | case WMI_11NA_CAPABILITY: |
| 4451 | case WMI_11AC_CAPABILITY: |
| 4452 | tgt_cfg.band_cap = eCSR_BAND_5G; |
| 4453 | break; |
| 4454 | case WMI_11AG_CAPABILITY: |
| 4455 | case WMI_11NAG_CAPABILITY: |
| 4456 | default: |
| 4457 | tgt_cfg.band_cap = eCSR_BAND_ALL; |
| 4458 | } |
| 4459 | |
| 4460 | tgt_cfg.max_intf_count = wma_handle->wlan_resource_config.num_vdevs; |
| 4461 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4462 | qdf_mem_copy(tgt_cfg.hw_macaddr.bytes, wma_handle->hwaddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4463 | ATH_MAC_LEN); |
| 4464 | |
| 4465 | wma_update_target_services(wma_handle, &tgt_cfg.services); |
| 4466 | wma_update_target_ht_cap(wma_handle, &tgt_cfg.ht_cap); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4467 | wma_update_target_vht_cap(wma_handle, &tgt_cfg.vht_cap); |
Krunal Soni | aa664da | 2016-06-15 23:46:40 -0700 | [diff] [blame] | 4468 | /* |
| 4469 | * This will overwrite the structure filled by wma_update_target_ht_cap |
| 4470 | * and wma_update_target_vht_cap APIs. |
| 4471 | */ |
| 4472 | wma_update_target_ext_ht_cap(wma_handle, &tgt_cfg.ht_cap); |
| 4473 | wma_update_target_ext_vht_cap(wma_handle, &tgt_cfg.vht_cap); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4474 | |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 4475 | wma_update_target_ext_he_cap(wma_handle, &tgt_cfg); |
| 4476 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4477 | tgt_cfg.target_fw_version = wma_handle->target_fw_version; |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 4478 | tgt_cfg.target_fw_vers_ext = wma_handle->target_fw_vers_ext; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4479 | #ifdef WLAN_FEATURE_LPSS |
| 4480 | tgt_cfg.lpss_support = wma_handle->lpss_support; |
| 4481 | #endif /* WLAN_FEATURE_LPSS */ |
| 4482 | tgt_cfg.ap_arpns_support = wma_handle->ap_arpns_support; |
Rajeev Kumar | e5a1682 | 2016-07-27 13:11:42 -0700 | [diff] [blame] | 4483 | tgt_cfg.bpf_enabled = wma_handle->bpf_enabled; |
Arif Hussain | 759a023 | 2017-03-20 13:17:18 -0700 | [diff] [blame] | 4484 | tgt_cfg.dfs_cac_offload = wma_handle->dfs_cac_offload; |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 4485 | wma_update_ra_rate_limit(wma_handle, &tgt_cfg); |
Krishna Kumaar Natarajan | 1ae4911 | 2015-11-24 21:43:22 -0800 | [diff] [blame] | 4486 | tgt_cfg.fine_time_measurement_cap = |
| 4487 | wma_handle->fine_time_measurement_cap; |
Rajeev Kumar Sirasanagandla | 4787300 | 2016-09-09 13:46:09 +0530 | [diff] [blame] | 4488 | tgt_cfg.wmi_max_len = wmi_get_max_msg_len(wma_handle->wmi_handle) |
| 4489 | - WMI_TLV_HEADROOM; |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 4490 | wma_setup_egap_support(&tgt_cfg, wma_handle); |
Nachiket Kukade | 8b4bfd8 | 2017-05-25 18:34:48 +0530 | [diff] [blame] | 4491 | tgt_cfg.tx_bfee_8ss_enabled = wma_handle->tx_bfee_8ss_enabled; |
Deepak Dhamdhere | 13230d3 | 2016-05-26 00:46:53 -0700 | [diff] [blame] | 4492 | wma_update_hdd_cfg_ndp(wma_handle, &tgt_cfg); |
Naveen Rawat | cb186cf | 2016-07-11 13:47:19 -0700 | [diff] [blame] | 4493 | wma_handle->tgt_cfg_update_cb(hdd_ctx, &tgt_cfg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4494 | } |
| 4495 | |
| 4496 | /** |
| 4497 | * wma_setup_wmi_init_msg() - fill wmi init message buffer |
| 4498 | * @wma_handle: wma handle |
| 4499 | * @ev: ready event fixed params |
| 4500 | * @param_buf: redy event TLVs |
| 4501 | * @len: buffer length |
| 4502 | * |
| 4503 | * Return: wmi buffer or NULL for error |
| 4504 | */ |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 4505 | static int wma_setup_wmi_init_msg(tp_wma_handle wma_handle, |
| 4506 | wmi_service_ready_event_fixed_param *ev, |
| 4507 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4508 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4509 | wlan_host_mem_req *ev_mem_reqs; |
| 4510 | wmi_abi_version my_vers; |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 4511 | wmi_abi_version host_abi_vers; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4512 | int num_whitelist; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4513 | uint16_t idx; |
| 4514 | uint32_t num_units; |
| 4515 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4516 | ev_mem_reqs = param_buf->mem_reqs; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4517 | |
| 4518 | /* allocate memory requested by FW */ |
| 4519 | if (ev->num_mem_reqs > WMI_MAX_MEM_REQS) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4520 | QDF_ASSERT(0); |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 4521 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4522 | } |
| 4523 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4524 | for (idx = 0; idx < ev->num_mem_reqs; ++idx) { |
| 4525 | num_units = ev_mem_reqs[idx].num_units; |
| 4526 | if (ev_mem_reqs[idx].num_unit_info & NUM_UNITS_IS_NUM_PEERS) { |
| 4527 | /* |
| 4528 | * number of units to allocate is number |
| 4529 | * of peers, 1 extra for self peer on |
| 4530 | * target. this needs to be fied, host |
| 4531 | * and target can get out of sync |
| 4532 | */ |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4533 | num_units = wma_handle->wlan_resource_config.num_peers + |
| 4534 | 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4535 | } |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4536 | WMA_LOGD("idx %d req %d num_units %d num_unit_info %d unit size %d actual units %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4537 | idx, ev_mem_reqs[idx].req_id, |
| 4538 | ev_mem_reqs[idx].num_units, |
| 4539 | ev_mem_reqs[idx].num_unit_info, |
| 4540 | ev_mem_reqs[idx].unit_size, num_units); |
| 4541 | wma_alloc_host_mem(wma_handle, ev_mem_reqs[idx].req_id, |
| 4542 | num_units, ev_mem_reqs[idx].unit_size); |
| 4543 | } |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 4544 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4545 | qdf_mem_copy(&wma_handle->target_abi_vers, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4546 | ¶m_buf->fixed_param->fw_abi_vers, |
| 4547 | sizeof(wmi_abi_version)); |
| 4548 | num_whitelist = sizeof(version_whitelist) / |
| 4549 | sizeof(wmi_whitelist_version_info); |
| 4550 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 4551 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 4552 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 4553 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 4554 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 4555 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 4556 | |
| 4557 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 4558 | &my_vers, |
| 4559 | ¶m_buf->fixed_param->fw_abi_vers, |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 4560 | &host_abi_vers); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4561 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 4562 | qdf_mem_copy(&wma_handle->final_abi_vers, &host_abi_vers, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4563 | sizeof(wmi_abi_version)); |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 4564 | |
| 4565 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4566 | } |
| 4567 | |
| 4568 | /** |
| 4569 | * wma_dump_dbs_hw_mode() - Print the DBS HW modes |
| 4570 | * @wma_handle: WMA handle |
| 4571 | * |
| 4572 | * Prints the DBS HW modes sent by the FW as part |
| 4573 | * of WMI ready event |
| 4574 | * |
| 4575 | * Return: None |
| 4576 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 4577 | static void wma_dump_dbs_hw_mode(tp_wma_handle wma_handle) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4578 | { |
| 4579 | uint32_t i, param; |
| 4580 | |
| 4581 | if (!wma_handle) { |
| 4582 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 4583 | return; |
| 4584 | } |
| 4585 | |
| 4586 | for (i = 0; i < wma_handle->num_dbs_hw_modes; i++) { |
| 4587 | param = wma_handle->hw_mode.hw_mode_list[i]; |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 4588 | 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] | 4589 | __func__, i, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 4590 | WMA_HW_MODE_MAC0_TX_STREAMS_GET(param), |
| 4591 | WMA_HW_MODE_MAC0_RX_STREAMS_GET(param), |
| 4592 | WMA_HW_MODE_MAC0_BANDWIDTH_GET(param)); |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 4593 | 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] | 4594 | __func__, i, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 4595 | WMA_HW_MODE_MAC1_TX_STREAMS_GET(param), |
| 4596 | WMA_HW_MODE_MAC1_RX_STREAMS_GET(param), |
| 4597 | WMA_HW_MODE_MAC1_BANDWIDTH_GET(param)); |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 4598 | WMA_LOGD("%s:[%d] DBS:%d SBS:%d", __func__, i, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 4599 | WMA_HW_MODE_DBS_MODE_GET(param), |
| 4600 | WMA_HW_MODE_SBS_MODE_GET(param)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4601 | } |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 4602 | policy_mgr_dump_dbs_hw_mode(wma_handle->psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4603 | } |
| 4604 | |
| 4605 | /** |
| 4606 | * wma_init_scan_fw_mode_config() - Initialize scan/fw mode config |
| 4607 | * @wma_handle: WMA handle |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 4608 | * @scan_config: Scam mode configuration |
| 4609 | * @fw_config: FW mode configuration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4610 | * |
| 4611 | * Enables all the valid bits of concurrent_scan_config_bits and |
| 4612 | * fw_mode_config_bits. |
| 4613 | * |
| 4614 | * Return: None |
| 4615 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 4616 | static void wma_init_scan_fw_mode_config(tp_wma_handle wma_handle, |
| 4617 | uint32_t scan_config, |
| 4618 | uint32_t fw_config) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4619 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4620 | WMA_LOGD("%s: Enter", __func__); |
| 4621 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4622 | if (!wma_handle) { |
| 4623 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 4624 | return; |
| 4625 | } |
| 4626 | |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 4627 | policy_mgr_init_dbs_config(wma_handle->psoc, scan_config, fw_config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4628 | } |
| 4629 | |
| 4630 | /** |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 4631 | * wma_update_ra_limit() - update ra limit based on bpf filter |
| 4632 | * enabled or not |
| 4633 | * @handle: wma handle |
| 4634 | * |
| 4635 | * Return: none |
| 4636 | */ |
| 4637 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 4638 | static void wma_update_ra_limit(tp_wma_handle wma_handle) |
| 4639 | { |
| 4640 | if (wma_handle->bpf_enabled) |
| 4641 | wma_handle->IsRArateLimitEnabled = false; |
| 4642 | } |
| 4643 | #else |
| 4644 | static void wma_update_ra__limit(tp_wma_handle handle) |
| 4645 | { |
| 4646 | } |
| 4647 | #endif |
| 4648 | |
| 4649 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4650 | * wma_rx_service_ready_event() - event handler to process |
| 4651 | * wmi rx sevice ready event. |
| 4652 | * @handle: wma handle |
| 4653 | * @cmd_param_info: command params info |
| 4654 | * |
| 4655 | * Return: none |
| 4656 | */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4657 | int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info, |
| 4658 | uint32_t length) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4659 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4660 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 4661 | struct wma_target_cap target_cap; |
| 4662 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 4663 | wmi_service_ready_event_fixed_param *ev; |
| 4664 | int status; |
| 4665 | uint32_t *ev_wlan_dbs_hw_mode_list; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4666 | QDF_STATUS ret; |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 4667 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4668 | |
| 4669 | WMA_LOGD("%s: Enter", __func__); |
| 4670 | |
| 4671 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) cmd_param_info; |
| 4672 | if (!(handle && param_buf)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4673 | WMA_LOGE("%s: Invalid arguments", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4674 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4675 | } |
| 4676 | |
| 4677 | ev = param_buf->fixed_param; |
| 4678 | if (!ev) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4679 | WMA_LOGE("%s: Invalid buffer", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4680 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4681 | } |
| 4682 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 4683 | WMA_LOGD("WMA <-- WMI_SERVICE_READY_EVENTID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4684 | |
| 4685 | wma_handle->num_dbs_hw_modes = ev->num_dbs_hw_modes; |
| 4686 | ev_wlan_dbs_hw_mode_list = param_buf->wlan_dbs_hw_mode_list; |
| 4687 | wma_handle->hw_mode.hw_mode_list = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4688 | qdf_mem_malloc(sizeof(*wma_handle->hw_mode.hw_mode_list) * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4689 | wma_handle->num_dbs_hw_modes); |
| 4690 | if (!wma_handle->hw_mode.hw_mode_list) { |
| 4691 | WMA_LOGE("%s: Memory allocation failed for DBS", __func__); |
| 4692 | /* Continuing with the rest of the processing */ |
| 4693 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4694 | qdf_mem_copy(wma_handle->hw_mode.hw_mode_list, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4695 | ev_wlan_dbs_hw_mode_list, |
| 4696 | (sizeof(*wma_handle->hw_mode.hw_mode_list) * |
| 4697 | wma_handle->num_dbs_hw_modes)); |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 4698 | policy_mgr_init_dbs_hw_mode(wma_handle->psoc, |
| 4699 | ev->num_dbs_hw_modes, ev_wlan_dbs_hw_mode_list); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4700 | wma_dump_dbs_hw_mode(wma_handle); |
| 4701 | |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 4702 | /* Initializes the fw_mode and scan_config to zero. |
| 4703 | * If ext service ready event is present it will set |
| 4704 | * the actual values of these two params. |
| 4705 | * This is to ensure that no garbage values would be |
| 4706 | * present in the absence of ext service ready event. |
| 4707 | */ |
| 4708 | wma_init_scan_fw_mode_config(wma_handle, 0, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4709 | |
| 4710 | wma_handle->phy_capability = ev->phy_capability; |
| 4711 | wma_handle->max_frag_entry = ev->max_frag_entry; |
| 4712 | wma_handle->num_rf_chains = ev->num_rf_chains; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4713 | qdf_mem_copy(&wma_handle->reg_cap, param_buf->hal_reg_capabilities, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4714 | sizeof(HAL_REG_CAPABILITIES)); |
| 4715 | wma_handle->ht_cap_info = ev->ht_cap_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4716 | wma_handle->vht_cap_info = ev->vht_cap_info; |
| 4717 | wma_handle->vht_supp_mcs = ev->vht_supp_mcs; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4718 | wma_handle->num_rf_chains = ev->num_rf_chains; |
| 4719 | |
| 4720 | wma_handle->target_fw_version = ev->fw_build_vers; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4721 | wma_handle->new_hw_mode_index = ev->default_dbs_hw_mode_index; |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 4722 | policy_mgr_update_new_hw_mode_index(wma_handle->psoc, |
| 4723 | ev->default_dbs_hw_mode_index); |
Krishna Kumaar Natarajan | 1ae4911 | 2015-11-24 21:43:22 -0800 | [diff] [blame] | 4724 | wma_handle->fine_time_measurement_cap = ev->wmi_fw_sub_feat_caps; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4725 | |
| 4726 | WMA_LOGD("%s: Firmware default hw mode index : %d", |
| 4727 | __func__, ev->default_dbs_hw_mode_index); |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 4728 | WMA_LOGI("%s: Firmware build version : %08x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4729 | __func__, ev->fw_build_vers); |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 4730 | WMA_LOGD("FW fine time meas cap: 0x%x", ev->wmi_fw_sub_feat_caps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4731 | |
| 4732 | if (ev->hw_bd_id) { |
| 4733 | wma_handle->hw_bd_id = ev->hw_bd_id; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4734 | qdf_mem_copy(wma_handle->hw_bd_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4735 | ev->hw_bd_info, sizeof(ev->hw_bd_info)); |
| 4736 | |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 4737 | WMA_LOGI("%s: Board version: %x.%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4738 | __func__, |
| 4739 | wma_handle->hw_bd_info[0], wma_handle->hw_bd_info[1]); |
| 4740 | } else { |
| 4741 | wma_handle->hw_bd_id = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4742 | qdf_mem_zero(wma_handle->hw_bd_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4743 | sizeof(wma_handle->hw_bd_info)); |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 4744 | WMA_LOGW("%s: Board version is unknown!", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4745 | } |
| 4746 | |
| 4747 | /* TODO: Recheck below line to dump service ready event */ |
| 4748 | /* dbg_print_wmi_service_11ac(ev); */ |
| 4749 | |
| 4750 | /* wmi service is ready */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4751 | qdf_mem_copy(wma_handle->wmi_service_bitmap, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4752 | param_buf->wmi_service_bitmap, |
| 4753 | sizeof(wma_handle->wmi_service_bitmap)); |
Nirav Shah | 22bf44d | 2015-12-10 15:39:48 +0530 | [diff] [blame] | 4754 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 4755 | cdp_cfg_tx_set_is_mgmt_over_wmi_enabled(soc, |
Nirav Shah | 22bf44d | 2015-12-10 15:39:48 +0530 | [diff] [blame] | 4756 | WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 4757 | WMI_SERVICE_MGMT_TX_WMI)); |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 4758 | cdp_set_desc_global_pool_size(soc, ev->num_msdu_desc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4759 | /* SWBA event handler for beacon transmission */ |
| 4760 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 4761 | WMI_HOST_SWBA_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4762 | wma_beacon_swba_handler, |
| 4763 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4764 | if (status) { |
| 4765 | WMA_LOGE("Failed to register swba beacon event cb"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4766 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4767 | } |
| 4768 | #ifdef WLAN_FEATURE_LPSS |
| 4769 | wma_handle->lpss_support = |
| 4770 | WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 4771 | WMI_SERVICE_LPASS); |
| 4772 | #endif /* WLAN_FEATURE_LPSS */ |
| 4773 | |
| 4774 | /* |
| 4775 | * This Service bit is added to check for ARP/NS Offload |
| 4776 | * support for LL/HL targets |
| 4777 | */ |
| 4778 | wma_handle->ap_arpns_support = |
| 4779 | WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 4780 | WMI_SERVICE_AP_ARPNS_OFFLOAD); |
| 4781 | |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 4782 | wma_handle->bpf_enabled = (wma_handle->bpf_packet_filter_enable && |
Rajeev Kumar | e5a1682 | 2016-07-27 13:11:42 -0700 | [diff] [blame] | 4783 | WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
Anurag Chouhan | 04dbf6d | 2016-09-08 15:32:52 +0530 | [diff] [blame] | 4784 | WMI_SERVICE_BPF_OFFLOAD)); |
| 4785 | wma_update_ra_limit(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4786 | if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 4787 | WMI_SERVICE_CSA_OFFLOAD)) { |
| 4788 | WMA_LOGD("%s: FW support CSA offload capability", __func__); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4789 | status = wmi_unified_register_event_handler( |
| 4790 | wma_handle->wmi_handle, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4791 | WMI_CSA_HANDLING_EVENTID, |
| 4792 | wma_csa_offload_handler, |
| 4793 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4794 | if (status) { |
| 4795 | WMA_LOGE("Failed to register CSA offload event cb"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4796 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4797 | } |
| 4798 | } |
| 4799 | |
| 4800 | if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 4801 | WMI_SERVICE_MGMT_TX_WMI)) { |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 4802 | 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] | 4803 | /* |
| 4804 | * Register Tx completion event handler for MGMT Tx over WMI |
| 4805 | * case |
| 4806 | */ |
| 4807 | status = wmi_unified_register_event_handler( |
| 4808 | wma_handle->wmi_handle, |
| 4809 | WMI_MGMT_TX_COMPLETION_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4810 | wma_mgmt_tx_completion_handler, |
| 4811 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4812 | if (status) { |
| 4813 | WMA_LOGE("Failed to register MGMT over WMI completion handler"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4814 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4815 | } |
| 4816 | |
Nirav Shah | 2048997 | 2016-06-16 19:20:28 +0530 | [diff] [blame] | 4817 | status = wmi_unified_register_event_handler( |
| 4818 | wma_handle->wmi_handle, |
| 4819 | WMI_MGMT_TX_BUNDLE_COMPLETION_EVENTID, |
| 4820 | wma_mgmt_tx_bundle_completion_handler, |
| 4821 | WMA_RX_SERIALIZER_CTX); |
| 4822 | if (status) { |
| 4823 | WMA_LOGE("Failed to register MGMT over WMI completion handler"); |
| 4824 | return -EINVAL; |
| 4825 | } |
| 4826 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4827 | } else { |
| 4828 | WMA_LOGE("FW doesnot support WMI_SERVICE_MGMT_TX_WMI, Use HTT interface for Management Tx"); |
| 4829 | } |
| 4830 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 4831 | if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 4832 | WMI_SERVICE_GTK_OFFLOAD)) { |
| 4833 | status = |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4834 | wmi_unified_register_event_handler( |
| 4835 | wma_handle->wmi_handle, |
Mukul Sharma | 3d36c39 | 2017-01-18 18:39:12 +0530 | [diff] [blame] | 4836 | WMI_GTK_OFFLOAD_STATUS_EVENTID, |
| 4837 | target_if_pmo_gtk_offload_status_event, |
| 4838 | WMA_RX_WORK_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4839 | if (status) { |
| 4840 | WMA_LOGE("Failed to register GTK offload event cb"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4841 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4842 | } |
| 4843 | } |
| 4844 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
| 4845 | |
Wu Gao | 9a704f4 | 2017-03-10 18:42:11 +0800 | [diff] [blame] | 4846 | #ifndef CONVERGED_P2P_ENABLE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4847 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 4848 | WMI_P2P_NOA_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4849 | wma_p2p_noa_event_handler, |
| 4850 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4851 | if (status) { |
| 4852 | WMA_LOGE("Failed to register WMI_P2P_NOA_EVENTID callback"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4853 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4854 | } |
Wu Gao | 9a704f4 | 2017-03-10 18:42:11 +0800 | [diff] [blame] | 4855 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4856 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4857 | WMI_TBTTOFFSET_UPDATE_EVENTID, |
| 4858 | wma_tbttoffset_update_event_handler, |
| 4859 | WMA_RX_SERIALIZER_CTX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4860 | if (status) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4861 | WMA_LOGE("Failed to register WMI_TBTTOFFSET_UPDATE_EVENTID callback"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4862 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4863 | } |
| 4864 | |
Govind Singh | efc5ccd | 2016-04-25 11:11:55 +0530 | [diff] [blame] | 4865 | /* mac_id is replaced with pdev_id in converged firmware to have |
| 4866 | * multi-radio support. In order to maintain backward compatibility |
| 4867 | * with old fw, host needs to check WMI_SERVICE_DEPRECATED_REPLACE |
| 4868 | * in service bitmap from FW and host needs to set use_pdev_id in |
| 4869 | * wmi_resource_config to true. If WMI_SERVICE_DEPRECATED_REPLACE |
| 4870 | * service is not set, then host shall not expect MAC ID from FW in |
| 4871 | * VDEV START RESPONSE event and host shall use PDEV ID. |
| 4872 | */ |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4873 | if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
Govind Singh | efc5ccd | 2016-04-25 11:11:55 +0530 | [diff] [blame] | 4874 | WMI_SERVICE_DEPRECATED_REPLACE)) |
| 4875 | wma_handle->wlan_resource_config.use_pdev_id = true; |
| 4876 | else |
| 4877 | wma_handle->wlan_resource_config.use_pdev_id = false; |
| 4878 | |
Nitesh Shah | f9a09ff | 2017-05-22 15:46:25 +0530 | [diff] [blame] | 4879 | wma_handle->wlan_resource_config.max_num_dbs_scan_duty_cycle = |
| 4880 | CDS_DBS_SCAN_CLIENTS_MAX; |
| 4881 | |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 4882 | /* register the Enhanced Green AP event handler */ |
| 4883 | wma_register_egap_event_handle(wma_handle); |
| 4884 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4885 | /* Initialize the log supported event handler */ |
| 4886 | status = wmi_unified_register_event_handler(wma_handle->wmi_handle, |
| 4887 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID, |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4888 | wma_log_supported_evt_handler, |
| 4889 | WMA_RX_SERIALIZER_CTX); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4890 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4891 | WMA_LOGE("Failed to register log supported event cb"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4892 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4893 | } |
| 4894 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 4895 | cdp_mark_first_wakeup_packet(soc, |
Himanshu Agarwal | 19141bb | 2016-07-20 20:15:48 +0530 | [diff] [blame] | 4896 | WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 4897 | WMI_SERVICE_MARK_FIRST_WAKEUP_PACKET)); |
Arif Hussain | 759a023 | 2017-03-20 13:17:18 -0700 | [diff] [blame] | 4898 | wma_handle->dfs_cac_offload = |
| 4899 | WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 4900 | WMI_SERVICE_DFS_PHYERR_OFFLOAD); |
Deepak Dhamdhere | 13230d3 | 2016-05-26 00:46:53 -0700 | [diff] [blame] | 4901 | wma_handle->nan_datapath_enabled = |
| 4902 | WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 4903 | WMI_SERVICE_NAN_DATA); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4904 | qdf_mem_copy(target_cap.wmi_service_bitmap, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4905 | param_buf->wmi_service_bitmap, |
| 4906 | sizeof(wma_handle->wmi_service_bitmap)); |
| 4907 | target_cap.wlan_resource_config = wma_handle->wlan_resource_config; |
| 4908 | wma_update_fw_config(wma_handle, &target_cap); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4909 | qdf_mem_copy(wma_handle->wmi_service_bitmap, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4910 | target_cap.wmi_service_bitmap, |
| 4911 | sizeof(wma_handle->wmi_service_bitmap)); |
| 4912 | wma_handle->wlan_resource_config = target_cap.wlan_resource_config; |
| 4913 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 4914 | status = wmi_unified_save_fw_version_cmd(wma_handle->wmi_handle, |
| 4915 | param_buf); |
| 4916 | if (status != EOK) { |
| 4917 | WMA_LOGE("Failed to send WMI_INIT_CMDID command"); |
| 4918 | return -EINVAL; |
| 4919 | } |
| 4920 | |
| 4921 | status = wma_setup_wmi_init_msg(wma_handle, ev, param_buf); |
| 4922 | if (status != EOK) { |
| 4923 | WMA_LOGE("Failed to setup for wma init command"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4924 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4925 | } |
| 4926 | |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 4927 | /* A host, which supports WMI_SERVICE_READY_EXT_EVENTID, would need to |
| 4928 | * check the WMI_SERVICE_READY message for an "extension" flag, and if |
| 4929 | * this flag is set, then hold off on sending the WMI_INIT message until |
| 4930 | * WMI_SERVICE_READY_EXT_EVENTID is received. |
| 4931 | */ |
| 4932 | if (!WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 4933 | WMI_SERVICE_EXT_MSG)) { |
| 4934 | /* No service extended message support. |
| 4935 | * Send INIT command immediately |
| 4936 | */ |
| 4937 | WMA_LOGA("WMA --> WMI_INIT_CMDID"); |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 4938 | status = wmi_unified_send_init_cmd(wma_handle->wmi_handle, |
| 4939 | &wma_handle->wlan_resource_config, |
| 4940 | wma_handle->num_mem_chunks, |
| 4941 | wma_handle->mem_chunks, 1); |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 4942 | if (status != EOK) { |
| 4943 | WMA_LOGE("Failed to send WMI_INIT_CMDID command"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4944 | return -EINVAL; |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 4945 | } |
| 4946 | } else { |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 4947 | status = wmi_unified_send_init_cmd(wma_handle->wmi_handle, |
| 4948 | &wma_handle->wlan_resource_config, |
| 4949 | wma_handle->num_mem_chunks, |
| 4950 | wma_handle->mem_chunks, 0); |
| 4951 | if (status != EOK) { |
| 4952 | WMA_LOGE("Failed to save WMI_INIT_CMDID command parameter"); |
| 4953 | return -EINVAL; |
| 4954 | } |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 4955 | /* The saved 'buf' will be freed after sending INIT command or |
| 4956 | * in other cases as required |
| 4957 | */ |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 4958 | ret = qdf_mc_timer_start(&wma_handle->service_ready_ext_timer, |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 4959 | WMA_SERVICE_READY_EXT_TIMEOUT); |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 4960 | if (!QDF_IS_STATUS_SUCCESS(ret)) |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 4961 | WMA_LOGE("Failed to start the service ready ext timer"); |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 4962 | |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 4963 | WMA_LOGD("%s: WMA waiting for WMI_SERVICE_READY_EXT_EVENTID", |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 4964 | __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4965 | } |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4966 | |
Nachiket Kukade | 8b4bfd8 | 2017-05-25 18:34:48 +0530 | [diff] [blame] | 4967 | if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 4968 | WMI_SERVICE_8SS_TX_BFEE)) |
| 4969 | wma_handle->tx_bfee_8ss_enabled = true; |
| 4970 | else |
| 4971 | wma_handle->tx_bfee_8ss_enabled = false; |
| 4972 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 4973 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4974 | } |
| 4975 | |
| 4976 | /** |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 4977 | * wma_get_phyid_for_given_band() - to get phyid for band |
| 4978 | * |
| 4979 | * @wma_handle: Pointer to wma handle |
| 4980 | * @map: Pointer to map which is derived from hw mode & has mapping between |
| 4981 | * hw mode and available PHYs for that hw mode. |
| 4982 | * @band: enum value of for 2G or 5G band |
| 4983 | * @phyid: Pointer to phyid which needs to be filled |
| 4984 | * |
| 4985 | * This API looks in to the map to find out which particular phy supports |
| 4986 | * provided band and return the idx (also called phyid) of that phy. Caller |
| 4987 | * use this phyid to fetch various caps of that phy |
| 4988 | * |
| 4989 | * Return: QDF_STATUS |
| 4990 | */ |
| 4991 | static QDF_STATUS wma_get_phyid_for_given_band( |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 4992 | tp_wma_handle wma_handle, |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 4993 | struct hw_mode_idx_to_mac_cap_idx *map, |
| 4994 | enum cds_band_type band, uint8_t *phyid) |
| 4995 | { |
| 4996 | uint8_t idx, i; |
| 4997 | WMI_MAC_PHY_CAPABILITIES *cap; |
| 4998 | |
| 4999 | if (!wma_handle) { |
| 5000 | WMA_LOGE("Invalid wma handle"); |
| 5001 | return QDF_STATUS_E_FAILURE; |
| 5002 | } |
| 5003 | |
| 5004 | if (!map) { |
| 5005 | WMA_LOGE("Invalid given map"); |
| 5006 | return QDF_STATUS_E_FAILURE; |
| 5007 | } |
| 5008 | idx = map->mac_cap_idx; |
| 5009 | *phyid = idx; |
| 5010 | |
| 5011 | for (i = 0; i < map->num_of_macs; i++) { |
| 5012 | cap = &wma_handle->phy_caps.each_phy_cap_per_hwmode[idx + i]; |
| 5013 | if ((band == CDS_BAND_2GHZ) && |
| 5014 | (WLAN_2G_CAPABILITY == cap->supported_bands)) { |
| 5015 | *phyid = idx + i; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5016 | WMA_LOGD("Select 2G capable phyid[%d]", *phyid); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5017 | return QDF_STATUS_SUCCESS; |
| 5018 | } else if ((band == CDS_BAND_5GHZ) && |
| 5019 | (WLAN_5G_CAPABILITY == cap->supported_bands)) { |
| 5020 | *phyid = idx + i; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5021 | WMA_LOGD("Select 5G capable phyid[%d]", *phyid); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5022 | return QDF_STATUS_SUCCESS; |
| 5023 | } |
| 5024 | } |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5025 | WMA_LOGD("Using default single hw mode phyid[%d]", *phyid); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5026 | return QDF_STATUS_SUCCESS; |
| 5027 | } |
| 5028 | |
| 5029 | /** |
| 5030 | * wma_get_caps_for_phyidx_hwmode() - to fetch caps for given hw mode and band |
| 5031 | * @caps_per_phy: Pointer to capabilities structure which needs to be filled |
| 5032 | * @hw_mode: Provided hardware mode |
| 5033 | * @band: Provide band i.e. 2G or 5G |
| 5034 | * |
| 5035 | * This API finds cap which suitable for provided hw mode and band. If user |
| 5036 | * is provides some invalid hw mode then it will automatically falls back to |
| 5037 | * default hw mode |
| 5038 | * |
| 5039 | * Return: QDF_STATUS |
| 5040 | */ |
| 5041 | QDF_STATUS wma_get_caps_for_phyidx_hwmode(struct wma_caps_per_phy *caps_per_phy, |
| 5042 | enum hw_mode_dbs_capab hw_mode, enum cds_band_type band) |
| 5043 | { |
| 5044 | t_wma_handle *wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 5045 | struct hw_mode_idx_to_mac_cap_idx *map; |
| 5046 | WMI_MAC_PHY_CAPABILITIES *phy_cap; |
| 5047 | uint8_t phyid, our_hw_mode = hw_mode; |
| 5048 | |
| 5049 | if (!wma_handle) { |
| 5050 | WMA_LOGE("Invalid wma handle"); |
| 5051 | return QDF_STATUS_E_FAILURE; |
| 5052 | } |
| 5053 | |
| 5054 | if (0 == wma_handle->phy_caps.num_hw_modes.num_hw_modes) { |
| 5055 | WMA_LOGE("Invalid number of hw modes"); |
| 5056 | return QDF_STATUS_E_FAILURE; |
| 5057 | } |
| 5058 | |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 5059 | if (!policy_mgr_is_dbs_enable(wma_handle->psoc)) |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5060 | our_hw_mode = HW_MODE_DBS_NONE; |
| 5061 | |
| 5062 | if (!caps_per_phy) { |
| 5063 | WMA_LOGE("Invalid caps pointer"); |
| 5064 | return QDF_STATUS_E_FAILURE; |
| 5065 | } |
| 5066 | |
| 5067 | map = &wma_handle->phy_caps.hw_mode_to_mac_cap_map[our_hw_mode]; |
| 5068 | |
| 5069 | if (QDF_STATUS_SUCCESS != |
| 5070 | wma_get_phyid_for_given_band(wma_handle, map, band, &phyid)) { |
| 5071 | WMA_LOGE("Invalid phyid"); |
| 5072 | return QDF_STATUS_E_FAILURE; |
| 5073 | } |
| 5074 | phy_cap = &wma_handle->phy_caps.each_phy_cap_per_hwmode[phyid]; |
| 5075 | |
| 5076 | caps_per_phy->ht_2g = phy_cap->ht_cap_info_2G; |
| 5077 | caps_per_phy->ht_5g = phy_cap->ht_cap_info_5G; |
| 5078 | caps_per_phy->vht_2g = phy_cap->vht_cap_info_2G; |
| 5079 | caps_per_phy->vht_5g = phy_cap->vht_cap_info_5G; |
| 5080 | caps_per_phy->he_2g = phy_cap->he_cap_info_2G; |
| 5081 | caps_per_phy->he_5g = phy_cap->he_cap_info_5G; |
| 5082 | |
| 5083 | return QDF_STATUS_SUCCESS; |
| 5084 | } |
| 5085 | |
| 5086 | /** |
| 5087 | * wma_is_rx_ldpc_supported_for_channel() - to find out if ldpc is supported |
| 5088 | * |
| 5089 | * @channel: Channel number for which it needs to check if rx ldpc is enabled |
| 5090 | * |
| 5091 | * This API takes channel number as argument and takes default hw mode as DBS |
| 5092 | * to check if rx LDPC support is enabled for that channel or no |
| 5093 | */ |
| 5094 | bool wma_is_rx_ldpc_supported_for_channel(uint32_t channel) |
| 5095 | { |
| 5096 | struct wma_caps_per_phy caps_per_phy = {0}; |
| 5097 | enum cds_band_type band; |
| 5098 | bool status; |
| 5099 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 5100 | if (!WLAN_REG_IS_24GHZ_CH(channel)) |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5101 | band = CDS_BAND_5GHZ; |
| 5102 | else |
| 5103 | band = CDS_BAND_2GHZ; |
| 5104 | |
| 5105 | if (QDF_STATUS_SUCCESS != wma_get_caps_for_phyidx_hwmode( |
| 5106 | &caps_per_phy, |
| 5107 | HW_MODE_DBS, band)) { |
| 5108 | return false; |
| 5109 | } |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 5110 | if (WLAN_REG_IS_24GHZ_CH(channel)) |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5111 | status = (!!(caps_per_phy.ht_2g & WMI_HT_CAP_RX_LDPC)); |
| 5112 | else |
| 5113 | status = (!!(caps_per_phy.ht_5g & WMI_HT_CAP_RX_LDPC)); |
| 5114 | |
| 5115 | return status; |
| 5116 | } |
| 5117 | |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 5118 | /** |
| 5119 | * wma_print_mac_phy_capabilities() - Prints MAC PHY capabilities |
| 5120 | * @cap: pointer to WMI_MAC_PHY_CAPABILITIES |
| 5121 | * @index: MAC_PHY index |
| 5122 | * |
| 5123 | * Return: none |
| 5124 | */ |
| 5125 | static void wma_print_mac_phy_capabilities(WMI_MAC_PHY_CAPABILITIES *cap, |
| 5126 | int index) |
| 5127 | { |
| 5128 | uint32_t mac_2G, mac_5G; |
| 5129 | uint32_t phy_2G[WMI_MAX_HECAP_PHY_SIZE]; |
| 5130 | uint32_t phy_5G[WMI_MAX_HECAP_PHY_SIZE]; |
| 5131 | wmi_ppe_threshold ppet_2G, ppet_5G; |
| 5132 | |
| 5133 | WMA_LOGI("\t: index [%d]", index); |
| 5134 | WMA_LOGI("\t: cap for hw_mode_id[%d]", cap->hw_mode_id); |
| 5135 | WMA_LOGI("\t: pdev_id[%d]", cap->pdev_id); |
| 5136 | WMA_LOGI("\t: phy_id[%d]", cap->phy_id); |
| 5137 | WMA_LOGI("\t: supports_11b[%d]", |
| 5138 | WMI_SUPPORT_11B_GET(cap->supported_flags)); |
| 5139 | WMA_LOGI("\t: supports_11g[%d]", |
| 5140 | WMI_SUPPORT_11G_GET(cap->supported_flags)); |
| 5141 | WMA_LOGI("\t: supports_11a[%d]", |
| 5142 | WMI_SUPPORT_11A_GET(cap->supported_flags)); |
| 5143 | WMA_LOGI("\t: supports_11n[%d]", |
| 5144 | WMI_SUPPORT_11N_GET(cap->supported_flags)); |
| 5145 | WMA_LOGI("\t: supports_11ac[%d]", |
| 5146 | WMI_SUPPORT_11AC_GET(cap->supported_flags)); |
| 5147 | WMA_LOGI("\t: supports_11ax[%d]", |
| 5148 | WMI_SUPPORT_11AX_GET(cap->supported_flags)); |
| 5149 | WMA_LOGI("\t: supported_flags[%d]", cap->supported_flags); |
| 5150 | WMA_LOGI("\t: supported_bands[%d]", cap->supported_bands); |
| 5151 | WMA_LOGI("\t: ampdu_density[%d]", cap->ampdu_density); |
| 5152 | WMA_LOGI("\t: max_bw_supported_2G[%d]", cap->max_bw_supported_2G); |
| 5153 | WMA_LOGI("\t: ht_cap_info_2G[%d]", cap->ht_cap_info_2G); |
| 5154 | WMA_LOGI("\t: vht_cap_info_2G[%d]", cap->vht_cap_info_2G); |
| 5155 | WMA_LOGI("\t: vht_supp_mcs_2G[%d]", cap->vht_supp_mcs_2G); |
| 5156 | WMA_LOGI("\t: tx_chain_mask_2G[%d]", cap->tx_chain_mask_2G); |
| 5157 | WMA_LOGI("\t: rx_chain_mask_2G[%d]", cap->rx_chain_mask_2G); |
| 5158 | WMA_LOGI("\t: max_bw_supported_5G[%d]", cap->max_bw_supported_5G); |
| 5159 | WMA_LOGI("\t: ht_cap_info_5G[%d]", cap->ht_cap_info_5G); |
| 5160 | WMA_LOGI("\t: vht_cap_info_5G[%d]", cap->vht_cap_info_5G); |
| 5161 | WMA_LOGI("\t: vht_supp_mcs_5G[%d]", cap->vht_supp_mcs_5G); |
| 5162 | WMA_LOGI("\t: tx_chain_mask_5G[%d]", cap->tx_chain_mask_5G); |
| 5163 | WMA_LOGI("\t: rx_chain_mask_5G[%d]", cap->rx_chain_mask_5G); |
| 5164 | WMA_LOGI("\t: he_cap_info_2G[%08x]", cap->he_cap_info_2G); |
| 5165 | WMA_LOGI("\t: he_supp_mcs_2G[%08x]", cap->he_supp_mcs_2G); |
| 5166 | WMA_LOGI("\t: he_cap_info_5G[%08x]", cap->he_cap_info_5G); |
| 5167 | WMA_LOGI("\t: he_supp_mcs_5G[%08x]", cap->he_supp_mcs_5G); |
| 5168 | mac_2G = cap->he_cap_info_2G; |
| 5169 | mac_5G = cap->he_cap_info_5G; |
| 5170 | qdf_mem_copy(phy_2G, cap->he_cap_phy_info_2G, |
| 5171 | WMI_MAX_HECAP_PHY_SIZE * 4); |
| 5172 | qdf_mem_copy(phy_5G, cap->he_cap_phy_info_5G, |
| 5173 | WMI_MAX_HECAP_PHY_SIZE * 4); |
| 5174 | ppet_2G = cap->he_ppet2G; |
| 5175 | ppet_5G = cap->he_ppet5G; |
| 5176 | |
| 5177 | wma_print_he_mac_cap(mac_2G); |
| 5178 | wma_print_he_phy_cap(phy_2G); |
| 5179 | wma_print_he_ppet(&ppet_2G); |
| 5180 | wma_print_he_mac_cap(mac_5G); |
| 5181 | wma_print_he_phy_cap(phy_5G); |
| 5182 | wma_print_he_ppet(&ppet_5G); |
| 5183 | } |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 5184 | |
| 5185 | /** |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5186 | * wma_print_populate_soc_caps() - Prints all the caps populated per hw mode |
| 5187 | * @wma_handle: pointer to wma_handle |
| 5188 | * |
| 5189 | * This function prints all the caps populater per hw mode and per PHY |
| 5190 | * |
| 5191 | * Return: none |
| 5192 | */ |
| 5193 | static void wma_print_populate_soc_caps(t_wma_handle *wma_handle) |
| 5194 | { |
| 5195 | int i, j = 0, max_mac; |
| 5196 | WMI_MAC_PHY_CAPABILITIES *tmp; |
| 5197 | |
| 5198 | /* print number of hw modes */ |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5199 | WMA_LOGD("%s: num of hw modes [%d]", __func__, |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5200 | wma_handle->phy_caps.num_hw_modes.num_hw_modes); |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5201 | WMA_LOGD("%s: <====== HW mode cap printing starts ======>", __func__); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5202 | /* print cap of each hw mode */ |
| 5203 | for (i = 0; i < wma_handle->phy_caps.num_hw_modes.num_hw_modes; i++) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5204 | WMA_LOGD("====>: hw mode id[%d], phy_id map[%d]", |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5205 | wma_handle->phy_caps.each_hw_mode_cap[i].hw_mode_id, |
| 5206 | wma_handle->phy_caps.each_hw_mode_cap[i].phy_id_map); |
| 5207 | if (wma_handle->phy_caps.each_hw_mode_cap[i].phy_id_map == |
| 5208 | PHY1_PHY2) |
| 5209 | max_mac = j + 2; |
| 5210 | else |
| 5211 | max_mac = j + 1; |
| 5212 | |
| 5213 | for ( ; j < max_mac; j++) { |
| 5214 | tmp = &wma_handle->phy_caps.each_phy_cap_per_hwmode[j]; |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 5215 | wma_print_mac_phy_capabilities(tmp, j); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5216 | } |
| 5217 | } |
| 5218 | WMA_LOGI("%s: <====== HW mode cap printing ends ======>\n", __func__); |
| 5219 | } |
| 5220 | |
| 5221 | /** |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5222 | * wma_map_wmi_channel_width_to_hw_mode_bw() - returns bandwidth |
| 5223 | * in terms of hw_mode_bandwidth |
| 5224 | * @width: bandwidth in terms of wmi_channel_width |
| 5225 | * |
| 5226 | * This function returns the bandwidth in terms of hw_mode_bandwidth. |
| 5227 | * |
| 5228 | * Return: BW in terms of hw_mode_bandwidth. |
| 5229 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 5230 | 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] | 5231 | wmi_channel_width width) |
| 5232 | { |
| 5233 | switch (width) { |
| 5234 | case WMI_CHAN_WIDTH_20: |
| 5235 | return HW_MODE_20_MHZ; |
| 5236 | case WMI_CHAN_WIDTH_40: |
| 5237 | return HW_MODE_40_MHZ; |
| 5238 | case WMI_CHAN_WIDTH_80: |
| 5239 | return HW_MODE_80_MHZ; |
| 5240 | case WMI_CHAN_WIDTH_160: |
| 5241 | return HW_MODE_160_MHZ; |
| 5242 | case WMI_CHAN_WIDTH_80P80: |
| 5243 | return HW_MODE_80_PLUS_80_MHZ; |
| 5244 | case WMI_CHAN_WIDTH_5: |
| 5245 | return HW_MODE_5_MHZ; |
| 5246 | case WMI_CHAN_WIDTH_10: |
| 5247 | return HW_MODE_10_MHZ; |
| 5248 | default: |
| 5249 | return HW_MODE_BW_NONE; |
| 5250 | } |
| 5251 | |
| 5252 | return HW_MODE_BW_NONE; |
| 5253 | } |
| 5254 | |
| 5255 | /** |
| 5256 | * wma_get_hw_mode_params() - get TX-RX stream and bandwidth |
| 5257 | * supported from the capabilities. |
| 5258 | * @caps: PHY capability |
| 5259 | * @info: param to store TX-RX stream and BW information |
| 5260 | * |
| 5261 | * This function will calculate TX-RX stream and bandwidth supported |
| 5262 | * as per the PHY capability, and assign to mac_ss_bw_info. |
| 5263 | * |
| 5264 | * Return: none |
| 5265 | */ |
| 5266 | static void wma_get_hw_mode_params(WMI_MAC_PHY_CAPABILITIES *caps, |
| 5267 | struct mac_ss_bw_info *info) |
| 5268 | { |
| 5269 | if (!caps) { |
| 5270 | WMA_LOGE("%s: Invalid capabilities", __func__); |
| 5271 | return; |
| 5272 | } |
| 5273 | |
| 5274 | info->mac_tx_stream = wma_get_num_of_setbits_from_bitmask( |
| 5275 | QDF_MAX(caps->tx_chain_mask_2G, |
| 5276 | caps->tx_chain_mask_5G)); |
| 5277 | info->mac_rx_stream = wma_get_num_of_setbits_from_bitmask( |
| 5278 | QDF_MAX(caps->rx_chain_mask_2G, |
| 5279 | caps->rx_chain_mask_5G)); |
| 5280 | info->mac_bw = wma_map_wmi_channel_width_to_hw_mode_bw( |
| 5281 | QDF_MAX(caps->max_bw_supported_2G, |
| 5282 | caps->max_bw_supported_5G)); |
| 5283 | } |
| 5284 | |
| 5285 | /** |
| 5286 | * wma_set_hw_mode_params() - sets TX-RX stream, bandwidth and |
| 5287 | * DBS in hw_mode_list |
| 5288 | * @wma_handle: pointer to wma global structure |
| 5289 | * @mac0_ss_bw_info: TX-RX streams, BW for MAC0 |
| 5290 | * @mac1_ss_bw_info: TX-RX streams, BW for MAC1 |
| 5291 | * @pos: refers to hw_mode_index |
| 5292 | * @dbs_mode: dbs_mode for the dbs_hw_mode |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5293 | * @sbs_mode: sbs_mode for the sbs_hw_mode |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5294 | * |
| 5295 | * This function sets TX-RX stream, bandwidth and DBS mode in |
| 5296 | * hw_mode_list. |
| 5297 | * |
| 5298 | * Return: none |
| 5299 | */ |
| 5300 | static void wma_set_hw_mode_params(t_wma_handle *wma_handle, |
| 5301 | struct mac_ss_bw_info mac0_ss_bw_info, |
| 5302 | struct mac_ss_bw_info mac1_ss_bw_info, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5303 | uint32_t pos, uint32_t dbs_mode, |
| 5304 | uint32_t sbs_mode) |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5305 | { |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5306 | WMA_HW_MODE_MAC0_TX_STREAMS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5307 | wma_handle->hw_mode.hw_mode_list[pos], |
| 5308 | mac0_ss_bw_info.mac_tx_stream); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5309 | WMA_HW_MODE_MAC0_RX_STREAMS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5310 | wma_handle->hw_mode.hw_mode_list[pos], |
| 5311 | mac0_ss_bw_info.mac_rx_stream); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5312 | WMA_HW_MODE_MAC0_BANDWIDTH_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5313 | wma_handle->hw_mode.hw_mode_list[pos], |
| 5314 | mac0_ss_bw_info.mac_bw); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5315 | WMA_HW_MODE_MAC1_TX_STREAMS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5316 | wma_handle->hw_mode.hw_mode_list[pos], |
| 5317 | mac1_ss_bw_info.mac_tx_stream); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5318 | WMA_HW_MODE_MAC1_RX_STREAMS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5319 | wma_handle->hw_mode.hw_mode_list[pos], |
| 5320 | mac1_ss_bw_info.mac_rx_stream); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5321 | WMA_HW_MODE_MAC1_BANDWIDTH_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5322 | wma_handle->hw_mode.hw_mode_list[pos], |
| 5323 | mac1_ss_bw_info.mac_bw); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5324 | WMA_HW_MODE_DBS_MODE_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5325 | wma_handle->hw_mode.hw_mode_list[pos], |
| 5326 | dbs_mode); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5327 | WMA_HW_MODE_AGILE_DFS_SET( |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5328 | wma_handle->hw_mode.hw_mode_list[pos], |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5329 | HW_MODE_AGILE_DFS_NONE); |
| 5330 | WMA_HW_MODE_SBS_MODE_SET( |
| 5331 | wma_handle->hw_mode.hw_mode_list[pos], |
| 5332 | sbs_mode); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5333 | } |
| 5334 | |
| 5335 | /** |
| 5336 | * wma_update_hw_mode_list() - updates hw_mode_list |
| 5337 | * @wma_handle: pointer to wma global structure |
| 5338 | * |
| 5339 | * This function updates hw_mode_list with tx_streams, rx_streams, |
| 5340 | * bandwidth, dbs and agile dfs for each hw_mode. |
| 5341 | * |
| 5342 | * Returns: 0 for success else failure. |
| 5343 | */ |
| 5344 | static QDF_STATUS wma_update_hw_mode_list(t_wma_handle *wma_handle) |
| 5345 | { |
| 5346 | struct extended_caps *phy_caps; |
| 5347 | WMI_MAC_PHY_CAPABILITIES *tmp; |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5348 | uint32_t i, hw_config_type, j = 0; |
| 5349 | uint32_t dbs_mode, sbs_mode; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5350 | struct mac_ss_bw_info mac0_ss_bw_info = {0}; |
| 5351 | struct mac_ss_bw_info mac1_ss_bw_info = {0}; |
| 5352 | |
| 5353 | if (!wma_handle) { |
| 5354 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 5355 | return QDF_STATUS_E_FAILURE; |
| 5356 | } |
| 5357 | |
| 5358 | phy_caps = &wma_handle->phy_caps; |
| 5359 | if (!phy_caps) { |
| 5360 | WMA_LOGE("%s: Invalid phy capabilities", __func__); |
| 5361 | return QDF_STATUS_SUCCESS; |
| 5362 | } |
| 5363 | |
| 5364 | if (!phy_caps->num_hw_modes.num_hw_modes) { |
| 5365 | WMA_LOGE("%s: Number of HW modes: %d", |
| 5366 | __func__, phy_caps->num_hw_modes.num_hw_modes); |
| 5367 | return QDF_STATUS_SUCCESS; |
| 5368 | } |
| 5369 | |
| 5370 | /* |
| 5371 | * This list was updated as part of service ready event. Re-populate |
| 5372 | * HW mode list from the device capabilities. |
| 5373 | */ |
| 5374 | if (wma_handle->hw_mode.hw_mode_list) { |
| 5375 | qdf_mem_free(wma_handle->hw_mode.hw_mode_list); |
| 5376 | wma_handle->hw_mode.hw_mode_list = NULL; |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5377 | WMA_LOGD("%s: DBS list is freed", __func__); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5378 | } |
| 5379 | |
| 5380 | wma_handle->num_dbs_hw_modes = phy_caps->num_hw_modes.num_hw_modes; |
| 5381 | wma_handle->hw_mode.hw_mode_list = |
| 5382 | qdf_mem_malloc(sizeof(*wma_handle->hw_mode.hw_mode_list) * |
| 5383 | wma_handle->num_dbs_hw_modes); |
| 5384 | if (!wma_handle->hw_mode.hw_mode_list) { |
| 5385 | WMA_LOGE("%s: Memory allocation failed for DBS", __func__); |
| 5386 | return QDF_STATUS_E_FAILURE; |
| 5387 | } |
| 5388 | |
Srinivas Girigowda | f147212 | 2017-03-09 15:44:12 -0800 | [diff] [blame] | 5389 | WMA_LOGD("%s: Updated HW mode list: Num modes:%d", |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5390 | __func__, wma_handle->num_dbs_hw_modes); |
| 5391 | |
| 5392 | for (i = 0; i < wma_handle->num_dbs_hw_modes; i++) { |
| 5393 | /* Update for MAC0 */ |
| 5394 | tmp = &phy_caps->each_phy_cap_per_hwmode[j++]; |
| 5395 | wma_get_hw_mode_params(tmp, &mac0_ss_bw_info); |
| 5396 | hw_config_type = |
| 5397 | phy_caps->each_hw_mode_cap[i].hw_mode_config_type; |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5398 | dbs_mode = HW_MODE_DBS_NONE; |
| 5399 | sbs_mode = HW_MODE_SBS_NONE; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5400 | mac1_ss_bw_info.mac_tx_stream = 0; |
| 5401 | mac1_ss_bw_info.mac_rx_stream = 0; |
| 5402 | mac1_ss_bw_info.mac_bw = 0; |
| 5403 | |
| 5404 | /* SBS and DBS have dual MAC. Upto 2 MACs are considered. */ |
| 5405 | if ((hw_config_type == WMI_HW_MODE_DBS) || |
| 5406 | (hw_config_type == WMI_HW_MODE_SBS_PASSIVE) || |
| 5407 | (hw_config_type == WMI_HW_MODE_SBS)) { |
| 5408 | /* Update for MAC1 */ |
| 5409 | tmp = &phy_caps->each_phy_cap_per_hwmode[j++]; |
| 5410 | wma_get_hw_mode_params(tmp, &mac1_ss_bw_info); |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5411 | if (hw_config_type == WMI_HW_MODE_DBS) |
| 5412 | dbs_mode = HW_MODE_DBS; |
| 5413 | if ((hw_config_type == WMI_HW_MODE_SBS_PASSIVE) || |
| 5414 | (hw_config_type == WMI_HW_MODE_SBS)) |
| 5415 | sbs_mode = HW_MODE_SBS; |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5416 | } |
| 5417 | |
| 5418 | /* Updating HW mode list */ |
| 5419 | wma_set_hw_mode_params(wma_handle, mac0_ss_bw_info, |
Nitesh Shah | 5b7bae0 | 2016-09-28 18:58:33 +0530 | [diff] [blame] | 5420 | mac1_ss_bw_info, i, dbs_mode, |
| 5421 | sbs_mode); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5422 | } |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 5423 | |
| 5424 | if (QDF_STATUS_SUCCESS != |
| 5425 | policy_mgr_update_hw_mode_list(wma_handle->psoc, phy_caps)) |
| 5426 | WMA_LOGE("%s: failed to update policy manager", __func__); |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5427 | wma_dump_dbs_hw_mode(wma_handle); |
| 5428 | return QDF_STATUS_SUCCESS; |
| 5429 | } |
| 5430 | |
Naveen Rawat | 4efe41b | 2017-04-29 16:23:14 -0700 | [diff] [blame] | 5431 | static void wma_init_wifi_pos_dma_rings(t_wma_handle *wma_handle, |
| 5432 | uint8_t num_mac, void *buf) |
| 5433 | { |
| 5434 | struct hif_softc *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); |
| 5435 | void *hal_soc = hif_get_hal_handle(hif_ctx); |
| 5436 | |
| 5437 | wifi_pos_init_cir_cfr_rings(wma_handle->psoc, hal_soc, num_mac, buf); |
| 5438 | } |
| 5439 | |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5440 | /** |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5441 | * wma_populate_soc_caps() - populate entire SOC's capabilities |
| 5442 | * @wma_handle: pointer to wma global structure |
| 5443 | * @param_buf: pointer to param of service ready extension event from fw |
| 5444 | * |
| 5445 | * This API populates all capabilities of entire SOC. For example, |
| 5446 | * how many number of hw modes are supported by this SOC, what are the |
| 5447 | * capabilities of each phy per hw mode, what are HAL reg capabilities per |
| 5448 | * phy. |
| 5449 | * |
| 5450 | * Return: none |
| 5451 | */ |
| 5452 | static void wma_populate_soc_caps(t_wma_handle *wma_handle, |
| 5453 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf) |
| 5454 | { |
| 5455 | int i, num_of_mac_caps = 0, tmp = 0; |
| 5456 | struct extended_caps *phy_caps; |
| 5457 | struct hw_mode_idx_to_mac_cap_idx *map; |
| 5458 | |
| 5459 | WMA_LOGD("%s: Enter", __func__); |
| 5460 | |
| 5461 | if (!wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5462 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5463 | return; |
| 5464 | } |
| 5465 | |
| 5466 | if (!param_buf) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5467 | WMA_LOGE("%s: Invalid event", __func__); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5468 | return; |
| 5469 | } |
| 5470 | phy_caps = &wma_handle->phy_caps; |
| 5471 | |
| 5472 | /* |
| 5473 | * first thing to do is to get how many number of hw modes are |
| 5474 | * supported and populate in wma_handle global structure |
| 5475 | */ |
Krunal Soni | fd85ba6 | 2016-07-11 08:18:53 -0700 | [diff] [blame] | 5476 | if (NULL == param_buf->soc_hw_mode_caps) { |
| 5477 | WMA_LOGE("%s: Invalid number of hw modes", __func__); |
| 5478 | return; |
| 5479 | } |
| 5480 | |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5481 | qdf_mem_copy(&phy_caps->num_hw_modes, |
| 5482 | param_buf->soc_hw_mode_caps, |
| 5483 | sizeof(WMI_SOC_MAC_PHY_HW_MODE_CAPS)); |
| 5484 | if (0 == phy_caps->num_hw_modes.num_hw_modes) { |
Krunal Soni | fd85ba6 | 2016-07-11 08:18:53 -0700 | [diff] [blame] | 5485 | WMA_LOGE("%s: Number of hw modes is zero", __func__); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5486 | return; |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5487 | } |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5488 | WMA_LOGD("%s: Given number of hw modes[%d]", |
Krunal Soni | fd85ba6 | 2016-07-11 08:18:53 -0700 | [diff] [blame] | 5489 | __func__, phy_caps->num_hw_modes.num_hw_modes); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5490 | |
| 5491 | /* |
| 5492 | * next thing is to allocate the memory to map hw mode to phy/mac caps |
| 5493 | */ |
| 5494 | phy_caps->hw_mode_to_mac_cap_map = |
| 5495 | qdf_mem_malloc(phy_caps->num_hw_modes.num_hw_modes * |
| 5496 | sizeof(struct hw_mode_idx_to_mac_cap_idx)); |
| 5497 | if (!phy_caps->hw_mode_to_mac_cap_map) { |
| 5498 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 5499 | return; |
| 5500 | } |
| 5501 | |
| 5502 | /* |
| 5503 | * next thing is to allocate the memory for per hw caps |
| 5504 | */ |
| 5505 | phy_caps->each_hw_mode_cap = |
| 5506 | qdf_mem_malloc(phy_caps->num_hw_modes.num_hw_modes * |
| 5507 | sizeof(WMI_HW_MODE_CAPABILITIES)); |
| 5508 | if (!phy_caps->each_hw_mode_cap) { |
| 5509 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 5510 | wma_cleanup_dbs_phy_caps(wma_handle); |
| 5511 | return; |
| 5512 | } |
| 5513 | qdf_mem_copy(phy_caps->each_hw_mode_cap, |
| 5514 | param_buf->hw_mode_caps, |
| 5515 | phy_caps->num_hw_modes.num_hw_modes * |
| 5516 | sizeof(WMI_HW_MODE_CAPABILITIES)); |
| 5517 | /* |
| 5518 | * next thing is to count the number of mac cap to populate per |
| 5519 | * hw mode and generate map, so that our search can be done |
| 5520 | * efficiently which is O(1) |
| 5521 | */ |
| 5522 | for (i = 0; i < phy_caps->num_hw_modes.num_hw_modes; i++) { |
| 5523 | map = &phy_caps->hw_mode_to_mac_cap_map[i]; |
| 5524 | if (phy_caps->each_hw_mode_cap[i].phy_id_map == PHY1_PHY2) { |
| 5525 | tmp = num_of_mac_caps; |
| 5526 | num_of_mac_caps = num_of_mac_caps + 2; |
| 5527 | map->num_of_macs = 2; |
| 5528 | } else { |
| 5529 | tmp = num_of_mac_caps; |
| 5530 | num_of_mac_caps = num_of_mac_caps + 1; |
| 5531 | map->num_of_macs = 1; |
| 5532 | } |
| 5533 | map->mac_cap_idx = tmp; |
| 5534 | map->hw_mode_id = phy_caps->each_hw_mode_cap[i].hw_mode_id; |
| 5535 | } |
| 5536 | |
| 5537 | /* |
| 5538 | * next thing is to populate each phy caps per hw mode |
| 5539 | */ |
| 5540 | phy_caps->each_phy_cap_per_hwmode = |
| 5541 | qdf_mem_malloc(num_of_mac_caps * |
| 5542 | sizeof(WMI_MAC_PHY_CAPABILITIES)); |
| 5543 | if (!phy_caps->each_phy_cap_per_hwmode) { |
| 5544 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 5545 | wma_cleanup_dbs_phy_caps(wma_handle); |
| 5546 | return; |
| 5547 | } |
| 5548 | qdf_mem_copy(phy_caps->each_phy_cap_per_hwmode, |
| 5549 | param_buf->mac_phy_caps, |
| 5550 | num_of_mac_caps * sizeof(WMI_MAC_PHY_CAPABILITIES)); |
| 5551 | |
| 5552 | /* |
| 5553 | * next thing is to populate reg caps per phy |
| 5554 | */ |
| 5555 | qdf_mem_copy(&phy_caps->num_phy_for_hal_reg_cap, |
| 5556 | param_buf->soc_hal_reg_caps, |
| 5557 | sizeof(WMI_SOC_HAL_REG_CAPABILITIES)); |
| 5558 | if (phy_caps->num_phy_for_hal_reg_cap.num_phy == 0) { |
| 5559 | WMA_LOGE("%s: incorrect number of phys", __func__); |
| 5560 | wma_cleanup_dbs_phy_caps(wma_handle); |
| 5561 | return; |
| 5562 | } |
| 5563 | phy_caps->each_phy_hal_reg_cap = |
| 5564 | qdf_mem_malloc(phy_caps->num_phy_for_hal_reg_cap.num_phy * |
| 5565 | sizeof(WMI_HAL_REG_CAPABILITIES_EXT)); |
| 5566 | if (!phy_caps->each_phy_hal_reg_cap) { |
| 5567 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 5568 | wma_cleanup_dbs_phy_caps(wma_handle); |
| 5569 | return; |
| 5570 | } |
| 5571 | qdf_mem_copy(phy_caps->each_phy_hal_reg_cap, |
| 5572 | param_buf->hal_reg_caps, |
| 5573 | phy_caps->num_phy_for_hal_reg_cap.num_phy * |
| 5574 | sizeof(WMI_HAL_REG_CAPABILITIES_EXT)); |
Naveen Rawat | 4efe41b | 2017-04-29 16:23:14 -0700 | [diff] [blame] | 5575 | |
| 5576 | wma_init_wifi_pos_dma_rings(wma_handle, |
| 5577 | param_buf->num_oem_dma_ring_caps, |
| 5578 | param_buf->oem_dma_ring_caps); |
| 5579 | |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5580 | wma_print_populate_soc_caps(wma_handle); |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5581 | } |
| 5582 | |
| 5583 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5584 | * wma_rx_service_ready_ext_event() - evt handler for sevice ready ext event. |
| 5585 | * @handle: wma handle |
| 5586 | * @event: params of the service ready extended event |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5587 | * @length: param length |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5588 | * |
| 5589 | * Return: none |
| 5590 | */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5591 | int wma_rx_service_ready_ext_event(void *handle, uint8_t *event, |
| 5592 | uint32_t length) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5593 | { |
| 5594 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 5595 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 5596 | wmi_service_ready_ext_event_fixed_param *ev; |
| 5597 | int status; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5598 | QDF_STATUS ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5599 | |
| 5600 | WMA_LOGD("%s: Enter", __func__); |
| 5601 | |
| 5602 | if (!wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5603 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5604 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5605 | } |
| 5606 | |
| 5607 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 5608 | if (!param_buf) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5609 | WMA_LOGE("%s: Invalid event", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5610 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5611 | } |
| 5612 | |
| 5613 | ev = param_buf->fixed_param; |
| 5614 | if (!ev) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5615 | WMA_LOGE("%s: Invalid buffer", __func__); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5616 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5617 | } |
| 5618 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 5619 | WMA_LOGD("WMA <-- WMI_SERVICE_READY_EXT_EVENTID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5620 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 5621 | WMA_LOGD("%s: Defaults: scan config:%x FW mode config:%x", |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 5622 | __func__, ev->default_conc_scan_config_bits, |
| 5623 | ev->default_fw_config_bits); |
| 5624 | |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 5625 | ret = qdf_mc_timer_stop(&wma_handle->service_ready_ext_timer); |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 5626 | if (!QDF_IS_STATUS_SUCCESS(ret)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5627 | WMA_LOGE("Failed to stop the service ready ext timer"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5628 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5629 | } |
Krunal Soni | 2e48d01 | 2016-05-02 16:55:26 -0700 | [diff] [blame] | 5630 | wma_populate_soc_caps(wma_handle, param_buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5631 | |
Nitesh Shah | 877ad5d | 2016-09-22 19:27:58 +0530 | [diff] [blame] | 5632 | ret = wma_update_hw_mode_list(wma_handle); |
| 5633 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 5634 | WMA_LOGE("Failed to update hw mode list"); |
| 5635 | return -EINVAL; |
| 5636 | } |
| 5637 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 5638 | WMA_LOGD("WMA --> WMI_INIT_CMDID"); |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 5639 | status = wmi_unified_send_saved_init_cmd(wma_handle->wmi_handle); |
| 5640 | if (status != EOK) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5641 | /* In success case, WMI layer will free after getting copy |
| 5642 | * engine TX complete interrupt |
| 5643 | */ |
| 5644 | WMA_LOGE("Failed to send WMI_INIT_CMDID command"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5645 | |
Chandrasekaran, Manishekar | c841692 | 2015-10-14 11:19:00 +0530 | [diff] [blame] | 5646 | wma_init_scan_fw_mode_config(wma_handle, |
| 5647 | ev->default_conc_scan_config_bits, |
| 5648 | ev->default_fw_config_bits); |
Sandeep Puligilla | 3d6a8e2 | 2016-10-11 18:57:14 -0700 | [diff] [blame] | 5649 | wma_handle->target_fw_vers_ext = ev->fw_build_vers_ext; |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5650 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5651 | } |
| 5652 | |
| 5653 | /** |
| 5654 | * wma_rx_ready_event() - event handler to process |
| 5655 | * wmi rx ready event. |
| 5656 | * @handle: wma handle |
| 5657 | * @cmd_param_info: command params info |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5658 | * @length: param length |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5659 | * |
| 5660 | * Return: none |
| 5661 | */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5662 | int wma_rx_ready_event(void *handle, uint8_t *cmd_param_info, |
| 5663 | uint32_t length) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5664 | { |
| 5665 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
| 5666 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 5667 | wmi_ready_event_fixed_param *ev = NULL; |
| 5668 | |
| 5669 | WMA_LOGD("%s: Enter", __func__); |
| 5670 | |
| 5671 | param_buf = (WMI_READY_EVENTID_param_tlvs *) cmd_param_info; |
| 5672 | if (!(wma_handle && param_buf)) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5673 | WMA_LOGE("%s: Invalid arguments", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5674 | QDF_ASSERT(0); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5675 | return -EINVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5676 | } |
| 5677 | |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 5678 | WMA_LOGD("WMA <-- WMI_READY_EVENTID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5679 | |
| 5680 | ev = param_buf->fixed_param; |
| 5681 | /* Indicate to the waiting thread that the ready |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5682 | * event was received |
| 5683 | */ |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 5684 | wma_handle->sub_20_support = |
| 5685 | WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, |
| 5686 | WMI_SERVICE_HALF_RATE_QUARTER_RATE_SUPPORT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5687 | wma_handle->wmi_ready = true; |
| 5688 | wma_handle->wlan_init_status = ev->status; |
| 5689 | |
| 5690 | /* |
| 5691 | * We need to check the WMI versions and make sure both |
| 5692 | * host and fw are compatible. |
| 5693 | */ |
| 5694 | if (!wmi_versions_are_compatible(&wma_handle->final_abi_vers, |
| 5695 | &ev->fw_abi_vers)) { |
| 5696 | /* |
| 5697 | * Error: Our host version and the given firmware version |
| 5698 | * are incompatible. |
| 5699 | */ |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5700 | WMA_LOGE("%s: Error: Incompatible WMI version.", __func__); |
| 5701 | WMA_LOGE("%s: Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5702 | __func__, |
| 5703 | WMI_VER_GET_MAJOR(wma_handle->final_abi_vers. |
| 5704 | abi_version_0), |
| 5705 | WMI_VER_GET_MINOR(wma_handle->final_abi_vers. |
| 5706 | abi_version_0), |
| 5707 | wma_handle->final_abi_vers.abi_version_ns_0, |
| 5708 | wma_handle->final_abi_vers.abi_version_ns_1, |
| 5709 | wma_handle->final_abi_vers.abi_version_ns_2, |
| 5710 | wma_handle->final_abi_vers.abi_version_ns_3, |
| 5711 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 5712 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 5713 | ev->fw_abi_vers.abi_version_ns_0, |
| 5714 | ev->fw_abi_vers.abi_version_ns_1, |
| 5715 | ev->fw_abi_vers.abi_version_ns_2, |
| 5716 | ev->fw_abi_vers.abi_version_ns_3); |
| 5717 | if (wma_handle->wlan_init_status == WLAN_INIT_STATUS_SUCCESS) { |
| 5718 | /* Failed this connection to FW */ |
| 5719 | wma_handle->wlan_init_status = |
| 5720 | WLAN_INIT_STATUS_GEN_FAILED; |
| 5721 | } |
| 5722 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5723 | qdf_mem_copy(&wma_handle->final_abi_vers, &ev->fw_abi_vers, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5724 | sizeof(wmi_abi_version)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5725 | qdf_mem_copy(&wma_handle->target_abi_vers, &ev->fw_abi_vers, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5726 | sizeof(wmi_abi_version)); |
| 5727 | |
| 5728 | /* copy the mac addr */ |
| 5729 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, wma_handle->myaddr); |
| 5730 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, wma_handle->hwaddr); |
| 5731 | |
| 5732 | wma_update_hdd_cfg(wma_handle); |
| 5733 | |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 5734 | qdf_event_set(&wma_handle->wma_ready_event); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5735 | |
| 5736 | WMA_LOGD("Exit"); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5737 | |
| 5738 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5739 | } |
| 5740 | |
| 5741 | /** |
| 5742 | * wma_setneedshutdown() - setting wma needshutdown flag |
| 5743 | * @cds_ctx: cds context |
| 5744 | * |
| 5745 | * Return: none |
| 5746 | */ |
| 5747 | void wma_setneedshutdown(void *cds_ctx) |
| 5748 | { |
| 5749 | tp_wma_handle wma_handle; |
| 5750 | |
| 5751 | WMA_LOGD("%s: Enter", __func__); |
| 5752 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5753 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5754 | |
| 5755 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5756 | WMA_LOGE("%s: Invalid arguments", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5757 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5758 | return; |
| 5759 | } |
| 5760 | |
| 5761 | wma_handle->needShutdown = true; |
| 5762 | WMA_LOGD("%s: Exit", __func__); |
| 5763 | } |
| 5764 | |
| 5765 | /** |
| 5766 | * wma_needshutdown() - Is wma needs shutdown? |
| 5767 | * @cds_ctx: cds context |
| 5768 | * |
| 5769 | * Return: returns true/false |
| 5770 | */ |
| 5771 | bool wma_needshutdown(void *cds_ctx) |
| 5772 | { |
| 5773 | tp_wma_handle wma_handle; |
| 5774 | |
| 5775 | WMA_LOGD("%s: Enter", __func__); |
| 5776 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5777 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5778 | |
| 5779 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5780 | WMA_LOGE("%s: Invalid arguments", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5781 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5782 | return false; |
| 5783 | } |
| 5784 | |
| 5785 | WMA_LOGD("%s: Exit", __func__); |
| 5786 | return wma_handle->needShutdown; |
| 5787 | } |
| 5788 | |
| 5789 | /** |
| 5790 | * wma_wait_for_ready_event() - wait for wma ready event |
| 5791 | * @handle: wma handle |
| 5792 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5793 | * Return: 0 for success or QDF error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5794 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5795 | QDF_STATUS wma_wait_for_ready_event(WMA_HANDLE handle) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5796 | { |
| 5797 | tp_wma_handle wma_handle = (tp_wma_handle) handle; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5798 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5799 | |
| 5800 | /* wait until WMI_READY_EVENTID received from FW */ |
Anurag Chouhan | df2b268 | 2016-02-29 14:15:27 +0530 | [diff] [blame] | 5801 | qdf_status = qdf_wait_single_event(&(wma_handle->wma_ready_event), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5802 | WMA_READY_EVENTID_TIMEOUT); |
| 5803 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5804 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 5805 | WMA_LOGE("%s: Timeout waiting for ready event from FW", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5806 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5807 | qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5808 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5809 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5810 | } |
| 5811 | |
| 5812 | /** |
| 5813 | * wma_set_ppsconfig() - set pps config in fw |
| 5814 | * @vdev_id: vdev id |
| 5815 | * @pps_param: pps params |
| 5816 | * @val : param value |
| 5817 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5818 | * Return: 0 for success or QDF error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5819 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5820 | 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] | 5821 | int val) |
| 5822 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5823 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5824 | int ret = -EIO; |
| 5825 | uint32_t pps_val; |
| 5826 | |
| 5827 | if (NULL == wma) { |
| 5828 | WMA_LOGE("%s: Failed to get wma", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5829 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5830 | } |
| 5831 | |
| 5832 | switch (pps_param) { |
| 5833 | case WMA_VHT_PPS_PAID_MATCH: |
| 5834 | pps_val = ((val << 31) & 0xffff0000) | |
| 5835 | (PKT_PWR_SAVE_PAID_MATCH & 0xffff); |
| 5836 | goto pkt_pwr_save_config; |
| 5837 | case WMA_VHT_PPS_GID_MATCH: |
| 5838 | pps_val = ((val << 31) & 0xffff0000) | |
| 5839 | (PKT_PWR_SAVE_GID_MATCH & 0xffff); |
| 5840 | goto pkt_pwr_save_config; |
| 5841 | case WMA_VHT_PPS_DELIM_CRC_FAIL: |
| 5842 | pps_val = ((val << 31) & 0xffff0000) | |
| 5843 | (PKT_PWR_SAVE_DELIM_CRC_FAIL & 0xffff); |
| 5844 | goto pkt_pwr_save_config; |
| 5845 | |
| 5846 | /* Enable the code below as and when the functionality |
| 5847 | * is supported/added in host. |
| 5848 | */ |
| 5849 | #ifdef NOT_YET |
| 5850 | case WMA_VHT_PPS_EARLY_TIM_CLEAR: |
| 5851 | pps_val = ((val << 31) & 0xffff0000) | |
| 5852 | (PKT_PWR_SAVE_EARLY_TIM_CLEAR & 0xffff); |
| 5853 | goto pkt_pwr_save_config; |
| 5854 | case WMA_VHT_PPS_EARLY_DTIM_CLEAR: |
| 5855 | pps_val = ((val << 31) & 0xffff0000) | |
| 5856 | (PKT_PWR_SAVE_EARLY_DTIM_CLEAR & 0xffff); |
| 5857 | goto pkt_pwr_save_config; |
| 5858 | case WMA_VHT_PPS_EOF_PAD_DELIM: |
| 5859 | pps_val = ((val << 31) & 0xffff0000) | |
| 5860 | (PKT_PWR_SAVE_EOF_PAD_DELIM & 0xffff); |
| 5861 | goto pkt_pwr_save_config; |
| 5862 | case WMA_VHT_PPS_MACADDR_MISMATCH: |
| 5863 | pps_val = ((val << 31) & 0xffff0000) | |
| 5864 | (PKT_PWR_SAVE_MACADDR_MISMATCH & 0xffff); |
| 5865 | goto pkt_pwr_save_config; |
| 5866 | case WMA_VHT_PPS_GID_NSTS_ZERO: |
| 5867 | pps_val = ((val << 31) & 0xffff0000) | |
| 5868 | (PKT_PWR_SAVE_GID_NSTS_ZERO & 0xffff); |
| 5869 | goto pkt_pwr_save_config; |
| 5870 | case WMA_VHT_PPS_RSSI_CHECK: |
| 5871 | pps_val = ((val << 31) & 0xffff0000) | |
| 5872 | (PKT_PWR_SAVE_RSSI_CHECK & 0xffff); |
| 5873 | goto pkt_pwr_save_config; |
| 5874 | #endif /* NOT_YET */ |
| 5875 | pkt_pwr_save_config: |
| 5876 | WMA_LOGD("vdev_id:%d val:0x%x pps_val:0x%x", vdev_id, |
| 5877 | val, pps_val); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5878 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5879 | WMI_VDEV_PARAM_PACKET_POWERSAVE, |
| 5880 | pps_val); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5881 | break; |
| 5882 | default: |
| 5883 | WMA_LOGE("%s:INVALID PPS CONFIG", __func__); |
| 5884 | } |
| 5885 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5886 | return (ret) ? QDF_STATUS_E_FAILURE : QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5887 | } |
| 5888 | |
| 5889 | /** |
| 5890 | * wma_process_set_mas() - Function to enable/disable MAS |
| 5891 | * @wma: Pointer to WMA handle |
| 5892 | * @mas_val: 1-Enable MAS, 0-Disable MAS |
| 5893 | * |
| 5894 | * This function enables/disables the MAS value |
| 5895 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5896 | * Return: QDF_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5897 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 5898 | static QDF_STATUS wma_process_set_mas(tp_wma_handle wma, |
| 5899 | uint32_t *mas_val) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5900 | { |
| 5901 | uint32_t val; |
| 5902 | |
| 5903 | if (NULL == wma || NULL == mas_val) { |
| 5904 | WMA_LOGE("%s: Invalid input to enable/disable MAS", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5905 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5906 | } |
| 5907 | |
| 5908 | val = (*mas_val); |
| 5909 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5910 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5911 | wma_set_enable_disable_mcc_adaptive_scheduler(val)) { |
| 5912 | WMA_LOGE("%s: Unable to enable/disable MAS", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5913 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5914 | } |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 5915 | WMA_LOGE("%s: Value is %d", __func__, val); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5916 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5917 | } |
| 5918 | |
| 5919 | /** |
| 5920 | * wma_process_set_miracast() - Function to set miracast value in WMA |
| 5921 | * @wma: Pointer to WMA handle |
| 5922 | * @miracast_val: 0-Disabled,1-Source,2-Sink |
| 5923 | * |
| 5924 | * This function stores the miracast value in WMA |
| 5925 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5926 | * Return: QDF_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5927 | * |
| 5928 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 5929 | static QDF_STATUS wma_process_set_miracast(tp_wma_handle wma, |
| 5930 | uint32_t *miracast_val) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5931 | { |
| 5932 | if (NULL == wma || NULL == miracast_val) { |
| 5933 | WMA_LOGE("%s: Invalid input to store miracast value", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5934 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5935 | } |
| 5936 | |
| 5937 | wma->miracast_value = *miracast_val; |
| 5938 | WMA_LOGE("%s: Miracast value is %d", __func__, wma->miracast_value); |
| 5939 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5940 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5941 | } |
| 5942 | |
| 5943 | /** |
| 5944 | * wma_config_stats_factor() - Function to configure stats avg. factor |
| 5945 | * @wma: pointer to WMA handle |
| 5946 | * @avg_factor: stats. avg. factor passed down by userspace |
| 5947 | * |
| 5948 | * This function configures the avg. stats value in firmware |
| 5949 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5950 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5951 | * |
| 5952 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5953 | static QDF_STATUS wma_config_stats_factor(tp_wma_handle wma, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5954 | struct sir_stats_avg_factor *avg_factor) |
| 5955 | { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5956 | QDF_STATUS ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5957 | |
| 5958 | if (NULL == wma || NULL == avg_factor) { |
| 5959 | WMA_LOGE("%s: Invalid input of stats avg factor", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5960 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5961 | } |
| 5962 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5963 | ret = wma_vdev_set_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5964 | avg_factor->vdev_id, |
| 5965 | WMI_VDEV_PARAM_STATS_AVG_FACTOR, |
| 5966 | avg_factor->stats_avg_factor); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5967 | if (QDF_IS_STATUS_ERROR(ret)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5968 | WMA_LOGE(" failed to set avg_factor for vdev_id %d", |
| 5969 | avg_factor->vdev_id); |
| 5970 | } |
| 5971 | |
| 5972 | WMA_LOGD("%s: Set stats_avg_factor %d for vdev_id %d", __func__, |
| 5973 | avg_factor->stats_avg_factor, avg_factor->vdev_id); |
| 5974 | |
| 5975 | return ret; |
| 5976 | } |
| 5977 | |
| 5978 | /** |
| 5979 | * wma_config_guard_time() - Function to set guard time in firmware |
| 5980 | * @wma: pointer to WMA handle |
| 5981 | * @guard_time: guard time passed down by userspace |
| 5982 | * |
| 5983 | * This function configures the guard time in firmware |
| 5984 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5985 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5986 | * |
| 5987 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5988 | static QDF_STATUS wma_config_guard_time(tp_wma_handle wma, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5989 | struct sir_guard_time_request *guard_time) |
| 5990 | { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5991 | QDF_STATUS ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5992 | |
| 5993 | if (NULL == wma || NULL == guard_time) { |
| 5994 | WMA_LOGE("%s: Invalid input of guard time", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5995 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5996 | } |
| 5997 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 5998 | ret = wma_vdev_set_param(wma->wmi_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5999 | guard_time->vdev_id, |
| 6000 | WMI_VDEV_PARAM_RX_LEAK_WINDOW, |
| 6001 | guard_time->guard_time); |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 6002 | if (QDF_IS_STATUS_ERROR(ret)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6003 | WMA_LOGE(" failed to set guard time for vdev_id %d", |
| 6004 | guard_time->vdev_id); |
| 6005 | } |
| 6006 | |
| 6007 | WMA_LOGD("Set guard time %d for vdev_id %d", |
| 6008 | guard_time->guard_time, guard_time->vdev_id); |
| 6009 | |
| 6010 | return ret; |
| 6011 | } |
| 6012 | |
| 6013 | /** |
| 6014 | * wma_enable_specific_fw_logs() - Start/Stop logging of diag event/log id |
| 6015 | * @wma_handle: WMA handle |
| 6016 | * @start_log: Start logging related parameters |
| 6017 | * |
| 6018 | * Send the command to the FW based on which specific logging of diag |
| 6019 | * event/log id can be started/stopped |
| 6020 | * |
| 6021 | * Return: None |
| 6022 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6023 | static void wma_enable_specific_fw_logs(tp_wma_handle wma_handle, |
| 6024 | struct sir_wifi_start_log *start_log) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6025 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6026 | |
| 6027 | if (!start_log) { |
| 6028 | WMA_LOGE("%s: start_log pointer is NULL", __func__); |
| 6029 | return; |
| 6030 | } |
| 6031 | if (!wma_handle) { |
| 6032 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 6033 | return; |
| 6034 | } |
| 6035 | |
| 6036 | if (!((start_log->ring_id == RING_ID_CONNECTIVITY) || |
| 6037 | (start_log->ring_id == RING_ID_FIRMWARE_DEBUG))) { |
| 6038 | WMA_LOGD("%s: Not connectivity or fw debug ring: %d", |
| 6039 | __func__, start_log->ring_id); |
| 6040 | return; |
| 6041 | } |
| 6042 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 6043 | wmi_unified_enable_specific_fw_logs_cmd(wma_handle->wmi_handle, |
| 6044 | (struct wmi_wifi_start_log *)start_log); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6045 | } |
| 6046 | |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 6047 | #define MEGABYTE (1024 * 1024) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6048 | /** |
| 6049 | * wma_set_wifi_start_packet_stats() - Start/stop packet stats |
| 6050 | * @wma_handle: WMA handle |
| 6051 | * @start_log: Struture containing the start wifi logger params |
| 6052 | * |
| 6053 | * This function is used to send the WMA commands to start/stop logging |
| 6054 | * of per packet statistics |
| 6055 | * |
| 6056 | * Return: None |
| 6057 | * |
| 6058 | */ |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6059 | #ifdef REMOVE_PKT_LOG |
| 6060 | static void wma_set_wifi_start_packet_stats(void *wma_handle, |
| 6061 | struct sir_wifi_start_log *start_log) |
| 6062 | { |
Jeff Johnson | c4b47a9 | 2016-10-07 12:34:41 -0700 | [diff] [blame] | 6063 | } |
| 6064 | #else |
| 6065 | static void wma_set_wifi_start_packet_stats(void *wma_handle, |
| 6066 | struct sir_wifi_start_log *start_log) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6067 | { |
Komal Seelam | 3d20286 | 2016-02-24 18:43:24 +0530 | [diff] [blame] | 6068 | struct hif_opaque_softc *scn; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6069 | uint32_t log_state; |
| 6070 | |
| 6071 | if (!start_log) { |
| 6072 | WMA_LOGE("%s: start_log pointer is NULL", __func__); |
| 6073 | return; |
| 6074 | } |
| 6075 | if (!wma_handle) { |
| 6076 | WMA_LOGE("%s: Invalid wma handle", __func__); |
| 6077 | return; |
| 6078 | } |
| 6079 | |
| 6080 | /* No need to register for ring IDs other than packet stats */ |
| 6081 | if (start_log->ring_id != RING_ID_PER_PACKET_STATS) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6082 | WMA_LOGD("%s: Ring id is not for per packet stats: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6083 | __func__, start_log->ring_id); |
| 6084 | return; |
| 6085 | } |
| 6086 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6087 | scn = cds_get_context(QDF_MODULE_ID_HIF); |
Naveen Rawat | b2109f6 | 2016-07-21 14:18:15 -0700 | [diff] [blame] | 6088 | if (scn == NULL) { |
| 6089 | WMA_LOGE("%s: Invalid HIF handle", __func__); |
| 6090 | return; |
| 6091 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6092 | |
| 6093 | log_state = ATH_PKTLOG_ANI | ATH_PKTLOG_RCUPDATE | ATH_PKTLOG_RCFIND | |
Nirav Shah | dcc4c87 | 2016-07-28 11:35:26 +0530 | [diff] [blame] | 6094 | ATH_PKTLOG_RX | ATH_PKTLOG_TX | |
| 6095 | ATH_PKTLOG_TEXT | ATH_PKTLOG_SW_EVENT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6096 | |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 6097 | if (start_log->size != 0) { |
| 6098 | pktlog_setsize(scn, start_log->size * MEGABYTE); |
| 6099 | return; |
Poddar, Siddarth | ab99a27 | 2017-04-10 12:53:26 +0530 | [diff] [blame] | 6100 | } else if (start_log->is_pktlog_buff_clear == true) { |
| 6101 | pktlog_clearbuff(scn, start_log->is_pktlog_buff_clear); |
| 6102 | return; |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 6103 | } |
| 6104 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6105 | if (start_log->verbose_level == WLAN_LOG_LEVEL_ACTIVE) { |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 6106 | pktlog_enable(scn, log_state, start_log->ini_triggered, |
Poddar, Siddarth | eefe348 | 2016-09-21 18:12:59 +0530 | [diff] [blame] | 6107 | start_log->user_triggered, |
| 6108 | start_log->is_iwpriv_command); |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6109 | WMA_LOGD("%s: Enabling per packet stats", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6110 | } else { |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 6111 | pktlog_enable(scn, 0, start_log->ini_triggered, |
Poddar, Siddarth | eefe348 | 2016-09-21 18:12:59 +0530 | [diff] [blame] | 6112 | start_log->user_triggered, |
| 6113 | start_log->is_iwpriv_command); |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6114 | WMA_LOGD("%s: Disabling per packet stats", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6115 | } |
| 6116 | } |
| 6117 | #endif |
| 6118 | |
| 6119 | /** |
| 6120 | * wma_send_flush_logs_to_fw() - Send log flush command to FW |
| 6121 | * @wma_handle: WMI handle |
| 6122 | * |
| 6123 | * This function is used to send the flush command to the FW, |
| 6124 | * that will flush the fw logs that are residue in the FW |
| 6125 | * |
| 6126 | * Return: None |
| 6127 | */ |
| 6128 | void wma_send_flush_logs_to_fw(tp_wma_handle wma_handle) |
| 6129 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6130 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6131 | int ret; |
| 6132 | |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 6133 | ret = wmi_unified_flush_logs_to_fw_cmd(wma_handle->wmi_handle); |
| 6134 | if (ret != EOK) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6135 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6136 | |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 6137 | status = qdf_mc_timer_start(&wma_handle->log_completion_timer, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6138 | WMA_LOG_COMPLETION_TIMER); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6139 | if (status != QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6140 | WMA_LOGE("Failed to start the log completion timer"); |
| 6141 | } |
| 6142 | |
| 6143 | /** |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 6144 | * wma_update_wep_default_key - To update default key id |
| 6145 | * @wma: pointer to wma handler |
| 6146 | * @update_def_key: pointer to wep_update_default_key_idx |
| 6147 | * |
| 6148 | * This function makes a copy of default key index to txrx node |
| 6149 | * |
| 6150 | * Return: Success |
| 6151 | */ |
| 6152 | static QDF_STATUS wma_update_wep_default_key(tp_wma_handle wma, |
| 6153 | struct wep_update_default_key_idx *update_def_key) |
| 6154 | { |
| 6155 | struct wma_txrx_node *iface = |
| 6156 | &wma->interfaces[update_def_key->session_id]; |
| 6157 | iface->wep_default_key_idx = update_def_key->default_idx; |
| 6158 | |
| 6159 | return QDF_STATUS_SUCCESS; |
| 6160 | } |
| 6161 | |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 6162 | /** |
| 6163 | * wma_update_tx_fail_cnt_th() - Set threshold for TX pkt fail |
| 6164 | * @wma_handle: WMA handle |
| 6165 | * @tx_fail_cnt_th: sme_tx_fail_cnt_threshold parameter |
| 6166 | * |
| 6167 | * This function is used to set Tx pkt fail count threshold, |
| 6168 | * FW will do disconnect with station once this threshold is reached. |
| 6169 | * |
| 6170 | * Return: VOS_STATUS_SUCCESS on success, error number otherwise |
| 6171 | */ |
| 6172 | 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] | 6173 | struct sme_tx_fail_cnt_threshold *tx_fail_cnt_th) |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 6174 | { |
| 6175 | u_int8_t vdev_id; |
| 6176 | u_int32_t tx_fail_disconn_th; |
| 6177 | int ret = -EIO; |
| 6178 | |
| 6179 | if (!wma || !wma->wmi_handle) { |
| 6180 | WMA_LOGE(FL("WMA is closed, can not issue Tx pkt fail count threshold")); |
| 6181 | return QDF_STATUS_E_INVAL; |
| 6182 | } |
| 6183 | vdev_id = tx_fail_cnt_th->session_id; |
| 6184 | tx_fail_disconn_th = tx_fail_cnt_th->tx_fail_cnt_threshold; |
| 6185 | WMA_LOGD("Set TX pkt fail count threshold vdevId %d count %d", |
| 6186 | vdev_id, tx_fail_disconn_th); |
| 6187 | |
| 6188 | |
| 6189 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 6190 | WMI_VDEV_PARAM_DISCONNECT_TH, |
| 6191 | tx_fail_disconn_th); |
| 6192 | |
| 6193 | if (ret) { |
| 6194 | WMA_LOGE(FL("Failed to send TX pkt fail count threshold command")); |
| 6195 | return QDF_STATUS_E_FAILURE; |
| 6196 | } |
| 6197 | |
| 6198 | return QDF_STATUS_SUCCESS; |
| 6199 | } |
| 6200 | |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 6201 | /** |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 6202 | * wma_update_short_retry_limit() - Set retry limit for short frames |
| 6203 | * @wma_handle: WMA handle |
| 6204 | * @short_retry_limit_th: retry limir count for Short frames. |
| 6205 | * |
| 6206 | * This function is used to configure the transmission retry limit at which |
| 6207 | * short frames needs to be retry. |
| 6208 | * |
| 6209 | * Return: VOS_STATUS_SUCCESS on success, error number otherwise |
| 6210 | */ |
| 6211 | static QDF_STATUS wma_update_short_retry_limit(tp_wma_handle wma, |
| 6212 | struct sme_short_retry_limit *short_retry_limit_th) |
| 6213 | { |
| 6214 | uint8_t vdev_id; |
| 6215 | uint32_t short_retry_limit; |
| 6216 | int ret; |
| 6217 | |
| 6218 | if (!wma || !wma->wmi_handle) { |
| 6219 | WMA_LOGE("WMA is closed, can not issue short retry limit threshold"); |
| 6220 | return QDF_STATUS_E_INVAL; |
| 6221 | } |
| 6222 | vdev_id = short_retry_limit_th->session_id; |
| 6223 | short_retry_limit = short_retry_limit_th->short_retry_limit; |
| 6224 | WMA_LOGD("Set short retry limit threshold vdevId %d count %d", |
| 6225 | vdev_id, short_retry_limit); |
| 6226 | |
| 6227 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 6228 | WMI_VDEV_PARAM_NON_AGG_SW_RETRY_TH, |
| 6229 | short_retry_limit); |
| 6230 | |
| 6231 | if (ret) { |
| 6232 | WMA_LOGE("Failed to send short limit threshold command"); |
| 6233 | return QDF_STATUS_E_FAILURE; |
| 6234 | } |
| 6235 | return QDF_STATUS_SUCCESS; |
| 6236 | } |
| 6237 | |
| 6238 | /** |
| 6239 | * wma_update_long_retry_limit() - Set retry limit for long frames |
| 6240 | * @wma_handle: WMA handle |
| 6241 | * @long_retry_limit_th: retry limir count for long frames |
| 6242 | * |
| 6243 | * This function is used to configure the transmission retry limit at which |
| 6244 | * long frames needs to be retry |
| 6245 | * |
| 6246 | * Return: VOS_STATUS_SUCCESS on success, error number otherwise |
| 6247 | */ |
| 6248 | static QDF_STATUS wma_update_long_retry_limit(tp_wma_handle wma, |
| 6249 | struct sme_long_retry_limit *long_retry_limit_th) |
| 6250 | { |
| 6251 | uint8_t vdev_id; |
| 6252 | uint32_t long_retry_limit; |
| 6253 | int ret; |
| 6254 | |
| 6255 | if (!wma || !wma->wmi_handle) { |
| 6256 | WMA_LOGE("WMA is closed, can not issue long retry limit threshold"); |
| 6257 | return QDF_STATUS_E_INVAL; |
| 6258 | } |
| 6259 | vdev_id = long_retry_limit_th->session_id; |
| 6260 | long_retry_limit = long_retry_limit_th->long_retry_limit; |
| 6261 | WMA_LOGD("Set TX pkt fail count threshold vdevId %d count %d", |
| 6262 | vdev_id, long_retry_limit); |
| 6263 | |
| 6264 | ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 6265 | WMI_VDEV_PARAM_AGG_SW_RETRY_TH, |
| 6266 | long_retry_limit); |
| 6267 | |
| 6268 | if (ret) { |
| 6269 | WMA_LOGE("Failed to send long limit threshold command"); |
| 6270 | return QDF_STATUS_E_FAILURE; |
| 6271 | } |
| 6272 | |
| 6273 | return QDF_STATUS_SUCCESS; |
| 6274 | } |
| 6275 | |
Agrawal, Ashish | 4e5fa1c | 2016-09-21 19:03:43 +0530 | [diff] [blame] | 6276 | /* |
| 6277 | * wma_update_sta_inactivity_timeout() - Set sta_inactivity_timeout to fw |
| 6278 | * @wma_handle: WMA handle |
| 6279 | * @sta_inactivity_timer: sme_sta_inactivity_timeout |
| 6280 | * |
| 6281 | * This function is used to set sta_inactivity_timeout. |
| 6282 | * If a station does not send anything in sta_inactivity_timeout seconds, an |
| 6283 | * empty data frame is sent to it in order to verify whether it is |
| 6284 | * still in range. If this frame is not ACKed, the station will be |
| 6285 | * disassociated and then deauthenticated. |
| 6286 | * |
| 6287 | * Return: None |
| 6288 | */ |
| 6289 | void wma_update_sta_inactivity_timeout(tp_wma_handle wma, |
| 6290 | struct sme_sta_inactivity_timeout *sta_inactivity_timer) |
| 6291 | { |
| 6292 | uint8_t vdev_id; |
| 6293 | uint32_t max_unresponsive_time; |
| 6294 | uint32_t min_inactive_time, max_inactive_time; |
| 6295 | |
| 6296 | if (!wma || !wma->wmi_handle) { |
| 6297 | WMA_LOGE("WMA is closed, can not issue sta_inactivity_timeout"); |
| 6298 | return; |
| 6299 | } |
| 6300 | vdev_id = sta_inactivity_timer->session_id; |
| 6301 | max_unresponsive_time = sta_inactivity_timer->sta_inactivity_timeout; |
| 6302 | max_inactive_time = max_unresponsive_time * TWO_THIRD; |
| 6303 | min_inactive_time = max_unresponsive_time - max_inactive_time; |
| 6304 | |
| 6305 | if (wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 6306 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS, |
| 6307 | min_inactive_time)) |
| 6308 | WMA_LOGE("Failed to Set AP MIN IDLE INACTIVE TIME"); |
| 6309 | |
| 6310 | if (wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 6311 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS, |
| 6312 | max_inactive_time)) |
| 6313 | WMA_LOGE("Failed to Set AP MAX IDLE INACTIVE TIME"); |
| 6314 | |
| 6315 | if (wma_vdev_set_param(wma->wmi_handle, vdev_id, |
| 6316 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS, |
| 6317 | max_unresponsive_time)) |
| 6318 | WMA_LOGE("Failed to Set MAX UNRESPONSIVE TIME"); |
| 6319 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6320 | 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] | 6321 | __func__, vdev_id, |
| 6322 | min_inactive_time, max_inactive_time, |
| 6323 | max_unresponsive_time); |
| 6324 | } |
| 6325 | |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 6326 | #ifdef WLAN_FEATURE_WOW_PULSE |
| 6327 | |
| 6328 | |
| 6329 | #define WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM \ |
| 6330 | WMI_WOW_HOSTWAKEUP_GPIO_PIN_PATTERN_CONFIG_CMD_fixed_param |
| 6331 | |
| 6332 | |
| 6333 | #define WMITLV_TAG_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM \ |
| 6334 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_gpio_pin_pattern_config_cmd_fixed_param |
| 6335 | |
| 6336 | /** |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 6337 | * wma_send_wow_pulse_cmd() - send wmi cmd of wow pulse cmd |
| 6338 | * information to fw. |
| 6339 | * @wma_handle: wma handler |
| 6340 | * @udp_response: wow_pulse_mode pointer |
| 6341 | * |
| 6342 | * Return: Return QDF_STATUS |
| 6343 | */ |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 6344 | static QDF_STATUS wma_send_wow_pulse_cmd(tp_wma_handle wma_handle, |
| 6345 | struct wow_pulse_mode *wow_pulse_cmd) |
| 6346 | { |
| 6347 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 6348 | wmi_buf_t buf; |
| 6349 | WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM *cmd; |
| 6350 | u_int16_t len; |
| 6351 | |
| 6352 | len = sizeof(*cmd); |
| 6353 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 6354 | if (!buf) { |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 6355 | WMA_LOGE("wmi_buf_alloc failed"); |
| 6356 | return QDF_STATUS_E_NOMEM; |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 6357 | } |
| 6358 | |
| 6359 | cmd = (WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM *)wmi_buf_data(buf); |
| 6360 | qdf_mem_zero(cmd, len); |
| 6361 | |
| 6362 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6363 | WMITLV_TAG_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM, |
| 6364 | WMITLV_GET_STRUCT_TLVLEN( |
| 6365 | WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM)); |
| 6366 | |
| 6367 | cmd->enable = wow_pulse_cmd->wow_pulse_enable; |
| 6368 | cmd->pin = wow_pulse_cmd->wow_pulse_pin; |
| 6369 | cmd->interval_low = wow_pulse_cmd->wow_pulse_interval_low; |
| 6370 | cmd->interval_high = wow_pulse_cmd->wow_pulse_interval_high; |
| 6371 | cmd->repeat_cnt = WMI_WOW_PULSE_REPEAT_CNT; |
| 6372 | |
| 6373 | if (wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 6374 | WMI_WOW_HOSTWAKEUP_GPIO_PIN_PATTERN_CONFIG_CMDID)) { |
| 6375 | WMA_LOGE("Failed to send send wow pulse"); |
| 6376 | wmi_buf_free(buf); |
| 6377 | status = QDF_STATUS_E_FAILURE; |
| 6378 | } |
| 6379 | |
| 6380 | WMA_LOGD("%s: Exit", __func__); |
| 6381 | return status; |
| 6382 | } |
| 6383 | |
| 6384 | #undef WMI_WOW_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM |
| 6385 | #undef WMITLV_TAG_HOSTWAKEUP_GPIO_CMD_FIXED_PARAM |
| 6386 | #undef WMI_WOW_PULSE_REPEAT_CNT |
| 6387 | |
| 6388 | #else |
| 6389 | static inline QDF_STATUS wma_send_wow_pulse_cmd(tp_wma_handle wma_handle, |
| 6390 | struct wow_pulse_mode *wow_pulse_cmd) |
| 6391 | { |
| 6392 | return QDF_STATUS_E_FAILURE; |
| 6393 | } |
| 6394 | #endif |
| 6395 | |
| 6396 | |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 6397 | /** |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 6398 | * wma_process_power_debug_stats_req() - Process the Chip Power stats collect |
| 6399 | * request and pass the Power stats request to Fw |
| 6400 | * @wma_handle: WMA handle |
| 6401 | * |
| 6402 | * Return: QDF_STATUS |
| 6403 | */ |
| 6404 | #ifdef WLAN_POWER_DEBUGFS |
| 6405 | static QDF_STATUS wma_process_power_debug_stats_req(tp_wma_handle wma_handle) |
| 6406 | { |
| 6407 | wmi_pdev_get_chip_power_stats_cmd_fixed_param *cmd; |
| 6408 | int32_t len; |
| 6409 | wmi_buf_t buf; |
| 6410 | uint8_t *buf_ptr; |
| 6411 | int ret; |
| 6412 | |
| 6413 | if (!wma_handle) { |
| 6414 | WMA_LOGE("%s: input pointer is NULL", __func__); |
| 6415 | return QDF_STATUS_E_FAILURE; |
| 6416 | } |
| 6417 | |
| 6418 | len = sizeof(*cmd); |
| 6419 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 6420 | if (!buf) { |
| 6421 | WMA_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6422 | return QDF_STATUS_E_NOMEM; |
| 6423 | } |
| 6424 | |
| 6425 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 6426 | cmd = (wmi_pdev_get_chip_power_stats_cmd_fixed_param *) buf_ptr; |
| 6427 | |
| 6428 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6429 | WMITLV_TAG_STRUC_wmi_get_chip_power_stats_cmd_fixed_param, |
| 6430 | WMITLV_GET_STRUCT_TLVLEN( |
| 6431 | wmi_pdev_get_chip_power_stats_cmd_fixed_param)); |
| 6432 | cmd->pdev_id = 0; |
| 6433 | |
| 6434 | WMA_LOGD("POWER_DEBUG_STATS - Get Request Params; Pdev id - %d", |
| 6435 | cmd->pdev_id); |
| 6436 | ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 6437 | WMI_PDEV_GET_CHIP_POWER_STATS_CMDID); |
| 6438 | if (ret) { |
| 6439 | WMA_LOGE("%s: Failed to send power debug stats request", |
| 6440 | __func__); |
| 6441 | wmi_buf_free(buf); |
| 6442 | return QDF_STATUS_E_FAILURE; |
| 6443 | } |
| 6444 | return QDF_STATUS_SUCCESS; |
| 6445 | } |
| 6446 | #else |
| 6447 | static QDF_STATUS wma_process_power_debug_stats_req(tp_wma_handle wma_handle) |
| 6448 | { |
| 6449 | return QDF_STATUS_SUCCESS; |
| 6450 | } |
| 6451 | #endif |
| 6452 | |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 6453 | QDF_STATUS wma_set_rx_reorder_timeout_val(tp_wma_handle wma_handle, |
| 6454 | struct sir_set_rx_reorder_timeout_val *reorder_timeout) |
| 6455 | { |
| 6456 | wmi_pdev_set_reorder_timeout_val_cmd_fixed_param *cmd; |
| 6457 | uint32_t len; |
| 6458 | wmi_buf_t buf; |
| 6459 | int ret; |
| 6460 | |
| 6461 | if (!reorder_timeout) { |
| 6462 | WMA_LOGE(FL("invalid pointer")); |
| 6463 | return QDF_STATUS_E_INVAL; |
| 6464 | } |
| 6465 | |
| 6466 | if (!wma_handle) { |
| 6467 | WMA_LOGE(FL("WMA context is invald!")); |
| 6468 | return QDF_STATUS_E_INVAL; |
| 6469 | } |
| 6470 | len = sizeof(*cmd); |
| 6471 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 6472 | |
| 6473 | if (!buf) { |
| 6474 | WMA_LOGE(FL("Failed allocate wmi buffer")); |
| 6475 | return QDF_STATUS_E_NOMEM; |
| 6476 | } |
| 6477 | cmd = (wmi_pdev_set_reorder_timeout_val_cmd_fixed_param *) |
| 6478 | wmi_buf_data(buf); |
| 6479 | |
| 6480 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6481 | WMITLV_TAG_STRUC_wmi_pdev_set_reorder_timeout_val_cmd_fixed_param, |
| 6482 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_reorder_timeout_val_cmd_fixed_param)); |
| 6483 | |
| 6484 | memcpy(cmd->rx_timeout_pri, reorder_timeout->rx_timeout_pri, |
| 6485 | sizeof(reorder_timeout->rx_timeout_pri)); |
| 6486 | |
| 6487 | WMA_LOGD("rx aggr record timeout: VO: %d, VI: %d, BE: %d, BK: %d", |
| 6488 | cmd->rx_timeout_pri[0], cmd->rx_timeout_pri[1], |
| 6489 | cmd->rx_timeout_pri[2], cmd->rx_timeout_pri[3]); |
| 6490 | |
| 6491 | ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 6492 | WMI_PDEV_SET_REORDER_TIMEOUT_VAL_CMDID); |
| 6493 | if (ret) { |
| 6494 | WMA_LOGE(FL("Failed to send aggregation timeout")); |
| 6495 | wmi_buf_free(buf); |
| 6496 | return QDF_STATUS_E_FAILURE; |
| 6497 | } |
| 6498 | |
| 6499 | return QDF_STATUS_SUCCESS; |
| 6500 | } |
| 6501 | |
| 6502 | QDF_STATUS wma_set_rx_blocksize(tp_wma_handle wma_handle, |
| 6503 | struct sir_peer_set_rx_blocksize *peer_rx_blocksize) |
| 6504 | { |
| 6505 | wmi_peer_set_rx_blocksize_cmd_fixed_param *cmd; |
| 6506 | int32_t len; |
| 6507 | wmi_buf_t buf; |
| 6508 | u_int8_t *buf_ptr; |
| 6509 | int ret; |
| 6510 | |
| 6511 | if (!peer_rx_blocksize) { |
| 6512 | WMA_LOGE(FL("invalid pointer")); |
| 6513 | return QDF_STATUS_E_INVAL; |
| 6514 | } |
| 6515 | |
| 6516 | if (!wma_handle) { |
| 6517 | WMA_LOGE(FL(" WMA context is invald!")); |
| 6518 | return QDF_STATUS_E_INVAL; |
| 6519 | } |
| 6520 | |
| 6521 | len = sizeof(*cmd); |
| 6522 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 6523 | |
| 6524 | if (!buf) { |
| 6525 | WMA_LOGE(FL("Failed allocate wmi buffer")); |
| 6526 | return QDF_STATUS_E_NOMEM; |
| 6527 | } |
| 6528 | |
| 6529 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 6530 | cmd = (wmi_peer_set_rx_blocksize_cmd_fixed_param *) buf_ptr; |
| 6531 | |
| 6532 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6533 | WMITLV_TAG_STRUC_wmi_peer_set_rx_blocksize_cmd_fixed_param, |
| 6534 | WMITLV_GET_STRUCT_TLVLEN(wmi_peer_set_rx_blocksize_cmd_fixed_param)); |
| 6535 | |
| 6536 | cmd->vdev_id = peer_rx_blocksize->vdev_id; |
| 6537 | cmd->rx_block_ack_win_limit = |
| 6538 | peer_rx_blocksize->rx_block_ack_win_limit; |
| 6539 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_rx_blocksize->peer_macaddr.bytes, |
| 6540 | &cmd->peer_macaddr); |
| 6541 | |
| 6542 | WMA_LOGD("rx aggr blocksize: %d", cmd->rx_block_ack_win_limit); |
| 6543 | |
| 6544 | ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 6545 | WMI_PEER_SET_RX_BLOCKSIZE_CMDID); |
| 6546 | if (ret) { |
| 6547 | WMA_LOGE(FL("Failed to send aggregation size command")); |
| 6548 | wmi_buf_free(buf); |
| 6549 | return QDF_STATUS_E_FAILURE; |
| 6550 | } |
| 6551 | |
| 6552 | return QDF_STATUS_SUCCESS; |
| 6553 | } |
| 6554 | |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 6555 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6556 | * wma_mc_process_msg() - process wma messages and call appropriate function. |
| 6557 | * @cds_context: cds context |
| 6558 | * @msg: message |
| 6559 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 6560 | * Return: QDF_SUCCESS for success otherwise failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6561 | */ |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 6562 | QDF_STATUS wma_mc_process_msg(void *cds_context, struct scheduler_msg *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6563 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6564 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6565 | tp_wma_handle wma_handle; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 6566 | struct cdp_vdev *txrx_vdev_handle = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6567 | extern uint8_t *mac_trace_get_wma_msg_string(uint16_t wmaMsg); |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 6568 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6569 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6570 | if (NULL == msg) { |
| 6571 | WMA_LOGE("msg is NULL"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6572 | QDF_ASSERT(0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6573 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6574 | goto end; |
| 6575 | } |
| 6576 | |
| 6577 | WMA_LOGD("msg->type = %x %s", msg->type, |
| 6578 | mac_trace_get_wma_msg_string(msg->type)); |
| 6579 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6580 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6581 | |
| 6582 | if (NULL == wma_handle) { |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 6583 | WMA_LOGE("%s: wma_handle is NULL", __func__); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6584 | QDF_ASSERT(0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6585 | qdf_mem_free(msg->bodyptr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6586 | qdf_status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6587 | goto end; |
| 6588 | } |
| 6589 | |
| 6590 | switch (msg->type) { |
| 6591 | |
| 6592 | /* Message posted by wmi for all control path related |
| 6593 | * FW events to serialize through mc_thread. |
| 6594 | */ |
| 6595 | case WMA_PROCESS_FW_EVENT: |
| 6596 | wma_process_fw_event(wma_handle, |
| 6597 | (wma_process_fw_event_params *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6598 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6599 | break; |
| 6600 | |
| 6601 | #ifdef FEATURE_WLAN_ESE |
| 6602 | case WMA_TSM_STATS_REQ: |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6603 | WMA_LOGD("McThread: WMA_TSM_STATS_REQ"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6604 | wma_process_tsm_stats_req(wma_handle, (void *)msg->bodyptr); |
| 6605 | break; |
| 6606 | #endif /* FEATURE_WLAN_ESE */ |
| 6607 | case WNI_CFG_DNLD_REQ: |
Srinivas Girigowda | 86ecc01 | 2017-03-10 12:26:57 -0800 | [diff] [blame] | 6608 | WMA_LOGD("McThread: WNI_CFG_DNLD_REQ"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6609 | qdf_status = wma_wni_cfg_dnld(wma_handle); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 6610 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6611 | cds_wma_complete_cback(cds_context); |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 6612 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6613 | WMA_LOGD("config download failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6614 | break; |
| 6615 | case WMA_ADD_STA_SELF_REQ: |
| 6616 | txrx_vdev_handle = |
| 6617 | wma_vdev_attach(wma_handle, |
| 6618 | (struct add_sta_self_params *) msg-> |
| 6619 | bodyptr, 1); |
| 6620 | if (!txrx_vdev_handle) { |
| 6621 | WMA_LOGE("Failed to attach vdev"); |
| 6622 | } else { |
| 6623 | /* Register with TxRx Module for Data Ack Complete Cb */ |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 6624 | if (soc) { |
| 6625 | cdp_data_tx_cb_set(soc, txrx_vdev_handle, |
| 6626 | wma_data_tx_ack_comp_hdlr, |
| 6627 | wma_handle); |
| 6628 | } else { |
| 6629 | WMA_LOGE("%s: SOC context is NULL", __func__); |
| 6630 | qdf_status = QDF_STATUS_E_FAILURE; |
| 6631 | goto end; |
| 6632 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6633 | } |
| 6634 | break; |
| 6635 | case WMA_DEL_STA_SELF_REQ: |
| 6636 | wma_vdev_detach(wma_handle, |
| 6637 | (struct del_sta_self_params *) msg->bodyptr, 1); |
| 6638 | break; |
| 6639 | case WMA_START_SCAN_OFFLOAD_REQ: |
| 6640 | wma_start_scan(wma_handle, msg->bodyptr, msg->type); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6641 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6642 | break; |
| 6643 | case WMA_STOP_SCAN_OFFLOAD_REQ: |
| 6644 | wma_stop_scan(wma_handle, msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6645 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6646 | break; |
| 6647 | case WMA_UPDATE_CHAN_LIST_REQ: |
| 6648 | wma_update_channel_list(wma_handle, |
| 6649 | (tSirUpdateChanList *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6650 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6651 | break; |
| 6652 | case WMA_SET_LINK_STATE: |
| 6653 | wma_set_linkstate(wma_handle, (tpLinkStateParams) msg->bodyptr); |
| 6654 | break; |
| 6655 | case WMA_CHNL_SWITCH_REQ: |
| 6656 | wma_set_channel(wma_handle, |
| 6657 | (tpSwitchChannelParams) msg->bodyptr); |
| 6658 | break; |
| 6659 | case WMA_ADD_BSS_REQ: |
| 6660 | wma_add_bss(wma_handle, (tpAddBssParams) msg->bodyptr); |
| 6661 | break; |
| 6662 | case WMA_ADD_STA_REQ: |
| 6663 | wma_add_sta(wma_handle, (tpAddStaParams) msg->bodyptr); |
| 6664 | break; |
| 6665 | case WMA_SET_BSSKEY_REQ: |
| 6666 | wma_set_bsskey(wma_handle, (tpSetBssKeyParams) msg->bodyptr); |
| 6667 | break; |
| 6668 | case WMA_SET_STAKEY_REQ: |
| 6669 | wma_set_stakey(wma_handle, (tpSetStaKeyParams) msg->bodyptr); |
| 6670 | break; |
| 6671 | case WMA_DELETE_STA_REQ: |
| 6672 | wma_delete_sta(wma_handle, (tpDeleteStaParams) msg->bodyptr); |
| 6673 | break; |
Deepak Dhamdhere | 2dae1bd | 2016-10-27 10:58:29 -0700 | [diff] [blame] | 6674 | case WMA_DELETE_BSS_HO_FAIL_REQ: |
| 6675 | wma_delete_bss_ho_fail(wma_handle, |
| 6676 | (tpDeleteBssParams) msg->bodyptr); |
| 6677 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6678 | case WMA_DELETE_BSS_REQ: |
| 6679 | wma_delete_bss(wma_handle, (tpDeleteBssParams) msg->bodyptr); |
| 6680 | break; |
| 6681 | case WMA_UPDATE_EDCA_PROFILE_IND: |
| 6682 | wma_process_update_edca_param_req(wma_handle, |
| 6683 | (tEdcaParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6684 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6685 | break; |
| 6686 | case WMA_SEND_BEACON_REQ: |
| 6687 | wma_send_beacon(wma_handle, (tpSendbeaconParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6688 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6689 | break; |
| 6690 | case WMA_SEND_PROBE_RSP_TMPL: |
| 6691 | wma_send_probe_rsp_tmpl(wma_handle, |
| 6692 | (tpSendProbeRespParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6693 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6694 | break; |
| 6695 | case WMA_CLI_SET_CMD: |
| 6696 | wma_process_cli_set_cmd(wma_handle, |
| 6697 | (wma_cli_set_cmd_t *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6698 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6699 | break; |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 6700 | case WMA_SET_PDEV_IE_REQ: |
| 6701 | wma_process_set_pdev_ie_req(wma_handle, |
| 6702 | (struct set_ie_param *)msg->bodyptr); |
| 6703 | qdf_mem_free(msg->bodyptr); |
| 6704 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6705 | #if !defined(REMOVE_PKT_LOG) |
| 6706 | case WMA_PKTLOG_ENABLE_REQ: |
| 6707 | wma_pktlog_wmi_send_cmd(wma_handle, |
| 6708 | (struct ath_pktlog_wmi_params *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6709 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6710 | break; |
| 6711 | #endif /* REMOVE_PKT_LOG */ |
| 6712 | #if defined(QCA_WIFI_FTM) |
| 6713 | case WMA_FTM_CMD_REQ: |
| 6714 | wma_process_ftm_command(wma_handle, |
| 6715 | (struct ar6k_testmode_cmd_data *)msg->bodyptr); |
| 6716 | break; |
| 6717 | #endif /* QCA_WIFI_FTM */ |
| 6718 | case WMA_ENTER_PS_REQ: |
| 6719 | wma_enable_sta_ps_mode(wma_handle, |
| 6720 | (tpEnablePsParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6721 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6722 | break; |
| 6723 | case WMA_EXIT_PS_REQ: |
| 6724 | wma_disable_sta_ps_mode(wma_handle, |
| 6725 | (tpDisablePsParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6726 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6727 | break; |
| 6728 | case WMA_ENABLE_UAPSD_REQ: |
| 6729 | wma_enable_uapsd_mode(wma_handle, |
| 6730 | (tpEnableUapsdParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6731 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6732 | break; |
| 6733 | case WMA_DISABLE_UAPSD_REQ: |
| 6734 | wma_disable_uapsd_mode(wma_handle, |
| 6735 | (tpDisableUapsdParams) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6736 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6737 | break; |
Kiran Kumar Lokere | 92fe759 | 2016-09-14 20:15:45 -0700 | [diff] [blame] | 6738 | case WMA_SET_DTIM_PERIOD: |
| 6739 | wma_set_dtim_period(wma_handle, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 6740 | (struct set_dtim_params *)msg->bodyptr); |
Kiran Kumar Lokere | 92fe759 | 2016-09-14 20:15:45 -0700 | [diff] [blame] | 6741 | qdf_mem_free(msg->bodyptr); |
| 6742 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6743 | case WMA_SET_TX_POWER_REQ: |
| 6744 | wma_set_tx_power(wma_handle, (tpMaxTxPowerParams) msg->bodyptr); |
| 6745 | break; |
| 6746 | case WMA_SET_MAX_TX_POWER_REQ: |
| 6747 | wma_set_max_tx_power(wma_handle, |
| 6748 | (tpMaxTxPowerParams) msg->bodyptr); |
| 6749 | break; |
| 6750 | case WMA_SET_KEEP_ALIVE: |
| 6751 | wma_set_keepalive_req(wma_handle, |
| 6752 | (tSirKeepAliveReq *) msg->bodyptr); |
| 6753 | break; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 6754 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6755 | case WMA_SET_PLM_REQ: |
| 6756 | wma_config_plm(wma_handle, (tpSirPlmReq) msg->bodyptr); |
| 6757 | break; |
| 6758 | #endif |
| 6759 | case WMA_GET_STATISTICS_REQ: |
| 6760 | wma_get_stats_req(wma_handle, |
| 6761 | (tAniGetPEStatsReq *) msg->bodyptr); |
| 6762 | break; |
| 6763 | |
| 6764 | case WMA_CONFIG_PARAM_UPDATE_REQ: |
Rajeev Kumar | 156188e | 2017-01-21 17:23:52 -0800 | [diff] [blame] | 6765 | wma_update_cfg_params(wma_handle, msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6766 | break; |
| 6767 | |
| 6768 | case WMA_UPDATE_OP_MODE: |
| 6769 | wma_process_update_opmode(wma_handle, |
| 6770 | (tUpdateVHTOpMode *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6771 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6772 | break; |
| 6773 | case WMA_UPDATE_RX_NSS: |
| 6774 | wma_process_update_rx_nss(wma_handle, |
| 6775 | (tUpdateRxNss *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6776 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6777 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6778 | case WMA_UPDATE_MEMBERSHIP: |
| 6779 | wma_process_update_membership(wma_handle, |
| 6780 | (tUpdateMembership *) msg->bodyptr); |
| 6781 | break; |
| 6782 | case WMA_UPDATE_USERPOS: |
| 6783 | wma_process_update_userpos(wma_handle, |
| 6784 | (tUpdateUserPos *) msg->bodyptr); |
| 6785 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6786 | case WMA_UPDATE_BEACON_IND: |
| 6787 | wma_process_update_beacon_params(wma_handle, |
| 6788 | (tUpdateBeaconParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6789 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6790 | break; |
| 6791 | |
| 6792 | case WMA_ADD_TS_REQ: |
| 6793 | wma_add_ts_req(wma_handle, (tAddTsParams *) msg->bodyptr); |
| 6794 | break; |
| 6795 | |
| 6796 | case WMA_DEL_TS_REQ: |
| 6797 | wma_del_ts_req(wma_handle, (tDelTsParams *) msg->bodyptr); |
| 6798 | break; |
| 6799 | |
| 6800 | case WMA_AGGR_QOS_REQ: |
| 6801 | wma_aggr_qos_req(wma_handle, (tAggrAddTsParams *) msg->bodyptr); |
| 6802 | break; |
| 6803 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6804 | case WMA_WOW_ADD_PTRN: |
| 6805 | wma_wow_add_pattern(wma_handle, |
| 6806 | (struct wow_add_pattern *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6807 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6808 | break; |
| 6809 | case WMA_WOW_DEL_PTRN: |
| 6810 | wma_wow_delete_user_pattern(wma_handle, |
| 6811 | (struct wow_delete_pattern *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6812 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6813 | break; |
| 6814 | case WMA_WOWL_ENTER_REQ: |
| 6815 | wma_wow_enter(wma_handle, |
| 6816 | (tpSirHalWowlEnterParams) msg->bodyptr); |
| 6817 | break; |
| 6818 | case WMA_WOWL_EXIT_REQ: |
| 6819 | wma_wow_exit(wma_handle, (tpSirHalWowlExitParams) msg->bodyptr); |
| 6820 | break; |
Houston Hoffman | a76591b | 2015-11-10 16:52:05 -0800 | [diff] [blame] | 6821 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6822 | case WMA_8023_MULTICAST_LIST_REQ: |
| 6823 | wma_process_mcbc_set_filter_req(wma_handle, |
| 6824 | (tpSirRcvFltMcAddrList) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6825 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6826 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6827 | case WMA_ROAM_SCAN_OFFLOAD_REQ: |
| 6828 | /* |
| 6829 | * Main entry point or roaming directives from CSR. |
| 6830 | */ |
Varun Reddy Yeturu | 30bc42c | 2016-02-04 10:07:30 -0800 | [diff] [blame] | 6831 | wma_process_roaming_config(wma_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6832 | (tSirRoamOffloadScanReq *) msg->bodyptr); |
| 6833 | break; |
| 6834 | |
| 6835 | case WMA_RATE_UPDATE_IND: |
| 6836 | wma_process_rate_update_indicate(wma_handle, |
| 6837 | (tSirRateUpdateInd *) msg->bodyptr); |
| 6838 | break; |
| 6839 | |
| 6840 | #ifdef FEATURE_WLAN_TDLS |
| 6841 | case WMA_UPDATE_FW_TDLS_STATE: |
| 6842 | wma_update_fw_tdls_state(wma_handle, |
| 6843 | (t_wma_tdls_params *) msg->bodyptr); |
| 6844 | break; |
| 6845 | case WMA_UPDATE_TDLS_PEER_STATE: |
| 6846 | wma_update_tdls_peer_state(wma_handle, |
| 6847 | (tTdlsPeerStateParams *) msg->bodyptr); |
| 6848 | break; |
| 6849 | case WMA_TDLS_SET_OFFCHAN_MODE: |
| 6850 | wma_set_tdls_offchan_mode(wma_handle, |
| 6851 | (tdls_chan_switch_params *)msg->bodyptr); |
| 6852 | break; |
| 6853 | #endif /* FEATURE_WLAN_TDLS */ |
| 6854 | case WMA_ADD_PERIODIC_TX_PTRN_IND: |
| 6855 | wma_process_add_periodic_tx_ptrn_ind(wma_handle, |
| 6856 | (tSirAddPeriodicTxPtrn *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6857 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6858 | break; |
| 6859 | case WMA_DEL_PERIODIC_TX_PTRN_IND: |
| 6860 | wma_process_del_periodic_tx_ptrn_ind(wma_handle, |
| 6861 | (tSirDelPeriodicTxPtrn *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6862 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6863 | break; |
| 6864 | case WMA_TX_POWER_LIMIT: |
| 6865 | wma_process_tx_power_limits(wma_handle, |
| 6866 | (tSirTxPowerLimit *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6867 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6868 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6869 | #ifdef FEATURE_WLAN_CH_AVOID |
| 6870 | case WMA_CH_AVOID_UPDATE_REQ: |
| 6871 | wma_process_ch_avoid_update_req(wma_handle, |
| 6872 | (tSirChAvoidUpdateReq *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6873 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6874 | break; |
| 6875 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 6876 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 6877 | case WMA_SET_AUTO_SHUTDOWN_TIMER_REQ: |
| 6878 | wma_set_auto_shutdown_timer_req(wma_handle, msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6879 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6880 | break; |
| 6881 | #endif /* FEATURE_WLAN_AUTO_SHUTDOWN */ |
| 6882 | case WMA_DHCP_START_IND: |
| 6883 | case WMA_DHCP_STOP_IND: |
| 6884 | wma_process_dhcp_ind(wma_handle, (tAniDHCPInd *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6885 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6886 | break; |
| 6887 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 6888 | case WMA_IBSS_CESIUM_ENABLE_IND: |
| 6889 | wma_process_cesium_enable_ind(wma_handle); |
| 6890 | break; |
| 6891 | case WMA_GET_IBSS_PEER_INFO_REQ: |
| 6892 | wma_process_get_peer_info_req(wma_handle, |
| 6893 | (tSirIbssGetPeerInfoReqParams *) |
| 6894 | msg->bodyptr); |
| 6895 | qdf_mem_free(msg->bodyptr); |
| 6896 | break; |
| 6897 | case WMA_TX_FAIL_MONITOR_IND: |
| 6898 | wma_process_tx_fail_monitor_ind(wma_handle, |
| 6899 | (tAniTXFailMonitorInd *) msg->bodyptr); |
| 6900 | qdf_mem_free(msg->bodyptr); |
| 6901 | break; |
| 6902 | |
| 6903 | case WMA_RMC_ENABLE_IND: |
| 6904 | wma_process_rmc_enable_ind(wma_handle); |
| 6905 | break; |
| 6906 | case WMA_RMC_DISABLE_IND: |
| 6907 | wma_process_rmc_disable_ind(wma_handle); |
| 6908 | break; |
| 6909 | case WMA_RMC_ACTION_PERIOD_IND: |
| 6910 | wma_process_rmc_action_period_ind(wma_handle); |
| 6911 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6912 | case WMA_INIT_THERMAL_INFO_CMD: |
| 6913 | wma_process_init_thermal_info(wma_handle, |
| 6914 | (t_thermal_mgmt *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6915 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6916 | break; |
| 6917 | |
| 6918 | case WMA_SET_THERMAL_LEVEL: |
| 6919 | wma_process_set_thermal_level(wma_handle, msg->bodyval); |
| 6920 | break; |
Poddar, Siddarth | 5a91f5b | 2016-04-28 12:24:10 +0530 | [diff] [blame] | 6921 | #ifdef CONFIG_HL_SUPPORT |
| 6922 | case WMA_INIT_BAD_PEER_TX_CTL_INFO_CMD: |
| 6923 | wma_process_init_bad_peer_tx_ctl_info( |
| 6924 | wma_handle, |
| 6925 | (struct t_bad_peer_txtcl_config *)msg->bodyptr); |
| 6926 | qdf_mem_free(msg->bodyptr); |
| 6927 | break; |
| 6928 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6929 | case WMA_SET_P2P_GO_NOA_REQ: |
| 6930 | wma_process_set_p2pgo_noa_req(wma_handle, |
| 6931 | (tP2pPsParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6932 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6933 | break; |
| 6934 | case WMA_SET_MIMOPS_REQ: |
| 6935 | wma_process_set_mimops_req(wma_handle, |
| 6936 | (tSetMIMOPS *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6937 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6938 | break; |
| 6939 | case WMA_SET_SAP_INTRABSS_DIS: |
| 6940 | wma_set_vdev_intrabss_fwd(wma_handle, |
| 6941 | (tDisableIntraBssFwd *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6942 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6943 | break; |
Will Huang | a981459 | 2017-05-24 15:47:58 +0800 | [diff] [blame] | 6944 | case WMA_GET_PEER_INFO: |
| 6945 | wma_get_peer_info(wma_handle, msg->bodyptr); |
| 6946 | qdf_mem_free(msg->bodyptr); |
| 6947 | break; |
| 6948 | case WMA_GET_PEER_INFO_EXT: |
| 6949 | wma_get_peer_info_ext(wma_handle, msg->bodyptr); |
| 6950 | qdf_mem_free(msg->bodyptr); |
| 6951 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6952 | case WMA_MODEM_POWER_STATE_IND: |
| 6953 | wma_notify_modem_power_state(wma_handle, |
| 6954 | (tSirModemPowerStateInd *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6955 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6956 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6957 | #ifdef WLAN_FEATURE_STATS_EXT |
| 6958 | case WMA_STATS_EXT_REQUEST: |
| 6959 | wma_stats_ext_req(wma_handle, |
| 6960 | (tpStatsExtRequest) (msg->bodyptr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6961 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6962 | break; |
| 6963 | #endif /* WLAN_FEATURE_STATS_EXT */ |
| 6964 | case WMA_HIDDEN_SSID_VDEV_RESTART: |
| 6965 | wma_hidden_ssid_vdev_restart(wma_handle, |
| 6966 | (tHalHiddenSsidVdevRestart *) msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6967 | break; |
| 6968 | #ifdef WLAN_FEATURE_EXTWOW_SUPPORT |
| 6969 | case WMA_WLAN_EXT_WOW: |
| 6970 | wma_enable_ext_wow(wma_handle, |
| 6971 | (tSirExtWoWParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6972 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6973 | break; |
| 6974 | case WMA_WLAN_SET_APP_TYPE1_PARAMS: |
| 6975 | wma_set_app_type1_params_in_fw(wma_handle, |
| 6976 | (tSirAppType1Params *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6977 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6978 | break; |
| 6979 | case WMA_WLAN_SET_APP_TYPE2_PARAMS: |
| 6980 | wma_set_app_type2_params_in_fw(wma_handle, |
| 6981 | (tSirAppType2Params *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6982 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6983 | break; |
| 6984 | #endif /* WLAN_FEATURE_EXTWOW_SUPPORT */ |
| 6985 | #ifdef FEATURE_WLAN_EXTSCAN |
| 6986 | case WMA_EXTSCAN_START_REQ: |
| 6987 | wma_start_extscan(wma_handle, |
| 6988 | (tSirWifiScanCmdReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6989 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6990 | break; |
| 6991 | case WMA_EXTSCAN_STOP_REQ: |
| 6992 | wma_stop_extscan(wma_handle, |
| 6993 | (tSirExtScanStopReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6994 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6995 | break; |
| 6996 | case WMA_EXTSCAN_SET_BSSID_HOTLIST_REQ: |
| 6997 | wma_extscan_start_hotlist_monitor(wma_handle, |
| 6998 | (tSirExtScanSetBssidHotListReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6999 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7000 | break; |
| 7001 | case WMA_EXTSCAN_RESET_BSSID_HOTLIST_REQ: |
| 7002 | wma_extscan_stop_hotlist_monitor(wma_handle, |
| 7003 | (tSirExtScanResetBssidHotlistReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7004 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7005 | break; |
| 7006 | case WMA_EXTSCAN_SET_SIGNF_CHANGE_REQ: |
| 7007 | wma_extscan_start_change_monitor(wma_handle, |
| 7008 | (tSirExtScanSetSigChangeReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7009 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7010 | break; |
| 7011 | case WMA_EXTSCAN_RESET_SIGNF_CHANGE_REQ: |
| 7012 | wma_extscan_stop_change_monitor(wma_handle, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7013 | (tSirExtScanResetSignificantChangeReqParams *) |
| 7014 | msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7015 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7016 | break; |
| 7017 | case WMA_EXTSCAN_GET_CACHED_RESULTS_REQ: |
| 7018 | wma_extscan_get_cached_results(wma_handle, |
| 7019 | (tSirExtScanGetCachedResultsReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7020 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7021 | break; |
| 7022 | case WMA_EXTSCAN_GET_CAPABILITIES_REQ: |
| 7023 | wma_extscan_get_capabilities(wma_handle, |
| 7024 | (tSirGetExtScanCapabilitiesReqParams *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7025 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7026 | break; |
| 7027 | case WMA_SET_EPNO_LIST_REQ: |
| 7028 | wma_set_epno_network_list(wma_handle, |
| 7029 | (struct wifi_epno_params *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7030 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7031 | break; |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 7032 | case WMA_SET_PER_ROAM_CONFIG_CMD: |
| 7033 | wma_update_per_roam_config(wma_handle, |
| 7034 | (struct wmi_per_roam_config_req *)msg->bodyptr); |
| 7035 | qdf_mem_free(msg->bodyptr); |
| 7036 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7037 | case WMA_SET_PASSPOINT_LIST_REQ: |
| 7038 | /* Issue reset passpoint network list first and clear |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7039 | * the entries |
| 7040 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7041 | wma_reset_passpoint_network_list(wma_handle, |
| 7042 | (struct wifi_passpoint_req *)msg->bodyptr); |
| 7043 | |
| 7044 | wma_set_passpoint_network_list(wma_handle, |
| 7045 | (struct wifi_passpoint_req *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7046 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7047 | break; |
| 7048 | case WMA_RESET_PASSPOINT_LIST_REQ: |
| 7049 | wma_reset_passpoint_network_list(wma_handle, |
| 7050 | (struct wifi_passpoint_req *)msg->bodyptr); |
| 7051 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7052 | #endif /* FEATURE_WLAN_EXTSCAN */ |
| 7053 | case WMA_SET_SCAN_MAC_OUI_REQ: |
| 7054 | wma_scan_probe_setoui(wma_handle, msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7055 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7056 | break; |
| 7057 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 7058 | case WMA_LINK_LAYER_STATS_CLEAR_REQ: |
| 7059 | wma_process_ll_stats_clear_req(wma_handle, |
| 7060 | (tpSirLLStatsClearReq) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7061 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7062 | break; |
| 7063 | case WMA_LINK_LAYER_STATS_SET_REQ: |
| 7064 | wma_process_ll_stats_set_req(wma_handle, |
| 7065 | (tpSirLLStatsSetReq) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7066 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7067 | break; |
| 7068 | case WMA_LINK_LAYER_STATS_GET_REQ: |
| 7069 | wma_process_ll_stats_get_req(wma_handle, |
| 7070 | (tpSirLLStatsGetReq) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7071 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7072 | break; |
Zhang Qian | 73c348a | 2017-03-13 16:15:55 +0800 | [diff] [blame] | 7073 | case WDA_LINK_LAYER_STATS_SET_THRESHOLD: |
| 7074 | wma_config_stats_ext_threshold(wma_handle, |
| 7075 | (struct sir_ll_ext_stats_threshold *)msg->bodyptr); |
| 7076 | qdf_mem_free(msg->bodyptr); |
| 7077 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7078 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 7079 | case SIR_HAL_UNIT_TEST_CMD: |
| 7080 | wma_process_unit_test_cmd(wma_handle, |
| 7081 | (t_wma_unit_test_cmd *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7082 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7083 | break; |
| 7084 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7085 | case WMA_ROAM_OFFLOAD_SYNCH_FAIL: |
| 7086 | wma_process_roam_synch_fail(wma_handle, |
| 7087 | (struct roam_offload_synch_fail *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7088 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7089 | break; |
| 7090 | case SIR_HAL_ROAM_INVOKE: |
| 7091 | wma_process_roam_invoke(wma_handle, |
| 7092 | (struct wma_roam_invoke_cmd *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7093 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7094 | break; |
| 7095 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 7096 | #ifdef WLAN_FEATURE_NAN |
| 7097 | case WMA_NAN_REQUEST: |
| 7098 | wma_nan_req(wma_handle, (tNanRequest *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7099 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7100 | break; |
| 7101 | #endif /* WLAN_FEATURE_NAN */ |
| 7102 | case SIR_HAL_SET_BASE_MACADDR_IND: |
| 7103 | wma_set_base_macaddr_indicate(wma_handle, |
| 7104 | (tSirMacAddr *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7105 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7106 | break; |
| 7107 | case WMA_LINK_STATUS_GET_REQ: |
| 7108 | wma_process_link_status_req(wma_handle, |
| 7109 | (tAniGetLinkStatus *) msg->bodyptr); |
| 7110 | break; |
| 7111 | case WMA_GET_TEMPERATURE_REQ: |
| 7112 | wma_get_temperature(wma_handle); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7113 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7114 | break; |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 7115 | case WMA_TSF_GPIO_PIN: |
| 7116 | wma_set_tsf_gpio_pin(wma_handle, msg->bodyval); |
| 7117 | break; |
| 7118 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7119 | #ifdef DHCP_SERVER_OFFLOAD |
| 7120 | case WMA_SET_DHCP_SERVER_OFFLOAD_CMD: |
| 7121 | wma_process_dhcpserver_offload(wma_handle, |
| 7122 | (tSirDhcpSrvOffloadInfo *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7123 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7124 | break; |
| 7125 | #endif /* DHCP_SERVER_OFFLOAD */ |
| 7126 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 7127 | case WMA_LED_FLASHING_REQ: |
| 7128 | wma_set_led_flashing(wma_handle, |
| 7129 | (tSirLedFlashingReq *) msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7130 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7131 | break; |
| 7132 | #endif /* WLAN_FEATURE_GPIO_LED_FLASHING */ |
| 7133 | case SIR_HAL_SET_MAS: |
| 7134 | wma_process_set_mas(wma_handle, |
| 7135 | (uint32_t *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7136 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7137 | break; |
| 7138 | case SIR_HAL_SET_MIRACAST: |
| 7139 | wma_process_set_miracast(wma_handle, |
| 7140 | (uint32_t *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7141 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7142 | break; |
| 7143 | case SIR_HAL_CONFIG_STATS_FACTOR: |
| 7144 | wma_config_stats_factor(wma_handle, |
| 7145 | (struct sir_stats_avg_factor *) |
| 7146 | msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7147 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7148 | break; |
| 7149 | case SIR_HAL_CONFIG_GUARD_TIME: |
| 7150 | wma_config_guard_time(wma_handle, |
| 7151 | (struct sir_guard_time_request *) |
| 7152 | msg->bodyptr); |
| 7153 | case WMA_IPA_OFFLOAD_ENABLE_DISABLE: |
| 7154 | wma_ipa_offload_enable_disable(wma_handle, |
| 7155 | (struct sir_ipa_offload_enable_disable *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7156 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7157 | break; |
| 7158 | case SIR_HAL_START_STOP_LOGGING: |
| 7159 | wma_set_wifi_start_packet_stats(wma_handle, |
| 7160 | (struct sir_wifi_start_log *)msg->bodyptr); |
| 7161 | wma_enable_specific_fw_logs(wma_handle, |
| 7162 | (struct sir_wifi_start_log *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7163 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7164 | break; |
| 7165 | case SIR_HAL_FLUSH_LOG_TO_FW: |
| 7166 | wma_send_flush_logs_to_fw(wma_handle); |
| 7167 | /* Body ptr is NULL here */ |
| 7168 | break; |
| 7169 | case WMA_SET_RSSI_MONITOR_REQ: |
| 7170 | wma_set_rssi_monitoring(wma_handle, |
| 7171 | (struct rssi_monitor_req *)msg->bodyptr); |
Prakash Dhavali | 87ddca3 | 2016-11-29 17:02:11 -0800 | [diff] [blame] | 7172 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7173 | break; |
| 7174 | case WMA_FW_MEM_DUMP_REQ: |
| 7175 | wma_process_fw_mem_dump_req(wma_handle, |
| 7176 | (struct fw_dump_req *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7177 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7178 | break; |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 7179 | case SIR_HAL_PDEV_SET_PCL_TO_FW: |
| 7180 | wma_send_pdev_set_pcl_cmd(wma_handle, |
| 7181 | (struct wmi_pcl_chan_weights *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7182 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7183 | break; |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 7184 | case SIR_HAL_PDEV_SET_HW_MODE: |
| 7185 | wma_send_pdev_set_hw_mode_cmd(wma_handle, |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 7186 | (struct policy_mgr_hw_mode *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7187 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7188 | break; |
| 7189 | case WMA_OCB_SET_CONFIG_CMD: |
| 7190 | wma_ocb_set_config_req(wma_handle, |
| 7191 | (struct sir_ocb_config *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7192 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7193 | break; |
| 7194 | case WMA_OCB_SET_UTC_TIME_CMD: |
| 7195 | wma_ocb_set_utc_time(wma_handle, |
| 7196 | (struct sir_ocb_utc *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7197 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7198 | break; |
| 7199 | case WMA_OCB_START_TIMING_ADVERT_CMD: |
| 7200 | wma_ocb_start_timing_advert(wma_handle, |
| 7201 | (struct sir_ocb_timing_advert *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7202 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7203 | break; |
| 7204 | case WMA_OCB_STOP_TIMING_ADVERT_CMD: |
| 7205 | wma_ocb_stop_timing_advert(wma_handle, |
| 7206 | (struct sir_ocb_timing_advert *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7207 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7208 | break; |
| 7209 | case WMA_DCC_CLEAR_STATS_CMD: |
| 7210 | wma_dcc_clear_stats(wma_handle, |
| 7211 | (struct sir_dcc_clear_stats *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7212 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7213 | break; |
| 7214 | case WMA_OCB_GET_TSF_TIMER_CMD: |
| 7215 | wma_ocb_get_tsf_timer(wma_handle, |
| 7216 | (struct sir_ocb_get_tsf_timer *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7217 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7218 | break; |
Manikandan Mohan | 80dea79 | 2016-04-28 16:36:48 -0700 | [diff] [blame] | 7219 | case WMA_SET_WISA_PARAMS: |
| 7220 | wma_set_wisa_params(wma_handle, |
| 7221 | (struct sir_wisa_params *)msg->bodyptr); |
| 7222 | qdf_mem_free(msg->bodyptr); |
| 7223 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7224 | case WMA_DCC_GET_STATS_CMD: |
| 7225 | wma_dcc_get_stats(wma_handle, |
| 7226 | (struct sir_dcc_get_stats *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7227 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7228 | break; |
| 7229 | case WMA_DCC_UPDATE_NDL_CMD: |
| 7230 | wma_dcc_update_ndl(wma_handle, |
| 7231 | (struct sir_dcc_update_ndl *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7232 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7233 | break; |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 7234 | case SIR_HAL_PDEV_DUAL_MAC_CFG_REQ: |
| 7235 | wma_send_pdev_set_dual_mac_config(wma_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7236 | (struct sir_dual_mac_config *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7237 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7238 | break; |
| 7239 | case WMA_SET_IE_INFO: |
| 7240 | wma_process_set_ie_info(wma_handle, |
| 7241 | (struct vdev_ie_info *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7242 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7243 | break; |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 7244 | case SIR_HAL_SOC_ANTENNA_MODE_REQ: |
| 7245 | wma_send_pdev_set_antenna_mode(wma_handle, |
| 7246 | (struct sir_antenna_mode_param *)msg->bodyptr); |
| 7247 | qdf_mem_free(msg->bodyptr); |
| 7248 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7249 | case WMA_LRO_CONFIG_CMD: |
| 7250 | wma_lro_config_cmd(wma_handle, |
Dhanashri Atre | 09828f1 | 2016-11-13 10:36:58 -0800 | [diff] [blame] | 7251 | (struct cdp_lro_hash_config *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7252 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7253 | break; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 7254 | case WMA_GW_PARAM_UPDATE_REQ: |
| 7255 | wma_set_gateway_params(wma_handle, |
| 7256 | (struct gateway_param_update_req *)msg->bodyptr); |
Archana Ramachandran | 28ab412 | 2016-03-08 16:17:14 -0800 | [diff] [blame] | 7257 | qdf_mem_free(msg->bodyptr); |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 7258 | break; |
| 7259 | case WMA_SET_EGAP_CONF_PARAMS: |
| 7260 | wma_send_egap_conf_params(wma_handle, |
| 7261 | (struct egap_conf_params *)msg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7262 | qdf_mem_free(msg->bodyptr); |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 7263 | break; |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 7264 | case WMA_SET_ADAPT_DWELLTIME_CONF_PARAMS: |
| 7265 | wma_send_adapt_dwelltime_params(wma_handle, |
| 7266 | (struct adaptive_dwelltime_params *)msg->bodyptr); |
| 7267 | qdf_mem_free(msg->bodyptr); |
| 7268 | break; |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 7269 | case WMA_HT40_OBSS_SCAN_IND: |
| 7270 | wma_send_ht40_obss_scanind(wma_handle, |
| 7271 | (struct obss_ht40_scanind *)msg->bodyptr); |
| 7272 | qdf_mem_free(msg->bodyptr); |
| 7273 | break; |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 7274 | case WMA_ADD_BCN_FILTER_CMDID: |
| 7275 | wma_add_beacon_filter(wma_handle, msg->bodyptr); |
| 7276 | qdf_mem_free(msg->bodyptr); |
| 7277 | break; |
| 7278 | case WMA_REMOVE_BCN_FILTER_CMDID: |
| 7279 | wma_remove_beacon_filter(wma_handle, msg->bodyptr); |
| 7280 | qdf_mem_free(msg->bodyptr); |
| 7281 | break; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 7282 | case WDA_BPF_GET_CAPABILITIES_REQ: |
| 7283 | wma_get_bpf_capabilities(wma_handle); |
| 7284 | break; |
| 7285 | case WDA_BPF_SET_INSTRUCTIONS_REQ: |
| 7286 | wma_set_bpf_instructions(wma_handle, msg->bodyptr); |
| 7287 | qdf_mem_free(msg->bodyptr); |
| 7288 | break; |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 7289 | case SIR_HAL_NDP_INITIATOR_REQ: |
| 7290 | wma_handle_ndp_initiator_req(wma_handle, msg->bodyptr); |
| 7291 | qdf_mem_free(msg->bodyptr); |
| 7292 | break; |
Naveen Rawat | f28315c | 2016-06-29 18:06:02 -0700 | [diff] [blame] | 7293 | |
Abhishek Singh | 4fef747 | 2016-06-06 11:36:03 -0700 | [diff] [blame] | 7294 | case SIR_HAL_NDP_RESPONDER_REQ: |
| 7295 | wma_handle_ndp_responder_req(wma_handle, msg->bodyptr); |
Naveen Rawat | f28315c | 2016-06-29 18:06:02 -0700 | [diff] [blame] | 7296 | break; |
| 7297 | |
| 7298 | case SIR_HAL_NDP_END_REQ: |
| 7299 | wma_handle_ndp_end_req(wma_handle, msg->bodyptr); |
Abhishek Singh | 4fef747 | 2016-06-06 11:36:03 -0700 | [diff] [blame] | 7300 | qdf_mem_free(msg->bodyptr); |
| 7301 | break; |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 7302 | case SIR_HAL_POWER_DBG_CMD: |
| 7303 | wma_process_hal_pwr_dbg_cmd(wma_handle, |
| 7304 | msg->bodyptr); |
| 7305 | qdf_mem_free(msg->bodyptr); |
| 7306 | break; |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 7307 | case WMA_UPDATE_WEP_DEFAULT_KEY: |
| 7308 | wma_update_wep_default_key(wma_handle, |
| 7309 | (struct wep_update_default_key_idx *)msg->bodyptr); |
| 7310 | qdf_mem_free(msg->bodyptr); |
| 7311 | break; |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 7312 | case WMA_SEND_FREQ_RANGE_CONTROL_IND: |
| 7313 | wma_enable_disable_caevent_ind(wma_handle, msg->bodyval); |
| 7314 | break; |
Padma, Santhosh Kumar | d7cc079 | 2016-06-28 18:54:12 +0530 | [diff] [blame] | 7315 | case WMA_ENCRYPT_DECRYPT_MSG: |
| 7316 | wma_encrypt_decrypt_msg(wma_handle, msg->bodyptr); |
| 7317 | qdf_mem_free(msg->bodyptr); |
| 7318 | break; |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 7319 | case SIR_HAL_UPDATE_TX_FAIL_CNT_TH: |
| 7320 | wma_update_tx_fail_cnt_th(wma_handle, msg->bodyptr); |
| 7321 | qdf_mem_free(msg->bodyptr); |
| 7322 | break; |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 7323 | case SIR_HAL_LONG_RETRY_LIMIT_CNT: |
| 7324 | wma_update_long_retry_limit(wma_handle, msg->bodyptr); |
| 7325 | qdf_mem_free(msg->bodyptr); |
| 7326 | break; |
| 7327 | case SIR_HAL_SHORT_RETRY_LIMIT_CNT: |
| 7328 | wma_update_short_retry_limit(wma_handle, msg->bodyptr); |
| 7329 | qdf_mem_free(msg->bodyptr); |
| 7330 | break; |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 7331 | case SIR_HAL_POWER_DEBUG_STATS_REQ: |
| 7332 | wma_process_power_debug_stats_req(wma_handle); |
| 7333 | break; |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 7334 | case WMA_SET_WOW_PULSE_CMD: |
| 7335 | wma_send_wow_pulse_cmd(wma_handle, |
| 7336 | (struct wow_pulse_mode *)msg->bodyptr); |
| 7337 | qdf_mem_free(msg->bodyptr); |
| 7338 | break; |
Nitesh Shah | f9a09ff | 2017-05-22 15:46:25 +0530 | [diff] [blame] | 7339 | case WMA_SET_DBS_SCAN_SEL_CONF_PARAMS: |
| 7340 | wma_send_dbs_scan_selection_params(wma_handle, |
| 7341 | (struct wmi_dbs_scan_sel_params *)msg->bodyptr); |
| 7342 | qdf_mem_free(msg->bodyptr); |
| 7343 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7344 | default: |
Dustin Brown | 86534fb | 2017-01-24 14:28:20 -0800 | [diff] [blame] | 7345 | WMA_LOGE("Unhandled WMA message of type %d", msg->type); |
| 7346 | if (msg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7347 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7348 | } |
| 7349 | end: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7350 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7351 | } |
| 7352 | |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 7353 | QDF_STATUS wma_mc_process_handler(struct scheduler_msg *msg) |
| 7354 | { |
| 7355 | void *cds_ctx = cds_get_global_context(); |
| 7356 | |
| 7357 | if (cds_ctx == NULL) { |
| 7358 | QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR, |
| 7359 | "CDS context is NULL"); |
| 7360 | return QDF_STATUS_E_FAILURE; |
| 7361 | } |
Rajeev Kumar | 156188e | 2017-01-21 17:23:52 -0800 | [diff] [blame] | 7362 | return wma_mc_process_msg(cds_ctx, msg); |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 7363 | } |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 7364 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7365 | /** |
| 7366 | * wma_log_completion_timeout() - Log completion timeout |
| 7367 | * @data: Timeout handler data |
| 7368 | * |
| 7369 | * This function is called when log completion timer expires |
| 7370 | * |
| 7371 | * Return: None |
| 7372 | */ |
| 7373 | void wma_log_completion_timeout(void *data) |
| 7374 | { |
| 7375 | tp_wma_handle wma_handle; |
| 7376 | |
| 7377 | WMA_LOGE("%s: Timeout occured for log completion command", __func__); |
| 7378 | |
| 7379 | wma_handle = (tp_wma_handle) data; |
| 7380 | if (!wma_handle) |
| 7381 | WMA_LOGE("%s: Invalid WMA handle", __func__); |
| 7382 | |
| 7383 | /* Though we did not receive any event from FW, |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7384 | * we can flush whatever logs we have with us |
| 7385 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7386 | cds_logging_set_fw_flush_complete(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7387 | } |
| 7388 | |
| 7389 | /** |
Manishekar Chandrasekaran | b82554d | 2016-08-04 17:46:46 +0530 | [diff] [blame] | 7390 | * wma_map_pcl_weights() - Map PCL weights |
| 7391 | * @pcl_weight: Internal PCL weights |
| 7392 | * |
| 7393 | * Maps the internal weights of PCL to the weights needed by FW |
| 7394 | * |
| 7395 | * Return: Mapped channel weight of type wmi_pcl_chan_weight |
| 7396 | */ |
| 7397 | static wmi_pcl_chan_weight wma_map_pcl_weights(uint32_t pcl_weight) |
| 7398 | { |
| 7399 | switch (pcl_weight) { |
| 7400 | case WEIGHT_OF_GROUP1_PCL_CHANNELS: |
| 7401 | return WMI_PCL_WEIGHT_VERY_HIGH; |
| 7402 | case WEIGHT_OF_GROUP2_PCL_CHANNELS: |
| 7403 | return WMI_PCL_WEIGHT_HIGH; |
| 7404 | case WEIGHT_OF_GROUP3_PCL_CHANNELS: |
| 7405 | return WMI_PCL_WEIGHT_MEDIUM; |
| 7406 | case WEIGHT_OF_NON_PCL_CHANNELS: |
| 7407 | return WMI_PCL_WEIGHT_LOW; |
| 7408 | default: |
| 7409 | return WMI_PCL_WEIGHT_DISALLOW; |
| 7410 | } |
| 7411 | } |
| 7412 | |
| 7413 | /** |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 7414 | * 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] | 7415 | * @wma_handle: WMA handle |
| 7416 | * @msg: PCL structure containing the PCL and the number of channels |
| 7417 | * |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 7418 | * 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] | 7419 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 7420 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 7421 | * to migrate to a new channel without host driver involvement. An example of |
| 7422 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 7423 | * manage the channel selection without firmware involvement. |
| 7424 | * |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 7425 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 7426 | * channel list. The weights corresponds to the channels sent in |
| 7427 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 7428 | * weightage compared to the non PCL channels. |
| 7429 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7430 | * Return: Success if the cmd is sent successfully to the firmware |
| 7431 | */ |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 7432 | QDF_STATUS wma_send_pdev_set_pcl_cmd(tp_wma_handle wma_handle, |
| 7433 | struct wmi_pcl_chan_weights *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7434 | { |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 7435 | uint32_t i; |
| 7436 | QDF_STATUS status; |
| 7437 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7438 | if (!wma_handle) { |
| 7439 | WMA_LOGE("%s: WMA handle is NULL. Cannot issue command", |
| 7440 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7441 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7442 | } |
| 7443 | |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 7444 | for (i = 0; i < wma_handle->saved_chan.num_channels; i++) { |
| 7445 | msg->saved_chan_list[i] = |
| 7446 | wma_handle->saved_chan.channel_list[i]; |
| 7447 | } |
| 7448 | |
| 7449 | msg->saved_num_chan = wma_handle->saved_chan.num_channels; |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 7450 | status = policy_mgr_get_valid_chan_weights(wma_handle->psoc, |
| 7451 | (struct policy_mgr_pcl_chan_weights *)msg); |
Manishekar Chandrasekaran | b82554d | 2016-08-04 17:46:46 +0530 | [diff] [blame] | 7452 | |
| 7453 | for (i = 0; i < msg->saved_num_chan; i++) { |
| 7454 | msg->weighed_valid_list[i] = |
| 7455 | wma_map_pcl_weights(msg->weighed_valid_list[i]); |
| 7456 | WMA_LOGD("%s: chan:%d weight[%d]=%d", __func__, |
| 7457 | msg->saved_chan_list[i], i, |
| 7458 | msg->weighed_valid_list[i]); |
| 7459 | } |
| 7460 | |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 7461 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 7462 | WMA_LOGE("%s: Error in creating weighed pcl", __func__); |
| 7463 | return status; |
| 7464 | } |
| 7465 | |
| 7466 | if (wmi_unified_pdev_set_pcl_cmd(wma_handle->wmi_handle, msg)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7467 | return QDF_STATUS_E_FAILURE; |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 7468 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7469 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7470 | } |
| 7471 | |
| 7472 | /** |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 7473 | * 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] | 7474 | * @wma_handle: WMA handle |
| 7475 | * @msg: Structure containing the following parameters |
| 7476 | * |
| 7477 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 7478 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 7479 | * |
| 7480 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 7481 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 7482 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 7483 | * |
| 7484 | * Return: Success if the cmd is sent successfully to the firmware |
| 7485 | */ |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 7486 | QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle, |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 7487 | struct policy_mgr_hw_mode *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7488 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7489 | struct sir_set_hw_mode_resp *param; |
| 7490 | |
| 7491 | if (!wma_handle) { |
| 7492 | WMA_LOGE("%s: WMA handle is NULL. Cannot issue command", |
| 7493 | __func__); |
| 7494 | /* Handle is NULL. Will not be able to send failure |
| 7495 | * response as well |
| 7496 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7497 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7498 | } |
| 7499 | |
| 7500 | if (!msg) { |
| 7501 | WMA_LOGE("%s: Set HW mode param is NULL", __func__); |
| 7502 | /* Lets try to free the active command list */ |
| 7503 | goto fail; |
| 7504 | } |
| 7505 | |
Krunal Soni | cebcc29 | 2017-06-14 19:59:20 -0700 | [diff] [blame] | 7506 | wma_acquire_wmi_resp_wakelock(wma_handle, |
| 7507 | WMA_VDEV_HW_MODE_REQUEST_TIMEOUT); |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 7508 | if (wmi_unified_soc_set_hw_mode_cmd(wma_handle->wmi_handle, |
Krunal Soni | cebcc29 | 2017-06-14 19:59:20 -0700 | [diff] [blame] | 7509 | msg->hw_mode_index)) { |
| 7510 | wma_release_wmi_resp_wakelock(wma_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7511 | goto fail; |
Krunal Soni | cebcc29 | 2017-06-14 19:59:20 -0700 | [diff] [blame] | 7512 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7513 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7514 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7515 | fail: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7516 | param = qdf_mem_malloc(sizeof(*param)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7517 | if (!param) { |
| 7518 | WMA_LOGE("%s: Memory allocation failed", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7519 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7520 | } |
| 7521 | param->status = SET_HW_MODE_STATUS_ECANCELED; |
| 7522 | param->cfgd_hw_mode_index = 0; |
| 7523 | param->num_vdev_mac_entries = 0; |
| 7524 | WMA_LOGE("%s: Sending HW mode fail response to LIM", __func__); |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 7525 | wma_send_msg(wma_handle, SIR_HAL_PDEV_SET_HW_MODE_RESP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7526 | (void *) param, 0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7527 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7528 | } |
| 7529 | |
| 7530 | /** |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 7531 | * 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] | 7532 | * @wma_handle: WMA handle |
| 7533 | * @msg: Dual MAC config parameters |
| 7534 | * |
| 7535 | * Configures WLAN firmware with the dual MAC features |
| 7536 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7537 | * Return: QDF_STATUS. 0 on success. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7538 | */ |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 7539 | 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] | 7540 | struct sir_dual_mac_config *msg) |
| 7541 | { |
Manishekar Chandrasekaran | 91152df | 2016-04-25 14:29:27 +0530 | [diff] [blame] | 7542 | QDF_STATUS status; |
| 7543 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7544 | if (!wma_handle) { |
| 7545 | WMA_LOGE("%s: WMA handle is NULL. Cannot issue command", |
| 7546 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7547 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7548 | } |
| 7549 | |
| 7550 | if (!msg) { |
| 7551 | WMA_LOGE("%s: Set dual mode config is NULL", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7552 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7553 | } |
| 7554 | |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 7555 | status = wmi_unified_pdev_set_dual_mac_config_cmd( |
| 7556 | wma_handle->wmi_handle, |
Manishekar Chandrasekaran | 91152df | 2016-04-25 14:29:27 +0530 | [diff] [blame] | 7557 | (struct wmi_dual_mac_config *)msg); |
| 7558 | if (QDF_IS_STATUS_ERROR(status)) { |
Manishekar Chandrasekaran | 5d46f70 | 2016-04-27 12:50:52 +0530 | [diff] [blame] | 7559 | 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] | 7560 | __func__, status); |
| 7561 | return status; |
| 7562 | } |
Tushnim Bhattacharyya | 51258a7 | 2017-03-13 12:55:02 -0700 | [diff] [blame] | 7563 | policy_mgr_update_dbs_req_config(wma_handle->psoc, |
| 7564 | msg->scan_config, msg->fw_mode_config); |
Govind Singh | f25a0f1 | 2016-03-08 16:09:48 +0530 | [diff] [blame] | 7565 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7566 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7567 | } |
| 7568 | |
| 7569 | /** |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 7570 | * wma_send_pdev_set_antenna_mode() - Set antenna mode to FW |
| 7571 | * @wma_handle: WMA handle |
| 7572 | * @msg: Antenna mode parameters |
| 7573 | * |
| 7574 | * Send WMI_PDEV_SET_ANTENNA_MODE_CMDID to FW requesting to |
| 7575 | * modify the number of TX/RX chains from host |
| 7576 | * |
| 7577 | * Return: QDF_STATUS. 0 on success. |
| 7578 | */ |
| 7579 | QDF_STATUS wma_send_pdev_set_antenna_mode(tp_wma_handle wma_handle, |
| 7580 | struct sir_antenna_mode_param *msg) |
| 7581 | { |
| 7582 | wmi_pdev_set_antenna_mode_cmd_fixed_param *cmd; |
| 7583 | wmi_buf_t buf; |
| 7584 | uint32_t len; |
| 7585 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 7586 | struct sir_antenna_mode_resp *param; |
| 7587 | |
| 7588 | if (!wma_handle) { |
| 7589 | WMA_LOGE("%s: WMA handle is NULL. Cannot issue command", |
| 7590 | __func__); |
| 7591 | return QDF_STATUS_E_NULL_VALUE; |
| 7592 | } |
| 7593 | |
| 7594 | if (!msg) { |
| 7595 | WMA_LOGE("%s: Set antenna mode param is NULL", __func__); |
| 7596 | return QDF_STATUS_E_NULL_VALUE; |
| 7597 | } |
| 7598 | |
| 7599 | len = sizeof(*cmd); |
| 7600 | |
| 7601 | buf = wmi_buf_alloc(wma_handle->wmi_handle, len); |
| 7602 | if (!buf) { |
| 7603 | WMA_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7604 | status = QDF_STATUS_E_NOMEM; |
| 7605 | goto resp; |
| 7606 | } |
| 7607 | |
| 7608 | cmd = (wmi_pdev_set_antenna_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 7609 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7610 | WMITLV_TAG_STRUC_wmi_pdev_set_antenna_mode_cmd_fixed_param, |
| 7611 | WMITLV_GET_STRUCT_TLVLEN( |
| 7612 | wmi_pdev_set_antenna_mode_cmd_fixed_param)); |
| 7613 | |
| 7614 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 7615 | /* Bits 0-15 is num of RX chains 16-31 is num of TX chains */ |
| 7616 | cmd->num_txrx_chains = msg->num_rx_chains; |
| 7617 | cmd->num_txrx_chains |= (msg->num_tx_chains << 16); |
| 7618 | |
Srinivas Girigowda | 3ad735a | 2017-03-20 09:26:17 -0700 | [diff] [blame] | 7619 | 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] | 7620 | __func__, msg->num_tx_chains, |
| 7621 | msg->num_rx_chains, cmd->num_txrx_chains); |
| 7622 | |
| 7623 | if (wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, |
| 7624 | WMI_PDEV_SET_ANTENNA_MODE_CMDID)) { |
| 7625 | WMA_LOGE("%s: Failed to send WMI_PDEV_SET_ANTENNA_MODE_CMDID", |
| 7626 | __func__); |
| 7627 | wmi_buf_free(buf); |
| 7628 | status = QDF_STATUS_E_FAILURE; |
| 7629 | goto resp; |
| 7630 | } |
| 7631 | status = QDF_STATUS_SUCCESS; |
| 7632 | |
| 7633 | resp: |
| 7634 | param = qdf_mem_malloc(sizeof(*param)); |
| 7635 | if (!param) { |
| 7636 | WMA_LOGE("%s: Memory allocation failed", __func__); |
| 7637 | return QDF_STATUS_E_NOMEM; |
| 7638 | } |
| 7639 | param->status = (status) ? |
| 7640 | SET_ANTENNA_MODE_STATUS_ECANCELED : |
| 7641 | SET_ANTENNA_MODE_STATUS_OK; |
| 7642 | WMA_LOGE("%s: Send antenna mode resp to LIM status: %d", |
| 7643 | __func__, param->status); |
| 7644 | wma_send_msg(wma_handle, SIR_HAL_SOC_ANTENNA_MODE_RESP, |
| 7645 | (void *) param, 0); |
| 7646 | return status; |
| 7647 | } |
| 7648 | |
| 7649 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7650 | * wma_crash_inject() - sends command to FW to simulate crash |
| 7651 | * @wma_handle: pointer of WMA context |
| 7652 | * @type: subtype of the command |
| 7653 | * @delay_time_ms: time in milliseconds for FW to delay the crash |
| 7654 | * |
| 7655 | * This function will send a command to FW in order to simulate different |
| 7656 | * kinds of FW crashes. |
| 7657 | * |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 7658 | * Return: QDF_STATUS_SUCCESS for success or error code |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7659 | */ |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 7660 | QDF_STATUS wma_crash_inject(tp_wma_handle wma_handle, uint32_t type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7661 | uint32_t delay_time_ms) |
| 7662 | { |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 7663 | struct crash_inject param; |
Manikandan Mohan | 1dd8b5d | 2017-04-18 15:54:09 -0700 | [diff] [blame] | 7664 | |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 7665 | param.type = type; |
| 7666 | param.delay_time_ms = delay_time_ms; |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 7667 | return wmi_crash_inject(wma_handle->wmi_handle, ¶m); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7668 | } |
Govind Singh | d76a5b0 | 2016-03-08 15:12:14 +0530 | [diff] [blame] | 7669 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7670 | #if defined(FEATURE_LRO) |
| 7671 | /** |
| 7672 | * wma_lro_init() - sends LRO configuration to FW |
| 7673 | * @lro_config: pointer to the config parameters |
| 7674 | * |
| 7675 | * This function ends LRO configuration to FW. |
| 7676 | * |
| 7677 | * Return: 0 for success or reasons for failure |
| 7678 | */ |
Dhanashri Atre | 09828f1 | 2016-11-13 10:36:58 -0800 | [diff] [blame] | 7679 | int wma_lro_init(struct cdp_lro_hash_config *lro_config) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7680 | { |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 7681 | struct scheduler_msg msg = {0}; |
Dhanashri Atre | 09828f1 | 2016-11-13 10:36:58 -0800 | [diff] [blame] | 7682 | struct cdp_lro_hash_config *iwcmd; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7683 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7684 | iwcmd = qdf_mem_malloc(sizeof(*iwcmd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7685 | if (!iwcmd) { |
| 7686 | WMA_LOGE("memory allocation for WMA_LRO_CONFIG_CMD failed!"); |
| 7687 | return -ENOMEM; |
| 7688 | } |
| 7689 | |
| 7690 | *iwcmd = *lro_config; |
| 7691 | |
| 7692 | msg.type = WMA_LRO_CONFIG_CMD; |
| 7693 | msg.reserved = 0; |
| 7694 | msg.bodyptr = iwcmd; |
| 7695 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7696 | if (QDF_STATUS_SUCCESS != |
Rajeev Kumar | b60abe4 | 2017-01-21 15:39:31 -0800 | [diff] [blame] | 7697 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7698 | WMA_LOGE("Failed to post WMA_LRO_CONFIG_CMD msg!"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7699 | qdf_mem_free(iwcmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7700 | return -EAGAIN; |
| 7701 | } |
| 7702 | |
| 7703 | WMA_LOGD("sending the LRO configuration to the fw"); |
| 7704 | return 0; |
| 7705 | } |
| 7706 | #endif |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 7707 | |
| 7708 | void wma_peer_set_default_routing(void *scn_handle, uint8_t *peer_macaddr, |
| 7709 | uint8_t vdev_id, bool hash_based, uint8_t ring_num) |
| 7710 | { |
| 7711 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 7712 | struct peer_set_params param; |
| 7713 | |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 7714 | if (!wma) { |
| 7715 | WMA_LOGE("%s:wma_handle is NULL", __func__); |
| 7716 | return; |
| 7717 | } |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 7718 | |
| 7719 | /* TODO: Need bit definitions for ring number and hash based routing |
| 7720 | * fields in common wmi header file |
| 7721 | */ |
| 7722 | param.param_id = WMI_HOST_PEER_SET_DEFAULT_ROUTING; |
| 7723 | param.vdev_id = vdev_id; |
| 7724 | param.param_value = ((hash_based) ? 1 : 0) | (ring_num << 1); |
Dhanashri Atre | 09828f1 | 2016-11-13 10:36:58 -0800 | [diff] [blame] | 7725 | WMA_LOGD("%s: param_value 0x%d", __func__, param.param_value); |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 7726 | wmi_set_peer_param_send(wma->wmi_handle, peer_macaddr, ¶m); |
| 7727 | |
| 7728 | return; |
| 7729 | } |
| 7730 | |
| 7731 | int wma_peer_rx_reorder_queue_setup(void *scn_handle, |
| 7732 | uint8_t vdev_id, uint8_t *peer_macaddr, qdf_dma_addr_t hw_qdesc, |
| 7733 | int tid, uint16_t queue_no) |
| 7734 | { |
| 7735 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 7736 | struct rx_reorder_queue_setup_params param; |
| 7737 | |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 7738 | if (!wma) { |
| 7739 | WMA_LOGE("%s:wma_handle is NULL", __func__); |
| 7740 | return QDF_STATUS_E_FAILURE; |
| 7741 | } |
| 7742 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 7743 | param.tid = tid; |
| 7744 | param.vdev_id = vdev_id; |
| 7745 | param.peer_macaddr = peer_macaddr; |
| 7746 | param.hw_qdesc_paddr_lo = hw_qdesc & 0xffffffff; |
| 7747 | param.hw_qdesc_paddr_hi = (uint64_t)hw_qdesc >> 32; |
| 7748 | param.queue_no = queue_no; |
| 7749 | |
| 7750 | return wmi_unified_peer_rx_reorder_queue_setup_send(wma->wmi_handle, |
| 7751 | ¶m); |
| 7752 | } |
| 7753 | |
| 7754 | int wma_peer_rx_reorder_queue_remove(void *scn_handle, |
| 7755 | uint8_t vdev_id, uint8_t *peer_macaddr, uint32_t peer_tid_bitmap) |
| 7756 | { |
| 7757 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 7758 | struct rx_reorder_queue_remove_params param; |
| 7759 | |
Nishank Aggarwal | a13b61d | 2016-12-01 12:53:58 +0530 | [diff] [blame] | 7760 | if (!wma) { |
| 7761 | WMA_LOGE("%s:wma_handle is NULL", __func__); |
| 7762 | return QDF_STATUS_E_FAILURE; |
| 7763 | } |
| 7764 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 7765 | param.vdev_id = vdev_id; |
| 7766 | param.peer_macaddr = peer_macaddr; |
| 7767 | param.peer_tid_bitmap = peer_tid_bitmap; |
| 7768 | |
| 7769 | return wmi_unified_peer_rx_reorder_queue_remove_send(wma->wmi_handle, |
| 7770 | ¶m); |
| 7771 | } |
| 7772 | |
Ashish Kumar Dhanotiya | b28338c | 2017-07-21 20:12:34 +0530 | [diff] [blame] | 7773 | QDF_STATUS wma_configure_smps_params(uint32_t vdev_id, uint32_t param_id, |
| 7774 | uint32_t param_val) |
| 7775 | { |
| 7776 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 7777 | int smps_cmd_value; |
| 7778 | int status = QDF_STATUS_E_INVAL; |
| 7779 | |
| 7780 | if (!wma) { |
| 7781 | WMA_LOGE("%s: Failed to get wma", __func__); |
| 7782 | return status; |
| 7783 | } |
| 7784 | |
| 7785 | smps_cmd_value = param_id << WMI_SMPS_PARAM_VALUE_S; |
| 7786 | smps_cmd_value = smps_cmd_value | param_val; |
| 7787 | |
| 7788 | status = wma_set_smps_params(wma, vdev_id, smps_cmd_value); |
| 7789 | if (status) |
| 7790 | WMA_LOGE("Failed to set SMPS Param"); |
| 7791 | |
| 7792 | return status; |
| 7793 | } |
| 7794 | |
Leo Chang | 9646490 | 2016-10-28 11:10:54 -0700 | [diff] [blame] | 7795 | |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 7796 | void wma_ipa_uc_stat_request(wma_cli_set_cmd_t *privcmd) |
| 7797 | { |
| 7798 | tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 7799 | |
Sreelakshmi Konamki | 7a57408 | 2017-05-15 16:53:45 +0530 | [diff] [blame] | 7800 | if (!wma) { |
| 7801 | WMA_LOGE("%s: Failed to get wma", __func__); |
| 7802 | return; |
| 7803 | } |
| 7804 | |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 7805 | if (wma_set_priv_cfg(wma, privcmd)) |
| 7806 | WMA_LOGE("Failed to set wma priv congiuration"); |
| 7807 | } |