Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1 | /* |
Naveen Rawat | 4f1e2ac | 2017-12-14 13:24:31 -0800 | [diff] [blame] | 2 | * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 3 | * |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19 | #include "wmi_unified_api.h" |
| 20 | #include "wmi.h" |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 21 | #include "wmi_version.h" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 22 | #include "wmi_unified_priv.h" |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 23 | #include "wmi_version_whitelist.h" |
Manikandan Mohan | 3dc8c51 | 2018-03-01 16:23:30 -0800 | [diff] [blame] | 24 | #include <qdf_module.h> |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 25 | #include <wlan_defs.h> |
Wu Gao | 5d1c9ed | 2018-10-12 18:16:09 +0800 | [diff] [blame] | 26 | #include <wlan_cmn.h> |
Pratik Gandhi | cf3b8b9 | 2018-02-05 17:22:41 +0530 | [diff] [blame] | 27 | #include <htc_services.h> |
Nachiket Kukade | e06beaa | 2018-05-25 14:52:55 +0530 | [diff] [blame] | 28 | #ifdef FEATURE_WLAN_APF |
Nachiket Kukade | 7d4f04b | 2018-05-21 17:28:32 +0530 | [diff] [blame] | 29 | #include "wmi_unified_apf_tlv.h" |
Nachiket Kukade | e06beaa | 2018-05-25 14:52:55 +0530 | [diff] [blame] | 30 | #endif |
Rajeev Kumar Sirasanagandla | daadf83 | 2017-09-18 16:47:52 +0530 | [diff] [blame] | 31 | #ifdef WLAN_FEATURE_ACTION_OUI |
| 32 | #include "wmi_unified_action_oui_tlv.h" |
| 33 | #endif |
Wu Gao | 52c0b77 | 2018-05-17 16:14:00 +0800 | [diff] [blame] | 34 | #ifdef WLAN_POWER_MANAGEMENT_OFFLOAD |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 35 | #include "wlan_pmo_hw_filter_public_struct.h" |
| 36 | #endif |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 37 | #include <wlan_utility.h> |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 38 | #ifdef WLAN_SUPPORT_GREEN_AP |
| 39 | #include "wlan_green_ap_api.h" |
| 40 | #endif |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 41 | |
Varun Reddy Yeturu | 2c8c912 | 2018-04-17 11:04:27 -0700 | [diff] [blame] | 42 | #include "wmi_unified_twt_api.h" |
Naveen Rawat | 4f1e2ac | 2017-12-14 13:24:31 -0800 | [diff] [blame] | 43 | |
Srinivas Girigowda | 5029ae7 | 2018-02-15 14:30:05 -0800 | [diff] [blame] | 44 | #ifdef WLAN_POLICY_MGR_ENABLE |
| 45 | #include "wlan_policy_mgr_public_struct.h" |
| 46 | #endif |
| 47 | |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 48 | #ifdef WMI_SMART_ANT_SUPPORT |
| 49 | #include "wmi_unified_smart_ant_api.h" |
| 50 | #endif |
| 51 | |
| 52 | #ifdef WMI_DBR_SUPPORT |
| 53 | #include "wmi_unified_dbr_api.h" |
| 54 | #endif |
| 55 | |
| 56 | #ifdef WMI_ATF_SUPPORT |
| 57 | #include "wmi_unified_atf_api.h" |
| 58 | #endif |
| 59 | |
| 60 | #ifdef WMI_AP_SUPPORT |
| 61 | #include "wmi_unified_ap_api.h" |
| 62 | #endif |
| 63 | |
Pratik Gandhi | cf3b8b9 | 2018-02-05 17:22:41 +0530 | [diff] [blame] | 64 | /* HTC service ids for WMI for multi-radio */ |
| 65 | static const uint32_t multi_svc_ids[] = {WMI_CONTROL_SVC, |
| 66 | WMI_CONTROL_SVC_WMAC1, |
| 67 | WMI_CONTROL_SVC_WMAC2}; |
| 68 | |
Arif Hussain | b522ac9 | 2018-06-27 10:51:06 -0700 | [diff] [blame] | 69 | /** |
| 70 | * convert_host_pdev_id_to_target_pdev_id() - Convert pdev_id from |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 71 | * host to target defines. |
Arif Hussain | b522ac9 | 2018-06-27 10:51:06 -0700 | [diff] [blame] | 72 | * @param pdev_id: host pdev_id to be converted. |
| 73 | * Return: target pdev_id after conversion. |
| 74 | */ |
| 75 | static uint32_t convert_host_pdev_id_to_target_pdev_id(uint32_t pdev_id) |
| 76 | { |
| 77 | switch (pdev_id) { |
| 78 | case WMI_HOST_PDEV_ID_SOC: |
| 79 | return WMI_PDEV_ID_SOC; |
| 80 | case WMI_HOST_PDEV_ID_0: |
| 81 | return WMI_PDEV_ID_1ST; |
| 82 | case WMI_HOST_PDEV_ID_1: |
| 83 | return WMI_PDEV_ID_2ND; |
| 84 | case WMI_HOST_PDEV_ID_2: |
| 85 | return WMI_PDEV_ID_3RD; |
| 86 | } |
| 87 | |
| 88 | QDF_ASSERT(0); |
| 89 | |
| 90 | return WMI_PDEV_ID_SOC; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * convert_target_pdev_id_to_host_pdev_id() - Convert pdev_id from |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 95 | * target to host defines. |
Arif Hussain | b522ac9 | 2018-06-27 10:51:06 -0700 | [diff] [blame] | 96 | * @param pdev_id: target pdev_id to be converted. |
| 97 | * Return: host pdev_id after conversion. |
| 98 | */ |
| 99 | static uint32_t convert_target_pdev_id_to_host_pdev_id(uint32_t pdev_id) |
| 100 | { |
| 101 | switch (pdev_id) { |
| 102 | case WMI_PDEV_ID_SOC: |
| 103 | return WMI_HOST_PDEV_ID_SOC; |
| 104 | case WMI_PDEV_ID_1ST: |
| 105 | return WMI_HOST_PDEV_ID_0; |
| 106 | case WMI_PDEV_ID_2ND: |
| 107 | return WMI_HOST_PDEV_ID_1; |
| 108 | case WMI_PDEV_ID_3RD: |
| 109 | return WMI_HOST_PDEV_ID_2; |
| 110 | } |
| 111 | |
| 112 | QDF_ASSERT(0); |
| 113 | |
| 114 | return WMI_HOST_PDEV_ID_SOC; |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * wmi_tlv_pdev_id_conversion_enable() - Enable pdev_id conversion |
| 119 | * |
| 120 | * Return None. |
| 121 | */ |
| 122 | static void wmi_tlv_pdev_id_conversion_enable(wmi_unified_t wmi_handle) |
| 123 | { |
| 124 | wmi_handle->ops->convert_pdev_id_host_to_target = |
| 125 | convert_host_pdev_id_to_target_pdev_id; |
| 126 | wmi_handle->ops->convert_pdev_id_target_to_host = |
| 127 | convert_target_pdev_id_to_host_pdev_id; |
| 128 | } |
| 129 | |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 130 | /* copy_vdev_create_pdev_id() - copy pdev from host params to target command |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 131 | * buffer. |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 132 | * @wmi_handle: pointer to wmi_handle |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 133 | * @cmd: pointer target vdev create command buffer |
| 134 | * @param: pointer host params for vdev create |
| 135 | * |
| 136 | * Return: None |
| 137 | */ |
| 138 | #ifdef CONFIG_MCL |
| 139 | static inline void copy_vdev_create_pdev_id( |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 140 | struct wmi_unified *wmi_handle, |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 141 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 142 | struct vdev_create_params *param) |
| 143 | { |
| 144 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 145 | } |
| 146 | #else |
| 147 | static inline void copy_vdev_create_pdev_id( |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 148 | struct wmi_unified *wmi_handle, |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 149 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 150 | struct vdev_create_params *param) |
| 151 | { |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 152 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 153 | param->pdev_id); |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 154 | } |
| 155 | #endif |
| 156 | |
Qiwei Cai | 2aacaff | 2018-09-13 16:17:46 +0800 | [diff] [blame] | 157 | void wmi_mtrace(uint32_t message_id, uint16_t vdev_id, uint32_t data) |
Ashish Kumar Dhanotiya | c8b83e5 | 2018-08-02 14:26:53 +0530 | [diff] [blame] | 158 | { |
| 159 | uint16_t mtrace_message_id; |
| 160 | |
| 161 | mtrace_message_id = QDF_WMI_MTRACE_CMD_ID(message_id) | |
| 162 | (QDF_WMI_MTRACE_GRP_ID(message_id) << |
| 163 | QDF_WMI_MTRACE_CMD_NUM_BITS); |
| 164 | qdf_mtrace(QDF_MODULE_ID_WMI, QDF_MODULE_ID_TARGET, |
| 165 | mtrace_message_id, vdev_id, data); |
| 166 | } |
| 167 | |
Qiwei Cai | 2aacaff | 2018-09-13 16:17:46 +0800 | [diff] [blame] | 168 | qdf_export_symbol(wmi_mtrace); |
| 169 | |
Ashish Kumar Dhanotiya | c8b83e5 | 2018-08-02 14:26:53 +0530 | [diff] [blame] | 170 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 171 | * send_vdev_create_cmd_tlv() - send VDEV create command to fw |
| 172 | * @wmi_handle: wmi handle |
| 173 | * @param: pointer to hold vdev create parameter |
| 174 | * @macaddr: vdev mac address |
| 175 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 176 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 177 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 178 | static QDF_STATUS send_vdev_create_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 179 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 180 | struct vdev_create_params *param) |
| 181 | { |
| 182 | wmi_vdev_create_cmd_fixed_param *cmd; |
| 183 | wmi_buf_t buf; |
| 184 | int32_t len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 185 | QDF_STATUS ret; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 186 | int num_bands = 2; |
| 187 | uint8_t *buf_ptr; |
| 188 | wmi_vdev_txrx_streams *txrx_streams; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 189 | |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 190 | len += (num_bands * sizeof(*txrx_streams) + WMI_TLV_HDR_SIZE); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 191 | buf = wmi_buf_alloc(wmi_handle, len); |
| 192 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 193 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 194 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 195 | } |
| 196 | cmd = (wmi_vdev_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 197 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 198 | WMITLV_TAG_STRUC_wmi_vdev_create_cmd_fixed_param, |
| 199 | WMITLV_GET_STRUCT_TLVLEN |
| 200 | (wmi_vdev_create_cmd_fixed_param)); |
| 201 | cmd->vdev_id = param->if_id; |
| 202 | cmd->vdev_type = param->type; |
| 203 | cmd->vdev_subtype = param->subtype; |
Manoj Ekbote | 0bce58b | 2018-06-06 16:52:39 -0700 | [diff] [blame] | 204 | cmd->flags = param->mbssid_flags; |
| 205 | cmd->vdevid_trans = param->vdevid_trans; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 206 | cmd->num_cfg_txrx_streams = num_bands; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 207 | copy_vdev_create_pdev_id(wmi_handle, cmd, param); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 208 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->vdev_macaddr); |
Neil Zhao | 98ec4c4 | 2017-08-10 11:51:33 -0700 | [diff] [blame] | 209 | WMI_LOGD("%s: ID = %d[pdev:%d] VAP Addr = %02x:%02x:%02x:%02x:%02x:%02x", |
| 210 | __func__, param->if_id, cmd->pdev_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 211 | macaddr[0], macaddr[1], macaddr[2], |
| 212 | macaddr[3], macaddr[4], macaddr[5]); |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 213 | buf_ptr = (uint8_t *)cmd + sizeof(*cmd); |
| 214 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 215 | (num_bands * sizeof(wmi_vdev_txrx_streams))); |
| 216 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 217 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 218 | WMI_LOGD("%s: type %d, subtype %d, nss_2g %d, nss_5g %d", __func__, |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 219 | param->type, param->subtype, |
| 220 | param->nss_2g, param->nss_5g); |
| 221 | txrx_streams = (wmi_vdev_txrx_streams *)buf_ptr; |
| 222 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_2G; |
| 223 | txrx_streams->supported_tx_streams = param->nss_2g; |
| 224 | txrx_streams->supported_rx_streams = param->nss_2g; |
| 225 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 226 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 227 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
| 228 | |
| 229 | txrx_streams++; |
| 230 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_5G; |
| 231 | txrx_streams->supported_tx_streams = param->nss_5g; |
| 232 | txrx_streams->supported_rx_streams = param->nss_5g; |
| 233 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 234 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 235 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 236 | wmi_mtrace(WMI_VDEV_CREATE_CMDID, cmd->vdev_id, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 237 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_VDEV_CREATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 238 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 239 | WMI_LOGE("Failed to send WMI_VDEV_CREATE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 240 | wmi_buf_free(buf); |
| 241 | } |
| 242 | |
| 243 | return ret; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * send_vdev_delete_cmd_tlv() - send VDEV delete command to fw |
| 248 | * @wmi_handle: wmi handle |
| 249 | * @if_id: vdev id |
| 250 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 251 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 252 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 253 | static QDF_STATUS send_vdev_delete_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 254 | uint8_t if_id) |
| 255 | { |
| 256 | wmi_vdev_delete_cmd_fixed_param *cmd; |
| 257 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 258 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 259 | |
| 260 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 261 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 262 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 263 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | cmd = (wmi_vdev_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 267 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 268 | WMITLV_TAG_STRUC_wmi_vdev_delete_cmd_fixed_param, |
| 269 | WMITLV_GET_STRUCT_TLVLEN |
| 270 | (wmi_vdev_delete_cmd_fixed_param)); |
| 271 | cmd->vdev_id = if_id; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 272 | wmi_mtrace(WMI_VDEV_DELETE_CMDID, cmd->vdev_id, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 273 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 274 | sizeof(wmi_vdev_delete_cmd_fixed_param), |
| 275 | WMI_VDEV_DELETE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 276 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 277 | WMI_LOGE("Failed to send WMI_VDEV_DELETE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 278 | wmi_buf_free(buf); |
| 279 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 280 | WMI_LOGD("%s:vdev id = %d", __func__, if_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 281 | |
| 282 | return ret; |
| 283 | } |
| 284 | |
| 285 | /** |
| 286 | * send_vdev_stop_cmd_tlv() - send vdev stop command to fw |
| 287 | * @wmi: wmi handle |
| 288 | * @vdev_id: vdev id |
| 289 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 290 | * Return: QDF_STATUS_SUCCESS for success or erro code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 291 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 292 | static QDF_STATUS send_vdev_stop_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 293 | uint8_t vdev_id) |
| 294 | { |
| 295 | wmi_vdev_stop_cmd_fixed_param *cmd; |
| 296 | wmi_buf_t buf; |
| 297 | int32_t len = sizeof(*cmd); |
| 298 | |
| 299 | buf = wmi_buf_alloc(wmi, len); |
| 300 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 301 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 302 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 303 | } |
| 304 | cmd = (wmi_vdev_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 305 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 306 | WMITLV_TAG_STRUC_wmi_vdev_stop_cmd_fixed_param, |
| 307 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_stop_cmd_fixed_param)); |
| 308 | cmd->vdev_id = vdev_id; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 309 | wmi_mtrace(WMI_VDEV_STOP_CMDID, cmd->vdev_id, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 310 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 311 | WMI_LOGP("%s: Failed to send vdev stop command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 312 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 313 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 314 | } |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 315 | WMI_LOGD("%s:vdev id = %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 316 | |
| 317 | return 0; |
| 318 | } |
| 319 | |
| 320 | /** |
| 321 | * send_vdev_down_cmd_tlv() - send vdev down command to fw |
| 322 | * @wmi: wmi handle |
| 323 | * @vdev_id: vdev id |
| 324 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 325 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 326 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 327 | static QDF_STATUS send_vdev_down_cmd_tlv(wmi_unified_t wmi, uint8_t vdev_id) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 328 | { |
| 329 | wmi_vdev_down_cmd_fixed_param *cmd; |
| 330 | wmi_buf_t buf; |
| 331 | int32_t len = sizeof(*cmd); |
| 332 | |
| 333 | buf = wmi_buf_alloc(wmi, len); |
| 334 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 335 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 336 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 337 | } |
| 338 | cmd = (wmi_vdev_down_cmd_fixed_param *) wmi_buf_data(buf); |
| 339 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 340 | WMITLV_TAG_STRUC_wmi_vdev_down_cmd_fixed_param, |
| 341 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_down_cmd_fixed_param)); |
| 342 | cmd->vdev_id = vdev_id; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 343 | wmi_mtrace(WMI_VDEV_DOWN_CMDID, cmd->vdev_id, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 344 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_DOWN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 345 | WMI_LOGP("%s: Failed to send vdev down", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 346 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 347 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 348 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 349 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 350 | |
| 351 | return 0; |
| 352 | } |
| 353 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 354 | #ifdef CONFIG_MCL |
| 355 | static inline void copy_channel_info( |
| 356 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 357 | wmi_channel *chan, |
| 358 | struct vdev_start_params *req) |
| 359 | { |
| 360 | chan->mhz = req->chan_freq; |
| 361 | |
| 362 | WMI_SET_CHANNEL_MODE(chan, req->chan_mode); |
| 363 | |
| 364 | chan->band_center_freq1 = req->band_center_freq1; |
| 365 | chan->band_center_freq2 = req->band_center_freq2; |
| 366 | |
| 367 | if (req->is_half_rate) |
| 368 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 369 | else if (req->is_quarter_rate) |
| 370 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 371 | |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 372 | if (req->is_dfs && req->flag_dfs) { |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 373 | WMI_SET_CHANNEL_FLAG(chan, req->flag_dfs); |
| 374 | cmd->disable_hw_ack = req->dis_hw_ack; |
| 375 | } |
| 376 | |
| 377 | WMI_SET_CHANNEL_REG_POWER(chan, req->max_txpow); |
| 378 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->max_txpow); |
| 379 | |
| 380 | } |
| 381 | #else |
| 382 | static inline void copy_channel_info( |
| 383 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 384 | wmi_channel *chan, |
| 385 | struct vdev_start_params *req) |
| 386 | { |
| 387 | chan->mhz = req->channel.mhz; |
| 388 | |
| 389 | WMI_SET_CHANNEL_MODE(chan, req->channel.phy_mode); |
| 390 | |
| 391 | chan->band_center_freq1 = req->channel.cfreq1; |
| 392 | chan->band_center_freq2 = req->channel.cfreq2; |
Shaakir Mohamed | 9fbf00a | 2018-02-12 14:00:22 -0800 | [diff] [blame] | 393 | WMI_LOGI("%s: req->channel.phy_mode: %d ", req->channel.phy_mode); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 394 | |
| 395 | if (req->channel.half_rate) |
| 396 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 397 | else if (req->channel.quarter_rate) |
| 398 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 399 | |
Shaakir Mohamed | 9fbf00a | 2018-02-12 14:00:22 -0800 | [diff] [blame] | 400 | WMI_LOGI("%s: req->channel.dfs_set: %d ", req->channel.dfs_set); |
| 401 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 402 | if (req->channel.dfs_set) { |
Kiran Venkatappa | f0b91a8 | 2016-11-09 13:59:16 +0530 | [diff] [blame] | 403 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 404 | cmd->disable_hw_ack = req->disable_hw_ack; |
| 405 | } |
| 406 | |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 407 | if (req->channel.dfs_set_cfreq2) |
| 408 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS_CFREQ2); |
| 409 | |
Kai Chen | 4710d46 | 2017-12-15 14:06:06 -0800 | [diff] [blame] | 410 | /* According to firmware both reg power and max tx power |
| 411 | * on set channel power is used and set it to max reg |
| 412 | * power from regulatory. |
| 413 | */ |
| 414 | WMI_SET_CHANNEL_MIN_POWER(chan, req->channel.minpower); |
| 415 | WMI_SET_CHANNEL_MAX_POWER(chan, req->channel.maxpower); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 416 | WMI_SET_CHANNEL_REG_POWER(chan, req->channel.maxregpower); |
Kai Chen | 4710d46 | 2017-12-15 14:06:06 -0800 | [diff] [blame] | 417 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, req->channel.antennamax); |
| 418 | WMI_SET_CHANNEL_REG_CLASSID(chan, req->channel.reg_class_id); |
| 419 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->channel.maxregpower); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 420 | |
| 421 | } |
| 422 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 423 | /** |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 424 | * send_vdev_start_cmd_tlv() - send vdev start request to fw |
| 425 | * @wmi_handle: wmi handle |
| 426 | * @req: vdev start params |
| 427 | * |
| 428 | * Return: QDF status |
| 429 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 430 | static QDF_STATUS send_vdev_start_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 431 | struct vdev_start_params *req) |
| 432 | { |
| 433 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 434 | wmi_buf_t buf; |
| 435 | wmi_channel *chan; |
| 436 | int32_t len, ret; |
| 437 | uint8_t *buf_ptr; |
| 438 | |
| 439 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 440 | buf = wmi_buf_alloc(wmi_handle, len); |
| 441 | if (!buf) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 442 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 443 | return QDF_STATUS_E_NOMEM; |
| 444 | } |
| 445 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 446 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 447 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 448 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 449 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 450 | WMITLV_GET_STRUCT_TLVLEN |
| 451 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 452 | WMITLV_SET_HDR(&chan->tlv_header, WMITLV_TAG_STRUC_wmi_channel, |
| 453 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 454 | cmd->vdev_id = req->vdev_id; |
| 455 | |
| 456 | /* Fill channel info */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 457 | copy_channel_info(cmd, chan, req); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 458 | |
| 459 | cmd->beacon_interval = req->beacon_intval; |
| 460 | cmd->dtim_period = req->dtim_period; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 461 | |
Jiachao Wu | b89e3bf | 2017-08-23 15:27:11 +0800 | [diff] [blame] | 462 | cmd->bcn_tx_rate = req->bcn_tx_rate_code; |
| 463 | if (req->bcn_tx_rate_code) |
| 464 | cmd->flags |= WMI_UNIFIED_VDEV_START_BCN_TX_RATE_PRESENT; |
| 465 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 466 | if (!req->is_restart) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 467 | cmd->beacon_interval = req->beacon_intval; |
| 468 | cmd->dtim_period = req->dtim_period; |
| 469 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 470 | /* Copy the SSID */ |
| 471 | if (req->ssid.length) { |
| 472 | if (req->ssid.length < sizeof(cmd->ssid.ssid)) |
| 473 | cmd->ssid.ssid_len = req->ssid.length; |
| 474 | else |
| 475 | cmd->ssid.ssid_len = sizeof(cmd->ssid.ssid); |
| 476 | qdf_mem_copy(cmd->ssid.ssid, req->ssid.mac_ssid, |
| 477 | cmd->ssid.ssid_len); |
| 478 | } |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 479 | |
| 480 | if (req->hidden_ssid) |
| 481 | cmd->flags |= WMI_UNIFIED_VDEV_START_HIDDEN_SSID; |
| 482 | |
| 483 | if (req->pmf_enabled) |
| 484 | cmd->flags |= WMI_UNIFIED_VDEV_START_PMF_ENABLED; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 485 | } |
| 486 | |
Varun Reddy Yeturu | 3e4d819 | 2017-03-20 17:28:42 -0700 | [diff] [blame] | 487 | cmd->flags |= WMI_UNIFIED_VDEV_START_LDPC_RX_ENABLED; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 488 | cmd->num_noa_descriptors = req->num_noa_descriptors; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 489 | cmd->preferred_rx_streams = req->preferred_rx_streams; |
| 490 | cmd->preferred_tx_streams = req->preferred_tx_streams; |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 491 | cmd->cac_duration_ms = req->cac_duration_ms; |
| 492 | cmd->regdomain = req->regdomain; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 493 | cmd->he_ops = req->he_ops; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 494 | |
| 495 | buf_ptr = (uint8_t *) (((uintptr_t) cmd) + sizeof(*cmd) + |
| 496 | sizeof(wmi_channel)); |
| 497 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 498 | cmd->num_noa_descriptors * |
| 499 | sizeof(wmi_p2p_noa_descriptor)); |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 500 | WMI_LOGI("%s: vdev_id %d freq %d chanmode %d ch_info: 0x%x is_dfs %d " |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 501 | "beacon interval %d dtim %d center_chan %d center_freq2 %d " |
| 502 | "reg_info_1: 0x%x reg_info_2: 0x%x, req->max_txpow: 0x%x " |
Shaakir Mohamed | 9fbf00a | 2018-02-12 14:00:22 -0800 | [diff] [blame] | 503 | "Tx SS %d, Rx SS %d, ldpc_rx: %d, cac %d, regd %d, HE ops: %d" |
| 504 | "req->dis_hw_ack: %d ", __func__, req->vdev_id, |
| 505 | chan->mhz, req->chan_mode, chan->info, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 506 | req->is_dfs, req->beacon_intval, cmd->dtim_period, |
| 507 | chan->band_center_freq1, chan->band_center_freq2, |
| 508 | chan->reg_info_1, chan->reg_info_2, req->max_txpow, |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 509 | req->preferred_tx_streams, req->preferred_rx_streams, |
Varun Reddy Yeturu | 3e4d819 | 2017-03-20 17:28:42 -0700 | [diff] [blame] | 510 | req->ldpc_rx_enabled, req->cac_duration_ms, |
Shaakir Mohamed | 9fbf00a | 2018-02-12 14:00:22 -0800 | [diff] [blame] | 511 | req->regdomain, req->he_ops, |
| 512 | req->dis_hw_ack); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 513 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 514 | if (req->is_restart) { |
| 515 | wmi_mtrace(WMI_VDEV_RESTART_REQUEST_CMDID, cmd->vdev_id, 0); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 516 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 517 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 518 | } else { |
| 519 | wmi_mtrace(WMI_VDEV_START_REQUEST_CMDID, cmd->vdev_id, 0); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 520 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 521 | WMI_VDEV_START_REQUEST_CMDID); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 522 | } |
| 523 | if (ret) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 524 | WMI_LOGP("%s: Failed to send vdev start command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 525 | wmi_buf_free(buf); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 526 | return QDF_STATUS_E_FAILURE; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 527 | } |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 528 | |
| 529 | return QDF_STATUS_SUCCESS; |
| 530 | } |
| 531 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 532 | /** |
| 533 | * send_hidden_ssid_vdev_restart_cmd_tlv() - restart vdev to set hidden ssid |
| 534 | * @wmi_handle: wmi handle |
| 535 | * @restart_params: vdev restart params |
| 536 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 537 | * Return: QDF_STATUS_SUCCESS for success or error code |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 538 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 539 | static QDF_STATUS send_hidden_ssid_vdev_restart_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 540 | struct hidden_ssid_vdev_restart_params *restart_params) |
| 541 | { |
| 542 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 543 | wmi_buf_t buf; |
| 544 | wmi_channel *chan; |
| 545 | int32_t len; |
| 546 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 547 | QDF_STATUS ret = 0; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 548 | |
| 549 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 550 | buf = wmi_buf_alloc(wmi_handle, len); |
| 551 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 552 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 553 | return QDF_STATUS_E_NOMEM; |
| 554 | } |
| 555 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 556 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 557 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 558 | |
| 559 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 560 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 561 | WMITLV_GET_STRUCT_TLVLEN |
| 562 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 563 | |
| 564 | WMITLV_SET_HDR(&chan->tlv_header, |
| 565 | WMITLV_TAG_STRUC_wmi_channel, |
| 566 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 567 | |
| 568 | cmd->vdev_id = restart_params->session_id; |
| 569 | cmd->ssid.ssid_len = restart_params->ssid_len; |
| 570 | qdf_mem_copy(cmd->ssid.ssid, |
| 571 | restart_params->ssid, |
| 572 | cmd->ssid.ssid_len); |
| 573 | cmd->flags = restart_params->flags; |
| 574 | cmd->requestor_id = restart_params->requestor_id; |
| 575 | cmd->disable_hw_ack = restart_params->disable_hw_ack; |
| 576 | |
| 577 | chan->mhz = restart_params->mhz; |
| 578 | chan->band_center_freq1 = |
| 579 | restart_params->band_center_freq1; |
| 580 | chan->band_center_freq2 = |
| 581 | restart_params->band_center_freq2; |
| 582 | chan->info = restart_params->info; |
| 583 | chan->reg_info_1 = restart_params->reg_info_1; |
| 584 | chan->reg_info_2 = restart_params->reg_info_2; |
| 585 | |
| 586 | cmd->num_noa_descriptors = 0; |
| 587 | buf_ptr = (uint8_t *) (((uint8_t *) cmd) + sizeof(*cmd) + |
| 588 | sizeof(wmi_channel)); |
| 589 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 590 | cmd->num_noa_descriptors * |
| 591 | sizeof(wmi_p2p_noa_descriptor)); |
| 592 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 593 | wmi_mtrace(WMI_VDEV_RESTART_REQUEST_CMDID, cmd->vdev_id, 0); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 594 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 595 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 596 | if (QDF_IS_STATUS_ERROR(ret)) { |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 597 | wmi_buf_free(buf); |
| 598 | return QDF_STATUS_E_FAILURE; |
| 599 | } |
| 600 | return QDF_STATUS_SUCCESS; |
| 601 | } |
| 602 | |
| 603 | |
| 604 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 605 | * send_peer_flush_tids_cmd_tlv() - flush peer tids packets in fw |
| 606 | * @wmi: wmi handle |
| 607 | * @peer_addr: peer mac address |
| 608 | * @param: pointer to hold peer flush tid parameter |
| 609 | * |
Jeff Johnson | eb83ef0 | 2018-05-06 00:09:31 -0700 | [diff] [blame] | 610 | * Return: 0 for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 611 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 612 | static QDF_STATUS send_peer_flush_tids_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 613 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 614 | struct peer_flush_params *param) |
| 615 | { |
| 616 | wmi_peer_flush_tids_cmd_fixed_param *cmd; |
| 617 | wmi_buf_t buf; |
| 618 | int32_t len = sizeof(*cmd); |
| 619 | |
| 620 | buf = wmi_buf_alloc(wmi, len); |
| 621 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 622 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 623 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 624 | } |
| 625 | cmd = (wmi_peer_flush_tids_cmd_fixed_param *) wmi_buf_data(buf); |
| 626 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 627 | WMITLV_TAG_STRUC_wmi_peer_flush_tids_cmd_fixed_param, |
| 628 | WMITLV_GET_STRUCT_TLVLEN |
| 629 | (wmi_peer_flush_tids_cmd_fixed_param)); |
| 630 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 631 | cmd->peer_tid_bitmap = param->peer_tid_bitmap; |
| 632 | cmd->vdev_id = param->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 633 | WMI_LOGD("%s: peer_addr %pM vdev_id %d and peer bitmap %d", __func__, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 634 | peer_addr, param->vdev_id, |
| 635 | param->peer_tid_bitmap); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 636 | wmi_mtrace(WMI_PEER_FLUSH_TIDS_CMDID, cmd->vdev_id, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 637 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_FLUSH_TIDS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 638 | WMI_LOGP("%s: Failed to send flush tid command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 639 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 640 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 641 | } |
| 642 | |
| 643 | return 0; |
| 644 | } |
| 645 | |
| 646 | /** |
| 647 | * send_peer_delete_cmd_tlv() - send PEER delete command to fw |
| 648 | * @wmi: wmi handle |
| 649 | * @peer_addr: peer mac addr |
| 650 | * @vdev_id: vdev id |
| 651 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 652 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 653 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 654 | static QDF_STATUS send_peer_delete_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 655 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 656 | uint8_t vdev_id) |
| 657 | { |
| 658 | wmi_peer_delete_cmd_fixed_param *cmd; |
| 659 | wmi_buf_t buf; |
| 660 | int32_t len = sizeof(*cmd); |
| 661 | buf = wmi_buf_alloc(wmi, len); |
| 662 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 663 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 664 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 665 | } |
| 666 | cmd = (wmi_peer_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 667 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 668 | WMITLV_TAG_STRUC_wmi_peer_delete_cmd_fixed_param, |
| 669 | WMITLV_GET_STRUCT_TLVLEN |
| 670 | (wmi_peer_delete_cmd_fixed_param)); |
| 671 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 672 | cmd->vdev_id = vdev_id; |
| 673 | |
Orhan K AKYILDIZ | c8d1c4b | 2017-01-10 14:32:18 -0800 | [diff] [blame] | 674 | WMI_LOGD("%s: peer_addr %pM vdev_id %d", __func__, peer_addr, vdev_id); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 675 | wmi_mtrace(WMI_PEER_DELETE_CMDID, cmd->vdev_id, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 676 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_DELETE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 677 | WMI_LOGP("%s: Failed to send peer delete command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 678 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 679 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 680 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 681 | |
| 682 | return 0; |
| 683 | } |
| 684 | |
| 685 | /** |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 686 | * convert_host_peer_id_to_target_id_tlv - convert host peer param_id |
| 687 | * to target id. |
| 688 | * @targ_paramid: Target parameter id to hold the result. |
| 689 | * @peer_param_id: host param id. |
| 690 | * |
| 691 | * Return: QDF_STATUS_SUCCESS for success |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 692 | * QDF_STATUS_E_NOSUPPORT when the param_id in not supported in tareget |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 693 | */ |
| 694 | #ifdef CONFIG_MCL |
| 695 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 696 | uint32_t *targ_paramid, |
| 697 | uint32_t peer_param_id) |
| 698 | { |
| 699 | *targ_paramid = peer_param_id; |
| 700 | return QDF_STATUS_SUCCESS; |
| 701 | } |
Mohit Khanna | b9e1e54 | 2018-07-24 15:28:04 -0700 | [diff] [blame] | 702 | |
| 703 | /** |
| 704 | * crash_on_send_peer_rx_reorder_queue_remove_cmd() - crash on reorder queue cmd |
| 705 | * |
| 706 | * On MCL side, we are suspecting this cmd to trigger drop of ARP |
| 707 | * response frames from REO by the FW. This function causes a crash if this |
| 708 | * command is sent out by the host, so we can track this issue. Ideally no one |
| 709 | * should be calling this API from the MCL side |
| 710 | * |
| 711 | * Return: None |
| 712 | */ |
| 713 | static void crash_on_send_peer_rx_reorder_queue_remove_cmd(void) |
| 714 | { |
| 715 | QDF_BUG(0); |
| 716 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 717 | #else |
| 718 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 719 | uint32_t *targ_paramid, |
| 720 | uint32_t peer_param_id) |
| 721 | { |
| 722 | switch (peer_param_id) { |
| 723 | case WMI_HOST_PEER_MIMO_PS_STATE: |
| 724 | *targ_paramid = WMI_PEER_MIMO_PS_STATE; |
| 725 | break; |
| 726 | case WMI_HOST_PEER_AMPDU: |
| 727 | *targ_paramid = WMI_PEER_AMPDU; |
| 728 | break; |
| 729 | case WMI_HOST_PEER_AUTHORIZE: |
| 730 | *targ_paramid = WMI_PEER_AUTHORIZE; |
| 731 | break; |
| 732 | case WMI_HOST_PEER_CHWIDTH: |
| 733 | *targ_paramid = WMI_PEER_CHWIDTH; |
| 734 | break; |
| 735 | case WMI_HOST_PEER_NSS: |
| 736 | *targ_paramid = WMI_PEER_NSS; |
| 737 | break; |
| 738 | case WMI_HOST_PEER_USE_4ADDR: |
| 739 | *targ_paramid = WMI_PEER_USE_4ADDR; |
| 740 | break; |
| 741 | case WMI_HOST_PEER_MEMBERSHIP: |
| 742 | *targ_paramid = WMI_PEER_MEMBERSHIP; |
| 743 | break; |
| 744 | case WMI_HOST_PEER_USERPOS: |
| 745 | *targ_paramid = WMI_PEER_USERPOS; |
| 746 | break; |
| 747 | case WMI_HOST_PEER_CRIT_PROTO_HINT_ENABLED: |
| 748 | *targ_paramid = WMI_PEER_CRIT_PROTO_HINT_ENABLED; |
| 749 | break; |
| 750 | case WMI_HOST_PEER_TX_FAIL_CNT_THR: |
| 751 | *targ_paramid = WMI_PEER_TX_FAIL_CNT_THR; |
| 752 | break; |
| 753 | case WMI_HOST_PEER_SET_HW_RETRY_CTS2S: |
| 754 | *targ_paramid = WMI_PEER_SET_HW_RETRY_CTS2S; |
| 755 | break; |
| 756 | case WMI_HOST_PEER_IBSS_ATIM_WINDOW_LENGTH: |
| 757 | *targ_paramid = WMI_PEER_IBSS_ATIM_WINDOW_LENGTH; |
| 758 | break; |
| 759 | case WMI_HOST_PEER_PHYMODE: |
| 760 | *targ_paramid = WMI_PEER_PHYMODE; |
| 761 | break; |
| 762 | case WMI_HOST_PEER_USE_FIXED_PWR: |
| 763 | *targ_paramid = WMI_PEER_USE_FIXED_PWR; |
| 764 | break; |
| 765 | case WMI_HOST_PEER_PARAM_FIXED_RATE: |
| 766 | *targ_paramid = WMI_PEER_PARAM_FIXED_RATE; |
| 767 | break; |
| 768 | case WMI_HOST_PEER_SET_MU_WHITELIST: |
| 769 | *targ_paramid = WMI_PEER_SET_MU_WHITELIST; |
| 770 | break; |
| 771 | case WMI_HOST_PEER_SET_MAC_TX_RATE: |
| 772 | *targ_paramid = WMI_PEER_SET_MAX_TX_RATE; |
| 773 | break; |
| 774 | case WMI_HOST_PEER_SET_MIN_TX_RATE: |
| 775 | *targ_paramid = WMI_PEER_SET_MIN_TX_RATE; |
| 776 | break; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 777 | case WMI_HOST_PEER_SET_DEFAULT_ROUTING: |
| 778 | *targ_paramid = WMI_PEER_SET_DEFAULT_ROUTING; |
| 779 | break; |
Soumya Bhat | 8db697d | 2017-08-29 18:49:13 +0530 | [diff] [blame] | 780 | case WMI_HOST_PEER_NSS_VHT160: |
| 781 | *targ_paramid = WMI_PEER_NSS_VHT160; |
| 782 | break; |
| 783 | case WMI_HOST_PEER_NSS_VHT80_80: |
| 784 | *targ_paramid = WMI_PEER_NSS_VHT80_80; |
| 785 | break; |
Venkateswara Swamy Bandaru | 65745ba | 2018-01-09 15:52:37 +0530 | [diff] [blame] | 786 | case WMI_HOST_PEER_PARAM_SU_TXBF_SOUNDING_INTERVAL: |
| 787 | *targ_paramid = WMI_PEER_PARAM_SU_TXBF_SOUNDING_INTERVAL; |
| 788 | break; |
| 789 | case WMI_HOST_PEER_PARAM_MU_TXBF_SOUNDING_INTERVAL: |
| 790 | *targ_paramid = WMI_PEER_PARAM_MU_TXBF_SOUNDING_INTERVAL; |
| 791 | break; |
| 792 | case WMI_HOST_PEER_PARAM_TXBF_SOUNDING_ENABLE: |
| 793 | *targ_paramid = WMI_PEER_PARAM_TXBF_SOUNDING_ENABLE; |
| 794 | break; |
Venkateswara Swamy Bandaru | 094bc7a | 2018-01-09 15:56:56 +0530 | [diff] [blame] | 795 | case WMI_HOST_PEER_PARAM_MU_ENABLE: |
| 796 | *targ_paramid = WMI_PEER_PARAM_MU_ENABLE; |
| 797 | break; |
| 798 | case WMI_HOST_PEER_PARAM_OFDMA_ENABLE: |
| 799 | *targ_paramid = WMI_PEER_PARAM_OFDMA_ENABLE; |
| 800 | break; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 801 | default: |
| 802 | return QDF_STATUS_E_NOSUPPORT; |
| 803 | } |
| 804 | |
| 805 | return QDF_STATUS_SUCCESS; |
| 806 | } |
Mohit Khanna | b9e1e54 | 2018-07-24 15:28:04 -0700 | [diff] [blame] | 807 | |
| 808 | static void crash_on_send_peer_rx_reorder_queue_remove_cmd(void) |
| 809 | { |
| 810 | /* No-OP */ |
| 811 | } |
| 812 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 813 | #endif |
| 814 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 815 | * send_peer_param_cmd_tlv() - set peer parameter in fw |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 816 | * @wmi: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 817 | * @peer_addr: peer mac address |
| 818 | * @param : pointer to hold peer set parameter |
| 819 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 820 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 821 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 822 | static QDF_STATUS send_peer_param_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 823 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 824 | struct peer_set_params *param) |
| 825 | { |
| 826 | wmi_peer_set_param_cmd_fixed_param *cmd; |
| 827 | wmi_buf_t buf; |
| 828 | int32_t err; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 829 | uint32_t param_id; |
| 830 | |
| 831 | if (convert_host_peer_id_to_target_id_tlv(¶m_id, |
| 832 | param->param_id) != QDF_STATUS_SUCCESS) |
| 833 | return QDF_STATUS_E_NOSUPPORT; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 834 | |
| 835 | buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 836 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 837 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 838 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 839 | } |
| 840 | cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 841 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 842 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 843 | WMITLV_GET_STRUCT_TLVLEN |
| 844 | (wmi_peer_set_param_cmd_fixed_param)); |
| 845 | cmd->vdev_id = param->vdev_id; |
| 846 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 847 | cmd->param_id = param_id; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 848 | cmd->param_value = param->param_value; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 849 | wmi_mtrace(WMI_PEER_SET_PARAM_CMDID, cmd->vdev_id, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 850 | err = wmi_unified_cmd_send(wmi, buf, |
| 851 | sizeof(wmi_peer_set_param_cmd_fixed_param), |
| 852 | WMI_PEER_SET_PARAM_CMDID); |
| 853 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 854 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 855 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 856 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 857 | } |
| 858 | |
| 859 | return 0; |
| 860 | } |
| 861 | |
| 862 | /** |
| 863 | * send_vdev_up_cmd_tlv() - send vdev up command in fw |
| 864 | * @wmi: wmi handle |
| 865 | * @bssid: bssid |
| 866 | * @vdev_up_params: pointer to hold vdev up parameter |
| 867 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 868 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 869 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 870 | static QDF_STATUS send_vdev_up_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 871 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 872 | struct vdev_up_params *params) |
| 873 | { |
| 874 | wmi_vdev_up_cmd_fixed_param *cmd; |
| 875 | wmi_buf_t buf; |
| 876 | int32_t len = sizeof(*cmd); |
| 877 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 878 | WMI_LOGD("%s: VDEV_UP", __func__); |
| 879 | WMI_LOGD("%s: vdev_id %d aid %d bssid %pM", __func__, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 880 | params->vdev_id, params->assoc_id, bssid); |
| 881 | buf = wmi_buf_alloc(wmi, len); |
| 882 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 883 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 884 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 885 | } |
| 886 | cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf); |
| 887 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 888 | WMITLV_TAG_STRUC_wmi_vdev_up_cmd_fixed_param, |
| 889 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_up_cmd_fixed_param)); |
| 890 | cmd->vdev_id = params->vdev_id; |
| 891 | cmd->vdev_assoc_id = params->assoc_id; |
Manoj Ekbote | 0bce58b | 2018-06-06 16:52:39 -0700 | [diff] [blame] | 892 | cmd->profile_idx = params->profile_idx; |
| 893 | cmd->profile_num = params->profile_num; |
| 894 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->trans_bssid, &cmd->trans_bssid); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 895 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid, &cmd->vdev_bssid); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 896 | wmi_mtrace(WMI_VDEV_UP_CMDID, cmd->vdev_id, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 897 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 898 | WMI_LOGP("%s: Failed to send vdev up command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 899 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 900 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 901 | } |
| 902 | |
| 903 | return 0; |
| 904 | } |
| 905 | |
| 906 | /** |
| 907 | * send_peer_create_cmd_tlv() - send peer create command to fw |
| 908 | * @wmi: wmi handle |
| 909 | * @peer_addr: peer mac address |
| 910 | * @peer_type: peer type |
| 911 | * @vdev_id: vdev id |
| 912 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 913 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 914 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 915 | static QDF_STATUS send_peer_create_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 916 | struct peer_create_params *param) |
| 917 | { |
| 918 | wmi_peer_create_cmd_fixed_param *cmd; |
| 919 | wmi_buf_t buf; |
| 920 | int32_t len = sizeof(*cmd); |
| 921 | |
| 922 | buf = wmi_buf_alloc(wmi, len); |
| 923 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 924 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 925 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 926 | } |
| 927 | cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 928 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 929 | WMITLV_TAG_STRUC_wmi_peer_create_cmd_fixed_param, |
| 930 | WMITLV_GET_STRUCT_TLVLEN |
| 931 | (wmi_peer_create_cmd_fixed_param)); |
| 932 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 933 | cmd->peer_type = param->peer_type; |
| 934 | cmd->vdev_id = param->vdev_id; |
| 935 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 936 | wmi_mtrace(WMI_PEER_CREATE_CMDID, cmd->vdev_id, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 937 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 938 | WMI_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 939 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 940 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 941 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 942 | WMI_LOGD("%s: peer_addr %pM vdev_id %d", __func__, param->peer_addr, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 943 | param->vdev_id); |
| 944 | |
| 945 | return 0; |
| 946 | } |
| 947 | |
| 948 | /** |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 949 | * send_peer_rx_reorder_queue_setup_cmd_tlv() - send rx reorder setup |
| 950 | * command to fw |
| 951 | * @wmi: wmi handle |
| 952 | * @rx_reorder_queue_setup_params: Rx reorder queue setup parameters |
| 953 | * |
| 954 | * Return: 0 for success or error code |
| 955 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 956 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 957 | QDF_STATUS send_peer_rx_reorder_queue_setup_cmd_tlv(wmi_unified_t wmi, |
| 958 | struct rx_reorder_queue_setup_params *param) |
| 959 | { |
| 960 | wmi_peer_reorder_queue_setup_cmd_fixed_param *cmd; |
| 961 | wmi_buf_t buf; |
| 962 | int32_t len = sizeof(*cmd); |
| 963 | |
| 964 | buf = wmi_buf_alloc(wmi, len); |
| 965 | if (!buf) { |
| 966 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 967 | return QDF_STATUS_E_NOMEM; |
| 968 | } |
| 969 | cmd = (wmi_peer_reorder_queue_setup_cmd_fixed_param *)wmi_buf_data(buf); |
| 970 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 971 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_setup_cmd_fixed_param, |
| 972 | WMITLV_GET_STRUCT_TLVLEN |
| 973 | (wmi_peer_reorder_queue_setup_cmd_fixed_param)); |
| 974 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 975 | cmd->vdev_id = param->vdev_id; |
| 976 | cmd->tid = param->tid; |
| 977 | cmd->queue_ptr_lo = param->hw_qdesc_paddr_lo; |
| 978 | cmd->queue_ptr_hi = param->hw_qdesc_paddr_hi; |
| 979 | cmd->queue_no = param->queue_no; |
Gyanranjan Hazarika | d6c4d78 | 2018-07-25 23:26:16 -0700 | [diff] [blame] | 980 | cmd->ba_window_size_valid = param->ba_window_size_valid; |
| 981 | cmd->ba_window_size = param->ba_window_size; |
| 982 | |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 983 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 984 | wmi_mtrace(WMI_PEER_REORDER_QUEUE_SETUP_CMDID, cmd->vdev_id, 0); |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 985 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 986 | WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) { |
| 987 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID", |
| 988 | __func__); |
Rakshith Suresh Patkar | 9eb15ee | 2018-09-12 16:51:30 +0530 | [diff] [blame] | 989 | wmi_buf_free(buf); |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 990 | return QDF_STATUS_E_FAILURE; |
| 991 | } |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 992 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d", __func__, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 993 | param->peer_macaddr, param->vdev_id, param->tid); |
| 994 | |
| 995 | return QDF_STATUS_SUCCESS; |
| 996 | } |
| 997 | |
| 998 | /** |
| 999 | * send_peer_rx_reorder_queue_remove_cmd_tlv() - send rx reorder remove |
| 1000 | * command to fw |
| 1001 | * @wmi: wmi handle |
| 1002 | * @rx_reorder_queue_remove_params: Rx reorder queue remove parameters |
| 1003 | * |
| 1004 | * Return: 0 for success or error code |
| 1005 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 1006 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 1007 | QDF_STATUS send_peer_rx_reorder_queue_remove_cmd_tlv(wmi_unified_t wmi, |
| 1008 | struct rx_reorder_queue_remove_params *param) |
| 1009 | { |
| 1010 | wmi_peer_reorder_queue_remove_cmd_fixed_param *cmd; |
| 1011 | wmi_buf_t buf; |
| 1012 | int32_t len = sizeof(*cmd); |
| 1013 | |
Mohit Khanna | b9e1e54 | 2018-07-24 15:28:04 -0700 | [diff] [blame] | 1014 | crash_on_send_peer_rx_reorder_queue_remove_cmd(); |
| 1015 | |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 1016 | buf = wmi_buf_alloc(wmi, len); |
| 1017 | if (!buf) { |
| 1018 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 1019 | return QDF_STATUS_E_NOMEM; |
| 1020 | } |
| 1021 | cmd = (wmi_peer_reorder_queue_remove_cmd_fixed_param *) |
| 1022 | wmi_buf_data(buf); |
| 1023 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1024 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_remove_cmd_fixed_param, |
| 1025 | WMITLV_GET_STRUCT_TLVLEN |
| 1026 | (wmi_peer_reorder_queue_remove_cmd_fixed_param)); |
| 1027 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 1028 | cmd->vdev_id = param->vdev_id; |
| 1029 | cmd->tid_mask = param->peer_tid_bitmap; |
| 1030 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1031 | wmi_mtrace(WMI_PEER_REORDER_QUEUE_REMOVE_CMDID, cmd->vdev_id, 0); |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 1032 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 1033 | WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) { |
| 1034 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID", |
| 1035 | __func__); |
Rakshith Suresh Patkar | 9eb15ee | 2018-09-12 16:51:30 +0530 | [diff] [blame] | 1036 | wmi_buf_free(buf); |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 1037 | return QDF_STATUS_E_FAILURE; |
| 1038 | } |
| 1039 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__, |
| 1040 | param->peer_macaddr, param->vdev_id, param->peer_tid_bitmap); |
| 1041 | |
| 1042 | return QDF_STATUS_SUCCESS; |
| 1043 | } |
| 1044 | |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 1045 | #ifdef WLAN_SUPPORT_GREEN_AP |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 1046 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1047 | * send_green_ap_ps_cmd_tlv() - enable green ap powersave command |
| 1048 | * @wmi_handle: wmi handle |
| 1049 | * @value: value |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 1050 | * @pdev_id: pdev id to have radio context |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1051 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1052 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1053 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1054 | static QDF_STATUS send_green_ap_ps_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 1055 | uint32_t value, uint8_t pdev_id) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1056 | { |
| 1057 | wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd; |
| 1058 | wmi_buf_t buf; |
| 1059 | int32_t len = sizeof(*cmd); |
| 1060 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1061 | WMI_LOGD("Set Green AP PS val %d", value); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1062 | |
| 1063 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1064 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1065 | WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1066 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1067 | } |
| 1068 | |
| 1069 | cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1070 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1071 | WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param, |
| 1072 | WMITLV_GET_STRUCT_TLVLEN |
| 1073 | (wmi_pdev_green_ap_ps_enable_cmd_fixed_param)); |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 1074 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1075 | cmd->enable = value; |
| 1076 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1077 | wmi_mtrace(WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID, NO_SESSION, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1078 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1079 | WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1080 | WMI_LOGE("Set Green AP PS param Failed val %d", value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1081 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1082 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1083 | } |
| 1084 | |
| 1085 | return 0; |
| 1086 | } |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 1087 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1088 | |
| 1089 | /** |
| 1090 | * send_pdev_utf_cmd_tlv() - send utf command to fw |
| 1091 | * @wmi_handle: wmi handle |
| 1092 | * @param: pointer to pdev_utf_params |
| 1093 | * @mac_id: mac id to have radio context |
| 1094 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1095 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1096 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1097 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1098 | send_pdev_utf_cmd_tlv(wmi_unified_t wmi_handle, |
| 1099 | struct pdev_utf_params *param, |
| 1100 | uint8_t mac_id) |
| 1101 | { |
| 1102 | wmi_buf_t buf; |
| 1103 | uint8_t *cmd; |
Houston Hoffman | cdd5eda | 2016-09-27 23:29:49 -0700 | [diff] [blame] | 1104 | /* if param->len is 0 no data is sent, return error */ |
| 1105 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1106 | static uint8_t msgref = 1; |
| 1107 | uint8_t segNumber = 0, segInfo, numSegments; |
| 1108 | uint16_t chunk_len, total_bytes; |
| 1109 | uint8_t *bufpos; |
| 1110 | struct seg_hdr_info segHdrInfo; |
| 1111 | |
| 1112 | bufpos = param->utf_payload; |
| 1113 | total_bytes = param->len; |
| 1114 | ASSERT(total_bytes / MAX_WMI_UTF_LEN == |
| 1115 | (uint8_t) (total_bytes / MAX_WMI_UTF_LEN)); |
| 1116 | numSegments = (uint8_t) (total_bytes / MAX_WMI_UTF_LEN); |
| 1117 | |
| 1118 | if (param->len - (numSegments * MAX_WMI_UTF_LEN)) |
| 1119 | numSegments++; |
| 1120 | |
| 1121 | while (param->len) { |
| 1122 | if (param->len > MAX_WMI_UTF_LEN) |
Jeff Johnson | da26399 | 2018-05-12 14:22:00 -0700 | [diff] [blame] | 1123 | chunk_len = MAX_WMI_UTF_LEN; /* MAX message */ |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1124 | else |
| 1125 | chunk_len = param->len; |
| 1126 | |
| 1127 | buf = wmi_buf_alloc(wmi_handle, |
| 1128 | (chunk_len + sizeof(segHdrInfo) + |
| 1129 | WMI_TLV_HDR_SIZE)); |
| 1130 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1131 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1132 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1133 | } |
| 1134 | |
| 1135 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 1136 | |
| 1137 | segHdrInfo.len = total_bytes; |
| 1138 | segHdrInfo.msgref = msgref; |
| 1139 | segInfo = ((numSegments << 4) & 0xF0) | (segNumber & 0xF); |
| 1140 | segHdrInfo.segmentInfo = segInfo; |
| 1141 | segHdrInfo.pad = 0; |
| 1142 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1143 | WMI_LOGD("%s:segHdrInfo.len = %d, segHdrInfo.msgref = %d," |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1144 | " segHdrInfo.segmentInfo = %d", |
| 1145 | __func__, segHdrInfo.len, segHdrInfo.msgref, |
| 1146 | segHdrInfo.segmentInfo); |
| 1147 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1148 | WMI_LOGD("%s:total_bytes %d segNumber %d totalSegments %d" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1149 | "chunk len %d", __func__, total_bytes, segNumber, |
| 1150 | numSegments, chunk_len); |
| 1151 | |
| 1152 | segNumber++; |
| 1153 | |
| 1154 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 1155 | (chunk_len + sizeof(segHdrInfo))); |
| 1156 | cmd += WMI_TLV_HDR_SIZE; |
| 1157 | memcpy(cmd, &segHdrInfo, sizeof(segHdrInfo)); /* 4 bytes */ |
| 1158 | memcpy(&cmd[sizeof(segHdrInfo)], bufpos, chunk_len); |
| 1159 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1160 | wmi_mtrace(WMI_PDEV_UTF_CMDID, NO_SESSION, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1161 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 1162 | (chunk_len + sizeof(segHdrInfo) + |
| 1163 | WMI_TLV_HDR_SIZE), |
| 1164 | WMI_PDEV_UTF_CMDID); |
| 1165 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1166 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1167 | WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1168 | wmi_buf_free(buf); |
| 1169 | break; |
| 1170 | } |
| 1171 | |
| 1172 | param->len -= chunk_len; |
| 1173 | bufpos += chunk_len; |
| 1174 | } |
| 1175 | |
| 1176 | msgref++; |
| 1177 | |
| 1178 | return ret; |
| 1179 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1180 | #ifdef CONFIG_MCL |
| 1181 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1182 | uint32_t host_param) |
| 1183 | { |
| 1184 | return host_param; |
| 1185 | } |
| 1186 | #else |
| 1187 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1188 | uint32_t host_param) |
| 1189 | { |
| 1190 | if (host_param < wmi_pdev_param_max) |
| 1191 | return wmi_handle->pdev_param[host_param]; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1192 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1193 | return WMI_UNAVAILABLE_PARAM; |
| 1194 | } |
| 1195 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1196 | /** |
| 1197 | * send_pdev_param_cmd_tlv() - set pdev parameters |
| 1198 | * @wmi_handle: wmi handle |
| 1199 | * @param: pointer to pdev parameter |
| 1200 | * @mac_id: radio context |
| 1201 | * |
| 1202 | * Return: 0 on success, errno on failure |
| 1203 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1204 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1205 | send_pdev_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 1206 | struct pdev_params *param, |
| 1207 | uint8_t mac_id) |
| 1208 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1209 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1210 | wmi_pdev_set_param_cmd_fixed_param *cmd; |
| 1211 | wmi_buf_t buf; |
| 1212 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1213 | uint32_t pdev_param; |
| 1214 | |
| 1215 | pdev_param = convert_host_pdev_param_tlv(wmi_handle, param->param_id); |
| 1216 | if (pdev_param == WMI_UNAVAILABLE_PARAM) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 1217 | WMI_LOGW("%s: Unavailable param %d", |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1218 | __func__, param->param_id); |
| 1219 | return QDF_STATUS_E_INVAL; |
| 1220 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1221 | |
| 1222 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1223 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1224 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1225 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1226 | } |
| 1227 | cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1228 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1229 | WMITLV_TAG_STRUC_wmi_pdev_set_param_cmd_fixed_param, |
| 1230 | WMITLV_GET_STRUCT_TLVLEN |
| 1231 | (wmi_pdev_set_param_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 1232 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(mac_id); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1233 | cmd->param_id = pdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1234 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1235 | WMI_LOGD("Setting pdev param = %x, value = %u", param->param_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1236 | param->param_value); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1237 | wmi_mtrace(WMI_PDEV_SET_PARAM_CMDID, NO_SESSION, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1238 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1239 | WMI_PDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1240 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1241 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1242 | wmi_buf_free(buf); |
| 1243 | } |
| 1244 | return ret; |
| 1245 | } |
| 1246 | |
| 1247 | /** |
| 1248 | * send_suspend_cmd_tlv() - WMI suspend function |
| 1249 | * @param wmi_handle : handle to WMI. |
| 1250 | * @param param : pointer to hold suspend parameter |
| 1251 | * @mac_id: radio context |
| 1252 | * |
| 1253 | * Return 0 on success and -ve on failure. |
| 1254 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1255 | static QDF_STATUS send_suspend_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1256 | struct suspend_params *param, |
| 1257 | uint8_t mac_id) |
| 1258 | { |
| 1259 | wmi_pdev_suspend_cmd_fixed_param *cmd; |
| 1260 | wmi_buf_t wmibuf; |
| 1261 | uint32_t len = sizeof(*cmd); |
| 1262 | int32_t ret; |
| 1263 | |
| 1264 | /* |
Jeff Johnson | 19a59fe | 2018-05-06 16:10:43 -0700 | [diff] [blame] | 1265 | * send the command to Target to ignore the |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1266 | * PCIE reset so as to ensure that Host and target |
| 1267 | * states are in sync |
| 1268 | */ |
| 1269 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 1270 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1271 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1272 | |
| 1273 | cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1274 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1275 | WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param, |
| 1276 | WMITLV_GET_STRUCT_TLVLEN |
| 1277 | (wmi_pdev_suspend_cmd_fixed_param)); |
| 1278 | if (param->disable_target_intr) |
| 1279 | cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR; |
| 1280 | else |
| 1281 | cmd->suspend_opt = WMI_PDEV_SUSPEND; |
Kiran Venkatappa | 330179c | 2017-06-13 20:44:54 +0530 | [diff] [blame] | 1282 | |
| 1283 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(mac_id); |
| 1284 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1285 | wmi_mtrace(WMI_PDEV_SUSPEND_CMDID, NO_SESSION, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1286 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 1287 | WMI_PDEV_SUSPEND_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1288 | if (ret) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1289 | wmi_buf_free(wmibuf); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1290 | WMI_LOGE("Failed to send WMI_PDEV_SUSPEND_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1291 | } |
| 1292 | |
| 1293 | return ret; |
| 1294 | } |
| 1295 | |
| 1296 | /** |
| 1297 | * send_resume_cmd_tlv() - WMI resume function |
| 1298 | * @param wmi_handle : handle to WMI. |
| 1299 | * @mac_id: radio context |
| 1300 | * |
| 1301 | * Return: 0 on success and -ve on failure. |
| 1302 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1303 | static QDF_STATUS send_resume_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1304 | uint8_t mac_id) |
| 1305 | { |
| 1306 | wmi_buf_t wmibuf; |
| 1307 | wmi_pdev_resume_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1308 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1309 | |
| 1310 | wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1311 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1312 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1313 | cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1314 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1315 | WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param, |
| 1316 | WMITLV_GET_STRUCT_TLVLEN |
| 1317 | (wmi_pdev_resume_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 1318 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(mac_id); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1319 | wmi_mtrace(WMI_PDEV_RESUME_CMDID, NO_SESSION, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1320 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd), |
| 1321 | WMI_PDEV_RESUME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1322 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1323 | WMI_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1324 | wmi_buf_free(wmibuf); |
| 1325 | } |
| 1326 | |
| 1327 | return ret; |
| 1328 | } |
| 1329 | |
| 1330 | /** |
| 1331 | * send_wow_enable_cmd_tlv() - WMI wow enable function |
| 1332 | * @param wmi_handle : handle to WMI. |
| 1333 | * @param param : pointer to hold wow enable parameter |
| 1334 | * @mac_id: radio context |
| 1335 | * |
| 1336 | * Return: 0 on success and -ve on failure. |
| 1337 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1338 | static QDF_STATUS send_wow_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1339 | struct wow_cmd_params *param, |
| 1340 | uint8_t mac_id) |
| 1341 | { |
| 1342 | wmi_wow_enable_cmd_fixed_param *cmd; |
| 1343 | wmi_buf_t buf; |
| 1344 | int32_t len; |
| 1345 | int32_t ret; |
| 1346 | |
| 1347 | len = sizeof(wmi_wow_enable_cmd_fixed_param); |
| 1348 | |
| 1349 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1350 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1351 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1352 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1353 | } |
| 1354 | cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1355 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1356 | WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param, |
| 1357 | WMITLV_GET_STRUCT_TLVLEN |
| 1358 | (wmi_wow_enable_cmd_fixed_param)); |
| 1359 | cmd->enable = param->enable; |
| 1360 | if (param->can_suspend_link) |
| 1361 | cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED; |
| 1362 | else |
| 1363 | cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; |
Dustin Brown | fc28c0e | 2016-11-10 11:25:36 -0800 | [diff] [blame] | 1364 | cmd->flags = param->flags; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1365 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1366 | WMI_LOGI("suspend type: %s", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1367 | cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? |
| 1368 | "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED"); |
| 1369 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1370 | wmi_mtrace(WMI_WOW_ENABLE_CMDID, NO_SESSION, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1371 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1372 | WMI_WOW_ENABLE_CMDID); |
| 1373 | if (ret) |
| 1374 | wmi_buf_free(buf); |
| 1375 | |
| 1376 | return ret; |
| 1377 | } |
| 1378 | |
| 1379 | /** |
| 1380 | * send_set_ap_ps_param_cmd_tlv() - set ap powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1381 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1382 | * @peer_addr: peer mac address |
| 1383 | * @param: pointer to ap_ps parameter structure |
| 1384 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1385 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1386 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1387 | static QDF_STATUS send_set_ap_ps_param_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1388 | uint8_t *peer_addr, |
| 1389 | struct ap_ps_params *param) |
| 1390 | { |
| 1391 | wmi_ap_ps_peer_cmd_fixed_param *cmd; |
| 1392 | wmi_buf_t buf; |
| 1393 | int32_t err; |
| 1394 | |
| 1395 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1396 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1397 | WMI_LOGE("Failed to allocate buffer to send set_ap_ps_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1398 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1399 | } |
| 1400 | cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf); |
| 1401 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1402 | WMITLV_TAG_STRUC_wmi_ap_ps_peer_cmd_fixed_param, |
| 1403 | WMITLV_GET_STRUCT_TLVLEN |
| 1404 | (wmi_ap_ps_peer_cmd_fixed_param)); |
| 1405 | cmd->vdev_id = param->vdev_id; |
| 1406 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 1407 | cmd->param = param->param; |
| 1408 | cmd->value = param->value; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1409 | wmi_mtrace(WMI_AP_PS_PEER_PARAM_CMDID, cmd->vdev_id, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1410 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 1411 | sizeof(*cmd), WMI_AP_PS_PEER_PARAM_CMDID); |
| 1412 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1413 | WMI_LOGE("Failed to send set_ap_ps_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1414 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1415 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1416 | } |
| 1417 | |
| 1418 | return 0; |
| 1419 | } |
| 1420 | |
| 1421 | /** |
| 1422 | * send_set_sta_ps_param_cmd_tlv() - set sta powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1423 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1424 | * @peer_addr: peer mac address |
| 1425 | * @param: pointer to sta_ps parameter structure |
| 1426 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1427 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1428 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1429 | static QDF_STATUS send_set_sta_ps_param_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1430 | struct sta_ps_params *param) |
| 1431 | { |
| 1432 | wmi_sta_powersave_param_cmd_fixed_param *cmd; |
| 1433 | wmi_buf_t buf; |
| 1434 | int32_t len = sizeof(*cmd); |
| 1435 | |
| 1436 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1437 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1438 | WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1439 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1440 | } |
| 1441 | |
| 1442 | cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1443 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1444 | WMITLV_TAG_STRUC_wmi_sta_powersave_param_cmd_fixed_param, |
| 1445 | WMITLV_GET_STRUCT_TLVLEN |
| 1446 | (wmi_sta_powersave_param_cmd_fixed_param)); |
| 1447 | cmd->vdev_id = param->vdev_id; |
| 1448 | cmd->param = param->param; |
| 1449 | cmd->value = param->value; |
| 1450 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1451 | wmi_mtrace(WMI_STA_POWERSAVE_PARAM_CMDID, cmd->vdev_id, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1452 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1453 | WMI_STA_POWERSAVE_PARAM_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1454 | WMI_LOGE("Set Sta Ps param Failed vdevId %d Param %d val %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1455 | param->vdev_id, param->param, param->value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1456 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1457 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1458 | } |
| 1459 | |
| 1460 | return 0; |
| 1461 | } |
| 1462 | |
| 1463 | /** |
| 1464 | * send_crash_inject_cmd_tlv() - inject fw crash |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1465 | * @wmi_handle: wmi handle |
Jeff Johnson | bbd428c | 2018-05-06 17:02:16 -0700 | [diff] [blame] | 1466 | * @param: ponirt to crash inject parameter structure |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1467 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1468 | * Return: QDF_STATUS_SUCCESS for success or return error |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1469 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1470 | static QDF_STATUS send_crash_inject_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1471 | struct crash_inject *param) |
| 1472 | { |
| 1473 | int32_t ret = 0; |
| 1474 | WMI_FORCE_FW_HANG_CMD_fixed_param *cmd; |
| 1475 | uint16_t len = sizeof(*cmd); |
| 1476 | wmi_buf_t buf; |
| 1477 | |
| 1478 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1479 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1480 | WMI_LOGE("%s: wmi_buf_alloc failed!", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1481 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1482 | } |
| 1483 | |
| 1484 | cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf); |
| 1485 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1486 | WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param, |
| 1487 | WMITLV_GET_STRUCT_TLVLEN |
| 1488 | (WMI_FORCE_FW_HANG_CMD_fixed_param)); |
| 1489 | cmd->type = param->type; |
| 1490 | cmd->delay_time_ms = param->delay_time_ms; |
| 1491 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1492 | wmi_mtrace(WMI_FORCE_FW_HANG_CMDID, NO_SESSION, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1493 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1494 | WMI_FORCE_FW_HANG_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1495 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1496 | WMI_LOGE("%s: Failed to send set param command, ret = %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1497 | __func__, ret); |
| 1498 | wmi_buf_free(buf); |
| 1499 | } |
| 1500 | |
| 1501 | return ret; |
| 1502 | } |
| 1503 | |
Wen Gong | ca17401 | 2018-04-20 16:56:28 +0800 | [diff] [blame] | 1504 | #ifdef FEATURE_FW_LOG_PARSING |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1505 | /** |
| 1506 | * send_dbglog_cmd_tlv() - set debug log level |
| 1507 | * @param wmi_handle : handle to WMI. |
| 1508 | * @param param : pointer to hold dbglog level parameter |
| 1509 | * |
| 1510 | * Return: 0 on success and -ve on failure. |
| 1511 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1512 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1513 | send_dbglog_cmd_tlv(wmi_unified_t wmi_handle, |
| 1514 | struct dbglog_params *dbglog_param) |
| 1515 | { |
| 1516 | wmi_buf_t buf; |
| 1517 | wmi_debug_log_config_cmd_fixed_param *configmsg; |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 1518 | QDF_STATUS status; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1519 | int32_t i; |
| 1520 | int32_t len; |
| 1521 | int8_t *buf_ptr; |
| 1522 | int32_t *module_id_bitmap_array; /* Used to fomr the second tlv */ |
| 1523 | |
Alok Kumar | 240afea | 2017-08-30 14:45:34 +0530 | [diff] [blame] | 1524 | ASSERT(dbglog_param->bitmap_len < MAX_MODULE_ID_BITMAP_WORDS); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1525 | |
| 1526 | /* Allocate size for 2 tlvs - including tlv hdr space for second tlv */ |
| 1527 | len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE + |
| 1528 | (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1529 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1530 | if (buf == NULL) |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 1531 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1532 | |
| 1533 | configmsg = |
| 1534 | (wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf)); |
| 1535 | buf_ptr = (int8_t *) configmsg; |
| 1536 | WMITLV_SET_HDR(&configmsg->tlv_header, |
| 1537 | WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param, |
| 1538 | WMITLV_GET_STRUCT_TLVLEN |
| 1539 | (wmi_debug_log_config_cmd_fixed_param)); |
| 1540 | configmsg->dbg_log_param = dbglog_param->param; |
| 1541 | configmsg->value = dbglog_param->val; |
| 1542 | /* Filling in the data part of second tlv -- should |
| 1543 | * follow first tlv _ WMI_TLV_HDR_SIZE */ |
Vivek | c582309 | 2018-03-22 23:27:21 +0530 | [diff] [blame] | 1544 | module_id_bitmap_array = (uint32_t *) (buf_ptr + |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1545 | sizeof |
| 1546 | (wmi_debug_log_config_cmd_fixed_param) |
| 1547 | + WMI_TLV_HDR_SIZE); |
| 1548 | WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param), |
| 1549 | WMITLV_TAG_ARRAY_UINT32, |
Vivek | c582309 | 2018-03-22 23:27:21 +0530 | [diff] [blame] | 1550 | sizeof(uint32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1551 | if (dbglog_param->module_id_bitmap) { |
| 1552 | for (i = 0; i < dbglog_param->bitmap_len; ++i) { |
| 1553 | module_id_bitmap_array[i] = |
| 1554 | dbglog_param->module_id_bitmap[i]; |
| 1555 | } |
| 1556 | } |
| 1557 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1558 | wmi_mtrace(WMI_DBGLOG_CFG_CMDID, NO_SESSION, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1559 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1560 | len, WMI_DBGLOG_CFG_CMDID); |
| 1561 | |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 1562 | if (status != QDF_STATUS_SUCCESS) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1563 | wmi_buf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1564 | |
| 1565 | return status; |
| 1566 | } |
Wen Gong | ca17401 | 2018-04-20 16:56:28 +0800 | [diff] [blame] | 1567 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1568 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1569 | #ifdef CONFIG_MCL |
| 1570 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1571 | uint32_t host_param) |
| 1572 | { |
| 1573 | return host_param; |
| 1574 | } |
| 1575 | #else |
| 1576 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1577 | uint32_t host_param) |
| 1578 | { |
| 1579 | if (host_param < wmi_vdev_param_max) |
| 1580 | return wmi_handle->vdev_param[host_param]; |
| 1581 | |
| 1582 | return WMI_UNAVAILABLE_PARAM; |
| 1583 | } |
| 1584 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1585 | /** |
| 1586 | * send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function |
| 1587 | * @param wmi_handle : handle to WMI. |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 1588 | * @param macaddr : MAC address |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1589 | * @param param : pointer to hold vdev set parameter |
| 1590 | * |
| 1591 | * Return: 0 on success and -ve on failure. |
| 1592 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1593 | static QDF_STATUS send_vdev_set_param_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1594 | struct vdev_set_params *param) |
| 1595 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1596 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1597 | wmi_vdev_set_param_cmd_fixed_param *cmd; |
| 1598 | wmi_buf_t buf; |
| 1599 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1600 | uint32_t vdev_param; |
| 1601 | |
| 1602 | vdev_param = convert_host_vdev_param_tlv(wmi_handle, param->param_id); |
| 1603 | if (vdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1604 | WMI_LOGW("%s:Vdev param %d not available", __func__, |
| 1605 | param->param_id); |
| 1606 | return QDF_STATUS_E_INVAL; |
| 1607 | |
| 1608 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1609 | |
| 1610 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1611 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1612 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1613 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1614 | } |
| 1615 | cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1616 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1617 | WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param, |
| 1618 | WMITLV_GET_STRUCT_TLVLEN |
| 1619 | (wmi_vdev_set_param_cmd_fixed_param)); |
| 1620 | cmd->vdev_id = param->if_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1621 | cmd->param_id = vdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1622 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1623 | WMI_LOGD("Setting vdev %d param = %x, value = %u", |
Neil Zhao | d32a7bd | 2018-01-10 17:00:04 -0800 | [diff] [blame] | 1624 | cmd->vdev_id, cmd->param_id, cmd->param_value); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1625 | wmi_mtrace(WMI_VDEV_SET_PARAM_CMDID, cmd->vdev_id, 0); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1626 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1627 | WMI_VDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1628 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1629 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1630 | wmi_buf_free(buf); |
| 1631 | } |
| 1632 | |
| 1633 | return ret; |
| 1634 | } |
| 1635 | |
| 1636 | /** |
| 1637 | * send_stats_request_cmd_tlv() - WMI request stats function |
| 1638 | * @param wmi_handle : handle to WMI. |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 1639 | * @param macaddr : MAC address |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1640 | * @param param : pointer to hold stats request parameter |
| 1641 | * |
| 1642 | * Return: 0 on success and -ve on failure. |
| 1643 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1644 | static QDF_STATUS send_stats_request_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1645 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1646 | struct stats_request_params *param) |
| 1647 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1648 | int32_t ret; |
| 1649 | wmi_request_stats_cmd_fixed_param *cmd; |
| 1650 | wmi_buf_t buf; |
| 1651 | uint16_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 1652 | |
| 1653 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1654 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1655 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1656 | return -QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1657 | } |
| 1658 | |
| 1659 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 1660 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1661 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 1662 | WMITLV_GET_STRUCT_TLVLEN |
| 1663 | (wmi_request_stats_cmd_fixed_param)); |
| 1664 | cmd->stats_id = param->stats_id; |
| 1665 | cmd->vdev_id = param->vdev_id; |
Gurumoorthi Gnanasambandhan | 305aeae | 2017-08-10 22:12:36 +0530 | [diff] [blame] | 1666 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 1667 | param->pdev_id); |
| 1668 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
Kabilan Kannan | 3e2b221 | 2017-12-21 00:52:10 -0800 | [diff] [blame] | 1669 | |
Gurumoorthi Gnanasambandhan | 305aeae | 2017-08-10 22:12:36 +0530 | [diff] [blame] | 1670 | WMI_LOGD("STATS REQ STATS_ID:%d VDEV_ID:%d PDEV_ID:%d-->", |
| 1671 | cmd->stats_id, cmd->vdev_id, cmd->pdev_id); |
Kabilan Kannan | 3e2b221 | 2017-12-21 00:52:10 -0800 | [diff] [blame] | 1672 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1673 | wmi_mtrace(WMI_REQUEST_STATS_CMDID, cmd->vdev_id, 0); |
Kabilan Kannan | 3e2b221 | 2017-12-21 00:52:10 -0800 | [diff] [blame] | 1674 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1675 | WMI_REQUEST_STATS_CMDID); |
| 1676 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1677 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1678 | WMI_LOGE("Failed to send status request to fw =%d", ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1679 | wmi_buf_free(buf); |
| 1680 | } |
| 1681 | |
| 1682 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1683 | } |
| 1684 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1685 | #ifdef CONFIG_WIN |
| 1686 | /** |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1687 | * send_packet_log_enable_cmd_tlv() - Send WMI command to enable packet-log |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1688 | * @param wmi_handle : handle to WMI. |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1689 | * @param PKTLOG_EVENT : packet log event |
| 1690 | * @mac_id: mac id to have radio context |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1691 | * |
| 1692 | * Return: 0 on success and -ve on failure. |
| 1693 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1694 | static QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1695 | WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT, uint8_t mac_id) |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1696 | { |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1697 | int32_t ret; |
| 1698 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 1699 | wmi_buf_t buf; |
| 1700 | uint16_t len = sizeof(wmi_pdev_pktlog_enable_cmd_fixed_param); |
| 1701 | |
| 1702 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1703 | if (!buf) { |
| 1704 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1705 | return -QDF_STATUS_E_NOMEM; |
| 1706 | } |
| 1707 | |
| 1708 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1709 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1710 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 1711 | WMITLV_GET_STRUCT_TLVLEN |
| 1712 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 1713 | cmd->evlist = PKTLOG_EVENT; |
| 1714 | cmd->pdev_id = mac_id; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1715 | wmi_mtrace(WMI_PDEV_PKTLOG_ENABLE_CMDID, cmd->pdev_id, 0); |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1716 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1717 | WMI_PDEV_PKTLOG_ENABLE_CMDID); |
| 1718 | if (ret) { |
| 1719 | WMI_LOGE("Failed to send pktlog enable cmd to FW =%d", ret); |
| 1720 | wmi_buf_free(buf); |
| 1721 | } |
| 1722 | |
| 1723 | return ret; |
| 1724 | } |
| 1725 | |
| 1726 | /** |
| 1727 | * send_packet_log_disable_cmd_tlv() - Send WMI command to disable packet-log |
| 1728 | * @param wmi_handle : handle to WMI. |
| 1729 | * @mac_id: mac id to have radio context |
| 1730 | * |
| 1731 | * Return: 0 on success and -ve on failure. |
| 1732 | */ |
| 1733 | static QDF_STATUS send_packet_log_disable_cmd_tlv(wmi_unified_t wmi_handle, |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 1734 | uint8_t mac_id) |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1735 | { |
| 1736 | int32_t ret; |
| 1737 | wmi_pdev_pktlog_disable_cmd_fixed_param *cmd; |
| 1738 | wmi_buf_t buf; |
| 1739 | uint16_t len = sizeof(wmi_pdev_pktlog_disable_cmd_fixed_param); |
| 1740 | |
| 1741 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1742 | if (!buf) { |
| 1743 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1744 | return -QDF_STATUS_E_NOMEM; |
| 1745 | } |
| 1746 | |
| 1747 | cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1748 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1749 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 1750 | WMITLV_GET_STRUCT_TLVLEN |
| 1751 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
| 1752 | cmd->pdev_id = mac_id; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1753 | wmi_mtrace(WMI_PDEV_PKTLOG_DISABLE_CMDID, cmd->pdev_id, 0); |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1754 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1755 | WMI_PDEV_PKTLOG_DISABLE_CMDID); |
| 1756 | if (ret) { |
| 1757 | WMI_LOGE("Failed to send pktlog disable cmd to FW =%d", ret); |
| 1758 | wmi_buf_free(buf); |
| 1759 | } |
| 1760 | |
| 1761 | return ret; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1762 | } |
| 1763 | #else |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1764 | /** |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 1765 | * send_packet_log_enable_cmd_tlv() - Send WMI command to enable |
| 1766 | * packet-log |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1767 | * @param wmi_handle : handle to WMI. |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 1768 | * @param macaddr : MAC address |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1769 | * @param param : pointer to hold stats request parameter |
| 1770 | * |
| 1771 | * Return: 0 on success and -ve on failure. |
| 1772 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1773 | static QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1774 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1775 | struct packet_enable_params *param) |
| 1776 | { |
| 1777 | return 0; |
| 1778 | } |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 1779 | /** |
| 1780 | * send_packet_log_disable_cmd_tlv() - Send WMI command to disable |
| 1781 | * packet-log |
| 1782 | * @param wmi_handle : handle to WMI. |
| 1783 | * @mac_id: mac id to have radio context |
| 1784 | * |
| 1785 | * Return: 0 on success and -ve on failure. |
| 1786 | */ |
| 1787 | static QDF_STATUS send_packet_log_disable_cmd_tlv(wmi_unified_t wmi_handle, |
| 1788 | uint8_t mac_id) |
| 1789 | { |
| 1790 | return 0; |
| 1791 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1792 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1793 | |
gaurank kathpalia | cdfb445 | 2018-02-21 18:58:29 +0530 | [diff] [blame] | 1794 | #define WMI_FW_TIME_STAMP_LOW_MASK 0xffffffff |
| 1795 | /** |
| 1796 | * send_time_stamp_sync_cmd_tlv() - Send WMI command to |
| 1797 | * sync time between bwtween host and firmware |
| 1798 | * @param wmi_handle : handle to WMI. |
| 1799 | * |
| 1800 | * Return: None |
| 1801 | */ |
| 1802 | static void send_time_stamp_sync_cmd_tlv(wmi_unified_t wmi_handle) |
| 1803 | { |
| 1804 | wmi_buf_t buf; |
Yuanyuan Liu | 977f53b | 2018-03-28 18:05:30 -0700 | [diff] [blame] | 1805 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | cdfb445 | 2018-02-21 18:58:29 +0530 | [diff] [blame] | 1806 | WMI_DBGLOG_TIME_STAMP_SYNC_CMD_fixed_param *time_stamp; |
| 1807 | int32_t len; |
| 1808 | qdf_time_t time_ms; |
| 1809 | |
| 1810 | len = sizeof(*time_stamp); |
| 1811 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1812 | |
| 1813 | if (!buf) { |
| 1814 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
| 1815 | return; |
| 1816 | } |
| 1817 | time_stamp = |
| 1818 | (WMI_DBGLOG_TIME_STAMP_SYNC_CMD_fixed_param *) |
| 1819 | (wmi_buf_data(buf)); |
| 1820 | WMITLV_SET_HDR(&time_stamp->tlv_header, |
| 1821 | WMITLV_TAG_STRUC_wmi_dbglog_time_stamp_sync_cmd_fixed_param, |
| 1822 | WMITLV_GET_STRUCT_TLVLEN( |
| 1823 | WMI_DBGLOG_TIME_STAMP_SYNC_CMD_fixed_param)); |
| 1824 | |
| 1825 | time_ms = qdf_get_time_of_the_day_ms(); |
| 1826 | time_stamp->mode = WMI_TIME_STAMP_SYNC_MODE_MS; |
| 1827 | time_stamp->time_stamp_low = time_ms & |
| 1828 | WMI_FW_TIME_STAMP_LOW_MASK; |
| 1829 | /* |
| 1830 | * Send time_stamp_high 0 as the time converted from HR:MIN:SEC:MS to ms |
| 1831 | * wont exceed 27 bit |
| 1832 | */ |
| 1833 | time_stamp->time_stamp_high = 0; |
| 1834 | WMI_LOGD(FL("WMA --> DBGLOG_TIME_STAMP_SYNC_CMDID mode %d time_stamp low %d high %d"), |
| 1835 | time_stamp->mode, time_stamp->time_stamp_low, |
| 1836 | time_stamp->time_stamp_high); |
| 1837 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1838 | wmi_mtrace(WMI_DBGLOG_TIME_STAMP_SYNC_CMDID, NO_SESSION, 0); |
gaurank kathpalia | cdfb445 | 2018-02-21 18:58:29 +0530 | [diff] [blame] | 1839 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1840 | len, WMI_DBGLOG_TIME_STAMP_SYNC_CMDID); |
| 1841 | if (status) { |
| 1842 | WMI_LOGE("Failed to send WMI_DBGLOG_TIME_STAMP_SYNC_CMDID command"); |
| 1843 | wmi_buf_free(buf); |
| 1844 | } |
| 1845 | |
| 1846 | } |
| 1847 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1848 | /** |
| 1849 | * send_beacon_send_tmpl_cmd_tlv() - WMI beacon send function |
| 1850 | * @param wmi_handle : handle to WMI. |
| 1851 | * @param param : pointer to hold beacon send cmd parameter |
| 1852 | * |
| 1853 | * Return: 0 on success and -ve on failure. |
| 1854 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1855 | static QDF_STATUS send_beacon_tmpl_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1856 | struct beacon_tmpl_params *param) |
| 1857 | { |
| 1858 | int32_t ret; |
| 1859 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1860 | wmi_bcn_prb_info *bcn_prb_info; |
| 1861 | wmi_buf_t wmi_buf; |
| 1862 | uint8_t *buf_ptr; |
| 1863 | uint32_t wmi_buf_len; |
| 1864 | |
| 1865 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1866 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1867 | param->tmpl_len_aligned; |
| 1868 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1869 | if (!wmi_buf) { |
| 1870 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1871 | return QDF_STATUS_E_NOMEM; |
| 1872 | } |
| 1873 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1874 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1875 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1876 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1877 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1878 | cmd->vdev_id = param->vdev_id; |
| 1879 | cmd->tim_ie_offset = param->tim_ie_offset; |
Manoj Ekbote | 0bce58b | 2018-06-06 16:52:39 -0700 | [diff] [blame] | 1880 | cmd->mbssid_ie_offset = param->mbssid_ie_offset; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1881 | cmd->csa_switch_count_offset = param->csa_switch_count_offset; |
| 1882 | cmd->ext_csa_switch_count_offset = param->ext_csa_switch_count_offset; |
Subrat Mishra | a667b1c | 2018-08-02 15:02:04 +0530 | [diff] [blame] | 1883 | cmd->esp_ie_offset = param->esp_ie_offset; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1884 | cmd->buf_len = param->tmpl_len; |
| 1885 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1886 | |
| 1887 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1888 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1889 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1890 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1891 | bcn_prb_info->caps = 0; |
| 1892 | bcn_prb_info->erp = 0; |
| 1893 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1894 | |
| 1895 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1896 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1897 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
| 1898 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 1899 | wmi_mtrace(WMI_BCN_TMPL_CMDID, cmd->vdev_id, 0); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1900 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1901 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1902 | if (ret) { |
| 1903 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
| 1904 | wmi_buf_free(wmi_buf); |
| 1905 | } |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1906 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1907 | return 0; |
| 1908 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1909 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1910 | #ifdef CONFIG_MCL |
| 1911 | static inline void copy_peer_flags_tlv( |
| 1912 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1913 | struct peer_assoc_params *param) |
| 1914 | { |
| 1915 | cmd->peer_flags = param->peer_flags; |
| 1916 | } |
| 1917 | #else |
| 1918 | static inline void copy_peer_flags_tlv( |
| 1919 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1920 | struct peer_assoc_params *param) |
| 1921 | { |
| 1922 | /* |
| 1923 | * The target only needs a subset of the flags maintained in the host. |
| 1924 | * Just populate those flags and send it down |
| 1925 | */ |
| 1926 | cmd->peer_flags = 0; |
| 1927 | |
| 1928 | /* |
| 1929 | * Do not enable HT/VHT if WMM/wme is disabled for vap. |
| 1930 | */ |
| 1931 | if (param->is_wme_set) { |
| 1932 | |
| 1933 | if (param->qos_flag) |
| 1934 | cmd->peer_flags |= WMI_PEER_QOS; |
| 1935 | if (param->apsd_flag) |
| 1936 | cmd->peer_flags |= WMI_PEER_APSD; |
| 1937 | if (param->ht_flag) |
| 1938 | cmd->peer_flags |= WMI_PEER_HT; |
| 1939 | if (param->bw_40) |
| 1940 | cmd->peer_flags |= WMI_PEER_40MHZ; |
| 1941 | if (param->bw_80) |
| 1942 | cmd->peer_flags |= WMI_PEER_80MHZ; |
| 1943 | if (param->bw_160) |
| 1944 | cmd->peer_flags |= WMI_PEER_160MHZ; |
| 1945 | |
| 1946 | /* Typically if STBC is enabled for VHT it should be enabled |
| 1947 | * for HT as well |
| 1948 | **/ |
| 1949 | if (param->stbc_flag) |
| 1950 | cmd->peer_flags |= WMI_PEER_STBC; |
| 1951 | |
| 1952 | /* Typically if LDPC is enabled for VHT it should be enabled |
| 1953 | * for HT as well |
| 1954 | **/ |
| 1955 | if (param->ldpc_flag) |
| 1956 | cmd->peer_flags |= WMI_PEER_LDPC; |
| 1957 | |
| 1958 | if (param->static_mimops_flag) |
| 1959 | cmd->peer_flags |= WMI_PEER_STATIC_MIMOPS; |
| 1960 | if (param->dynamic_mimops_flag) |
| 1961 | cmd->peer_flags |= WMI_PEER_DYN_MIMOPS; |
| 1962 | if (param->spatial_mux_flag) |
| 1963 | cmd->peer_flags |= WMI_PEER_SPATIAL_MUX; |
| 1964 | if (param->vht_flag) |
| 1965 | cmd->peer_flags |= WMI_PEER_VHT; |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 1966 | if (param->he_flag) |
| 1967 | cmd->peer_flags |= WMI_PEER_HE; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1968 | } |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 1969 | |
Gurumoorthi Gnanasambandhan | d18a061 | 2017-07-03 16:14:55 +0530 | [diff] [blame] | 1970 | if (param->is_pmf_enabled) |
| 1971 | cmd->peer_flags |= WMI_PEER_PMF; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1972 | /* |
| 1973 | * Suppress authorization for all AUTH modes that need 4-way handshake |
| 1974 | * (during re-association). |
| 1975 | * Authorization will be done for these modes on key installation. |
| 1976 | */ |
| 1977 | if (param->auth_flag) |
| 1978 | cmd->peer_flags |= WMI_PEER_AUTH; |
| 1979 | if (param->need_ptk_4_way) |
| 1980 | cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY; |
| 1981 | else |
| 1982 | cmd->peer_flags &= ~WMI_PEER_NEED_PTK_4_WAY; |
| 1983 | if (param->need_gtk_2_way) |
| 1984 | cmd->peer_flags |= WMI_PEER_NEED_GTK_2_WAY; |
| 1985 | /* safe mode bypass the 4-way handshake */ |
| 1986 | if (param->safe_mode_enabled) |
| 1987 | cmd->peer_flags &= |
| 1988 | ~(WMI_PEER_NEED_PTK_4_WAY | WMI_PEER_NEED_GTK_2_WAY); |
| 1989 | /* Disable AMSDU for station transmit, if user configures it */ |
| 1990 | /* Disable AMSDU for AP transmit to 11n Stations, if user configures |
| 1991 | * it |
| 1992 | * if (param->amsdu_disable) Add after FW support |
| 1993 | **/ |
| 1994 | |
| 1995 | /* Target asserts if node is marked HT and all MCS is set to 0. |
| 1996 | * Mark the node as non-HT if all the mcs rates are disabled through |
| 1997 | * iwpriv |
| 1998 | **/ |
| 1999 | if (param->peer_ht_rates.num_rates == 0) |
| 2000 | cmd->peer_flags &= ~WMI_PEER_HT; |
Kiran Venkatappa | 54c2afd | 2018-07-30 12:04:42 +0530 | [diff] [blame] | 2001 | |
| 2002 | if (param->twt_requester) |
| 2003 | cmd->peer_flags |= WMI_PEER_TWT_REQ; |
| 2004 | |
| 2005 | if (param->twt_responder) |
| 2006 | cmd->peer_flags |= WMI_PEER_TWT_RESP; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2007 | } |
| 2008 | #endif |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 2009 | |
| 2010 | #ifdef CONFIG_MCL |
| 2011 | static inline void copy_peer_mac_addr_tlv( |
| 2012 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 2013 | struct peer_assoc_params *param) |
| 2014 | { |
| 2015 | qdf_mem_copy(&cmd->peer_macaddr, ¶m->peer_macaddr, |
| 2016 | sizeof(param->peer_macaddr)); |
| 2017 | } |
| 2018 | #else |
| 2019 | static inline void copy_peer_mac_addr_tlv( |
| 2020 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 2021 | struct peer_assoc_params *param) |
| 2022 | { |
| 2023 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_mac, &cmd->peer_macaddr); |
| 2024 | } |
| 2025 | #endif |
| 2026 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2027 | /** |
| 2028 | * send_peer_assoc_cmd_tlv() - WMI peer assoc function |
| 2029 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2030 | * @param param : pointer to peer assoc parameter |
| 2031 | * |
| 2032 | * Return: 0 on success and -ve on failure. |
| 2033 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2034 | static QDF_STATUS send_peer_assoc_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2035 | struct peer_assoc_params *param) |
| 2036 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2037 | wmi_peer_assoc_complete_cmd_fixed_param *cmd; |
| 2038 | wmi_vht_rate_set *mcs; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2039 | wmi_he_rate_set *he_mcs; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2040 | wmi_buf_t buf; |
| 2041 | int32_t len; |
| 2042 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2043 | QDF_STATUS ret; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2044 | uint32_t peer_legacy_rates_align; |
| 2045 | uint32_t peer_ht_rates_align; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2046 | int32_t i; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2047 | |
| 2048 | |
| 2049 | peer_legacy_rates_align = wmi_align(param->peer_legacy_rates.num_rates); |
| 2050 | peer_ht_rates_align = wmi_align(param->peer_ht_rates.num_rates); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2051 | |
| 2052 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2053 | (peer_legacy_rates_align * sizeof(uint8_t)) + |
| 2054 | WMI_TLV_HDR_SIZE + |
| 2055 | (peer_ht_rates_align * sizeof(uint8_t)) + |
| 2056 | sizeof(wmi_vht_rate_set) + |
| 2057 | (sizeof(wmi_he_rate_set) * param->peer_he_mcs_count |
| 2058 | + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2059 | |
| 2060 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2061 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2062 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2063 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2064 | } |
| 2065 | |
| 2066 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2067 | cmd = (wmi_peer_assoc_complete_cmd_fixed_param *) buf_ptr; |
| 2068 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2069 | WMITLV_TAG_STRUC_wmi_peer_assoc_complete_cmd_fixed_param, |
| 2070 | WMITLV_GET_STRUCT_TLVLEN |
| 2071 | (wmi_peer_assoc_complete_cmd_fixed_param)); |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2072 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2073 | cmd->vdev_id = param->vdev_id; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 2074 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2075 | cmd->peer_new_assoc = param->peer_new_assoc; |
| 2076 | cmd->peer_associd = param->peer_associd; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 2077 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2078 | copy_peer_flags_tlv(cmd, param); |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 2079 | copy_peer_mac_addr_tlv(cmd, param); |
| 2080 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2081 | cmd->peer_rate_caps = param->peer_rate_caps; |
| 2082 | cmd->peer_caps = param->peer_caps; |
| 2083 | cmd->peer_listen_intval = param->peer_listen_intval; |
| 2084 | cmd->peer_ht_caps = param->peer_ht_caps; |
| 2085 | cmd->peer_max_mpdu = param->peer_max_mpdu; |
| 2086 | cmd->peer_mpdu_density = param->peer_mpdu_density; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2087 | cmd->peer_vht_caps = param->peer_vht_caps; |
| 2088 | cmd->peer_phymode = param->peer_phymode; |
| 2089 | |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 2090 | /* Update 11ax capabilities */ |
Gyanranjan Hazarika | e881c7c | 2018-08-17 01:54:48 -0700 | [diff] [blame] | 2091 | cmd->peer_he_cap_info = |
| 2092 | param->peer_he_cap_macinfo[WMI_HOST_HECAP_MAC_WORD1]; |
| 2093 | cmd->peer_he_cap_info_ext = |
| 2094 | param->peer_he_cap_macinfo[WMI_HOST_HECAP_MAC_WORD2]; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 2095 | cmd->peer_he_ops = param->peer_he_ops; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 2096 | qdf_mem_copy(&cmd->peer_he_cap_phy, ¶m->peer_he_cap_phyinfo, |
| 2097 | sizeof(param->peer_he_cap_phyinfo)); |
| 2098 | qdf_mem_copy(&cmd->peer_ppet, ¶m->peer_ppet, |
| 2099 | sizeof(param->peer_ppet)); |
| 2100 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2101 | /* Update peer legacy rate information */ |
| 2102 | buf_ptr += sizeof(*cmd); |
| 2103 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2104 | peer_legacy_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2105 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2106 | cmd->num_peer_legacy_rates = param->peer_legacy_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2107 | qdf_mem_copy(buf_ptr, param->peer_legacy_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2108 | param->peer_legacy_rates.num_rates); |
| 2109 | |
| 2110 | /* Update peer HT rate information */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 2111 | buf_ptr += peer_legacy_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2112 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2113 | peer_ht_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2114 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2115 | cmd->num_peer_ht_rates = param->peer_ht_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2116 | qdf_mem_copy(buf_ptr, param->peer_ht_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2117 | param->peer_ht_rates.num_rates); |
| 2118 | |
| 2119 | /* VHT Rates */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 2120 | buf_ptr += peer_ht_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2121 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_vht_rate_set, |
| 2122 | WMITLV_GET_STRUCT_TLVLEN(wmi_vht_rate_set)); |
| 2123 | |
| 2124 | cmd->peer_nss = param->peer_nss; |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2125 | |
| 2126 | /* Update bandwidth-NSS mapping */ |
| 2127 | cmd->peer_bw_rxnss_override = 0; |
| 2128 | cmd->peer_bw_rxnss_override |= param->peer_bw_rxnss_override; |
| 2129 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2130 | mcs = (wmi_vht_rate_set *) buf_ptr; |
| 2131 | if (param->vht_capable) { |
| 2132 | mcs->rx_max_rate = param->rx_max_rate; |
| 2133 | mcs->rx_mcs_set = param->rx_mcs_set; |
| 2134 | mcs->tx_max_rate = param->tx_max_rate; |
| 2135 | mcs->tx_mcs_set = param->tx_mcs_set; |
| 2136 | } |
| 2137 | |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2138 | /* HE Rates */ |
| 2139 | cmd->peer_he_mcs = param->peer_he_mcs_count; |
| 2140 | buf_ptr += sizeof(wmi_vht_rate_set); |
| 2141 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2142 | (param->peer_he_mcs_count * sizeof(wmi_he_rate_set))); |
| 2143 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2144 | |
| 2145 | /* Loop through the HE rate set */ |
| 2146 | for (i = 0; i < param->peer_he_mcs_count; i++) { |
| 2147 | he_mcs = (wmi_he_rate_set *) buf_ptr; |
| 2148 | WMITLV_SET_HDR(he_mcs, WMITLV_TAG_STRUC_wmi_he_rate_set, |
| 2149 | WMITLV_GET_STRUCT_TLVLEN(wmi_he_rate_set)); |
| 2150 | |
| 2151 | he_mcs->rx_mcs_set = param->peer_he_rx_mcs_set[i]; |
| 2152 | he_mcs->tx_mcs_set = param->peer_he_tx_mcs_set[i]; |
| 2153 | WMI_LOGD("%s:HE idx %d RxMCSmap %x TxMCSmap %x ", __func__, |
| 2154 | i, he_mcs->rx_mcs_set, he_mcs->tx_mcs_set); |
| 2155 | buf_ptr += sizeof(wmi_he_rate_set); |
| 2156 | } |
| 2157 | |
| 2158 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2159 | WMI_LOGD("%s: vdev_id %d associd %d peer_flags %x rate_caps %x " |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2160 | "peer_caps %x listen_intval %d ht_caps %x max_mpdu %d " |
| 2161 | "nss %d phymode %d peer_mpdu_density %d " |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2162 | "cmd->peer_vht_caps %x " |
| 2163 | "HE cap_info %x ops %x " |
Gyanranjan Hazarika | e881c7c | 2018-08-17 01:54:48 -0700 | [diff] [blame] | 2164 | "HE cap_info_ext %x " |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2165 | "HE phy %x %x %x " |
| 2166 | "peer_bw_rxnss_override %x", __func__, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2167 | cmd->vdev_id, cmd->peer_associd, cmd->peer_flags, |
| 2168 | cmd->peer_rate_caps, cmd->peer_caps, |
| 2169 | cmd->peer_listen_intval, cmd->peer_ht_caps, |
| 2170 | cmd->peer_max_mpdu, cmd->peer_nss, cmd->peer_phymode, |
| 2171 | cmd->peer_mpdu_density, |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2172 | cmd->peer_vht_caps, cmd->peer_he_cap_info, |
Gyanranjan Hazarika | e881c7c | 2018-08-17 01:54:48 -0700 | [diff] [blame] | 2173 | cmd->peer_he_ops, cmd->peer_he_cap_info_ext, |
| 2174 | cmd->peer_he_cap_phy[0], cmd->peer_he_cap_phy[1], |
| 2175 | cmd->peer_he_cap_phy[2], |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2176 | cmd->peer_bw_rxnss_override); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2177 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 2178 | wmi_mtrace(WMI_PEER_ASSOC_CMDID, cmd->vdev_id, 0); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2179 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2180 | WMI_PEER_ASSOC_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2181 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2182 | WMI_LOGP("%s: Failed to send peer assoc command ret = %d", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2183 | __func__, ret); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2184 | wmi_buf_free(buf); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2185 | } |
| 2186 | |
| 2187 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2188 | } |
| 2189 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2190 | /* copy_scan_notify_events() - Helper routine to copy scan notify events |
| 2191 | */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2192 | static inline void copy_scan_event_cntrl_flags( |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2193 | wmi_start_scan_cmd_fixed_param * cmd, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2194 | struct scan_req_params *param) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2195 | { |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2196 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2197 | /* Scan events subscription */ |
| 2198 | if (param->scan_ev_started) |
| 2199 | cmd->notify_scan_events |= WMI_SCAN_EVENT_STARTED; |
| 2200 | if (param->scan_ev_completed) |
| 2201 | cmd->notify_scan_events |= WMI_SCAN_EVENT_COMPLETED; |
| 2202 | if (param->scan_ev_bss_chan) |
| 2203 | cmd->notify_scan_events |= WMI_SCAN_EVENT_BSS_CHANNEL; |
| 2204 | if (param->scan_ev_foreign_chan) |
| 2205 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL; |
| 2206 | if (param->scan_ev_dequeued) |
| 2207 | cmd->notify_scan_events |= WMI_SCAN_EVENT_DEQUEUED; |
| 2208 | if (param->scan_ev_preempted) |
| 2209 | cmd->notify_scan_events |= WMI_SCAN_EVENT_PREEMPTED; |
| 2210 | if (param->scan_ev_start_failed) |
| 2211 | cmd->notify_scan_events |= WMI_SCAN_EVENT_START_FAILED; |
| 2212 | if (param->scan_ev_restarted) |
| 2213 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESTARTED; |
| 2214 | if (param->scan_ev_foreign_chn_exit) |
| 2215 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT; |
| 2216 | if (param->scan_ev_suspended) |
| 2217 | cmd->notify_scan_events |= WMI_SCAN_EVENT_SUSPENDED; |
| 2218 | if (param->scan_ev_resumed) |
| 2219 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESUMED; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2220 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2221 | /** Set scan control flags */ |
| 2222 | cmd->scan_ctrl_flags = 0; |
| 2223 | if (param->scan_f_passive) |
| 2224 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE; |
| 2225 | if (param->scan_f_strict_passive_pch) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2226 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_STRICT_PASSIVE_ON_PCHN; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2227 | if (param->scan_f_promisc_mode) |
| 2228 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROMISCOUS; |
| 2229 | if (param->scan_f_capture_phy_err) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2230 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2231 | if (param->scan_f_half_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2232 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_HALF_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2233 | if (param->scan_f_quarter_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2234 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_QUARTER_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2235 | if (param->scan_f_cck_rates) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2236 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_CCK_RATES; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2237 | if (param->scan_f_ofdm_rates) |
| 2238 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_OFDM_RATES; |
| 2239 | if (param->scan_f_chan_stat_evnt) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2240 | cmd->scan_ctrl_flags |= WMI_SCAN_CHAN_STAT_EVENT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2241 | if (param->scan_f_filter_prb_req) |
| 2242 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ; |
| 2243 | if (param->scan_f_bcast_probe) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2244 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_BCAST_PROBE_REQ; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2245 | if (param->scan_f_offchan_mgmt_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2246 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_MGMT_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2247 | if (param->scan_f_offchan_data_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2248 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_DATA_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2249 | if (param->scan_f_force_active_dfs_chn) |
| 2250 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_FORCE_ACTIVE_ON_DFS; |
| 2251 | if (param->scan_f_add_tpc_ie_in_probe) |
| 2252 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_TPC_IE_IN_PROBE_REQ; |
| 2253 | if (param->scan_f_add_ds_ie_in_probe) |
| 2254 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
| 2255 | if (param->scan_f_add_spoofed_mac_in_probe) |
| 2256 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ; |
| 2257 | if (param->scan_f_add_rand_seq_in_probe) |
| 2258 | cmd->scan_ctrl_flags |= WMI_SCAN_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 2259 | if (param->scan_f_en_ie_whitelist_in_probe) |
| 2260 | cmd->scan_ctrl_flags |= |
| 2261 | WMI_SCAN_ENABLE_IE_WHTELIST_IN_PROBE_REQ; |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2262 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2263 | /* for adaptive scan mode using 3 bits (21 - 23 bits) */ |
| 2264 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 2265 | param->adaptive_dwell_time_mode); |
| 2266 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2267 | |
| 2268 | /* scan_copy_ie_buffer() - Copy scan ie_data */ |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2269 | static inline void scan_copy_ie_buffer(uint8_t *buf_ptr, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2270 | struct scan_req_params *params) |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2271 | { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2272 | qdf_mem_copy(buf_ptr, params->extraie.ptr, params->extraie.len); |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2273 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2274 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2275 | /** |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 2276 | * wmi_copy_scan_random_mac() - To copy scan randomization attrs to wmi buffer |
| 2277 | * @mac: random mac addr |
| 2278 | * @mask: random mac mask |
| 2279 | * @mac_addr: wmi random mac |
| 2280 | * @mac_mask: wmi random mac mask |
| 2281 | * |
| 2282 | * Return None. |
| 2283 | */ |
| 2284 | static inline |
| 2285 | void wmi_copy_scan_random_mac(uint8_t *mac, uint8_t *mask, |
| 2286 | wmi_mac_addr *mac_addr, wmi_mac_addr *mac_mask) |
| 2287 | { |
| 2288 | WMI_CHAR_ARRAY_TO_MAC_ADDR(mac, mac_addr); |
| 2289 | WMI_CHAR_ARRAY_TO_MAC_ADDR(mask, mac_mask); |
| 2290 | } |
| 2291 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2292 | /* |
| 2293 | * wmi_fill_vendor_oui() - fill vendor OUIs |
| 2294 | * @buf_ptr: pointer to wmi tlv buffer |
| 2295 | * @num_vendor_oui: number of vendor OUIs to be filled |
| 2296 | * @param_voui: pointer to OUI buffer |
| 2297 | * |
| 2298 | * This function populates the wmi tlv buffer when vendor specific OUIs are |
| 2299 | * present. |
| 2300 | * |
| 2301 | * Return: None |
| 2302 | */ |
| 2303 | static inline |
| 2304 | void wmi_fill_vendor_oui(uint8_t *buf_ptr, uint32_t num_vendor_oui, |
| 2305 | uint32_t *pvoui) |
| 2306 | { |
| 2307 | wmi_vendor_oui *voui = NULL; |
| 2308 | uint32_t i; |
| 2309 | |
| 2310 | voui = (wmi_vendor_oui *)buf_ptr; |
| 2311 | |
| 2312 | for (i = 0; i < num_vendor_oui; i++) { |
| 2313 | WMITLV_SET_HDR(&voui[i].tlv_header, |
| 2314 | WMITLV_TAG_STRUC_wmi_vendor_oui, |
| 2315 | WMITLV_GET_STRUCT_TLVLEN(wmi_vendor_oui)); |
| 2316 | voui[i].oui_type_subtype = pvoui[i]; |
| 2317 | } |
| 2318 | } |
| 2319 | |
| 2320 | /* |
| 2321 | * wmi_fill_ie_whitelist_attrs() - fill IE whitelist attrs |
| 2322 | * @ie_bitmap: output pointer to ie bit map in cmd |
| 2323 | * @num_vendor_oui: output pointer to num vendor OUIs |
| 2324 | * @ie_whitelist: input parameter |
| 2325 | * |
| 2326 | * This function populates the IE whitelist attrs of scan, pno and |
| 2327 | * scan oui commands for ie_whitelist parameter. |
| 2328 | * |
| 2329 | * Return: None |
| 2330 | */ |
| 2331 | static inline |
| 2332 | void wmi_fill_ie_whitelist_attrs(uint32_t *ie_bitmap, |
| 2333 | uint32_t *num_vendor_oui, |
| 2334 | struct probe_req_whitelist_attr *ie_whitelist) |
| 2335 | { |
| 2336 | uint32_t i = 0; |
| 2337 | |
| 2338 | for (i = 0; i < PROBE_REQ_BITMAP_LEN; i++) |
| 2339 | ie_bitmap[i] = ie_whitelist->ie_bitmap[i]; |
| 2340 | |
| 2341 | *num_vendor_oui = ie_whitelist->num_vendor_oui; |
| 2342 | } |
| 2343 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 2344 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2345 | * send_scan_start_cmd_tlv() - WMI scan start function |
| 2346 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2347 | * @param param : pointer to hold scan start cmd parameter |
| 2348 | * |
| 2349 | * Return: 0 on success and -ve on failure. |
| 2350 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2351 | static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2352 | struct scan_req_params *params) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2353 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2354 | int32_t ret = 0; |
| 2355 | int32_t i; |
| 2356 | wmi_buf_t wmi_buf; |
| 2357 | wmi_start_scan_cmd_fixed_param *cmd; |
| 2358 | uint8_t *buf_ptr; |
| 2359 | uint32_t *tmp_ptr; |
| 2360 | wmi_ssid *ssid = NULL; |
| 2361 | wmi_mac_addr *bssid; |
| 2362 | int len = sizeof(*cmd); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2363 | uint8_t extraie_len_with_pad = 0; |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2364 | uint8_t phymode_roundup = 0; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2365 | struct probe_req_whitelist_attr *ie_whitelist = ¶ms->ie_whitelist; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2366 | |
| 2367 | /* Length TLV placeholder for array of uint32_t */ |
| 2368 | len += WMI_TLV_HDR_SIZE; |
| 2369 | /* calculate the length of buffer required */ |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2370 | if (params->chan_list.num_chan) |
| 2371 | len += params->chan_list.num_chan * sizeof(uint32_t); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2372 | |
| 2373 | /* Length TLV placeholder for array of wmi_ssid structures */ |
| 2374 | len += WMI_TLV_HDR_SIZE; |
| 2375 | if (params->num_ssids) |
| 2376 | len += params->num_ssids * sizeof(wmi_ssid); |
| 2377 | |
| 2378 | /* Length TLV placeholder for array of wmi_mac_addr structures */ |
| 2379 | len += WMI_TLV_HDR_SIZE; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2380 | if (params->num_bssid) |
| 2381 | len += sizeof(wmi_mac_addr) * params->num_bssid; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2382 | |
| 2383 | /* Length TLV placeholder for array of bytes */ |
| 2384 | len += WMI_TLV_HDR_SIZE; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2385 | if (params->extraie.len) |
| 2386 | extraie_len_with_pad = |
| 2387 | roundup(params->extraie.len, sizeof(uint32_t)); |
wadesong | 94c7ce6 | 2018-01-22 15:03:12 +0800 | [diff] [blame] | 2388 | len += extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2389 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2390 | len += WMI_TLV_HDR_SIZE; /* Length of TLV for array of wmi_vendor_oui */ |
| 2391 | if (ie_whitelist->num_vendor_oui) |
| 2392 | len += ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 2393 | |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2394 | len += WMI_TLV_HDR_SIZE; /* Length of TLV for array of scan phymode */ |
| 2395 | if (params->scan_f_wide_band) |
| 2396 | phymode_roundup = |
| 2397 | qdf_roundup(params->chan_list.num_chan * sizeof(uint8_t), |
| 2398 | sizeof(uint32_t)); |
| 2399 | len += phymode_roundup; |
| 2400 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2401 | /* Allocate the memory */ |
| 2402 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2403 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2404 | WMI_LOGP("%s: failed to allocate memory for start scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2405 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2406 | return QDF_STATUS_E_FAILURE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2407 | } |
| 2408 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 2409 | cmd = (wmi_start_scan_cmd_fixed_param *) buf_ptr; |
| 2410 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2411 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 2412 | WMITLV_GET_STRUCT_TLVLEN |
| 2413 | (wmi_start_scan_cmd_fixed_param)); |
| 2414 | |
| 2415 | cmd->scan_id = params->scan_id; |
| 2416 | cmd->scan_req_id = params->scan_req_id; |
| 2417 | cmd->vdev_id = params->vdev_id; |
| 2418 | cmd->scan_priority = params->scan_priority; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2419 | |
| 2420 | copy_scan_event_cntrl_flags(cmd, params); |
| 2421 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2422 | cmd->dwell_time_active = params->dwell_time_active; |
Arif Hussain | 397f08c | 2018-07-23 18:10:34 -0700 | [diff] [blame] | 2423 | cmd->dwell_time_active_2g = params->dwell_time_active_2g; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2424 | cmd->dwell_time_passive = params->dwell_time_passive; |
| 2425 | cmd->min_rest_time = params->min_rest_time; |
| 2426 | cmd->max_rest_time = params->max_rest_time; |
| 2427 | cmd->repeat_probe_time = params->repeat_probe_time; |
| 2428 | cmd->probe_spacing_time = params->probe_spacing_time; |
| 2429 | cmd->idle_time = params->idle_time; |
| 2430 | cmd->max_scan_time = params->max_scan_time; |
| 2431 | cmd->probe_delay = params->probe_delay; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2432 | cmd->burst_duration = params->burst_duration; |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2433 | cmd->num_chan = params->chan_list.num_chan; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2434 | cmd->num_bssid = params->num_bssid; |
| 2435 | cmd->num_ssids = params->num_ssids; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2436 | cmd->ie_len = params->extraie.len; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2437 | cmd->n_probes = params->n_probes; |
Nitesh Shah | 52323d0 | 2017-05-22 15:49:00 +0530 | [diff] [blame] | 2438 | cmd->scan_ctrl_flags_ext = params->scan_ctrl_flags_ext; |
| 2439 | |
| 2440 | WMI_LOGD("scan_ctrl_flags_ext = %x", cmd->scan_ctrl_flags_ext); |
| 2441 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 2442 | if (params->scan_random.randomize) |
| 2443 | wmi_copy_scan_random_mac(params->scan_random.mac_addr, |
| 2444 | params->scan_random.mac_mask, |
| 2445 | &cmd->mac_addr, |
| 2446 | &cmd->mac_mask); |
| 2447 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2448 | if (ie_whitelist->white_list) |
| 2449 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 2450 | &cmd->num_vendor_oui, |
| 2451 | ie_whitelist); |
| 2452 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2453 | buf_ptr += sizeof(*cmd); |
| 2454 | tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2455 | for (i = 0; i < params->chan_list.num_chan; ++i) |
| 2456 | tmp_ptr[i] = params->chan_list.chan[i].freq; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2457 | |
| 2458 | WMITLV_SET_HDR(buf_ptr, |
| 2459 | WMITLV_TAG_ARRAY_UINT32, |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2460 | (params->chan_list.num_chan * sizeof(uint32_t))); |
| 2461 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 2462 | (params->chan_list.num_chan * sizeof(uint32_t)); |
| 2463 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2464 | if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2465 | WMI_LOGE("Invalid value for numSsid"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2466 | goto error; |
| 2467 | } |
| 2468 | |
| 2469 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2470 | (params->num_ssids * sizeof(wmi_ssid))); |
| 2471 | |
| 2472 | if (params->num_ssids) { |
| 2473 | ssid = (wmi_ssid *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2474 | for (i = 0; i < params->num_ssids; ++i) { |
| 2475 | ssid->ssid_len = params->ssid[i].length; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2476 | qdf_mem_copy(ssid->ssid, params->ssid[i].ssid, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2477 | params->ssid[i].length); |
| 2478 | ssid++; |
| 2479 | } |
| 2480 | } |
| 2481 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_ssids * sizeof(wmi_ssid)); |
| 2482 | |
| 2483 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2484 | (params->num_bssid * sizeof(wmi_mac_addr))); |
| 2485 | bssid = (wmi_mac_addr *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2486 | |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2487 | if (params->num_bssid) { |
| 2488 | for (i = 0; i < params->num_bssid; ++i) { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2489 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 2490 | ¶ms->bssid_list[i].bytes[0], bssid); |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2491 | bssid++; |
| 2492 | } |
| 2493 | } |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2494 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2495 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 2496 | (params->num_bssid * sizeof(wmi_mac_addr)); |
| 2497 | |
| 2498 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, extraie_len_with_pad); |
| 2499 | if (params->extraie.len) |
| 2500 | scan_copy_ie_buffer(buf_ptr + WMI_TLV_HDR_SIZE, |
| 2501 | params); |
| 2502 | |
| 2503 | buf_ptr += WMI_TLV_HDR_SIZE + extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2504 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2505 | /* probe req ie whitelisting */ |
| 2506 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2507 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 2508 | |
| 2509 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2510 | |
| 2511 | if (cmd->num_vendor_oui) { |
| 2512 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 2513 | ie_whitelist->voui); |
| 2514 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 2515 | } |
| 2516 | |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2517 | /* Add phy mode TLV if it's a wide band scan */ |
| 2518 | if (params->scan_f_wide_band) { |
| 2519 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, phymode_roundup); |
| 2520 | buf_ptr = (uint8_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2521 | for (i = 0; i < params->chan_list.num_chan; ++i) |
| 2522 | buf_ptr[i] = |
| 2523 | WMI_SCAN_CHAN_SET_MODE(params->chan_list.chan[i].phymode); |
| 2524 | buf_ptr += phymode_roundup; |
| 2525 | } else { |
| 2526 | /* Add ZERO legth phy mode TLV */ |
| 2527 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, 0); |
| 2528 | } |
| 2529 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 2530 | wmi_mtrace(WMI_START_SCAN_CMDID, cmd->vdev_id, 0); |
Santosh Anbu | 1e11b47 | 2018-03-07 15:33:27 +0530 | [diff] [blame] | 2531 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, |
Varun Reddy Yeturu | e6f8be3 | 2018-02-27 13:46:11 -0800 | [diff] [blame] | 2532 | len, WMI_START_SCAN_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2533 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2534 | WMI_LOGE("%s: Failed to start scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2535 | wmi_buf_free(wmi_buf); |
| 2536 | } |
| 2537 | return ret; |
| 2538 | error: |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2539 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2540 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2541 | } |
| 2542 | |
| 2543 | /** |
| 2544 | * send_scan_stop_cmd_tlv() - WMI scan start function |
| 2545 | * @param wmi_handle : handle to WMI. |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2546 | * @param param : pointer to hold scan cancel cmd parameter |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2547 | * |
| 2548 | * Return: 0 on success and -ve on failure. |
| 2549 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2550 | static QDF_STATUS send_scan_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2551 | struct scan_cancel_param *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2552 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2553 | wmi_stop_scan_cmd_fixed_param *cmd; |
| 2554 | int ret; |
| 2555 | int len = sizeof(*cmd); |
| 2556 | wmi_buf_t wmi_buf; |
| 2557 | |
| 2558 | /* Allocate the memory */ |
| 2559 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2560 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2561 | WMI_LOGP("%s: failed to allocate memory for stop scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2562 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2563 | ret = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2564 | goto error; |
| 2565 | } |
| 2566 | |
| 2567 | cmd = (wmi_stop_scan_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 2568 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2569 | WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param, |
| 2570 | WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param)); |
| 2571 | cmd->vdev_id = param->vdev_id; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2572 | cmd->requestor = param->requester; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2573 | cmd->scan_id = param->scan_id; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2574 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2575 | param->pdev_id); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2576 | /* stop the scan with the corresponding scan_id */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2577 | if (param->req_type == WLAN_SCAN_CANCEL_PDEV_ALL) { |
| 2578 | /* Cancelling all scans */ |
| 2579 | cmd->req_type = WMI_SCAN_STOP_ALL; |
| 2580 | } else if (param->req_type == WLAN_SCAN_CANCEL_VDEV_ALL) { |
| 2581 | /* Cancelling VAP scans */ |
| 2582 | cmd->req_type = WMI_SCN_STOP_VAP_ALL; |
| 2583 | } else if (param->req_type == WLAN_SCAN_CANCEL_SINGLE) { |
| 2584 | /* Cancelling specific scan */ |
| 2585 | cmd->req_type = WMI_SCAN_STOP_ONE; |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2586 | } else { |
| 2587 | WMI_LOGE("%s: Invalid Command : ", __func__); |
| 2588 | wmi_buf_free(wmi_buf); |
| 2589 | return QDF_STATUS_E_INVAL; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2590 | } |
| 2591 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 2592 | wmi_mtrace(WMI_STOP_SCAN_CMDID, cmd->vdev_id, 0); |
Santosh Anbu | 1e11b47 | 2018-03-07 15:33:27 +0530 | [diff] [blame] | 2593 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, |
Varun Reddy Yeturu | e6f8be3 | 2018-02-27 13:46:11 -0800 | [diff] [blame] | 2594 | len, WMI_STOP_SCAN_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2595 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2596 | WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2597 | wmi_buf_free(wmi_buf); |
| 2598 | } |
| 2599 | |
| 2600 | error: |
| 2601 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2602 | } |
| 2603 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2604 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2605 | /** |
| 2606 | * send_scan_chan_list_cmd_tlv() - WMI scan channel list function |
| 2607 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2608 | * @param param : pointer to hold scan channel list parameter |
| 2609 | * |
| 2610 | * Return: 0 on success and -ve on failure. |
| 2611 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2612 | static QDF_STATUS send_scan_chan_list_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2613 | struct scan_chan_list_params *chan_list) |
| 2614 | { |
| 2615 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2616 | QDF_STATUS qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2617 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2618 | int i; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2619 | uint8_t *buf_ptr; |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2620 | wmi_channel_param *chan_info, *tchan_info; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2621 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 2622 | |
| 2623 | len += sizeof(wmi_channel) * chan_list->num_scan_chans; |
| 2624 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2625 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2626 | WMI_LOGE("Failed to allocate memory"); |
| 2627 | qdf_status = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2628 | goto end; |
| 2629 | } |
| 2630 | |
| 2631 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2632 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2633 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2634 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2635 | WMITLV_GET_STRUCT_TLVLEN |
| 2636 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2637 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2638 | WMI_LOGD("no of channels = %d, len = %d", chan_list->num_scan_chans, len); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2639 | |
| 2640 | cmd->num_scan_chans = chan_list->num_scan_chans; |
| 2641 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2642 | WMITLV_TAG_ARRAY_STRUC, |
| 2643 | sizeof(wmi_channel) * chan_list->num_scan_chans); |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2644 | chan_info = (wmi_channel_param *) |
| 2645 | (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2646 | tchan_info = chan_list->chan_info; |
| 2647 | |
| 2648 | for (i = 0; i < chan_list->num_scan_chans; ++i) { |
| 2649 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2650 | WMITLV_TAG_STRUC_wmi_channel, |
| 2651 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2652 | chan_info->mhz = tchan_info->mhz; |
| 2653 | chan_info->band_center_freq1 = |
| 2654 | tchan_info->band_center_freq1; |
| 2655 | chan_info->band_center_freq2 = |
| 2656 | tchan_info->band_center_freq2; |
| 2657 | chan_info->info = tchan_info->info; |
| 2658 | chan_info->reg_info_1 = tchan_info->reg_info_1; |
| 2659 | chan_info->reg_info_2 = tchan_info->reg_info_2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2660 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2661 | |
| 2662 | /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ |
| 2663 | /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ |
| 2664 | /*TODO: WMI_SET_CHANNEL_REG_CLASSID */ |
| 2665 | tchan_info++; |
| 2666 | chan_info++; |
| 2667 | } |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2668 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2669 | chan_list->pdev_id); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2670 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 2671 | wmi_mtrace(WMI_SCAN_CHAN_LIST_CMDID, NO_SESSION, 0); |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2672 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 2673 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2674 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2675 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2676 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2677 | wmi_buf_free(buf); |
| 2678 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2679 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2680 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2681 | return qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2682 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2683 | #else |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2684 | static QDF_STATUS send_scan_chan_list_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2685 | struct scan_chan_list_params *chan_list) |
| 2686 | { |
| 2687 | wmi_buf_t buf; |
| 2688 | QDF_STATUS qdf_status; |
| 2689 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
| 2690 | int i; |
| 2691 | uint8_t *buf_ptr; |
| 2692 | wmi_channel *chan_info; |
| 2693 | struct channel_param *tchan_info; |
| 2694 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2695 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2696 | len += sizeof(wmi_channel) * chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2697 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2698 | if (!buf) { |
| 2699 | WMI_LOGE("Failed to allocate memory"); |
| 2700 | qdf_status = QDF_STATUS_E_NOMEM; |
| 2701 | goto end; |
| 2702 | } |
| 2703 | |
| 2704 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2705 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2706 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2707 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2708 | WMITLV_GET_STRUCT_TLVLEN |
| 2709 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2710 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2711 | WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2712 | |
Om Prakash Tripathi | cd851c6 | 2017-12-15 17:29:55 +0530 | [diff] [blame] | 2713 | if (chan_list->append) |
| 2714 | cmd->flags |= APPEND_TO_EXISTING_CHAN_LIST; |
| 2715 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2716 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2717 | chan_list->pdev_id); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2718 | cmd->num_scan_chans = chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2719 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2720 | WMITLV_TAG_ARRAY_STRUC, |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2721 | sizeof(wmi_channel) * chan_list->nallchans); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2722 | chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
| 2723 | tchan_info = &(chan_list->ch_param[0]); |
| 2724 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2725 | for (i = 0; i < chan_list->nallchans; ++i) { |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2726 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2727 | WMITLV_TAG_STRUC_wmi_channel, |
| 2728 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2729 | chan_info->mhz = tchan_info->mhz; |
| 2730 | chan_info->band_center_freq1 = |
| 2731 | tchan_info->cfreq1; |
| 2732 | chan_info->band_center_freq2 = |
| 2733 | tchan_info->cfreq2; |
| 2734 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2735 | if (tchan_info->is_chan_passive) |
| 2736 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2737 | WMI_CHAN_FLAG_PASSIVE); |
| 2738 | |
| 2739 | if (tchan_info->allow_vht) |
| 2740 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2741 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 2742 | else if (tchan_info->allow_ht) |
| 2743 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2744 | WMI_CHAN_FLAG_ALLOW_HT); |
| 2745 | WMI_SET_CHANNEL_MODE(chan_info, |
| 2746 | tchan_info->phy_mode); |
| 2747 | |
Shashikala Prabhu | adb0aaa | 2018-03-26 09:10:35 +0530 | [diff] [blame] | 2748 | if (tchan_info->half_rate) |
| 2749 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2750 | WMI_CHAN_FLAG_HALF_RATE); |
| 2751 | |
| 2752 | if (tchan_info->quarter_rate) |
| 2753 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2754 | WMI_CHAN_FLAG_QUARTER_RATE); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2755 | |
| 2756 | /* also fill in power information */ |
| 2757 | WMI_SET_CHANNEL_MIN_POWER(chan_info, |
| 2758 | tchan_info->minpower); |
| 2759 | WMI_SET_CHANNEL_MAX_POWER(chan_info, |
| 2760 | tchan_info->maxpower); |
| 2761 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 2762 | tchan_info->maxregpower); |
| 2763 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, |
| 2764 | tchan_info->antennamax); |
| 2765 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, |
| 2766 | tchan_info->reg_class_id); |
Kai Chen | 4710d46 | 2017-12-15 14:06:06 -0800 | [diff] [blame] | 2767 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 2768 | tchan_info->maxregpower); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2769 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2770 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
| 2771 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2772 | tchan_info++; |
| 2773 | chan_info++; |
| 2774 | } |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2775 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2776 | chan_list->pdev_id); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2777 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 2778 | wmi_mtrace(WMI_SCAN_CHAN_LIST_CMDID, cmd->pdev_id, 0); |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2779 | qdf_status = wmi_unified_cmd_send( |
| 2780 | wmi_handle, |
| 2781 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2782 | |
| 2783 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2784 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
| 2785 | wmi_buf_free(buf); |
| 2786 | } |
| 2787 | |
| 2788 | end: |
| 2789 | return qdf_status; |
| 2790 | } |
| 2791 | #endif |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2792 | |
| 2793 | /** |
| 2794 | * populate_tx_send_params - Populate TX param TLV for mgmt and offchan tx |
| 2795 | * |
| 2796 | * @bufp: Pointer to buffer |
| 2797 | * @param: Pointer to tx param |
| 2798 | * |
| 2799 | * Return: QDF_STATUS_SUCCESS for success and QDF_STATUS_E_FAILURE for failure |
| 2800 | */ |
| 2801 | static inline QDF_STATUS populate_tx_send_params(uint8_t *bufp, |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 2802 | struct tx_send_params param) |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2803 | { |
| 2804 | wmi_tx_send_params *tx_param; |
| 2805 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2806 | |
| 2807 | if (!bufp) { |
| 2808 | status = QDF_STATUS_E_FAILURE; |
| 2809 | return status; |
| 2810 | } |
| 2811 | tx_param = (wmi_tx_send_params *)bufp; |
| 2812 | WMITLV_SET_HDR(&tx_param->tlv_header, |
| 2813 | WMITLV_TAG_STRUC_wmi_tx_send_params, |
| 2814 | WMITLV_GET_STRUCT_TLVLEN(wmi_tx_send_params)); |
| 2815 | WMI_TX_SEND_PARAM_PWR_SET(tx_param->tx_param_dword0, param.pwr); |
| 2816 | WMI_TX_SEND_PARAM_MCS_MASK_SET(tx_param->tx_param_dword0, |
| 2817 | param.mcs_mask); |
| 2818 | WMI_TX_SEND_PARAM_NSS_MASK_SET(tx_param->tx_param_dword0, |
| 2819 | param.nss_mask); |
| 2820 | WMI_TX_SEND_PARAM_RETRY_LIMIT_SET(tx_param->tx_param_dword0, |
| 2821 | param.retry_limit); |
| 2822 | WMI_TX_SEND_PARAM_CHAIN_MASK_SET(tx_param->tx_param_dword1, |
| 2823 | param.chain_mask); |
| 2824 | WMI_TX_SEND_PARAM_BW_MASK_SET(tx_param->tx_param_dword1, |
| 2825 | param.bw_mask); |
| 2826 | WMI_TX_SEND_PARAM_PREAMBLE_SET(tx_param->tx_param_dword1, |
| 2827 | param.preamble_type); |
| 2828 | WMI_TX_SEND_PARAM_FRAME_TYPE_SET(tx_param->tx_param_dword1, |
| 2829 | param.frame_type); |
| 2830 | |
| 2831 | return status; |
| 2832 | } |
| 2833 | |
Madhvapathi Sriram | 9130ff2 | 2018-04-20 09:22:51 +0530 | [diff] [blame] | 2834 | #ifdef CONFIG_HL_SUPPORT |
| 2835 | /** |
| 2836 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 2837 | * @wmi_handle : handle to WMI. |
| 2838 | * @param : pointer to hold mgmt cmd parameter |
| 2839 | * |
| 2840 | * Return: 0 on success and -ve on failure. |
| 2841 | */ |
| 2842 | static QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
| 2843 | struct wmi_mgmt_params *param) |
| 2844 | { |
| 2845 | wmi_buf_t buf; |
| 2846 | uint8_t *bufp; |
| 2847 | int32_t cmd_len; |
| 2848 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 2849 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 2850 | mgmt_tx_dl_frm_len; |
| 2851 | |
| 2852 | if (param->frm_len > mgmt_tx_dl_frm_len) { |
| 2853 | WMI_LOGE("%s:mgmt frame len %u exceeds %u", |
| 2854 | __func__, param->frm_len, mgmt_tx_dl_frm_len); |
| 2855 | return QDF_STATUS_E_INVAL; |
| 2856 | } |
| 2857 | |
| 2858 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
| 2859 | WMI_TLV_HDR_SIZE + |
| 2860 | roundup(bufp_len, sizeof(uint32_t)); |
| 2861 | |
| 2862 | buf = wmi_buf_alloc(wmi_handle, sizeof(wmi_tx_send_params) + cmd_len); |
| 2863 | if (!buf) { |
| 2864 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2865 | return QDF_STATUS_E_NOMEM; |
| 2866 | } |
| 2867 | |
| 2868 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 2869 | bufp = (uint8_t *) cmd; |
| 2870 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2871 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 2872 | WMITLV_GET_STRUCT_TLVLEN |
| 2873 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 2874 | |
| 2875 | cmd->vdev_id = param->vdev_id; |
| 2876 | |
| 2877 | cmd->desc_id = param->desc_id; |
| 2878 | cmd->chanfreq = param->chanfreq; |
| 2879 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 2880 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2881 | sizeof(uint32_t))); |
| 2882 | bufp += WMI_TLV_HDR_SIZE; |
| 2883 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 2884 | |
| 2885 | cmd->frame_len = param->frm_len; |
| 2886 | cmd->buf_len = bufp_len; |
| 2887 | cmd->tx_params_valid = param->tx_params_valid; |
| 2888 | |
| 2889 | wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, |
| 2890 | bufp, cmd->vdev_id, cmd->chanfreq); |
| 2891 | |
| 2892 | bufp += roundup(bufp_len, sizeof(uint32_t)); |
| 2893 | if (param->tx_params_valid) { |
| 2894 | if (populate_tx_send_params(bufp, param->tx_param) != |
| 2895 | QDF_STATUS_SUCCESS) { |
| 2896 | WMI_LOGE("%s: Populate TX send params failed", |
| 2897 | __func__); |
| 2898 | goto free_buf; |
| 2899 | } |
| 2900 | cmd_len += sizeof(wmi_tx_send_params); |
| 2901 | } |
| 2902 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 2903 | wmi_mtrace(WMI_MGMT_TX_SEND_CMDID, cmd->vdev_id, 0); |
Madhvapathi Sriram | 9130ff2 | 2018-04-20 09:22:51 +0530 | [diff] [blame] | 2904 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2905 | WMI_MGMT_TX_SEND_CMDID)) { |
| 2906 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
| 2907 | goto free_buf; |
| 2908 | } |
| 2909 | return QDF_STATUS_SUCCESS; |
| 2910 | |
| 2911 | free_buf: |
| 2912 | wmi_buf_free(buf); |
| 2913 | return QDF_STATUS_E_FAILURE; |
| 2914 | } |
| 2915 | #else |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2916 | /** |
| 2917 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 2918 | * @wmi_handle : handle to WMI. |
| 2919 | * @param : pointer to hold mgmt cmd parameter |
| 2920 | * |
| 2921 | * Return: 0 on success and -ve on failure. |
| 2922 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2923 | static QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2924 | struct wmi_mgmt_params *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2925 | { |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2926 | wmi_buf_t buf; |
| 2927 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 2928 | int32_t cmd_len; |
| 2929 | uint64_t dma_addr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2930 | void *qdf_ctx = param->qdf_ctx; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2931 | uint8_t *bufp; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2932 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2933 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 2934 | mgmt_tx_dl_frm_len; |
| 2935 | |
| 2936 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2937 | WMI_TLV_HDR_SIZE + |
| 2938 | roundup(bufp_len, sizeof(uint32_t)); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2939 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2940 | buf = wmi_buf_alloc(wmi_handle, sizeof(wmi_tx_send_params) + cmd_len); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2941 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2942 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2943 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2944 | } |
| 2945 | |
| 2946 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 2947 | bufp = (uint8_t *) cmd; |
| 2948 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2949 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 2950 | WMITLV_GET_STRUCT_TLVLEN |
| 2951 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 2952 | |
| 2953 | cmd->vdev_id = param->vdev_id; |
| 2954 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 2955 | cmd->desc_id = param->desc_id; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2956 | cmd->chanfreq = param->chanfreq; |
| 2957 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 2958 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2959 | sizeof(uint32_t))); |
| 2960 | bufp += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2961 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
Himanshu Agarwal | e3d1374 | 2017-04-04 12:36:33 +0530 | [diff] [blame] | 2962 | |
| 2963 | status = qdf_nbuf_map_single(qdf_ctx, param->tx_frame, |
| 2964 | QDF_DMA_TO_DEVICE); |
| 2965 | if (status != QDF_STATUS_SUCCESS) { |
| 2966 | WMI_LOGE("%s: wmi buf map failed", __func__); |
Himanshu Agarwal | f06d9e3 | 2018-02-12 19:09:12 +0530 | [diff] [blame] | 2967 | goto free_buf; |
Himanshu Agarwal | e3d1374 | 2017-04-04 12:36:33 +0530 | [diff] [blame] | 2968 | } |
| 2969 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2970 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2971 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
Orhan K AKYILDIZ | 271641f | 2017-01-29 15:17:12 -0800 | [diff] [blame] | 2972 | #if defined(HTT_PADDR64) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2973 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2974 | #endif |
| 2975 | cmd->frame_len = param->frm_len; |
| 2976 | cmd->buf_len = bufp_len; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2977 | cmd->tx_params_valid = param->tx_params_valid; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2978 | |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2979 | wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 2980 | bufp, cmd->vdev_id, cmd->chanfreq); |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2981 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2982 | bufp += roundup(bufp_len, sizeof(uint32_t)); |
| 2983 | if (param->tx_params_valid) { |
| 2984 | status = populate_tx_send_params(bufp, param->tx_param); |
| 2985 | if (status != QDF_STATUS_SUCCESS) { |
| 2986 | WMI_LOGE("%s: Populate TX send params failed", |
| 2987 | __func__); |
Himanshu Agarwal | f06d9e3 | 2018-02-12 19:09:12 +0530 | [diff] [blame] | 2988 | goto unmap_tx_frame; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2989 | } |
| 2990 | cmd_len += sizeof(wmi_tx_send_params); |
| 2991 | } |
| 2992 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 2993 | wmi_mtrace(WMI_MGMT_TX_SEND_CMDID, cmd->vdev_id, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2994 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2995 | WMI_MGMT_TX_SEND_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2996 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
Himanshu Agarwal | f06d9e3 | 2018-02-12 19:09:12 +0530 | [diff] [blame] | 2997 | goto unmap_tx_frame; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2998 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2999 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3000 | |
Himanshu Agarwal | f06d9e3 | 2018-02-12 19:09:12 +0530 | [diff] [blame] | 3001 | unmap_tx_frame: |
| 3002 | qdf_nbuf_unmap_single(qdf_ctx, param->tx_frame, |
| 3003 | QDF_DMA_TO_DEVICE); |
| 3004 | free_buf: |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3005 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3006 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3007 | } |
Madhvapathi Sriram | 9130ff2 | 2018-04-20 09:22:51 +0530 | [diff] [blame] | 3008 | #endif /* CONFIG_HL_SUPPORT */ |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3009 | |
| 3010 | /** |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3011 | * send_offchan_data_tx_send_cmd_tlv() - Send off-chan tx data |
| 3012 | * @wmi_handle : handle to WMI. |
| 3013 | * @param : pointer to offchan data tx cmd parameter |
| 3014 | * |
| 3015 | * Return: QDF_STATUS_SUCCESS on success and error on failure. |
| 3016 | */ |
| 3017 | static QDF_STATUS send_offchan_data_tx_cmd_tlv(wmi_unified_t wmi_handle, |
| 3018 | struct wmi_offchan_data_tx_params *param) |
| 3019 | { |
| 3020 | wmi_buf_t buf; |
| 3021 | wmi_offchan_data_tx_send_cmd_fixed_param *cmd; |
| 3022 | int32_t cmd_len; |
| 3023 | uint64_t dma_addr; |
| 3024 | void *qdf_ctx = param->qdf_ctx; |
| 3025 | uint8_t *bufp; |
| 3026 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? |
| 3027 | param->frm_len : mgmt_tx_dl_frm_len; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3028 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3029 | |
| 3030 | cmd_len = sizeof(wmi_offchan_data_tx_send_cmd_fixed_param) + |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3031 | WMI_TLV_HDR_SIZE + |
| 3032 | roundup(bufp_len, sizeof(uint32_t)); |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3033 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3034 | buf = wmi_buf_alloc(wmi_handle, sizeof(wmi_tx_send_params) + cmd_len); |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3035 | if (!buf) { |
| 3036 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 3037 | return QDF_STATUS_E_NOMEM; |
| 3038 | } |
| 3039 | |
| 3040 | cmd = (wmi_offchan_data_tx_send_cmd_fixed_param *) wmi_buf_data(buf); |
| 3041 | bufp = (uint8_t *) cmd; |
| 3042 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3043 | WMITLV_TAG_STRUC_wmi_offchan_data_tx_send_cmd_fixed_param, |
| 3044 | WMITLV_GET_STRUCT_TLVLEN |
| 3045 | (wmi_offchan_data_tx_send_cmd_fixed_param)); |
| 3046 | |
| 3047 | cmd->vdev_id = param->vdev_id; |
| 3048 | |
| 3049 | cmd->desc_id = param->desc_id; |
| 3050 | cmd->chanfreq = param->chanfreq; |
| 3051 | bufp += sizeof(wmi_offchan_data_tx_send_cmd_fixed_param); |
| 3052 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 3053 | sizeof(uint32_t))); |
| 3054 | bufp += WMI_TLV_HDR_SIZE; |
| 3055 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 3056 | qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE); |
| 3057 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
| 3058 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
| 3059 | #if defined(HTT_PADDR64) |
| 3060 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 3061 | #endif |
| 3062 | cmd->frame_len = param->frm_len; |
| 3063 | cmd->buf_len = bufp_len; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3064 | cmd->tx_params_valid = param->tx_params_valid; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3065 | |
| 3066 | wmi_mgmt_cmd_record(wmi_handle, WMI_OFFCHAN_DATA_TX_SEND_CMDID, |
| 3067 | bufp, cmd->vdev_id, cmd->chanfreq); |
| 3068 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3069 | bufp += roundup(bufp_len, sizeof(uint32_t)); |
| 3070 | if (param->tx_params_valid) { |
| 3071 | status = populate_tx_send_params(bufp, param->tx_param); |
| 3072 | if (status != QDF_STATUS_SUCCESS) { |
| 3073 | WMI_LOGE("%s: Populate TX send params failed", |
| 3074 | __func__); |
| 3075 | goto err1; |
| 3076 | } |
| 3077 | cmd_len += sizeof(wmi_tx_send_params); |
| 3078 | } |
| 3079 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3080 | wmi_mtrace(WMI_OFFCHAN_DATA_TX_SEND_CMDID, cmd->vdev_id, 0); |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3081 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 3082 | WMI_OFFCHAN_DATA_TX_SEND_CMDID)) { |
| 3083 | WMI_LOGE("%s: Failed to offchan data Tx", __func__); |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3084 | goto err1; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3085 | } |
| 3086 | |
| 3087 | return QDF_STATUS_SUCCESS; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3088 | |
| 3089 | err1: |
| 3090 | wmi_buf_free(buf); |
| 3091 | return QDF_STATUS_E_FAILURE; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3092 | } |
| 3093 | |
| 3094 | /** |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3095 | * send_modem_power_state_cmd_tlv() - set modem power state to fw |
| 3096 | * @wmi_handle: wmi handle |
| 3097 | * @param_value: parameter value |
| 3098 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3099 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3100 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3101 | static QDF_STATUS send_modem_power_state_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3102 | uint32_t param_value) |
| 3103 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3104 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3105 | wmi_modem_power_state_cmd_param *cmd; |
| 3106 | wmi_buf_t buf; |
| 3107 | uint16_t len = sizeof(*cmd); |
| 3108 | |
| 3109 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3110 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3111 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3112 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3113 | } |
| 3114 | cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf); |
| 3115 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3116 | WMITLV_TAG_STRUC_wmi_modem_power_state_cmd_param, |
| 3117 | WMITLV_GET_STRUCT_TLVLEN |
| 3118 | (wmi_modem_power_state_cmd_param)); |
| 3119 | cmd->modem_power_state = param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3120 | WMI_LOGD("%s: Setting cmd->modem_power_state = %u", __func__, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3121 | param_value); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3122 | wmi_mtrace(WMI_MODEM_POWER_STATE_CMDID, NO_SESSION, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3123 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3124 | WMI_MODEM_POWER_STATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3125 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3126 | WMI_LOGE("Failed to send notify cmd ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3127 | wmi_buf_free(buf); |
| 3128 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3129 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3130 | return ret; |
| 3131 | } |
| 3132 | |
| 3133 | /** |
| 3134 | * send_set_sta_ps_mode_cmd_tlv() - set sta powersave mode in fw |
| 3135 | * @wmi_handle: wmi handle |
| 3136 | * @vdev_id: vdev id |
| 3137 | * @val: value |
| 3138 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3139 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3140 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3141 | static QDF_STATUS send_set_sta_ps_mode_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3142 | uint32_t vdev_id, uint8_t val) |
| 3143 | { |
| 3144 | wmi_sta_powersave_mode_cmd_fixed_param *cmd; |
| 3145 | wmi_buf_t buf; |
| 3146 | int32_t len = sizeof(*cmd); |
| 3147 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3148 | WMI_LOGD("Set Sta Mode Ps vdevId %d val %d", vdev_id, val); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3149 | |
| 3150 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3151 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3152 | WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3153 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3154 | } |
| 3155 | cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 3156 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3157 | WMITLV_TAG_STRUC_wmi_sta_powersave_mode_cmd_fixed_param, |
| 3158 | WMITLV_GET_STRUCT_TLVLEN |
| 3159 | (wmi_sta_powersave_mode_cmd_fixed_param)); |
| 3160 | cmd->vdev_id = vdev_id; |
| 3161 | if (val) |
| 3162 | cmd->sta_ps_mode = WMI_STA_PS_MODE_ENABLED; |
| 3163 | else |
| 3164 | cmd->sta_ps_mode = WMI_STA_PS_MODE_DISABLED; |
| 3165 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3166 | wmi_mtrace(WMI_STA_POWERSAVE_MODE_CMDID, cmd->vdev_id, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3167 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3168 | WMI_STA_POWERSAVE_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3169 | WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3170 | vdev_id, val); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3171 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3172 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3173 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 3174 | return 0; |
| 3175 | } |
| 3176 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3177 | /** |
| 3178 | * send_set_mimops_cmd_tlv() - set MIMO powersave |
| 3179 | * @wmi_handle: wmi handle |
| 3180 | * @vdev_id: vdev id |
| 3181 | * @value: value |
| 3182 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3183 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3184 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3185 | static QDF_STATUS send_set_mimops_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3186 | uint8_t vdev_id, int value) |
| 3187 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3188 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3189 | wmi_sta_smps_force_mode_cmd_fixed_param *cmd; |
| 3190 | wmi_buf_t buf; |
| 3191 | uint16_t len = sizeof(*cmd); |
| 3192 | |
| 3193 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3194 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3195 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3196 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3197 | } |
| 3198 | cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 3199 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3200 | WMITLV_TAG_STRUC_wmi_sta_smps_force_mode_cmd_fixed_param, |
| 3201 | WMITLV_GET_STRUCT_TLVLEN |
| 3202 | (wmi_sta_smps_force_mode_cmd_fixed_param)); |
| 3203 | |
| 3204 | cmd->vdev_id = vdev_id; |
| 3205 | |
Houston Hoffman | b516805 | 2016-04-14 02:18:01 -0700 | [diff] [blame] | 3206 | /* WMI_SMPS_FORCED_MODE values do not directly map |
| 3207 | * to SM power save values defined in the specification. |
| 3208 | * Make sure to send the right mapping. |
| 3209 | */ |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3210 | switch (value) { |
| 3211 | case 0: |
| 3212 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_NONE; |
| 3213 | break; |
| 3214 | case 1: |
| 3215 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DISABLED; |
| 3216 | break; |
| 3217 | case 2: |
| 3218 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_STATIC; |
| 3219 | break; |
| 3220 | case 3: |
| 3221 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DYNAMIC; |
| 3222 | break; |
| 3223 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3224 | WMI_LOGE("%s:INVALID Mimo PS CONFIG", __func__); |
Surabhi Vishnoi | 83f677e | 2018-04-26 09:46:39 +0530 | [diff] [blame] | 3225 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3226 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3227 | } |
| 3228 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3229 | WMI_LOGD("Setting vdev %d value = %u", vdev_id, value); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3230 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3231 | wmi_mtrace(WMI_STA_SMPS_FORCE_MODE_CMDID, cmd->vdev_id, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3232 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3233 | WMI_STA_SMPS_FORCE_MODE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3234 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3235 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3236 | wmi_buf_free(buf); |
| 3237 | } |
| 3238 | |
| 3239 | return ret; |
| 3240 | } |
| 3241 | |
| 3242 | /** |
| 3243 | * send_set_smps_params_cmd_tlv() - set smps params |
| 3244 | * @wmi_handle: wmi handle |
| 3245 | * @vdev_id: vdev id |
| 3246 | * @value: value |
| 3247 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3248 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3249 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3250 | static QDF_STATUS send_set_smps_params_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3251 | int value) |
| 3252 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3253 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3254 | wmi_sta_smps_param_cmd_fixed_param *cmd; |
| 3255 | wmi_buf_t buf; |
| 3256 | uint16_t len = sizeof(*cmd); |
| 3257 | |
| 3258 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3259 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3260 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3261 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3262 | } |
| 3263 | cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 3264 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3265 | WMITLV_TAG_STRUC_wmi_sta_smps_param_cmd_fixed_param, |
| 3266 | WMITLV_GET_STRUCT_TLVLEN |
| 3267 | (wmi_sta_smps_param_cmd_fixed_param)); |
| 3268 | |
| 3269 | cmd->vdev_id = vdev_id; |
| 3270 | cmd->value = value & WMI_SMPS_MASK_LOWER_16BITS; |
| 3271 | cmd->param = |
| 3272 | (value >> WMI_SMPS_PARAM_VALUE_S) & WMI_SMPS_MASK_UPPER_3BITS; |
| 3273 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3274 | WMI_LOGD("Setting vdev %d value = %x param %x", vdev_id, cmd->value, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3275 | cmd->param); |
| 3276 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3277 | wmi_mtrace(WMI_STA_SMPS_PARAM_CMDID, cmd->vdev_id, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3278 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3279 | WMI_STA_SMPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3280 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3281 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3282 | wmi_buf_free(buf); |
| 3283 | } |
| 3284 | |
| 3285 | return ret; |
| 3286 | } |
| 3287 | |
| 3288 | /** |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3289 | * send_get_temperature_cmd_tlv() - get pdev temperature req |
| 3290 | * @wmi_handle: wmi handle |
| 3291 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3292 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3293 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3294 | static QDF_STATUS send_get_temperature_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3295 | { |
| 3296 | wmi_pdev_get_temperature_cmd_fixed_param *cmd; |
| 3297 | wmi_buf_t wmi_buf; |
| 3298 | uint32_t len = sizeof(wmi_pdev_get_temperature_cmd_fixed_param); |
| 3299 | uint8_t *buf_ptr; |
| 3300 | |
| 3301 | if (!wmi_handle) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3302 | WMI_LOGE(FL("WMI is closed, can not issue cmd")); |
| 3303 | return QDF_STATUS_E_INVAL; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3304 | } |
| 3305 | |
| 3306 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 3307 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3308 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3309 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3310 | } |
| 3311 | |
| 3312 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3313 | |
| 3314 | cmd = (wmi_pdev_get_temperature_cmd_fixed_param *) buf_ptr; |
| 3315 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3316 | WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, |
| 3317 | WMITLV_GET_STRUCT_TLVLEN |
| 3318 | (wmi_pdev_get_temperature_cmd_fixed_param)); |
| 3319 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3320 | wmi_mtrace(WMI_PDEV_GET_TEMPERATURE_CMDID, NO_SESSION, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3321 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 3322 | WMI_PDEV_GET_TEMPERATURE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3323 | WMI_LOGE(FL("failed to send get temperature command")); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3324 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3325 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3326 | } |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3327 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3328 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3329 | } |
| 3330 | |
| 3331 | /** |
| 3332 | * send_set_sta_uapsd_auto_trig_cmd_tlv() - set uapsd auto trigger command |
| 3333 | * @wmi_handle: wmi handle |
| 3334 | * @vdevid: vdev id |
| 3335 | * @peer_addr: peer mac address |
| 3336 | * @auto_triggerparam: auto trigger parameters |
| 3337 | * @num_ac: number of access category |
| 3338 | * |
| 3339 | * This function sets the trigger |
| 3340 | * uapsd params such as service interval, delay interval |
| 3341 | * and suspend interval which will be used by the firmware |
| 3342 | * to send trigger frames periodically when there is no |
| 3343 | * traffic on the transmit side. |
| 3344 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3345 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3346 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3347 | static QDF_STATUS send_set_sta_uapsd_auto_trig_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3348 | struct sta_uapsd_trig_params *param) |
| 3349 | { |
| 3350 | wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3351 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3352 | uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param); |
| 3353 | uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE; |
| 3354 | uint32_t i; |
| 3355 | wmi_buf_t buf; |
| 3356 | uint8_t *buf_ptr; |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3357 | struct sta_uapsd_params *uapsd_param; |
| 3358 | wmi_sta_uapsd_auto_trig_param *trig_param; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3359 | |
| 3360 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 3361 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3362 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3363 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3364 | } |
| 3365 | |
| 3366 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3367 | cmd = (wmi_sta_uapsd_auto_trig_cmd_fixed_param *) buf_ptr; |
| 3368 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3369 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_cmd_fixed_param, |
| 3370 | WMITLV_GET_STRUCT_TLVLEN |
| 3371 | (wmi_sta_uapsd_auto_trig_cmd_fixed_param)); |
| 3372 | cmd->vdev_id = param->vdevid; |
| 3373 | cmd->num_ac = param->num_ac; |
| 3374 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 3375 | |
| 3376 | /* TLV indicating array of structures to follow */ |
| 3377 | buf_ptr += sizeof(*cmd); |
| 3378 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, param_len); |
| 3379 | |
| 3380 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3381 | |
| 3382 | /* |
| 3383 | * Update tag and length for uapsd auto trigger params (this will take |
| 3384 | * care of updating tag and length if it is not pre-filled by caller). |
| 3385 | */ |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3386 | uapsd_param = (struct sta_uapsd_params *)param->auto_triggerparam; |
| 3387 | trig_param = (wmi_sta_uapsd_auto_trig_param *)buf_ptr; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3388 | for (i = 0; i < param->num_ac; i++) { |
| 3389 | WMITLV_SET_HDR((buf_ptr + |
| 3390 | (i * sizeof(wmi_sta_uapsd_auto_trig_param))), |
| 3391 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_param, |
| 3392 | WMITLV_GET_STRUCT_TLVLEN |
| 3393 | (wmi_sta_uapsd_auto_trig_param)); |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3394 | trig_param->wmm_ac = uapsd_param->wmm_ac; |
| 3395 | trig_param->user_priority = uapsd_param->user_priority; |
| 3396 | trig_param->service_interval = uapsd_param->service_interval; |
| 3397 | trig_param->suspend_interval = uapsd_param->suspend_interval; |
| 3398 | trig_param->delay_interval = uapsd_param->delay_interval; |
| 3399 | trig_param++; |
| 3400 | uapsd_param++; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3401 | } |
| 3402 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3403 | wmi_mtrace(WMI_STA_UAPSD_AUTO_TRIG_CMDID, cmd->vdev_id, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3404 | ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 3405 | WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3406 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3407 | WMI_LOGE("Failed to send set uapsd param ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3408 | wmi_buf_free(buf); |
| 3409 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3410 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3411 | return ret; |
| 3412 | } |
| 3413 | |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3414 | /** |
| 3415 | * send_set_thermal_mgmt_cmd_tlv() - set thermal mgmt command to fw |
| 3416 | * @wmi_handle: Pointer to wmi handle |
| 3417 | * @thermal_info: Thermal command information |
| 3418 | * |
| 3419 | * This function sends the thermal management command |
| 3420 | * to the firmware |
| 3421 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3422 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3423 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3424 | static QDF_STATUS send_set_thermal_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3425 | struct thermal_cmd_params *thermal_info) |
| 3426 | { |
| 3427 | wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL; |
| 3428 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3429 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3430 | uint32_t len = 0; |
| 3431 | |
| 3432 | len = sizeof(*cmd); |
| 3433 | |
| 3434 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3435 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3436 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 3437 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3438 | } |
| 3439 | |
| 3440 | cmd = (wmi_thermal_mgmt_cmd_fixed_param *) wmi_buf_data(buf); |
| 3441 | |
| 3442 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3443 | WMITLV_TAG_STRUC_wmi_thermal_mgmt_cmd_fixed_param, |
| 3444 | WMITLV_GET_STRUCT_TLVLEN |
| 3445 | (wmi_thermal_mgmt_cmd_fixed_param)); |
| 3446 | |
| 3447 | cmd->lower_thresh_degreeC = thermal_info->min_temp; |
| 3448 | cmd->upper_thresh_degreeC = thermal_info->max_temp; |
| 3449 | cmd->enable = thermal_info->thermal_enable; |
| 3450 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3451 | WMI_LOGE("TM Sending thermal mgmt cmd: low temp %d, upper temp %d, enabled %d", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3452 | cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); |
| 3453 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3454 | wmi_mtrace(WMI_THERMAL_MGMT_CMDID, NO_SESSION, 0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3455 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3456 | WMI_THERMAL_MGMT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3457 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3458 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3459 | WMI_LOGE("%s:Failed to send thermal mgmt command", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3460 | } |
| 3461 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3462 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3463 | } |
| 3464 | |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3465 | /** |
| 3466 | * send_lro_config_cmd_tlv() - process the LRO config command |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3467 | * @wmi_handle: Pointer to WMI handle |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3468 | * @wmi_lro_cmd: Pointer to LRO configuration parameters |
| 3469 | * |
| 3470 | * This function sends down the LRO configuration parameters to |
| 3471 | * the firmware to enable LRO, sets the TCP flags and sets the |
| 3472 | * seed values for the toeplitz hash generation |
| 3473 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3474 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3475 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3476 | static QDF_STATUS send_lro_config_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3477 | struct wmi_lro_config_cmd_t *wmi_lro_cmd) |
| 3478 | { |
| 3479 | wmi_lro_info_cmd_fixed_param *cmd; |
| 3480 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3481 | QDF_STATUS status; |
Tallapragada Kalyan | 85a7400 | 2018-08-28 12:34:21 +0530 | [diff] [blame] | 3482 | uint8_t pdev_id = wmi_lro_cmd->pdev_id; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3483 | |
| 3484 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3485 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3486 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 3487 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3488 | } |
| 3489 | |
| 3490 | cmd = (wmi_lro_info_cmd_fixed_param *) wmi_buf_data(buf); |
| 3491 | |
| 3492 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3493 | WMITLV_TAG_STRUC_wmi_lro_info_cmd_fixed_param, |
| 3494 | WMITLV_GET_STRUCT_TLVLEN(wmi_lro_info_cmd_fixed_param)); |
| 3495 | |
| 3496 | cmd->lro_enable = wmi_lro_cmd->lro_enable; |
| 3497 | WMI_LRO_INFO_TCP_FLAG_VALS_SET(cmd->tcp_flag_u32, |
| 3498 | wmi_lro_cmd->tcp_flag); |
| 3499 | WMI_LRO_INFO_TCP_FLAGS_MASK_SET(cmd->tcp_flag_u32, |
| 3500 | wmi_lro_cmd->tcp_flag_mask); |
| 3501 | cmd->toeplitz_hash_ipv4_0_3 = |
| 3502 | wmi_lro_cmd->toeplitz_hash_ipv4[0]; |
| 3503 | cmd->toeplitz_hash_ipv4_4_7 = |
| 3504 | wmi_lro_cmd->toeplitz_hash_ipv4[1]; |
| 3505 | cmd->toeplitz_hash_ipv4_8_11 = |
| 3506 | wmi_lro_cmd->toeplitz_hash_ipv4[2]; |
| 3507 | cmd->toeplitz_hash_ipv4_12_15 = |
| 3508 | wmi_lro_cmd->toeplitz_hash_ipv4[3]; |
| 3509 | cmd->toeplitz_hash_ipv4_16 = |
| 3510 | wmi_lro_cmd->toeplitz_hash_ipv4[4]; |
| 3511 | |
| 3512 | cmd->toeplitz_hash_ipv6_0_3 = |
| 3513 | wmi_lro_cmd->toeplitz_hash_ipv6[0]; |
| 3514 | cmd->toeplitz_hash_ipv6_4_7 = |
| 3515 | wmi_lro_cmd->toeplitz_hash_ipv6[1]; |
| 3516 | cmd->toeplitz_hash_ipv6_8_11 = |
| 3517 | wmi_lro_cmd->toeplitz_hash_ipv6[2]; |
| 3518 | cmd->toeplitz_hash_ipv6_12_15 = |
| 3519 | wmi_lro_cmd->toeplitz_hash_ipv6[3]; |
| 3520 | cmd->toeplitz_hash_ipv6_16_19 = |
| 3521 | wmi_lro_cmd->toeplitz_hash_ipv6[4]; |
| 3522 | cmd->toeplitz_hash_ipv6_20_23 = |
| 3523 | wmi_lro_cmd->toeplitz_hash_ipv6[5]; |
| 3524 | cmd->toeplitz_hash_ipv6_24_27 = |
| 3525 | wmi_lro_cmd->toeplitz_hash_ipv6[6]; |
| 3526 | cmd->toeplitz_hash_ipv6_28_31 = |
| 3527 | wmi_lro_cmd->toeplitz_hash_ipv6[7]; |
| 3528 | cmd->toeplitz_hash_ipv6_32_35 = |
| 3529 | wmi_lro_cmd->toeplitz_hash_ipv6[8]; |
| 3530 | cmd->toeplitz_hash_ipv6_36_39 = |
| 3531 | wmi_lro_cmd->toeplitz_hash_ipv6[9]; |
| 3532 | cmd->toeplitz_hash_ipv6_40 = |
| 3533 | wmi_lro_cmd->toeplitz_hash_ipv6[10]; |
| 3534 | |
Tallapragada Kalyan | 85a7400 | 2018-08-28 12:34:21 +0530 | [diff] [blame] | 3535 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
| 3536 | WMI_LOGD("WMI_LRO_CONFIG: lro_enable %d, tcp_flag 0x%x, pdev_id: %d", |
| 3537 | cmd->lro_enable, cmd->tcp_flag_u32, cmd->pdev_id); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3538 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3539 | wmi_mtrace(WMI_LRO_CONFIG_CMDID, NO_SESSION, 0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3540 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 3541 | sizeof(*cmd), WMI_LRO_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3542 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3543 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3544 | WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3545 | } |
| 3546 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3547 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3548 | } |
| 3549 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3550 | /** |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3551 | * send_peer_rate_report_cmd_tlv() - process the peer rate report command |
| 3552 | * @wmi_handle: Pointer to wmi handle |
| 3553 | * @rate_report_params: Pointer to peer rate report parameters |
| 3554 | * |
| 3555 | * |
| 3556 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
| 3557 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3558 | static QDF_STATUS send_peer_rate_report_cmd_tlv(wmi_unified_t wmi_handle, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3559 | struct wmi_peer_rate_report_params *rate_report_params) |
| 3560 | { |
| 3561 | wmi_peer_set_rate_report_condition_fixed_param *cmd = NULL; |
| 3562 | wmi_buf_t buf = NULL; |
| 3563 | QDF_STATUS status = 0; |
| 3564 | uint32_t len = 0; |
| 3565 | uint32_t i, j; |
| 3566 | |
| 3567 | len = sizeof(*cmd); |
| 3568 | |
| 3569 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3570 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 3571 | WMI_LOGE("Failed to alloc buf to peer_set_condition cmd"); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3572 | return QDF_STATUS_E_FAILURE; |
| 3573 | } |
| 3574 | |
| 3575 | cmd = (wmi_peer_set_rate_report_condition_fixed_param *) |
| 3576 | wmi_buf_data(buf); |
| 3577 | |
| 3578 | WMITLV_SET_HDR( |
| 3579 | &cmd->tlv_header, |
| 3580 | WMITLV_TAG_STRUC_wmi_peer_set_rate_report_condition_fixed_param, |
| 3581 | WMITLV_GET_STRUCT_TLVLEN( |
| 3582 | wmi_peer_set_rate_report_condition_fixed_param)); |
| 3583 | |
| 3584 | cmd->enable_rate_report = rate_report_params->rate_report_enable; |
| 3585 | cmd->report_backoff_time = rate_report_params->backoff_time; |
| 3586 | cmd->report_timer_period = rate_report_params->timer_period; |
| 3587 | for (i = 0; i < PEER_RATE_REPORT_COND_MAX_NUM; i++) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 3588 | cmd->cond_per_phy[i].val_cond_flags = |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3589 | rate_report_params->report_per_phy[i].cond_flags; |
| 3590 | cmd->cond_per_phy[i].rate_delta.min_delta = |
| 3591 | rate_report_params->report_per_phy[i].delta.delta_min; |
| 3592 | cmd->cond_per_phy[i].rate_delta.percentage = |
| 3593 | rate_report_params->report_per_phy[i].delta.percent; |
| 3594 | for (j = 0; j < MAX_NUM_OF_RATE_THRESH; j++) { |
| 3595 | cmd->cond_per_phy[i].rate_threshold[j] = |
| 3596 | rate_report_params->report_per_phy[i]. |
| 3597 | report_rate_threshold[j]; |
| 3598 | } |
| 3599 | } |
| 3600 | |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 3601 | WMI_LOGE("%s enable %d backoff_time %d period %d", __func__, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3602 | cmd->enable_rate_report, |
| 3603 | cmd->report_backoff_time, cmd->report_timer_period); |
| 3604 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3605 | wmi_mtrace(WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID, NO_SESSION, 0); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3606 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3607 | WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); |
| 3608 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3609 | wmi_buf_free(buf); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3610 | WMI_LOGE("%s:Failed to send peer_set_report_cond command", |
| 3611 | __func__); |
| 3612 | } |
| 3613 | return status; |
| 3614 | } |
| 3615 | |
| 3616 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3617 | * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL |
| 3618 | * @wmi_handle: wmi handle |
| 3619 | * @param: bcn ll cmd parameter |
| 3620 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3621 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3622 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3623 | static QDF_STATUS send_bcn_buf_ll_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3624 | wmi_bcn_send_from_host_cmd_fixed_param *param) |
| 3625 | { |
| 3626 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 3627 | wmi_buf_t wmi_buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3628 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3629 | |
| 3630 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3631 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3632 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 3633 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3634 | } |
| 3635 | |
| 3636 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 3637 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3638 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 3639 | WMITLV_GET_STRUCT_TLVLEN |
| 3640 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 3641 | cmd->vdev_id = param->vdev_id; |
| 3642 | cmd->data_len = param->data_len; |
| 3643 | cmd->frame_ctrl = param->frame_ctrl; |
| 3644 | cmd->frag_ptr = param->frag_ptr; |
| 3645 | cmd->dtim_flag = param->dtim_flag; |
| 3646 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3647 | wmi_mtrace(WMI_PDEV_SEND_BCN_CMDID, cmd->vdev_id, 0); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3648 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 3649 | WMI_PDEV_SEND_BCN_CMDID); |
| 3650 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3651 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3652 | WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3653 | wmi_buf_free(wmi_buf); |
| 3654 | } |
| 3655 | |
| 3656 | return ret; |
| 3657 | } |
| 3658 | |
| 3659 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3660 | * send_process_update_edca_param_cmd_tlv() - update EDCA params |
| 3661 | * @wmi_handle: wmi handle |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 3662 | * @vdev_id: vdev id. |
| 3663 | * @wmm_vparams: edca parameters |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3664 | * |
| 3665 | * This function updates EDCA parameters to the target |
| 3666 | * |
| 3667 | * Return: CDF Status |
| 3668 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3669 | static QDF_STATUS send_process_update_edca_param_cmd_tlv(wmi_unified_t wmi_handle, |
Kiran Kumar Lokere | a536eac | 2018-04-06 16:56:47 -0700 | [diff] [blame] | 3670 | uint8_t vdev_id, bool mu_edca_param, |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 3671 | struct wmi_host_wme_vparams wmm_vparams[WMI_MAX_NUM_AC]) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3672 | { |
| 3673 | uint8_t *buf_ptr; |
| 3674 | wmi_buf_t buf; |
| 3675 | wmi_vdev_set_wmm_params_cmd_fixed_param *cmd; |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 3676 | wmi_wmm_vparams *wmm_param; |
| 3677 | struct wmi_host_wme_vparams *twmm_param; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3678 | int len = sizeof(*cmd); |
| 3679 | int ac; |
| 3680 | |
| 3681 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3682 | |
| 3683 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3684 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 3685 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3686 | } |
| 3687 | |
| 3688 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3689 | cmd = (wmi_vdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 3690 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3691 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 3692 | WMITLV_GET_STRUCT_TLVLEN |
| 3693 | (wmi_vdev_set_wmm_params_cmd_fixed_param)); |
| 3694 | cmd->vdev_id = vdev_id; |
Kiran Kumar Lokere | a536eac | 2018-04-06 16:56:47 -0700 | [diff] [blame] | 3695 | cmd->wmm_param_type = mu_edca_param; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3696 | |
| 3697 | for (ac = 0; ac < WMI_MAX_NUM_AC; ac++) { |
| 3698 | wmm_param = (wmi_wmm_vparams *) (&cmd->wmm_params[ac]); |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 3699 | twmm_param = (struct wmi_host_wme_vparams *) (&wmm_vparams[ac]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3700 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 3701 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 3702 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_vparams)); |
| 3703 | wmm_param->cwmin = twmm_param->cwmin; |
| 3704 | wmm_param->cwmax = twmm_param->cwmax; |
| 3705 | wmm_param->aifs = twmm_param->aifs; |
Kiran Kumar Lokere | a536eac | 2018-04-06 16:56:47 -0700 | [diff] [blame] | 3706 | if (mu_edca_param) |
| 3707 | wmm_param->mu_edca_timer = twmm_param->mu_edca_timer; |
| 3708 | else |
| 3709 | wmm_param->txoplimit = twmm_param->txoplimit; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3710 | wmm_param->acm = twmm_param->acm; |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 3711 | wmm_param->no_ack = twmm_param->noackpolicy; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3712 | } |
| 3713 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3714 | wmi_mtrace(WMI_VDEV_SET_WMM_PARAMS_CMDID, cmd->vdev_id, 0); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3715 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3716 | WMI_VDEV_SET_WMM_PARAMS_CMDID)) |
| 3717 | goto fail; |
| 3718 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3719 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3720 | |
| 3721 | fail: |
| 3722 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3723 | WMI_LOGE("%s: Failed to set WMM Paremeters", __func__); |
| 3724 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3725 | } |
| 3726 | |
| 3727 | /** |
| 3728 | * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw |
| 3729 | * @wmi_handle: wmi handle |
| 3730 | * @vdev_id: vdev id |
| 3731 | * @probe_rsp_info: probe response info |
| 3732 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3733 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3734 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3735 | static QDF_STATUS send_probe_rsp_tmpl_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3736 | uint8_t vdev_id, |
Krunal Soni | 8942686 | 2017-11-14 15:42:48 -0800 | [diff] [blame] | 3737 | struct wmi_probe_resp_params *probe_rsp_info) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3738 | { |
| 3739 | wmi_prb_tmpl_cmd_fixed_param *cmd; |
| 3740 | wmi_bcn_prb_info *bcn_prb_info; |
| 3741 | wmi_buf_t wmi_buf; |
| 3742 | uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len; |
| 3743 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3744 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3745 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3746 | WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3747 | |
Krunal Soni | 8942686 | 2017-11-14 15:42:48 -0800 | [diff] [blame] | 3748 | tmpl_len = probe_rsp_info->prb_rsp_template_len; |
Vivek | c582309 | 2018-03-22 23:27:21 +0530 | [diff] [blame] | 3749 | tmpl_len_aligned = roundup(tmpl_len, sizeof(uint32_t)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3750 | |
| 3751 | wmi_buf_len = sizeof(wmi_prb_tmpl_cmd_fixed_param) + |
| 3752 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 3753 | tmpl_len_aligned; |
| 3754 | |
| 3755 | if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3756 | WMI_LOGE(FL("wmi_buf_len: %d > %d. Can't send wmi cmd"), |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3757 | wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3758 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3759 | } |
| 3760 | |
| 3761 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 3762 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3763 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3764 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3765 | } |
| 3766 | |
| 3767 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3768 | |
| 3769 | cmd = (wmi_prb_tmpl_cmd_fixed_param *) buf_ptr; |
| 3770 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3771 | WMITLV_TAG_STRUC_wmi_prb_tmpl_cmd_fixed_param, |
| 3772 | WMITLV_GET_STRUCT_TLVLEN(wmi_prb_tmpl_cmd_fixed_param)); |
| 3773 | cmd->vdev_id = vdev_id; |
| 3774 | cmd->buf_len = tmpl_len; |
| 3775 | buf_ptr += sizeof(wmi_prb_tmpl_cmd_fixed_param); |
| 3776 | |
| 3777 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 3778 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 3779 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 3780 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 3781 | bcn_prb_info->caps = 0; |
| 3782 | bcn_prb_info->erp = 0; |
| 3783 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 3784 | |
| 3785 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, tmpl_len_aligned); |
| 3786 | buf_ptr += WMI_TLV_HDR_SIZE; |
Krunal Soni | 8942686 | 2017-11-14 15:42:48 -0800 | [diff] [blame] | 3787 | qdf_mem_copy(buf_ptr, probe_rsp_info->prb_rsp_template_frm, tmpl_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3788 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3789 | wmi_mtrace(WMI_PRB_TMPL_CMDID, cmd->vdev_id, 0); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3790 | ret = wmi_unified_cmd_send(wmi_handle, |
| 3791 | wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3792 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3793 | WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3794 | wmi_buf_free(wmi_buf); |
| 3795 | } |
| 3796 | |
| 3797 | return ret; |
| 3798 | } |
| 3799 | |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 3800 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3801 | #define WPI_IV_LEN 16 |
| 3802 | |
| 3803 | /** |
| 3804 | * wmi_update_wpi_key_counter() - update WAPI tsc and rsc key counters |
| 3805 | * |
| 3806 | * @dest_tx: destination address of tsc key counter |
| 3807 | * @src_tx: source address of tsc key counter |
| 3808 | * @dest_rx: destination address of rsc key counter |
| 3809 | * @src_rx: source address of rsc key counter |
| 3810 | * |
| 3811 | * This function copies WAPI tsc and rsc key counters in the wmi buffer. |
| 3812 | * |
| 3813 | * Return: None |
| 3814 | * |
| 3815 | */ |
| 3816 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 3817 | uint8_t *dest_rx, uint8_t *src_rx) |
| 3818 | { |
| 3819 | qdf_mem_copy(dest_tx, src_tx, WPI_IV_LEN); |
| 3820 | qdf_mem_copy(dest_rx, src_rx, WPI_IV_LEN); |
| 3821 | } |
| 3822 | #else |
| 3823 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 3824 | uint8_t *dest_rx, uint8_t *src_rx) |
| 3825 | { |
| 3826 | return; |
| 3827 | } |
| 3828 | #endif |
| 3829 | |
| 3830 | /** |
| 3831 | * send_setup_install_key_cmd_tlv() - set key parameters |
| 3832 | * @wmi_handle: wmi handle |
| 3833 | * @key_params: key parameters |
| 3834 | * |
| 3835 | * This function fills structure from information |
| 3836 | * passed in key_params. |
| 3837 | * |
| 3838 | * Return: QDF_STATUS_SUCCESS - success |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 3839 | * QDF_STATUS_E_FAILURE - failure |
| 3840 | * QDF_STATUS_E_NOMEM - not able to allocate buffer |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3841 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3842 | static QDF_STATUS send_setup_install_key_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3843 | struct set_key_params *key_params) |
| 3844 | { |
| 3845 | wmi_vdev_install_key_cmd_fixed_param *cmd; |
| 3846 | wmi_buf_t buf; |
| 3847 | uint8_t *buf_ptr; |
| 3848 | uint32_t len; |
| 3849 | uint8_t *key_data; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3850 | QDF_STATUS status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3851 | |
| 3852 | len = sizeof(*cmd) + roundup(key_params->key_len, sizeof(uint32_t)) + |
| 3853 | WMI_TLV_HDR_SIZE; |
| 3854 | |
| 3855 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3856 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3857 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3858 | return QDF_STATUS_E_NOMEM; |
| 3859 | } |
| 3860 | |
| 3861 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3862 | cmd = (wmi_vdev_install_key_cmd_fixed_param *) buf_ptr; |
| 3863 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3864 | WMITLV_TAG_STRUC_wmi_vdev_install_key_cmd_fixed_param, |
| 3865 | WMITLV_GET_STRUCT_TLVLEN |
| 3866 | (wmi_vdev_install_key_cmd_fixed_param)); |
| 3867 | cmd->vdev_id = key_params->vdev_id; |
| 3868 | cmd->key_ix = key_params->key_idx; |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 3869 | |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 3870 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3871 | WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr); |
| 3872 | cmd->key_flags |= key_params->key_flags; |
| 3873 | cmd->key_cipher = key_params->key_cipher; |
| 3874 | if ((key_params->key_txmic_len) && |
| 3875 | (key_params->key_rxmic_len)) { |
| 3876 | cmd->key_txmic_len = key_params->key_txmic_len; |
| 3877 | cmd->key_rxmic_len = key_params->key_rxmic_len; |
| 3878 | } |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 3879 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3880 | wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter, |
| 3881 | key_params->tx_iv, |
| 3882 | cmd->wpi_key_rsc_counter, |
| 3883 | key_params->rx_iv); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 3884 | #endif |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3885 | buf_ptr += sizeof(wmi_vdev_install_key_cmd_fixed_param); |
| 3886 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3887 | roundup(key_params->key_len, sizeof(uint32_t))); |
Vivek | c582309 | 2018-03-22 23:27:21 +0530 | [diff] [blame] | 3888 | key_data = (uint8_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3889 | qdf_mem_copy((void *)key_data, |
| 3890 | (const void *)key_params->key_data, key_params->key_len); |
Krunal Soni | 3a0fd85 | 2017-10-24 23:33:05 -0700 | [diff] [blame] | 3891 | if (key_params->key_rsc_counter) |
| 3892 | qdf_mem_copy(&cmd->key_rsc_counter, key_params->key_rsc_counter, |
| 3893 | sizeof(wmi_key_seq_counter)); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3894 | cmd->key_len = key_params->key_len; |
| 3895 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3896 | wmi_mtrace(WMI_VDEV_INSTALL_KEY_CMDID, cmd->vdev_id, 0); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3897 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3898 | WMI_VDEV_INSTALL_KEY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3899 | if (QDF_IS_STATUS_ERROR(status)) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3900 | wmi_buf_free(buf); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3901 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3902 | return status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 3903 | } |
| 3904 | |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 3905 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3906 | * send_p2p_go_set_beacon_ie_cmd_tlv() - set beacon IE for p2p go |
| 3907 | * @wmi_handle: wmi handle |
| 3908 | * @vdev_id: vdev id |
| 3909 | * @p2p_ie: p2p IE |
| 3910 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3911 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3912 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3913 | static QDF_STATUS send_p2p_go_set_beacon_ie_cmd_tlv(wmi_unified_t wmi_handle, |
Vivek | c582309 | 2018-03-22 23:27:21 +0530 | [diff] [blame] | 3914 | uint32_t vdev_id, uint8_t *p2p_ie) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3915 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3916 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3917 | wmi_p2p_go_set_beacon_ie_fixed_param *cmd; |
| 3918 | wmi_buf_t wmi_buf; |
| 3919 | uint32_t ie_len, ie_len_aligned, wmi_buf_len; |
| 3920 | uint8_t *buf_ptr; |
| 3921 | |
| 3922 | ie_len = (uint32_t) (p2p_ie[1] + 2); |
| 3923 | |
| 3924 | /* More than one P2P IE may be included in a single frame. |
| 3925 | If multiple P2P IEs are present, the complete P2P attribute |
| 3926 | data consists of the concatenation of the P2P Attribute |
| 3927 | fields of the P2P IEs. The P2P Attributes field of each |
| 3928 | P2P IE may be any length up to the maximum (251 octets). |
| 3929 | In this case host sends one P2P IE to firmware so the length |
| 3930 | should not exceed more than 251 bytes |
| 3931 | */ |
| 3932 | if (ie_len > 251) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3933 | WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3934 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3935 | } |
| 3936 | |
Vivek | c582309 | 2018-03-22 23:27:21 +0530 | [diff] [blame] | 3937 | ie_len_aligned = roundup(ie_len, sizeof(uint32_t)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3938 | |
| 3939 | wmi_buf_len = |
| 3940 | sizeof(wmi_p2p_go_set_beacon_ie_fixed_param) + ie_len_aligned + |
| 3941 | WMI_TLV_HDR_SIZE; |
| 3942 | |
| 3943 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 3944 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3945 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3946 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3947 | } |
| 3948 | |
| 3949 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3950 | |
| 3951 | cmd = (wmi_p2p_go_set_beacon_ie_fixed_param *) buf_ptr; |
| 3952 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3953 | WMITLV_TAG_STRUC_wmi_p2p_go_set_beacon_ie_fixed_param, |
| 3954 | WMITLV_GET_STRUCT_TLVLEN |
| 3955 | (wmi_p2p_go_set_beacon_ie_fixed_param)); |
| 3956 | cmd->vdev_id = vdev_id; |
| 3957 | cmd->ie_buf_len = ie_len; |
| 3958 | |
| 3959 | buf_ptr += sizeof(wmi_p2p_go_set_beacon_ie_fixed_param); |
| 3960 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 3961 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3962 | qdf_mem_copy(buf_ptr, p2p_ie, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3963 | |
Yeshwanth Sriram Guntuka | b0ced00 | 2018-08-23 18:25:28 +0530 | [diff] [blame] | 3964 | WMI_LOGD("%s: Sending WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3965 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 3966 | wmi_mtrace(WMI_P2P_GO_SET_BEACON_IE, cmd->vdev_id, 0); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3967 | ret = wmi_unified_cmd_send(wmi_handle, |
| 3968 | wmi_buf, wmi_buf_len, |
| 3969 | WMI_P2P_GO_SET_BEACON_IE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3970 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3971 | WMI_LOGE("Failed to send bcn tmpl: %d", ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3972 | wmi_buf_free(wmi_buf); |
| 3973 | } |
| 3974 | |
Yeshwanth Sriram Guntuka | b0ced00 | 2018-08-23 18:25:28 +0530 | [diff] [blame] | 3975 | WMI_LOGD("%s: Successfully sent WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3976 | return ret; |
| 3977 | } |
| 3978 | |
| 3979 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3980 | * send_scan_probe_setoui_cmd_tlv() - set scan probe OUI |
| 3981 | * @wmi_handle: wmi handle |
| 3982 | * @psetoui: OUI parameters |
| 3983 | * |
| 3984 | * set scan probe OUI parameters in firmware |
| 3985 | * |
| 3986 | * Return: CDF status |
| 3987 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3988 | static QDF_STATUS send_scan_probe_setoui_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3989 | struct scan_mac_oui *psetoui) |
| 3990 | { |
| 3991 | wmi_scan_prob_req_oui_cmd_fixed_param *cmd; |
| 3992 | wmi_buf_t wmi_buf; |
| 3993 | uint32_t len; |
| 3994 | uint8_t *buf_ptr; |
| 3995 | uint32_t *oui_buf; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 3996 | struct probe_req_whitelist_attr *ie_whitelist = &psetoui->ie_whitelist; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3997 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 3998 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 3999 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 4000 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4001 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4002 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4003 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4004 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4005 | } |
| 4006 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4007 | cmd = (wmi_scan_prob_req_oui_cmd_fixed_param *) buf_ptr; |
| 4008 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4009 | WMITLV_TAG_STRUC_wmi_scan_prob_req_oui_cmd_fixed_param, |
| 4010 | WMITLV_GET_STRUCT_TLVLEN |
| 4011 | (wmi_scan_prob_req_oui_cmd_fixed_param)); |
| 4012 | |
| 4013 | oui_buf = &cmd->prob_req_oui; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4014 | qdf_mem_zero(oui_buf, sizeof(cmd->prob_req_oui)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4015 | *oui_buf = psetoui->oui[0] << 16 | psetoui->oui[1] << 8 |
| 4016 | | psetoui->oui[2]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4017 | WMI_LOGD("%s: wmi:oui received from hdd %08x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4018 | cmd->prob_req_oui); |
| 4019 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 4020 | cmd->vdev_id = psetoui->vdev_id; |
| 4021 | cmd->flags = WMI_SCAN_PROBE_OUI_SPOOFED_MAC_IN_PROBE_REQ; |
| 4022 | if (psetoui->enb_probe_req_sno_randomization) |
| 4023 | cmd->flags |= WMI_SCAN_PROBE_OUI_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 4024 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 4025 | if (ie_whitelist->white_list) { |
| 4026 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 4027 | &cmd->num_vendor_oui, |
| 4028 | ie_whitelist); |
| 4029 | cmd->flags |= |
| 4030 | WMI_SCAN_PROBE_OUI_ENABLE_IE_WHITELIST_IN_PROBE_REQ; |
| 4031 | } |
| 4032 | |
| 4033 | buf_ptr += sizeof(*cmd); |
| 4034 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4035 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 4036 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4037 | |
| 4038 | if (cmd->num_vendor_oui != 0) { |
| 4039 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 4040 | ie_whitelist->voui); |
| 4041 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 4042 | } |
| 4043 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4044 | wmi_mtrace(WMI_SCAN_PROB_REQ_OUI_CMDID, cmd->vdev_id, 0); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4045 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4046 | WMI_SCAN_PROB_REQ_OUI_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4047 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4048 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4049 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4050 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4051 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4052 | } |
| 4053 | |
Sravan Kumar Kairam | 963cad9 | 2018-02-15 23:28:34 +0530 | [diff] [blame] | 4054 | #ifdef IPA_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4055 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 4056 | * @wmi_handle: wmi handle |
| 4057 | * @ipa_offload: ipa offload control parameter |
| 4058 | * |
| 4059 | * Returns: 0 on success, error number otherwise |
| 4060 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4061 | static QDF_STATUS send_ipa_offload_control_cmd_tlv(wmi_unified_t wmi_handle, |
Sravan Kumar Kairam | 963cad9 | 2018-02-15 23:28:34 +0530 | [diff] [blame] | 4062 | struct ipa_uc_offload_control_params *ipa_offload) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4063 | { |
| 4064 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 4065 | wmi_buf_t wmi_buf; |
| 4066 | uint32_t len; |
| 4067 | u_int8_t *buf_ptr; |
| 4068 | |
| 4069 | len = sizeof(*cmd); |
| 4070 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4071 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4072 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 4073 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4074 | } |
| 4075 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 4076 | WMI_LOGD("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4077 | ipa_offload->offload_type, ipa_offload->enable); |
| 4078 | |
| 4079 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 4080 | |
| 4081 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 4082 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4083 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 4084 | WMITLV_GET_STRUCT_TLVLEN( |
| 4085 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 4086 | |
| 4087 | cmd->offload_type = ipa_offload->offload_type; |
| 4088 | cmd->vdev_id = ipa_offload->vdev_id; |
| 4089 | cmd->enable = ipa_offload->enable; |
| 4090 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4091 | wmi_mtrace(WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID, cmd->vdev_id, 0); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4092 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4093 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4094 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4095 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4096 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4097 | } |
| 4098 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4099 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4100 | } |
Sravan Kumar Kairam | 963cad9 | 2018-02-15 23:28:34 +0530 | [diff] [blame] | 4101 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4102 | |
| 4103 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4104 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 4105 | * @wmi_handle: wmi handle |
| 4106 | * @vdev_id: vdev id |
| 4107 | * |
| 4108 | * This function request FW to stop ongoing PNO operation. |
| 4109 | * |
| 4110 | * Return: CDF status |
| 4111 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4112 | static QDF_STATUS send_pno_stop_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4113 | { |
| 4114 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 4115 | int32_t len = sizeof(*cmd); |
| 4116 | wmi_buf_t buf; |
| 4117 | uint8_t *buf_ptr; |
| 4118 | int ret; |
| 4119 | |
| 4120 | /* |
| 4121 | * TLV place holder for array of structures nlo_configured_parameters |
| 4122 | * TLV place holder for array of uint32_t channel_list |
| 4123 | * TLV place holder for chnl prediction cfg |
| 4124 | */ |
| 4125 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 4126 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4127 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4128 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4129 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4130 | } |
| 4131 | |
| 4132 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 4133 | buf_ptr = (uint8_t *) cmd; |
| 4134 | |
| 4135 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4136 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 4137 | WMITLV_GET_STRUCT_TLVLEN |
| 4138 | (wmi_nlo_config_cmd_fixed_param)); |
| 4139 | |
| 4140 | cmd->vdev_id = vdev_id; |
| 4141 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 4142 | buf_ptr += sizeof(*cmd); |
| 4143 | |
| 4144 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 4145 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4146 | |
| 4147 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 4148 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4149 | |
| 4150 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 4151 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4152 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4153 | wmi_mtrace(WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID, cmd->vdev_id, 0); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4154 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4155 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 4156 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4157 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4158 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4159 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4160 | } |
| 4161 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4162 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4163 | } |
| 4164 | |
| 4165 | /** |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 4166 | * wmi_set_pno_channel_prediction() - Set PNO channel prediction |
| 4167 | * @buf_ptr: Buffer passed by upper layers |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 4168 | * @pno: Buffer to be sent to the firmware |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 4169 | * |
| 4170 | * Copy the PNO Channel prediction configuration parameters |
| 4171 | * passed by the upper layers to a WMI format TLV and send it |
| 4172 | * down to the firmware. |
| 4173 | * |
| 4174 | * Return: None |
| 4175 | */ |
| 4176 | static void wmi_set_pno_channel_prediction(uint8_t *buf_ptr, |
| 4177 | struct pno_scan_req_params *pno) |
| 4178 | { |
| 4179 | nlo_channel_prediction_cfg *channel_prediction_cfg = |
| 4180 | (nlo_channel_prediction_cfg *) buf_ptr; |
| 4181 | WMITLV_SET_HDR(&channel_prediction_cfg->tlv_header, |
| 4182 | WMITLV_TAG_ARRAY_BYTE, |
| 4183 | WMITLV_GET_STRUCT_TLVLEN(nlo_channel_prediction_cfg)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4184 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 4185 | channel_prediction_cfg->enable = pno->pno_channel_prediction; |
| 4186 | channel_prediction_cfg->top_k_num = pno->top_k_num_of_channels; |
| 4187 | channel_prediction_cfg->stationary_threshold = pno->stationary_thresh; |
| 4188 | channel_prediction_cfg->full_scan_period_ms = |
| 4189 | pno->channel_prediction_full_scan; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4190 | #endif |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 4191 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
| 4192 | WMI_LOGD("enable: %d, top_k_num: %d, stat_thresh: %d, full_scan: %d", |
| 4193 | channel_prediction_cfg->enable, |
| 4194 | channel_prediction_cfg->top_k_num, |
| 4195 | channel_prediction_cfg->stationary_threshold, |
| 4196 | channel_prediction_cfg->full_scan_period_ms); |
| 4197 | } |
| 4198 | |
| 4199 | /** |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 4200 | * send_nlo_mawc_cmd_tlv() - Send MAWC NLO configuration |
| 4201 | * @wmi_handle: wmi handle |
| 4202 | * @params: configuration parameters |
| 4203 | * |
| 4204 | * Return: QDF_STATUS |
| 4205 | */ |
| 4206 | static QDF_STATUS send_nlo_mawc_cmd_tlv(wmi_unified_t wmi_handle, |
| 4207 | struct nlo_mawc_params *params) |
| 4208 | { |
| 4209 | wmi_buf_t buf = NULL; |
| 4210 | QDF_STATUS status; |
| 4211 | int len; |
| 4212 | uint8_t *buf_ptr; |
| 4213 | wmi_nlo_configure_mawc_cmd_fixed_param *wmi_nlo_mawc_params; |
| 4214 | |
| 4215 | len = sizeof(*wmi_nlo_mawc_params); |
| 4216 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4217 | if (!buf) { |
| 4218 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 4219 | return QDF_STATUS_E_NOMEM; |
| 4220 | } |
| 4221 | |
| 4222 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4223 | wmi_nlo_mawc_params = |
| 4224 | (wmi_nlo_configure_mawc_cmd_fixed_param *) buf_ptr; |
| 4225 | WMITLV_SET_HDR(&wmi_nlo_mawc_params->tlv_header, |
| 4226 | WMITLV_TAG_STRUC_wmi_nlo_configure_mawc_cmd_fixed_param, |
| 4227 | WMITLV_GET_STRUCT_TLVLEN |
| 4228 | (wmi_nlo_configure_mawc_cmd_fixed_param)); |
| 4229 | wmi_nlo_mawc_params->vdev_id = params->vdev_id; |
| 4230 | if (params->enable) |
| 4231 | wmi_nlo_mawc_params->enable = 1; |
| 4232 | else |
| 4233 | wmi_nlo_mawc_params->enable = 0; |
| 4234 | wmi_nlo_mawc_params->exp_backoff_ratio = params->exp_backoff_ratio; |
| 4235 | wmi_nlo_mawc_params->init_scan_interval = params->init_scan_interval; |
| 4236 | wmi_nlo_mawc_params->max_scan_interval = params->max_scan_interval; |
Varun Reddy Yeturu | 7a8c337 | 2017-08-21 10:28:13 -0700 | [diff] [blame] | 4237 | WMI_LOGD(FL("MAWC NLO en=%d, vdev=%d, ratio=%d, SCAN init=%d, max=%d"), |
| 4238 | wmi_nlo_mawc_params->enable, wmi_nlo_mawc_params->vdev_id, |
| 4239 | wmi_nlo_mawc_params->exp_backoff_ratio, |
| 4240 | wmi_nlo_mawc_params->init_scan_interval, |
| 4241 | wmi_nlo_mawc_params->max_scan_interval); |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 4242 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4243 | wmi_mtrace(WMI_NLO_CONFIGURE_MAWC_CMDID, NO_SESSION, 0); |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 4244 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 4245 | len, WMI_NLO_CONFIGURE_MAWC_CMDID); |
| 4246 | if (QDF_IS_STATUS_ERROR(status)) { |
| 4247 | WMI_LOGE("WMI_NLO_CONFIGURE_MAWC_CMDID failed, Error %d", |
| 4248 | status); |
| 4249 | wmi_buf_free(buf); |
| 4250 | return QDF_STATUS_E_FAILURE; |
| 4251 | } |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 4252 | |
| 4253 | return QDF_STATUS_SUCCESS; |
| 4254 | } |
| 4255 | |
| 4256 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4257 | * send_pno_start_cmd_tlv() - PNO start request |
| 4258 | * @wmi_handle: wmi handle |
| 4259 | * @pno: PNO request |
| 4260 | * |
| 4261 | * This function request FW to start PNO request. |
| 4262 | * Request: CDF status |
| 4263 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4264 | static QDF_STATUS send_pno_start_cmd_tlv(wmi_unified_t wmi_handle, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4265 | struct pno_scan_req_params *pno) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4266 | { |
| 4267 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 4268 | nlo_configured_parameters *nlo_list; |
| 4269 | uint32_t *channel_list; |
| 4270 | int32_t len; |
| 4271 | wmi_buf_t buf; |
| 4272 | uint8_t *buf_ptr; |
| 4273 | uint8_t i; |
| 4274 | int ret; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 4275 | struct probe_req_whitelist_attr *ie_whitelist = &pno->ie_whitelist; |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 4276 | connected_nlo_rssi_params *nlo_relative_rssi; |
| 4277 | connected_nlo_bss_band_rssi_pref *nlo_band_rssi; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4278 | |
| 4279 | /* |
| 4280 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 4281 | * TLV place holder for array of uint32_t channel_list |
| 4282 | * TLV place holder for chnnl prediction cfg |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 4283 | * TLV place holder for array of wmi_vendor_oui |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 4284 | * TLV place holder for array of connected_nlo_bss_band_rssi_pref |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4285 | */ |
| 4286 | len = sizeof(*cmd) + |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 4287 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 4288 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4289 | |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4290 | len += sizeof(uint32_t) * QDF_MIN(pno->networks_list[0].channel_cnt, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4291 | WMI_NLO_MAX_CHAN); |
| 4292 | len += sizeof(nlo_configured_parameters) * |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4293 | QDF_MIN(pno->networks_cnt, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4294 | len += sizeof(nlo_channel_prediction_cfg); |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 4295 | len += sizeof(enlo_candidate_score_params); |
| 4296 | len += sizeof(wmi_vendor_oui) * ie_whitelist->num_vendor_oui; |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 4297 | len += sizeof(connected_nlo_rssi_params); |
| 4298 | len += sizeof(connected_nlo_bss_band_rssi_pref); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4299 | |
| 4300 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4301 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4302 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4303 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4304 | } |
| 4305 | |
| 4306 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 4307 | |
| 4308 | buf_ptr = (uint8_t *) cmd; |
| 4309 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4310 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 4311 | WMITLV_GET_STRUCT_TLVLEN |
| 4312 | (wmi_nlo_config_cmd_fixed_param)); |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4313 | cmd->vdev_id = pno->vdev_id; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4314 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 4315 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4316 | #ifdef FEATURE_WLAN_SCAN_PNO |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 4317 | WMI_SCAN_SET_DWELL_MODE(cmd->flags, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4318 | pno->adaptive_dwell_mode); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4319 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4320 | /* Current FW does not support min-max range for dwell time */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4321 | cmd->active_dwell_time = pno->active_dwell_time; |
| 4322 | cmd->passive_dwell_time = pno->passive_dwell_time; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4323 | |
Manjeet Singh | cd2dc06 | 2016-08-11 15:31:34 +0530 | [diff] [blame] | 4324 | if (pno->do_passive_scan) |
| 4325 | cmd->flags |= WMI_NLO_CONFIG_SCAN_PASSIVE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4326 | /* Copy scan interval */ |
| 4327 | cmd->fast_scan_period = pno->fast_scan_period; |
| 4328 | cmd->slow_scan_period = pno->slow_scan_period; |
Arif Hussain | 17ff203 | 2017-03-02 11:56:04 -0800 | [diff] [blame] | 4329 | cmd->delay_start_time = WMI_SEC_TO_MSEC(pno->delay_start_time); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4330 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Dustin Brown | 9d86564 | 2017-04-24 10:47:42 -0700 | [diff] [blame] | 4331 | cmd->scan_backoff_multiplier = pno->scan_backoff_multiplier; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4332 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4333 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4334 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4335 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 4336 | /* mac randomization attributes */ |
| 4337 | if (pno->scan_random.randomize) { |
| 4338 | cmd->flags |= WMI_NLO_CONFIG_SPOOFED_MAC_IN_PROBE_REQ | |
| 4339 | WMI_NLO_CONFIG_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 4340 | wmi_copy_scan_random_mac(pno->scan_random.mac_addr, |
| 4341 | pno->scan_random.mac_mask, |
| 4342 | &cmd->mac_addr, |
| 4343 | &cmd->mac_mask); |
| 4344 | } |
| 4345 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4346 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 4347 | |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4348 | cmd->no_of_ssids = QDF_MIN(pno->networks_cnt, WMI_NLO_MAX_SSIDS); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4349 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4350 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4351 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 4352 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4353 | |
| 4354 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 4355 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 4356 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 4357 | WMITLV_TAG_ARRAY_BYTE, |
| 4358 | WMITLV_GET_STRUCT_TLVLEN |
| 4359 | (nlo_configured_parameters)); |
| 4360 | /* Copy ssid and it's length */ |
| 4361 | nlo_list[i].ssid.valid = true; |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4362 | nlo_list[i].ssid.ssid.ssid_len = |
| 4363 | pno->networks_list[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4364 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4365 | pno->networks_list[i].ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4366 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4367 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4368 | nlo_list[i].ssid.ssid.ssid_len, |
| 4369 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 4370 | nlo_list[i].ssid.ssid.ssid_len); |
| 4371 | |
| 4372 | /* Copy rssi threshold */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4373 | if (pno->networks_list[i].rssi_thresh && |
| 4374 | pno->networks_list[i].rssi_thresh > |
| 4375 | WMI_RSSI_THOLD_DEFAULT) { |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4376 | nlo_list[i].rssi_cond.valid = true; |
| 4377 | nlo_list[i].rssi_cond.rssi = |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4378 | pno->networks_list[i].rssi_thresh; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4379 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4380 | nlo_list[i].rssi_cond.rssi); |
| 4381 | } |
| 4382 | nlo_list[i].bcast_nw_type.valid = true; |
| 4383 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4384 | pno->networks_list[i].bc_new_type; |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 4385 | WMI_LOGD("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4386 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 4387 | } |
| 4388 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 4389 | |
| 4390 | /* Copy channel info */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4391 | cmd->num_of_channels = QDF_MIN(pno->networks_list[0].channel_cnt, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4392 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4393 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4394 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 4395 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 4396 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4397 | |
| 4398 | channel_list = (uint32_t *) buf_ptr; |
| 4399 | for (i = 0; i < cmd->num_of_channels; i++) { |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4400 | channel_list[i] = pno->networks_list[0].channels[i]; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4401 | |
| 4402 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 4403 | channel_list[i] = |
| 4404 | wlan_chan_to_freq(pno-> |
| 4405 | networks_list[0].channels[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4406 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4407 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4408 | } |
| 4409 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 4410 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4411 | sizeof(nlo_channel_prediction_cfg)); |
| 4412 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 4413 | wmi_set_pno_channel_prediction(buf_ptr, pno); |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 4414 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4415 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 4416 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 4417 | */ |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 4418 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 4419 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 4420 | buf_ptr += sizeof(enlo_candidate_score_params); |
| 4421 | |
| 4422 | if (ie_whitelist->white_list) { |
| 4423 | cmd->flags |= WMI_NLO_CONFIG_ENABLE_IE_WHITELIST_IN_PROBE_REQ; |
| 4424 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 4425 | &cmd->num_vendor_oui, |
| 4426 | ie_whitelist); |
| 4427 | } |
| 4428 | |
| 4429 | /* ie white list */ |
| 4430 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4431 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 4432 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4433 | if (cmd->num_vendor_oui != 0) { |
| 4434 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 4435 | ie_whitelist->voui); |
| 4436 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 4437 | } |
| 4438 | |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 4439 | if (pno->relative_rssi_set) |
| 4440 | cmd->flags |= WMI_NLO_CONFIG_ENABLE_CNLO_RSSI_CONFIG; |
| 4441 | |
| 4442 | /* |
| 4443 | * Firmware calculation using connected PNO params: |
| 4444 | * New AP's RSSI >= (Connected AP's RSSI + relative_rssi +/- rssi_pref) |
| 4445 | * deduction of rssi_pref for chosen band_pref and |
| 4446 | * addition of rssi_pref for remaining bands (other than chosen band). |
| 4447 | */ |
| 4448 | nlo_relative_rssi = (connected_nlo_rssi_params *) buf_ptr; |
| 4449 | WMITLV_SET_HDR(&nlo_relative_rssi->tlv_header, |
| 4450 | WMITLV_TAG_STRUC_wmi_connected_nlo_rssi_params, |
| 4451 | WMITLV_GET_STRUCT_TLVLEN(connected_nlo_rssi_params)); |
| 4452 | nlo_relative_rssi->relative_rssi = pno->relative_rssi; |
| 4453 | WMI_LOGD("relative_rssi %d", nlo_relative_rssi->relative_rssi); |
| 4454 | buf_ptr += sizeof(*nlo_relative_rssi); |
| 4455 | |
| 4456 | /* |
| 4457 | * As of now Kernel and Host supports one band and rssi preference. |
| 4458 | * Firmware supports array of band and rssi preferences |
| 4459 | */ |
| 4460 | cmd->num_cnlo_band_pref = 1; |
| 4461 | WMITLV_SET_HDR(buf_ptr, |
| 4462 | WMITLV_TAG_ARRAY_STRUC, |
| 4463 | cmd->num_cnlo_band_pref * |
| 4464 | sizeof(connected_nlo_bss_band_rssi_pref)); |
| 4465 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4466 | |
| 4467 | nlo_band_rssi = (connected_nlo_bss_band_rssi_pref *) buf_ptr; |
| 4468 | for (i = 0; i < cmd->num_cnlo_band_pref; i++) { |
| 4469 | WMITLV_SET_HDR(&nlo_band_rssi[i].tlv_header, |
| 4470 | WMITLV_TAG_STRUC_wmi_connected_nlo_bss_band_rssi_pref, |
| 4471 | WMITLV_GET_STRUCT_TLVLEN( |
| 4472 | connected_nlo_bss_band_rssi_pref)); |
| 4473 | nlo_band_rssi[i].band = pno->band_rssi_pref.band; |
| 4474 | nlo_band_rssi[i].rssi_pref = pno->band_rssi_pref.rssi; |
| 4475 | WMI_LOGI("band_pref %d, rssi_pref %d", |
| 4476 | nlo_band_rssi[i].band, |
| 4477 | nlo_band_rssi[i].rssi_pref); |
| 4478 | } |
| 4479 | buf_ptr += cmd->num_cnlo_band_pref * sizeof(*nlo_band_rssi); |
| 4480 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4481 | wmi_mtrace(WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID, cmd->vdev_id, 0); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4482 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4483 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 4484 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4485 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4486 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4487 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4488 | } |
| 4489 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4490 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4491 | } |
| 4492 | |
Qiwei Cai | 1ccba22 | 2018-05-21 16:49:39 +0800 | [diff] [blame] | 4493 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4494 | /** |
| 4495 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 4496 | * @wmi_handle: wmi handle |
| 4497 | * @clear_req: ll stats clear request command params |
| 4498 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4499 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4500 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4501 | static QDF_STATUS send_process_ll_stats_clear_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4502 | const struct ll_stats_clear_params *clear_req, |
| 4503 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 4504 | { |
| 4505 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 4506 | int32_t len; |
| 4507 | wmi_buf_t buf; |
| 4508 | uint8_t *buf_ptr; |
| 4509 | int ret; |
| 4510 | |
| 4511 | len = sizeof(*cmd); |
| 4512 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4513 | |
| 4514 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4515 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4516 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4517 | } |
| 4518 | |
| 4519 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4520 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4521 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 4522 | |
| 4523 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4524 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 4525 | WMITLV_GET_STRUCT_TLVLEN |
| 4526 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 4527 | |
| 4528 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 4529 | cmd->vdev_id = clear_req->sta_id; |
| 4530 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 4531 | |
| 4532 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 4533 | &cmd->peer_macaddr); |
| 4534 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4535 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 4536 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 4537 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4538 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 4539 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4540 | cmd->peer_macaddr); */ |
| 4541 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4542 | wmi_mtrace(WMI_CLEAR_LINK_STATS_CMDID, cmd->vdev_id, 0); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4543 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4544 | WMI_CLEAR_LINK_STATS_CMDID); |
| 4545 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4546 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4547 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4548 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4549 | } |
| 4550 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4551 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 4552 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4553 | } |
| 4554 | |
| 4555 | /** |
| 4556 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 4557 | * @wmi_handle: wmi handle |
| 4558 | * @setReq: ll stats set request command params |
| 4559 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4560 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4561 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4562 | static QDF_STATUS send_process_ll_stats_set_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4563 | const struct ll_stats_set_params *set_req) |
| 4564 | { |
| 4565 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 4566 | int32_t len; |
| 4567 | wmi_buf_t buf; |
| 4568 | uint8_t *buf_ptr; |
| 4569 | int ret; |
| 4570 | |
| 4571 | len = sizeof(*cmd); |
| 4572 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4573 | |
| 4574 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4575 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4576 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4577 | } |
| 4578 | |
| 4579 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4580 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4581 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 4582 | |
| 4583 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4584 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 4585 | WMITLV_GET_STRUCT_TLVLEN |
| 4586 | (wmi_start_link_stats_cmd_fixed_param)); |
| 4587 | |
| 4588 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 4589 | cmd->aggressive_statistics_gathering = |
| 4590 | set_req->aggressive_statistics_gathering; |
| 4591 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4592 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 4593 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 4594 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4595 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4596 | wmi_mtrace(WMI_START_LINK_STATS_CMDID, NO_SESSION, 0); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4597 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4598 | WMI_START_LINK_STATS_CMDID); |
| 4599 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4600 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4601 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4602 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4603 | } |
| 4604 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4605 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4606 | } |
| 4607 | |
| 4608 | /** |
| 4609 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 4610 | * @wmi_handle:wmi handle |
| 4611 | * @get_req:ll stats get request command params |
| 4612 | * @addr: mac address |
| 4613 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4614 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4615 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4616 | static QDF_STATUS send_process_ll_stats_get_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4617 | const struct ll_stats_get_params *get_req, |
| 4618 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 4619 | { |
| 4620 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 4621 | int32_t len; |
| 4622 | wmi_buf_t buf; |
| 4623 | uint8_t *buf_ptr; |
| 4624 | int ret; |
| 4625 | |
| 4626 | len = sizeof(*cmd); |
| 4627 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4628 | |
Himanshu Agarwal | ac3869b | 2016-06-30 18:04:14 +0530 | [diff] [blame] | 4629 | if (!buf) { |
| 4630 | WMI_LOGE("%s: buf allocation failed", __func__); |
| 4631 | return QDF_STATUS_E_NOMEM; |
| 4632 | } |
| 4633 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4634 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4635 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4636 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 4637 | |
| 4638 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4639 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 4640 | WMITLV_GET_STRUCT_TLVLEN |
| 4641 | (wmi_request_link_stats_cmd_fixed_param)); |
| 4642 | |
| 4643 | cmd->request_id = get_req->req_id; |
| 4644 | cmd->stats_type = get_req->param_id_mask; |
| 4645 | cmd->vdev_id = get_req->sta_id; |
| 4646 | |
| 4647 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 4648 | &cmd->peer_macaddr); |
| 4649 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4650 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
Krishna Kumaar Natarajan | f6a996c | 2017-03-10 17:24:55 -0800 | [diff] [blame] | 4651 | WMI_LOGD("Request ID : %u", cmd->request_id); |
| 4652 | WMI_LOGD("Stats Type : %0x", cmd->stats_type); |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 4653 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4654 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4655 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4656 | wmi_mtrace(WMI_REQUEST_LINK_STATS_CMDID, cmd->vdev_id, 0); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4657 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4658 | WMI_REQUEST_LINK_STATS_CMDID); |
| 4659 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4660 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4661 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4662 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4663 | } |
| 4664 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4665 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4666 | } |
Qiwei Cai | 1ccba22 | 2018-05-21 16:49:39 +0800 | [diff] [blame] | 4667 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4668 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4669 | /** |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 4670 | * send_congestion_cmd_tlv() - send request to fw to get CCA |
| 4671 | * @wmi_handle: wmi handle |
| 4672 | * @vdev_id: vdev id |
| 4673 | * |
| 4674 | * Return: CDF status |
| 4675 | */ |
| 4676 | static QDF_STATUS send_congestion_cmd_tlv(wmi_unified_t wmi_handle, |
Vivek | c582309 | 2018-03-22 23:27:21 +0530 | [diff] [blame] | 4677 | uint8_t vdev_id) |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 4678 | { |
| 4679 | wmi_buf_t buf; |
| 4680 | wmi_request_stats_cmd_fixed_param *cmd; |
| 4681 | uint8_t len; |
| 4682 | uint8_t *buf_ptr; |
| 4683 | |
| 4684 | len = sizeof(*cmd); |
| 4685 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4686 | if (!buf) { |
| 4687 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 4688 | return QDF_STATUS_E_FAILURE; |
| 4689 | } |
| 4690 | |
| 4691 | buf_ptr = wmi_buf_data(buf); |
| 4692 | cmd = (wmi_request_stats_cmd_fixed_param *)buf_ptr; |
| 4693 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4694 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 4695 | WMITLV_GET_STRUCT_TLVLEN |
| 4696 | (wmi_request_stats_cmd_fixed_param)); |
| 4697 | |
| 4698 | cmd->stats_id = WMI_REQUEST_CONGESTION_STAT; |
| 4699 | cmd->vdev_id = vdev_id; |
| 4700 | WMI_LOGD("STATS REQ VDEV_ID:%d stats_id %d -->", |
| 4701 | cmd->vdev_id, cmd->stats_id); |
| 4702 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4703 | wmi_mtrace(WMI_REQUEST_STATS_CMDID, cmd->vdev_id, 0); |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 4704 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4705 | WMI_REQUEST_STATS_CMDID)) { |
| 4706 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
| 4707 | __func__); |
| 4708 | wmi_buf_free(buf); |
| 4709 | return QDF_STATUS_E_FAILURE; |
| 4710 | } |
| 4711 | |
| 4712 | return QDF_STATUS_SUCCESS; |
| 4713 | } |
| 4714 | |
| 4715 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4716 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 4717 | * @wmi_handle: wmi handle |
| 4718 | * @rssi_req: get RSSI request |
| 4719 | * |
| 4720 | * Return: CDF status |
| 4721 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4722 | static QDF_STATUS send_snr_request_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4723 | { |
| 4724 | wmi_buf_t buf; |
| 4725 | wmi_request_stats_cmd_fixed_param *cmd; |
| 4726 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 4727 | |
| 4728 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4729 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4730 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4731 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4732 | } |
| 4733 | |
| 4734 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 4735 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4736 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 4737 | WMITLV_GET_STRUCT_TLVLEN |
| 4738 | (wmi_request_stats_cmd_fixed_param)); |
| 4739 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4740 | wmi_mtrace(WMI_REQUEST_STATS_CMDID, cmd->vdev_id, 0); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4741 | if (wmi_unified_cmd_send |
| 4742 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4743 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4744 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4745 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4746 | } |
| 4747 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4748 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4749 | } |
| 4750 | |
| 4751 | /** |
| 4752 | * send_snr_cmd_tlv() - get RSSI from fw |
| 4753 | * @wmi_handle: wmi handle |
| 4754 | * @vdev_id: vdev id |
| 4755 | * |
| 4756 | * Return: CDF status |
| 4757 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4758 | static QDF_STATUS send_snr_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4759 | { |
| 4760 | wmi_buf_t buf; |
| 4761 | wmi_request_stats_cmd_fixed_param *cmd; |
| 4762 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 4763 | |
| 4764 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4765 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4766 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4767 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4768 | } |
| 4769 | |
| 4770 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 4771 | cmd->vdev_id = vdev_id; |
| 4772 | |
| 4773 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4774 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 4775 | WMITLV_GET_STRUCT_TLVLEN |
| 4776 | (wmi_request_stats_cmd_fixed_param)); |
| 4777 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4778 | wmi_mtrace(WMI_REQUEST_STATS_CMDID, cmd->vdev_id, 0); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4779 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4780 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4781 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4782 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4783 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4784 | } |
| 4785 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4786 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4787 | } |
| 4788 | |
| 4789 | /** |
| 4790 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 4791 | * @wmi_handle: wmi handle |
| 4792 | * @link_status: get link params |
| 4793 | * |
| 4794 | * Return: CDF status |
| 4795 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4796 | static QDF_STATUS send_link_status_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4797 | struct link_status_params *link_status) |
| 4798 | { |
| 4799 | wmi_buf_t buf; |
| 4800 | wmi_request_stats_cmd_fixed_param *cmd; |
| 4801 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 4802 | |
| 4803 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4804 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4805 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4806 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4807 | } |
| 4808 | |
| 4809 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 4810 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4811 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 4812 | WMITLV_GET_STRUCT_TLVLEN |
| 4813 | (wmi_request_stats_cmd_fixed_param)); |
| 4814 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 4815 | cmd->vdev_id = link_status->session_id; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4816 | wmi_mtrace(WMI_REQUEST_STATS_CMDID, cmd->vdev_id, 0); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4817 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4818 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4819 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4820 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4821 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4822 | } |
| 4823 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4824 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4825 | } |
| 4826 | |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 4827 | #ifdef WLAN_SUPPORT_GREEN_AP |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4828 | /** |
| 4829 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 4830 | * @wmi_handle: wmi handler |
| 4831 | * @egap_params: pointer to egap_params |
| 4832 | * |
| 4833 | * Return: 0 for success, otherwise appropriate error code |
| 4834 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4835 | static QDF_STATUS send_egap_conf_params_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 4836 | struct wlan_green_ap_egap_params *egap_params) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4837 | { |
| 4838 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 4839 | wmi_buf_t buf; |
| 4840 | int32_t err; |
| 4841 | |
| 4842 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4843 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4844 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 4845 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4846 | } |
| 4847 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 4848 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4849 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 4850 | WMITLV_GET_STRUCT_TLVLEN( |
| 4851 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 4852 | |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 4853 | cmd->enable = egap_params->host_enable_egap; |
| 4854 | cmd->inactivity_time = egap_params->egap_inactivity_time; |
| 4855 | cmd->wait_time = egap_params->egap_wait_time; |
| 4856 | cmd->flags = egap_params->egap_feature_flags; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4857 | wmi_mtrace(WMI_AP_PS_EGAP_PARAM_CMDID, NO_SESSION, 0); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4858 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 4859 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 4860 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4861 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4862 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4863 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4864 | } |
| 4865 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4866 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4867 | } |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 4868 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4869 | |
| 4870 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4871 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 4872 | * @wmi_handle: wmi handle |
| 4873 | * @vdev_id: vdev id |
| 4874 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4875 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4876 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4877 | static QDF_STATUS send_csa_offload_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4878 | uint8_t vdev_id) |
| 4879 | { |
| 4880 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 4881 | wmi_buf_t buf; |
| 4882 | int32_t len = sizeof(*cmd); |
| 4883 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4884 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4885 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4886 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4887 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4888 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4889 | } |
| 4890 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 4891 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4892 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 4893 | WMITLV_GET_STRUCT_TLVLEN |
| 4894 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 4895 | cmd->vdev_id = vdev_id; |
| 4896 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4897 | wmi_mtrace(WMI_CSA_OFFLOAD_ENABLE_CMDID, cmd->vdev_id, 0); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4898 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4899 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4900 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4901 | __func__); |
| 4902 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4903 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4904 | } |
| 4905 | |
| 4906 | return 0; |
| 4907 | } |
| 4908 | |
Naveen Rawat | 42cd1e6 | 2017-05-13 15:56:57 -0700 | [diff] [blame] | 4909 | #ifdef WLAN_FEATURE_CIF_CFR |
| 4910 | /** |
| 4911 | * send_oem_dma_cfg_cmd_tlv() - configure OEM DMA rings |
| 4912 | * @wmi_handle: wmi handle |
| 4913 | * @data_len: len of dma cfg req |
| 4914 | * @data: dma cfg req |
| 4915 | * |
| 4916 | * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure |
| 4917 | */ |
| 4918 | static QDF_STATUS send_oem_dma_cfg_cmd_tlv(wmi_unified_t wmi_handle, |
| 4919 | wmi_oem_dma_ring_cfg_req_fixed_param *cfg) |
| 4920 | { |
| 4921 | wmi_buf_t buf; |
| 4922 | uint8_t *cmd; |
| 4923 | QDF_STATUS ret; |
| 4924 | |
| 4925 | WMITLV_SET_HDR(cfg, |
| 4926 | WMITLV_TAG_STRUC_wmi_oem_dma_ring_cfg_req_fixed_param, |
| 4927 | (sizeof(*cfg) - WMI_TLV_HDR_SIZE)); |
| 4928 | |
| 4929 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cfg)); |
| 4930 | if (!buf) { |
| 4931 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 4932 | return QDF_STATUS_E_FAILURE; |
| 4933 | } |
| 4934 | |
| 4935 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 4936 | qdf_mem_copy(cmd, cfg, sizeof(*cfg)); |
| 4937 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %lu"), |
| 4938 | sizeof(*cfg)); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4939 | wmi_mtrace(WMI_OEM_DMA_RING_CFG_REQ_CMDID, NO_SESSION, 0); |
Naveen Rawat | 42cd1e6 | 2017-05-13 15:56:57 -0700 | [diff] [blame] | 4940 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cfg), |
| 4941 | WMI_OEM_DMA_RING_CFG_REQ_CMDID); |
| 4942 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4943 | WMI_LOGE(FL(":wmi cmd send failed")); |
| 4944 | wmi_buf_free(buf); |
| 4945 | } |
| 4946 | |
| 4947 | return ret; |
| 4948 | } |
| 4949 | #endif |
| 4950 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 4951 | /** |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 4952 | * send_start_11d_scan_cmd_tlv() - start 11d scan request |
| 4953 | * @wmi_handle: wmi handle |
| 4954 | * @start_11d_scan: 11d scan start request parameters |
| 4955 | * |
| 4956 | * This function request FW to start 11d scan. |
| 4957 | * |
| 4958 | * Return: QDF status |
| 4959 | */ |
| 4960 | static QDF_STATUS send_start_11d_scan_cmd_tlv(wmi_unified_t wmi_handle, |
| 4961 | struct reg_start_11d_scan_req *start_11d_scan) |
| 4962 | { |
| 4963 | wmi_11d_scan_start_cmd_fixed_param *cmd; |
| 4964 | int32_t len; |
| 4965 | wmi_buf_t buf; |
| 4966 | int ret; |
| 4967 | |
| 4968 | len = sizeof(*cmd); |
| 4969 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4970 | if (!buf) { |
| 4971 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4972 | return QDF_STATUS_E_NOMEM; |
| 4973 | } |
| 4974 | |
| 4975 | cmd = (wmi_11d_scan_start_cmd_fixed_param *)wmi_buf_data(buf); |
| 4976 | |
| 4977 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4978 | WMITLV_TAG_STRUC_wmi_11d_scan_start_cmd_fixed_param, |
| 4979 | WMITLV_GET_STRUCT_TLVLEN |
| 4980 | (wmi_11d_scan_start_cmd_fixed_param)); |
| 4981 | |
| 4982 | cmd->vdev_id = start_11d_scan->vdev_id; |
| 4983 | cmd->scan_period_msec = start_11d_scan->scan_period_msec; |
| 4984 | cmd->start_interval_msec = start_11d_scan->start_interval_msec; |
| 4985 | |
| 4986 | WMI_LOGD("vdev %d sending 11D scan start req", cmd->vdev_id); |
| 4987 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 4988 | wmi_mtrace(WMI_11D_SCAN_START_CMDID, cmd->vdev_id, 0); |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 4989 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4990 | WMI_11D_SCAN_START_CMDID); |
| 4991 | if (ret) { |
| 4992 | WMI_LOGE("%s: Failed to send start 11d scan wmi cmd", __func__); |
| 4993 | wmi_buf_free(buf); |
| 4994 | return QDF_STATUS_E_FAILURE; |
| 4995 | } |
| 4996 | |
| 4997 | return QDF_STATUS_SUCCESS; |
| 4998 | } |
| 4999 | |
| 5000 | /** |
| 5001 | * send_stop_11d_scan_cmd_tlv() - stop 11d scan request |
| 5002 | * @wmi_handle: wmi handle |
| 5003 | * @start_11d_scan: 11d scan stop request parameters |
| 5004 | * |
| 5005 | * This function request FW to stop 11d scan. |
| 5006 | * |
| 5007 | * Return: QDF status |
| 5008 | */ |
| 5009 | static QDF_STATUS send_stop_11d_scan_cmd_tlv(wmi_unified_t wmi_handle, |
| 5010 | struct reg_stop_11d_scan_req *stop_11d_scan) |
| 5011 | { |
| 5012 | wmi_11d_scan_stop_cmd_fixed_param *cmd; |
| 5013 | int32_t len; |
| 5014 | wmi_buf_t buf; |
| 5015 | int ret; |
| 5016 | |
| 5017 | len = sizeof(*cmd); |
| 5018 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5019 | if (!buf) { |
| 5020 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5021 | return QDF_STATUS_E_NOMEM; |
| 5022 | } |
| 5023 | |
| 5024 | cmd = (wmi_11d_scan_stop_cmd_fixed_param *)wmi_buf_data(buf); |
| 5025 | |
| 5026 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5027 | WMITLV_TAG_STRUC_wmi_11d_scan_stop_cmd_fixed_param, |
| 5028 | WMITLV_GET_STRUCT_TLVLEN |
| 5029 | (wmi_11d_scan_stop_cmd_fixed_param)); |
| 5030 | |
| 5031 | cmd->vdev_id = stop_11d_scan->vdev_id; |
| 5032 | |
| 5033 | WMI_LOGD("vdev %d sending 11D scan stop req", cmd->vdev_id); |
| 5034 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5035 | wmi_mtrace(WMI_11D_SCAN_STOP_CMDID, cmd->vdev_id, 0); |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 5036 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5037 | WMI_11D_SCAN_STOP_CMDID); |
| 5038 | if (ret) { |
| 5039 | WMI_LOGE("%s: Failed to send stop 11d scan wmi cmd", __func__); |
| 5040 | wmi_buf_free(buf); |
| 5041 | return QDF_STATUS_E_FAILURE; |
| 5042 | } |
| 5043 | |
| 5044 | return QDF_STATUS_SUCCESS; |
| 5045 | } |
| 5046 | |
| 5047 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5048 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 5049 | * @wmi_handle: wmi handle |
| 5050 | * @startOemDataReq: start request params |
| 5051 | * |
| 5052 | * Return: CDF status |
| 5053 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5054 | static QDF_STATUS send_start_oem_data_cmd_tlv(wmi_unified_t wmi_handle, |
Krishna Kumaar Natarajan | b16bb27 | 2016-07-21 15:02:44 -0700 | [diff] [blame] | 5055 | uint32_t data_len, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5056 | uint8_t *data) |
| 5057 | { |
| 5058 | wmi_buf_t buf; |
| 5059 | uint8_t *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5060 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5061 | |
| 5062 | buf = wmi_buf_alloc(wmi_handle, |
| 5063 | (data_len + WMI_TLV_HDR_SIZE)); |
| 5064 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5065 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 5066 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5067 | } |
| 5068 | |
| 5069 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 5070 | |
| 5071 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 5072 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5073 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5074 | data_len); |
| 5075 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 5076 | WMI_LOGD(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5077 | data_len); |
| 5078 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5079 | wmi_mtrace(WMI_OEM_REQ_CMDID, NO_SESSION, 0); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5080 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 5081 | (data_len + |
| 5082 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 5083 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5084 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5085 | WMI_LOGE(FL(":wmi cmd send failed")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5086 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5087 | } |
| 5088 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5089 | return ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5090 | } |
| 5091 | |
| 5092 | /** |
| 5093 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 5094 | * @wmi_handle: wmi handle |
| 5095 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 5096 | * |
| 5097 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 5098 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 5099 | * to firmware based on phyerr filtering |
| 5100 | * offload status. |
| 5101 | * |
| 5102 | * Return: 1 success, 0 failure |
| 5103 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5104 | static QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5105 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 5106 | bool dfs_phyerr_filter_offload) |
| 5107 | { |
| 5108 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 5109 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 5110 | wmi_buf_t buf; |
| 5111 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5112 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5113 | |
| 5114 | |
Arif Hussain | 4ab1c4c | 2016-06-30 15:57:49 -0700 | [diff] [blame] | 5115 | if (false == dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5116 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5117 | __func__); |
| 5118 | len = sizeof(*disable_phyerr_offload_cmd); |
| 5119 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5120 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5121 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5122 | return 0; |
| 5123 | } |
| 5124 | disable_phyerr_offload_cmd = |
| 5125 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 5126 | wmi_buf_data(buf); |
| 5127 | |
| 5128 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 5129 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 5130 | WMITLV_GET_STRUCT_TLVLEN |
| 5131 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 5132 | |
| 5133 | /* |
| 5134 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 5135 | * to the firmware to disable the phyerror |
| 5136 | * filtering offload. |
| 5137 | */ |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5138 | wmi_mtrace(WMI_DFS_PHYERR_FILTER_DIS_CMDID, NO_SESSION, 0); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5139 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5140 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5141 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5142 | WMI_LOGE("%s: Failed to send WMI_DFS_PHYERR_FILTER_DIS_CMDID ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5143 | __func__, ret); |
| 5144 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5145 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5146 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5147 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5148 | __func__); |
| 5149 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5150 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5151 | __func__); |
| 5152 | |
| 5153 | len = sizeof(*enable_phyerr_offload_cmd); |
| 5154 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5155 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5156 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 5157 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5158 | } |
| 5159 | |
| 5160 | enable_phyerr_offload_cmd = |
| 5161 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 5162 | wmi_buf_data(buf); |
| 5163 | |
| 5164 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 5165 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 5166 | WMITLV_GET_STRUCT_TLVLEN |
| 5167 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 5168 | |
| 5169 | /* |
| 5170 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 5171 | * to the firmware to enable the phyerror |
| 5172 | * filtering offload. |
| 5173 | */ |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5174 | wmi_mtrace(WMI_DFS_PHYERR_FILTER_ENA_CMDID, NO_SESSION, 0); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5175 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5176 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 5177 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5178 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5179 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5180 | __func__, ret); |
| 5181 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5182 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5183 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5184 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5185 | __func__); |
| 5186 | } |
| 5187 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5188 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5189 | } |
| 5190 | |
| 5191 | #if !defined(REMOVE_PKT_LOG) |
| 5192 | /** |
| 5193 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 5194 | * @wmi_handle: wmi handle |
| 5195 | * @pktlog_event: pktlog event |
| 5196 | * @cmd_id: pktlog cmd id |
| 5197 | * |
| 5198 | * Return: CDF status |
| 5199 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5200 | static QDF_STATUS send_pktlog_wmi_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5201 | WMI_PKTLOG_EVENT pktlog_event, |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 5202 | WMI_CMD_ID cmd_id, uint8_t user_triggered) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5203 | { |
| 5204 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 5205 | WMI_CMD_ID CMD_ID; |
| 5206 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 5207 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 5208 | int len = 0; |
| 5209 | wmi_buf_t buf; |
| 5210 | |
| 5211 | PKTLOG_EVENT = pktlog_event; |
| 5212 | CMD_ID = cmd_id; |
| 5213 | |
| 5214 | switch (CMD_ID) { |
| 5215 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 5216 | len = sizeof(*cmd); |
| 5217 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5218 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5219 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 5220 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5221 | } |
| 5222 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 5223 | wmi_buf_data(buf); |
| 5224 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5225 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 5226 | WMITLV_GET_STRUCT_TLVLEN |
| 5227 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 5228 | cmd->evlist = PKTLOG_EVENT; |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 5229 | cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE |
| 5230 | : WMI_PKTLOG_ENABLE_AUTO; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 5231 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 5232 | WMI_HOST_PDEV_ID_SOC); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5233 | wmi_mtrace(WMI_PDEV_PKTLOG_ENABLE_CMDID, NO_SESSION, 0); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5234 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5235 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5236 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5237 | goto wmi_send_failed; |
| 5238 | } |
| 5239 | break; |
| 5240 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 5241 | len = sizeof(*disable_cmd); |
| 5242 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5243 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5244 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 5245 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5246 | } |
| 5247 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 5248 | wmi_buf_data(buf); |
| 5249 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 5250 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 5251 | WMITLV_GET_STRUCT_TLVLEN |
| 5252 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 5253 | disable_cmd->pdev_id = |
| 5254 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 5255 | WMI_HOST_PDEV_ID_SOC); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5256 | wmi_mtrace(WMI_PDEV_PKTLOG_DISABLE_CMDID, NO_SESSION, 0); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5257 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5258 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5259 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5260 | goto wmi_send_failed; |
| 5261 | } |
| 5262 | break; |
| 5263 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5264 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5265 | break; |
| 5266 | } |
| 5267 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5268 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5269 | |
| 5270 | wmi_send_failed: |
| 5271 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5272 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5273 | } |
| 5274 | #endif /* REMOVE_PKT_LOG */ |
| 5275 | |
| 5276 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5277 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 5278 | * @wmi_handle: wmi handle |
| 5279 | * @preq: stats ext params |
| 5280 | * |
| 5281 | * Return: CDF status |
| 5282 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5283 | static QDF_STATUS send_stats_ext_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5284 | struct stats_ext_params *preq) |
| 5285 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5286 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5287 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 5288 | wmi_buf_t buf; |
Pragaspathi Thilagaraj | 5920a4b | 2018-05-16 18:51:32 +0530 | [diff] [blame] | 5289 | size_t len; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5290 | uint8_t *buf_ptr; |
| 5291 | |
| 5292 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 5293 | |
| 5294 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5295 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5296 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5297 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5298 | } |
| 5299 | |
| 5300 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5301 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 5302 | |
| 5303 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5304 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 5305 | WMITLV_GET_STRUCT_TLVLEN |
| 5306 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 5307 | cmd->vdev_id = preq->vdev_id; |
| 5308 | cmd->data_len = preq->request_data_len; |
| 5309 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5310 | WMI_LOGD("%s: The data len value is %u and vdev id set is %u ", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5311 | __func__, preq->request_data_len, preq->vdev_id); |
| 5312 | |
| 5313 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 5314 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 5315 | |
| 5316 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5317 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5318 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5319 | wmi_mtrace(WMI_REQUEST_STATS_EXT_CMDID, cmd->vdev_id, 0); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5320 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5321 | WMI_REQUEST_STATS_EXT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5322 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5323 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5324 | ret); |
| 5325 | wmi_buf_free(buf); |
| 5326 | } |
| 5327 | |
| 5328 | return ret; |
| 5329 | } |
| 5330 | |
| 5331 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5332 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 5333 | * @wmi_handle: wmi handle |
Jeff Johnson | a87370f | 2017-10-04 19:19:20 -0700 | [diff] [blame] | 5334 | * @params: DHCP server offload info |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5335 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5336 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5337 | */ |
Jeff Johnson | a87370f | 2017-10-04 19:19:20 -0700 | [diff] [blame] | 5338 | static QDF_STATUS |
| 5339 | send_process_dhcpserver_offload_cmd_tlv(wmi_unified_t wmi_handle, |
| 5340 | struct dhcp_offload_info_params *params) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5341 | { |
| 5342 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 5343 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5344 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5345 | |
| 5346 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 5347 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5348 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5349 | "set_dhcp_server_offload cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5350 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5351 | } |
| 5352 | |
| 5353 | cmd = (wmi_set_dhcp_server_offload_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5354 | |
| 5355 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5356 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 5357 | WMITLV_GET_STRUCT_TLVLEN |
| 5358 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
Jeff Johnson | a87370f | 2017-10-04 19:19:20 -0700 | [diff] [blame] | 5359 | cmd->vdev_id = params->vdev_id; |
| 5360 | cmd->enable = params->dhcp_offload_enabled; |
| 5361 | cmd->num_client = params->dhcp_client_num; |
| 5362 | cmd->srv_ipv4 = params->dhcp_srv_addr; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5363 | cmd->start_lsb = 0; |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5364 | wmi_mtrace(WMI_SET_DHCP_SERVER_OFFLOAD_CMDID, cmd->vdev_id, 0); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5365 | status = wmi_unified_cmd_send(wmi_handle, buf, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5366 | sizeof(*cmd), |
| 5367 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5368 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5369 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5370 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5371 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5372 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5373 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Jeff Johnson | a87370f | 2017-10-04 19:19:20 -0700 | [diff] [blame] | 5374 | params->vdev_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5375 | |
| 5376 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5377 | } |
| 5378 | |
| 5379 | /** |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 5380 | * send_pdev_set_regdomain_cmd_tlv() - send set regdomain command to fw |
| 5381 | * @wmi_handle: wmi handle |
| 5382 | * @param: pointer to pdev regdomain params |
| 5383 | * |
| 5384 | * Return: 0 for success or error code |
| 5385 | */ |
| 5386 | static QDF_STATUS |
| 5387 | send_pdev_set_regdomain_cmd_tlv(wmi_unified_t wmi_handle, |
| 5388 | struct pdev_set_regdomain_params *param) |
| 5389 | { |
| 5390 | wmi_buf_t buf; |
| 5391 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 5392 | int32_t len = sizeof(*cmd); |
| 5393 | |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 5394 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5395 | if (!buf) { |
| 5396 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 5397 | return QDF_STATUS_E_NOMEM; |
| 5398 | } |
| 5399 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 5400 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5401 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 5402 | WMITLV_GET_STRUCT_TLVLEN |
| 5403 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 5404 | |
| 5405 | cmd->reg_domain = param->currentRDinuse; |
| 5406 | cmd->reg_domain_2G = param->currentRD2G; |
| 5407 | cmd->reg_domain_5G = param->currentRD5G; |
| 5408 | cmd->conformance_test_limit_2G = param->ctl_2G; |
| 5409 | cmd->conformance_test_limit_5G = param->ctl_5G; |
| 5410 | cmd->dfs_domain = param->dfsDomain; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 5411 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 5412 | param->pdev_id); |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 5413 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5414 | wmi_mtrace(WMI_PDEV_SET_REGDOMAIN_CMDID, NO_SESSION, 0); |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 5415 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5416 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
| 5417 | WMI_LOGE("%s: Failed to send pdev set regdomain command", |
| 5418 | __func__); |
| 5419 | wmi_buf_free(buf); |
| 5420 | return QDF_STATUS_E_FAILURE; |
| 5421 | } |
| 5422 | |
| 5423 | return QDF_STATUS_SUCCESS; |
| 5424 | } |
| 5425 | |
| 5426 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5427 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 5428 | * @wmi_handle: wmi handle |
| 5429 | * @reg_dmn: reg domain |
| 5430 | * @regdmn2G: 2G reg domain |
| 5431 | * @regdmn5G: 5G reg domain |
| 5432 | * @ctl2G: 2G test limit |
| 5433 | * @ctl5G: 5G test limit |
| 5434 | * |
| 5435 | * Return: none |
| 5436 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5437 | static QDF_STATUS send_regdomain_info_to_fw_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5438 | uint32_t reg_dmn, uint16_t regdmn2G, |
Rajeev Kumar Sirasanagandla | 4c1fecd | 2017-06-06 13:27:56 +0530 | [diff] [blame] | 5439 | uint16_t regdmn5G, uint8_t ctl2G, |
| 5440 | uint8_t ctl5G) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5441 | { |
| 5442 | wmi_buf_t buf; |
| 5443 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 5444 | int32_t len = sizeof(*cmd); |
| 5445 | |
| 5446 | |
| 5447 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5448 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5449 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 5450 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5451 | } |
| 5452 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 5453 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5454 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 5455 | WMITLV_GET_STRUCT_TLVLEN |
| 5456 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 5457 | cmd->reg_domain = reg_dmn; |
| 5458 | cmd->reg_domain_2G = regdmn2G; |
| 5459 | cmd->reg_domain_5G = regdmn5G; |
| 5460 | cmd->conformance_test_limit_2G = ctl2G; |
| 5461 | cmd->conformance_test_limit_5G = ctl5G; |
| 5462 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5463 | wmi_mtrace(WMI_PDEV_SET_REGDOMAIN_CMDID, NO_SESSION, 0); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5464 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5465 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5466 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5467 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5468 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5469 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5470 | } |
| 5471 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5472 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5473 | } |
| 5474 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 5475 | /** |
Sathish Kumar | 6011c74 | 2017-11-08 14:49:58 +0530 | [diff] [blame] | 5476 | * copy_custom_aggr_bitmap() - copies host side bitmap using FW APIs |
| 5477 | * @param: param sent from the host side |
| 5478 | * @cmd: param to be sent to the fw side |
| 5479 | */ |
| 5480 | static inline void copy_custom_aggr_bitmap( |
| 5481 | struct set_custom_aggr_size_params *param, |
| 5482 | wmi_vdev_set_custom_aggr_size_cmd_fixed_param *cmd) |
| 5483 | { |
| 5484 | WMI_VDEV_CUSTOM_AGGR_AC_SET(cmd->enable_bitmap, |
| 5485 | param->ac); |
| 5486 | WMI_VDEV_CUSTOM_AGGR_TYPE_SET(cmd->enable_bitmap, |
| 5487 | param->aggr_type); |
| 5488 | WMI_VDEV_CUSTOM_TX_AGGR_SZ_DIS_SET(cmd->enable_bitmap, |
| 5489 | param->tx_aggr_size_disable); |
| 5490 | WMI_VDEV_CUSTOM_RX_AGGR_SZ_DIS_SET(cmd->enable_bitmap, |
| 5491 | param->rx_aggr_size_disable); |
| 5492 | WMI_VDEV_CUSTOM_TX_AC_EN_SET(cmd->enable_bitmap, |
| 5493 | param->tx_ac_enable); |
| 5494 | } |
| 5495 | |
| 5496 | /** |
| 5497 | * send_vdev_set_custom_aggr_size_cmd_tlv() - custom aggr size param in fw |
| 5498 | * @wmi_handle: wmi handle |
| 5499 | * @param: pointer to hold custom aggr size params |
| 5500 | * |
| 5501 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 5502 | */ |
| 5503 | static QDF_STATUS send_vdev_set_custom_aggr_size_cmd_tlv( |
| 5504 | wmi_unified_t wmi_handle, |
| 5505 | struct set_custom_aggr_size_params *param) |
| 5506 | { |
| 5507 | wmi_vdev_set_custom_aggr_size_cmd_fixed_param *cmd; |
| 5508 | wmi_buf_t buf; |
| 5509 | int32_t len = sizeof(*cmd); |
| 5510 | |
| 5511 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5512 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5513 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Sathish Kumar | 6011c74 | 2017-11-08 14:49:58 +0530 | [diff] [blame] | 5514 | return QDF_STATUS_E_FAILURE; |
| 5515 | } |
| 5516 | cmd = (wmi_vdev_set_custom_aggr_size_cmd_fixed_param *) |
| 5517 | wmi_buf_data(buf); |
| 5518 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5519 | WMITLV_TAG_STRUC_wmi_vdev_set_custom_aggr_size_cmd_fixed_param, |
| 5520 | WMITLV_GET_STRUCT_TLVLEN( |
| 5521 | wmi_vdev_set_custom_aggr_size_cmd_fixed_param)); |
| 5522 | cmd->vdev_id = param->vdev_id; |
| 5523 | cmd->tx_aggr_size = param->tx_aggr_size; |
| 5524 | cmd->rx_aggr_size = param->rx_aggr_size; |
| 5525 | copy_custom_aggr_bitmap(param, cmd); |
| 5526 | |
| 5527 | WMI_LOGD("Set custom aggr: vdev id=0x%X, tx aggr size=0x%X " |
| 5528 | "rx_aggr_size=0x%X access category=0x%X, agg_type=0x%X " |
| 5529 | "tx_aggr_size_disable=0x%X, rx_aggr_size_disable=0x%X " |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5530 | "tx_ac_enable=0x%X", |
Sathish Kumar | 6011c74 | 2017-11-08 14:49:58 +0530 | [diff] [blame] | 5531 | param->vdev_id, param->tx_aggr_size, param->rx_aggr_size, |
| 5532 | param->ac, param->aggr_type, param->tx_aggr_size_disable, |
| 5533 | param->rx_aggr_size_disable, param->tx_ac_enable); |
| 5534 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5535 | wmi_mtrace(WMI_VDEV_SET_CUSTOM_AGGR_SIZE_CMDID, cmd->vdev_id, 0); |
Sathish Kumar | 6011c74 | 2017-11-08 14:49:58 +0530 | [diff] [blame] | 5536 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5537 | WMI_VDEV_SET_CUSTOM_AGGR_SIZE_CMDID)) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5538 | WMI_LOGE("Seting custom aggregation size failed"); |
Sathish Kumar | 6011c74 | 2017-11-08 14:49:58 +0530 | [diff] [blame] | 5539 | wmi_buf_free(buf); |
| 5540 | return QDF_STATUS_E_FAILURE; |
| 5541 | } |
| 5542 | |
| 5543 | return QDF_STATUS_SUCCESS; |
| 5544 | } |
| 5545 | |
| 5546 | /** |
Venkateswara Swamy Bandaru | 9983ac5 | 2017-12-22 17:16:19 +0530 | [diff] [blame] | 5547 | * send_vdev_set_qdepth_thresh_cmd_tlv() - WMI set qdepth threshold |
| 5548 | * @param wmi_handle : handle to WMI. |
| 5549 | * @param param : pointer to tx antenna param |
| 5550 | * |
| 5551 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 5552 | */ |
| 5553 | |
| 5554 | static QDF_STATUS send_vdev_set_qdepth_thresh_cmd_tlv(wmi_unified_t wmi_handle, |
| 5555 | struct set_qdepth_thresh_params *param) |
| 5556 | { |
| 5557 | wmi_peer_tid_msduq_qdepth_thresh_update_cmd_fixed_param *cmd; |
| 5558 | wmi_msduq_qdepth_thresh_update *cmd_update; |
| 5559 | wmi_buf_t buf; |
| 5560 | int32_t len = 0; |
| 5561 | int i; |
| 5562 | uint8_t *buf_ptr; |
| 5563 | QDF_STATUS ret; |
| 5564 | |
| 5565 | if (param->num_of_msduq_updates > QDEPTH_THRESH_MAX_UPDATES) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5566 | WMI_LOGE("%s: Invalid Update Count!", __func__); |
Venkateswara Swamy Bandaru | 9983ac5 | 2017-12-22 17:16:19 +0530 | [diff] [blame] | 5567 | return QDF_STATUS_E_INVAL; |
| 5568 | } |
| 5569 | |
| 5570 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 5571 | len += (sizeof(wmi_msduq_qdepth_thresh_update) * |
| 5572 | param->num_of_msduq_updates); |
| 5573 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5574 | |
| 5575 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5576 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Venkateswara Swamy Bandaru | 9983ac5 | 2017-12-22 17:16:19 +0530 | [diff] [blame] | 5577 | return QDF_STATUS_E_NOMEM; |
| 5578 | } |
| 5579 | |
| 5580 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 5581 | cmd = (wmi_peer_tid_msduq_qdepth_thresh_update_cmd_fixed_param *) |
| 5582 | buf_ptr; |
| 5583 | |
| 5584 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5585 | WMITLV_TAG_STRUC_wmi_peer_tid_msduq_qdepth_thresh_update_cmd_fixed_param |
| 5586 | , WMITLV_GET_STRUCT_TLVLEN( |
| 5587 | wmi_peer_tid_msduq_qdepth_thresh_update_cmd_fixed_param)); |
| 5588 | |
| 5589 | cmd->pdev_id = |
| 5590 | wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id); |
| 5591 | cmd->vdev_id = param->vdev_id; |
| 5592 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->mac_addr, &cmd->peer_mac_address); |
| 5593 | cmd->num_of_msduq_updates = param->num_of_msduq_updates; |
| 5594 | |
| 5595 | buf_ptr += sizeof( |
| 5596 | wmi_peer_tid_msduq_qdepth_thresh_update_cmd_fixed_param); |
| 5597 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5598 | param->num_of_msduq_updates * |
| 5599 | sizeof(wmi_msduq_qdepth_thresh_update)); |
| 5600 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5601 | cmd_update = (wmi_msduq_qdepth_thresh_update *)buf_ptr; |
| 5602 | |
| 5603 | for (i = 0; i < cmd->num_of_msduq_updates; i++) { |
| 5604 | WMITLV_SET_HDR(&cmd_update->tlv_header, |
| 5605 | WMITLV_TAG_STRUC_wmi_msduq_qdepth_thresh_update, |
| 5606 | WMITLV_GET_STRUCT_TLVLEN( |
| 5607 | wmi_msduq_qdepth_thresh_update)); |
| 5608 | cmd_update->tid_num = param->update_params[i].tid_num; |
| 5609 | cmd_update->msduq_update_mask = |
| 5610 | param->update_params[i].msduq_update_mask; |
| 5611 | cmd_update->qdepth_thresh_value = |
| 5612 | param->update_params[i].qdepth_thresh_value; |
| 5613 | WMI_LOGD("Set QDepth Threshold: vdev=0x%X pdev=0x%X, tid=0x%X " |
| 5614 | "mac_addr_upper4=%X, mac_addr_lower2:%X," |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5615 | " update mask=0x%X thresh val=0x%X", |
Venkateswara Swamy Bandaru | 9983ac5 | 2017-12-22 17:16:19 +0530 | [diff] [blame] | 5616 | cmd->vdev_id, cmd->pdev_id, cmd_update->tid_num, |
| 5617 | cmd->peer_mac_address.mac_addr31to0, |
| 5618 | cmd->peer_mac_address.mac_addr47to32, |
| 5619 | cmd_update->msduq_update_mask, |
| 5620 | cmd_update->qdepth_thresh_value); |
| 5621 | cmd_update++; |
| 5622 | } |
| 5623 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5624 | wmi_mtrace(WMI_PEER_TID_MSDUQ_QDEPTH_THRESH_UPDATE_CMDID, |
| 5625 | cmd->vdev_id, 0); |
Venkateswara Swamy Bandaru | 9983ac5 | 2017-12-22 17:16:19 +0530 | [diff] [blame] | 5626 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5627 | WMI_PEER_TID_MSDUQ_QDEPTH_THRESH_UPDATE_CMDID); |
| 5628 | |
| 5629 | if (ret != 0) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5630 | WMI_LOGE(" %s :WMI Failed", __func__); |
Venkateswara Swamy Bandaru | 9983ac5 | 2017-12-22 17:16:19 +0530 | [diff] [blame] | 5631 | wmi_buf_free(buf); |
| 5632 | } |
| 5633 | |
| 5634 | return ret; |
| 5635 | } |
| 5636 | |
| 5637 | /** |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 5638 | * send_set_vap_dscp_tid_map_cmd_tlv() - send vap dscp tid map cmd to fw |
| 5639 | * @wmi_handle: wmi handle |
| 5640 | * @param: pointer to hold vap dscp tid map param |
| 5641 | * |
| 5642 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 5643 | */ |
| 5644 | static QDF_STATUS |
| 5645 | send_set_vap_dscp_tid_map_cmd_tlv(wmi_unified_t wmi_handle, |
| 5646 | struct vap_dscp_tid_map_params *param) |
| 5647 | { |
| 5648 | wmi_buf_t buf; |
| 5649 | wmi_vdev_set_dscp_tid_map_cmd_fixed_param *cmd; |
| 5650 | int32_t len = sizeof(*cmd); |
| 5651 | |
| 5652 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5653 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5654 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 5655 | return QDF_STATUS_E_FAILURE; |
| 5656 | } |
| 5657 | |
| 5658 | cmd = (wmi_vdev_set_dscp_tid_map_cmd_fixed_param *)wmi_buf_data(buf); |
| 5659 | qdf_mem_copy(cmd->dscp_to_tid_map, param->dscp_to_tid_map, |
Vivek | c582309 | 2018-03-22 23:27:21 +0530 | [diff] [blame] | 5660 | sizeof(uint32_t) * WMI_DSCP_MAP_MAX); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 5661 | |
| 5662 | cmd->vdev_id = param->vdev_id; |
| 5663 | cmd->enable_override = 0; |
| 5664 | |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5665 | WMI_LOGI("Setting dscp for vap id: %d", cmd->vdev_id); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5666 | wmi_mtrace(WMI_VDEV_SET_DSCP_TID_MAP_CMDID, cmd->vdev_id, 0); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 5667 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5668 | WMI_VDEV_SET_DSCP_TID_MAP_CMDID)) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5669 | WMI_LOGE("Failed to set dscp cmd"); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 5670 | wmi_buf_free(buf); |
| 5671 | return QDF_STATUS_E_FAILURE; |
| 5672 | } |
| 5673 | |
| 5674 | return QDF_STATUS_SUCCESS; |
| 5675 | } |
| 5676 | |
| 5677 | /** |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 5678 | * send_vdev_set_fwtest_param_cmd_tlv() - send fwtest param in fw |
| 5679 | * @wmi_handle: wmi handle |
| 5680 | * @param: pointer to hold fwtest param |
| 5681 | * |
| 5682 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 5683 | */ |
| 5684 | static QDF_STATUS send_vdev_set_fwtest_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 5685 | struct set_fwtest_params *param) |
| 5686 | { |
| 5687 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 5688 | wmi_buf_t buf; |
| 5689 | int32_t len = sizeof(*cmd); |
| 5690 | |
| 5691 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5692 | |
| 5693 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5694 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 5695 | return QDF_STATUS_E_FAILURE; |
| 5696 | } |
| 5697 | |
| 5698 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 5699 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5700 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 5701 | WMITLV_GET_STRUCT_TLVLEN( |
| 5702 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 5703 | cmd->param_id = param->arg; |
| 5704 | cmd->param_value = param->value; |
| 5705 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5706 | wmi_mtrace(WMI_FWTEST_CMDID, NO_SESSION, 0); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 5707 | if (wmi_unified_cmd_send(wmi_handle, buf, len, WMI_FWTEST_CMDID)) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5708 | WMI_LOGE("Setting FW test param failed"); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 5709 | wmi_buf_free(buf); |
| 5710 | return QDF_STATUS_E_FAILURE; |
| 5711 | } |
| 5712 | |
| 5713 | return QDF_STATUS_SUCCESS; |
| 5714 | } |
| 5715 | |
| 5716 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 5717 | * send_phyerr_disable_cmd_tlv() - WMI phyerr disable function |
| 5718 | * |
| 5719 | * @param wmi_handle : handle to WMI. |
| 5720 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 5721 | */ |
| 5722 | static QDF_STATUS send_phyerr_disable_cmd_tlv(wmi_unified_t wmi_handle) |
| 5723 | { |
| 5724 | wmi_pdev_dfs_disable_cmd_fixed_param *cmd; |
| 5725 | wmi_buf_t buf; |
| 5726 | QDF_STATUS ret; |
| 5727 | int32_t len; |
| 5728 | |
| 5729 | len = sizeof(*cmd); |
| 5730 | |
| 5731 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5732 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5733 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 5734 | return QDF_STATUS_E_FAILURE; |
| 5735 | } |
| 5736 | |
| 5737 | cmd = (wmi_pdev_dfs_disable_cmd_fixed_param *)wmi_buf_data(buf); |
| 5738 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5739 | WMITLV_TAG_STRUC_wmi_pdev_dfs_disable_cmd_fixed_param, |
| 5740 | WMITLV_GET_STRUCT_TLVLEN( |
| 5741 | wmi_pdev_dfs_disable_cmd_fixed_param)); |
| 5742 | /* Filling it with WMI_PDEV_ID_SOC for now */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 5743 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 5744 | WMI_HOST_PDEV_ID_SOC); |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 5745 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5746 | wmi_mtrace(WMI_PDEV_DFS_DISABLE_CMDID, NO_SESSION, 0); |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 5747 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 5748 | WMI_PDEV_DFS_DISABLE_CMDID); |
| 5749 | |
| 5750 | if (ret != 0) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5751 | WMI_LOGE("Sending PDEV DFS disable cmd failed"); |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 5752 | wmi_buf_free(buf); |
| 5753 | } |
| 5754 | |
| 5755 | return ret; |
| 5756 | } |
| 5757 | |
| 5758 | /** |
| 5759 | * send_phyerr_enable_cmd_tlv() - WMI phyerr disable function |
| 5760 | * |
| 5761 | * @param wmi_handle : handle to WMI. |
| 5762 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 5763 | */ |
| 5764 | static QDF_STATUS send_phyerr_enable_cmd_tlv(wmi_unified_t wmi_handle) |
| 5765 | { |
| 5766 | wmi_pdev_dfs_enable_cmd_fixed_param *cmd; |
| 5767 | wmi_buf_t buf; |
| 5768 | QDF_STATUS ret; |
| 5769 | int32_t len; |
| 5770 | |
| 5771 | len = sizeof(*cmd); |
| 5772 | |
| 5773 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5774 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5775 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 5776 | return QDF_STATUS_E_FAILURE; |
| 5777 | } |
| 5778 | |
| 5779 | cmd = (wmi_pdev_dfs_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 5780 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5781 | WMITLV_TAG_STRUC_wmi_pdev_dfs_enable_cmd_fixed_param, |
| 5782 | WMITLV_GET_STRUCT_TLVLEN( |
| 5783 | wmi_pdev_dfs_enable_cmd_fixed_param)); |
| 5784 | /* Reserved for future use */ |
| 5785 | cmd->reserved0 = 0; |
| 5786 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5787 | wmi_mtrace(WMI_PDEV_DFS_ENABLE_CMDID, NO_SESSION, 0); |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 5788 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 5789 | WMI_PDEV_DFS_ENABLE_CMDID); |
| 5790 | |
| 5791 | if (ret != 0) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5792 | WMI_LOGE("Sending PDEV DFS enable cmd failed"); |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 5793 | wmi_buf_free(buf); |
| 5794 | } |
| 5795 | |
| 5796 | return ret; |
| 5797 | } |
| 5798 | |
| 5799 | /** |
Sathish Kumar | 0ff69e4 | 2017-11-02 10:44:39 +0530 | [diff] [blame] | 5800 | * send_periodic_chan_stats_config_cmd_tlv() - send periodic chan stats cmd |
| 5801 | * to fw |
| 5802 | * @wmi_handle: wmi handle |
| 5803 | * @param: pointer to hold periodic chan stats param |
| 5804 | * |
| 5805 | * Return: 0 for success or error code |
| 5806 | */ |
| 5807 | static QDF_STATUS |
| 5808 | send_periodic_chan_stats_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 5809 | struct periodic_chan_stats_params *param) |
| 5810 | { |
| 5811 | wmi_set_periodic_channel_stats_config_fixed_param *cmd; |
| 5812 | wmi_buf_t buf; |
| 5813 | QDF_STATUS ret; |
| 5814 | int32_t len; |
| 5815 | |
| 5816 | len = sizeof(*cmd); |
| 5817 | |
| 5818 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5819 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5820 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Sathish Kumar | 0ff69e4 | 2017-11-02 10:44:39 +0530 | [diff] [blame] | 5821 | return QDF_STATUS_E_FAILURE; |
| 5822 | } |
| 5823 | |
| 5824 | cmd = (wmi_set_periodic_channel_stats_config_fixed_param *) |
| 5825 | wmi_buf_data(buf); |
| 5826 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5827 | WMITLV_TAG_STRUC_wmi_set_periodic_channel_stats_config_fixed_param, |
| 5828 | WMITLV_GET_STRUCT_TLVLEN( |
| 5829 | wmi_set_periodic_channel_stats_config_fixed_param)); |
| 5830 | cmd->enable = param->enable; |
| 5831 | cmd->stats_period = param->stats_period; |
| 5832 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 5833 | param->pdev_id); |
| 5834 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5835 | wmi_mtrace(WMI_SET_PERIODIC_CHANNEL_STATS_CONFIG_CMDID, NO_SESSION, 0); |
Sathish Kumar | 0ff69e4 | 2017-11-02 10:44:39 +0530 | [diff] [blame] | 5836 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 5837 | WMI_SET_PERIODIC_CHANNEL_STATS_CONFIG_CMDID); |
| 5838 | |
| 5839 | if (ret != 0) { |
| 5840 | WMI_LOGE("Sending periodic chan stats config failed"); |
| 5841 | wmi_buf_free(buf); |
| 5842 | } |
| 5843 | |
| 5844 | return ret; |
| 5845 | } |
| 5846 | |
| 5847 | /** |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5848 | * send_vdev_spectral_configure_cmd_tlv() - send VDEV spectral configure |
| 5849 | * command to fw |
| 5850 | * @wmi_handle: wmi handle |
| 5851 | * @param: pointer to hold spectral config parameter |
| 5852 | * |
| 5853 | * Return: 0 for success or error code |
| 5854 | */ |
| 5855 | static QDF_STATUS send_vdev_spectral_configure_cmd_tlv(wmi_unified_t wmi_handle, |
| 5856 | struct vdev_spectral_configure_params *param) |
| 5857 | { |
| 5858 | wmi_vdev_spectral_configure_cmd_fixed_param *cmd; |
| 5859 | wmi_buf_t buf; |
| 5860 | QDF_STATUS ret; |
| 5861 | int32_t len; |
| 5862 | |
| 5863 | len = sizeof(*cmd); |
| 5864 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5865 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5866 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5867 | return QDF_STATUS_E_FAILURE; |
| 5868 | } |
| 5869 | |
| 5870 | cmd = (wmi_vdev_spectral_configure_cmd_fixed_param *)wmi_buf_data(buf); |
| 5871 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5872 | WMITLV_TAG_STRUC_wmi_vdev_spectral_configure_cmd_fixed_param, |
| 5873 | WMITLV_GET_STRUCT_TLVLEN( |
Edayilliam Jayadev | dca2054 | 2017-07-21 12:24:04 +0530 | [diff] [blame] | 5874 | wmi_vdev_spectral_configure_cmd_fixed_param)); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5875 | |
| 5876 | cmd->vdev_id = param->vdev_id; |
| 5877 | cmd->spectral_scan_count = param->count; |
| 5878 | cmd->spectral_scan_period = param->period; |
| 5879 | cmd->spectral_scan_priority = param->spectral_pri; |
| 5880 | cmd->spectral_scan_fft_size = param->fft_size; |
| 5881 | cmd->spectral_scan_gc_ena = param->gc_enable; |
| 5882 | cmd->spectral_scan_restart_ena = param->restart_enable; |
| 5883 | cmd->spectral_scan_noise_floor_ref = param->noise_floor_ref; |
| 5884 | cmd->spectral_scan_init_delay = param->init_delay; |
| 5885 | cmd->spectral_scan_nb_tone_thr = param->nb_tone_thr; |
| 5886 | cmd->spectral_scan_str_bin_thr = param->str_bin_thr; |
| 5887 | cmd->spectral_scan_wb_rpt_mode = param->wb_rpt_mode; |
| 5888 | cmd->spectral_scan_rssi_rpt_mode = param->rssi_rpt_mode; |
| 5889 | cmd->spectral_scan_rssi_thr = param->rssi_thr; |
| 5890 | cmd->spectral_scan_pwr_format = param->pwr_format; |
| 5891 | cmd->spectral_scan_rpt_mode = param->rpt_mode; |
| 5892 | cmd->spectral_scan_bin_scale = param->bin_scale; |
Shiva Krishna Pittala | 90ccf6c | 2017-12-18 16:39:20 +0530 | [diff] [blame] | 5893 | cmd->spectral_scan_dBm_adj = param->dbm_adj; |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5894 | cmd->spectral_scan_chn_mask = param->chn_mask; |
| 5895 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5896 | wmi_mtrace(WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID, cmd->vdev_id, 0); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5897 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5898 | WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID); |
| 5899 | |
| 5900 | if (ret != 0) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5901 | WMI_LOGE("Sending set quiet cmd failed"); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5902 | wmi_buf_free(buf); |
| 5903 | } |
| 5904 | |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5905 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID", |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5906 | __func__); |
| 5907 | |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5908 | WMI_LOGI("vdev_id = %u" |
| 5909 | "spectral_scan_count = %u" |
| 5910 | "spectral_scan_period = %u" |
| 5911 | "spectral_scan_priority = %u" |
| 5912 | "spectral_scan_fft_size = %u" |
| 5913 | "spectral_scan_gc_ena = %u" |
| 5914 | "spectral_scan_restart_ena = %u" |
| 5915 | "spectral_scan_noise_floor_ref = %u" |
| 5916 | "spectral_scan_init_delay = %u" |
| 5917 | "spectral_scan_nb_tone_thr = %u" |
| 5918 | "spectral_scan_str_bin_thr = %u" |
| 5919 | "spectral_scan_wb_rpt_mode = %u" |
| 5920 | "spectral_scan_rssi_rpt_mode = %u" |
| 5921 | "spectral_scan_rssi_thr = %u" |
| 5922 | "spectral_scan_pwr_format = %u" |
| 5923 | "spectral_scan_rpt_mode = %u" |
| 5924 | "spectral_scan_bin_scale = %u" |
| 5925 | "spectral_scan_dBm_adj = %u" |
| 5926 | "spectral_scan_chn_mask = %u", |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5927 | param->vdev_id, |
| 5928 | param->count, |
| 5929 | param->period, |
| 5930 | param->spectral_pri, |
| 5931 | param->fft_size, |
| 5932 | param->gc_enable, |
| 5933 | param->restart_enable, |
| 5934 | param->noise_floor_ref, |
| 5935 | param->init_delay, |
| 5936 | param->nb_tone_thr, |
| 5937 | param->str_bin_thr, |
| 5938 | param->wb_rpt_mode, |
| 5939 | param->rssi_rpt_mode, |
| 5940 | param->rssi_thr, |
| 5941 | param->pwr_format, |
| 5942 | param->rpt_mode, |
| 5943 | param->bin_scale, |
Shiva Krishna Pittala | 90ccf6c | 2017-12-18 16:39:20 +0530 | [diff] [blame] | 5944 | param->dbm_adj, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5945 | param->chn_mask); |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5946 | WMI_LOGI("%s: Status: %d\n", __func__, ret); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5947 | |
| 5948 | return ret; |
| 5949 | } |
| 5950 | |
| 5951 | /** |
| 5952 | * send_vdev_spectral_enable_cmd_tlv() - send VDEV spectral configure |
| 5953 | * command to fw |
| 5954 | * @wmi_handle: wmi handle |
| 5955 | * @param: pointer to hold spectral enable parameter |
| 5956 | * |
| 5957 | * Return: 0 for success or error code |
| 5958 | */ |
| 5959 | static QDF_STATUS send_vdev_spectral_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 5960 | struct vdev_spectral_enable_params *param) |
| 5961 | { |
| 5962 | wmi_vdev_spectral_enable_cmd_fixed_param *cmd; |
| 5963 | wmi_buf_t buf; |
| 5964 | QDF_STATUS ret; |
| 5965 | int32_t len; |
| 5966 | |
| 5967 | len = sizeof(*cmd); |
| 5968 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5969 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 5970 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5971 | return QDF_STATUS_E_FAILURE; |
| 5972 | } |
| 5973 | |
| 5974 | cmd = (wmi_vdev_spectral_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 5975 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5976 | WMITLV_TAG_STRUC_wmi_vdev_spectral_enable_cmd_fixed_param, |
| 5977 | WMITLV_GET_STRUCT_TLVLEN( |
Edayilliam Jayadev | dca2054 | 2017-07-21 12:24:04 +0530 | [diff] [blame] | 5978 | wmi_vdev_spectral_enable_cmd_fixed_param)); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5979 | |
| 5980 | cmd->vdev_id = param->vdev_id; |
| 5981 | |
| 5982 | if (param->active_valid) { |
| 5983 | cmd->trigger_cmd = param->active ? 1 : 2; |
| 5984 | /* 1: Trigger, 2: Clear Trigger */ |
| 5985 | } else { |
| 5986 | cmd->trigger_cmd = 0; /* 0: Ignore */ |
| 5987 | } |
| 5988 | |
| 5989 | if (param->enabled_valid) { |
| 5990 | cmd->enable_cmd = param->enabled ? 1 : 2; |
| 5991 | /* 1: Enable 2: Disable */ |
| 5992 | } else { |
| 5993 | cmd->enable_cmd = 0; /* 0: Ignore */ |
| 5994 | } |
| 5995 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 5996 | wmi_mtrace(WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID, cmd->vdev_id, 0); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 5997 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5998 | WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID); |
| 5999 | |
| 6000 | if (ret != 0) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 6001 | WMI_LOGE("Sending scan enable CMD failed"); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 6002 | wmi_buf_free(buf); |
| 6003 | } |
| 6004 | |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 6005 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID", __func__); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 6006 | |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 6007 | WMI_LOGI("vdev_id = %u" |
| 6008 | "trigger_cmd = %u" |
| 6009 | "enable_cmd = %u", |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 6010 | cmd->vdev_id, |
| 6011 | cmd->trigger_cmd, |
| 6012 | cmd->enable_cmd); |
| 6013 | |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 6014 | WMI_LOGI("%s: Status: %d\n", __func__, ret); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 6015 | |
| 6016 | return ret; |
| 6017 | } |
| 6018 | |
| 6019 | /** |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 6020 | * send_thermal_mitigation_param_cmd_tlv() - configure thermal mitigation params |
| 6021 | * @param wmi_handle : handle to WMI. |
| 6022 | * @param param : pointer to hold thermal mitigation param |
| 6023 | * |
| 6024 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 6025 | */ |
| 6026 | static QDF_STATUS send_thermal_mitigation_param_cmd_tlv( |
| 6027 | wmi_unified_t wmi_handle, |
| 6028 | struct thermal_mitigation_params *param) |
| 6029 | { |
| 6030 | wmi_therm_throt_config_request_fixed_param *tt_conf = NULL; |
| 6031 | wmi_therm_throt_level_config_info *lvl_conf = NULL; |
| 6032 | wmi_buf_t buf = NULL; |
| 6033 | uint8_t *buf_ptr = NULL; |
| 6034 | int error; |
| 6035 | int32_t len; |
| 6036 | int i; |
| 6037 | |
| 6038 | len = sizeof(*tt_conf) + WMI_TLV_HDR_SIZE + |
| 6039 | THERMAL_LEVELS * sizeof(wmi_therm_throt_level_config_info); |
| 6040 | |
| 6041 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6042 | if (!buf) { |
| 6043 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 6044 | return QDF_STATUS_E_NOMEM; |
| 6045 | } |
| 6046 | tt_conf = (wmi_therm_throt_config_request_fixed_param *) wmi_buf_data(buf); |
| 6047 | |
| 6048 | /* init fixed params */ |
| 6049 | WMITLV_SET_HDR(tt_conf, |
| 6050 | WMITLV_TAG_STRUC_wmi_therm_throt_config_request_fixed_param, |
| 6051 | (WMITLV_GET_STRUCT_TLVLEN(wmi_therm_throt_config_request_fixed_param))); |
| 6052 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 6053 | tt_conf->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 6054 | param->pdev_id); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 6055 | tt_conf->enable = param->enable; |
| 6056 | tt_conf->dc = param->dc; |
| 6057 | tt_conf->dc_per_event = param->dc_per_event; |
| 6058 | tt_conf->therm_throt_levels = THERMAL_LEVELS; |
| 6059 | |
| 6060 | buf_ptr = (uint8_t *) ++tt_conf; |
| 6061 | /* init TLV params */ |
| 6062 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6063 | (THERMAL_LEVELS * sizeof(wmi_therm_throt_level_config_info))); |
| 6064 | |
| 6065 | lvl_conf = (wmi_therm_throt_level_config_info *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6066 | for (i = 0; i < THERMAL_LEVELS; i++) { |
| 6067 | WMITLV_SET_HDR(&lvl_conf->tlv_header, |
| 6068 | WMITLV_TAG_STRUC_wmi_therm_throt_level_config_info, |
| 6069 | WMITLV_GET_STRUCT_TLVLEN(wmi_therm_throt_level_config_info)); |
| 6070 | lvl_conf->temp_lwm = param->levelconf[i].tmplwm; |
| 6071 | lvl_conf->temp_hwm = param->levelconf[i].tmphwm; |
| 6072 | lvl_conf->dc_off_percent = param->levelconf[i].dcoffpercent; |
| 6073 | lvl_conf->prio = param->levelconf[i].priority; |
| 6074 | lvl_conf++; |
| 6075 | } |
| 6076 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 6077 | wmi_mtrace(WMI_THERM_THROT_SET_CONF_CMDID, NO_SESSION, 0); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 6078 | error = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6079 | WMI_THERM_THROT_SET_CONF_CMDID); |
| 6080 | if (QDF_IS_STATUS_ERROR(error)) { |
| 6081 | wmi_buf_free(buf); |
| 6082 | WMI_LOGE("Failed to send WMI_THERM_THROT_SET_CONF_CMDID command"); |
| 6083 | } |
| 6084 | |
| 6085 | return error; |
| 6086 | } |
| 6087 | |
| 6088 | /** |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 6089 | * send_coex_config_cmd_tlv() - send coex config command to fw |
| 6090 | * @wmi_handle: wmi handle |
| 6091 | * @param: pointer to coex config param |
| 6092 | * |
| 6093 | * Return: 0 for success or error code |
| 6094 | */ |
| 6095 | static QDF_STATUS |
| 6096 | send_coex_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 6097 | struct coex_config_params *param) |
| 6098 | { |
| 6099 | WMI_COEX_CONFIG_CMD_fixed_param *cmd; |
| 6100 | wmi_buf_t buf; |
| 6101 | QDF_STATUS ret; |
| 6102 | int32_t len; |
| 6103 | |
| 6104 | len = sizeof(*cmd); |
| 6105 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6106 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 6107 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 6108 | return QDF_STATUS_E_FAILURE; |
| 6109 | } |
| 6110 | |
| 6111 | cmd = (WMI_COEX_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 6112 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6113 | WMITLV_TAG_STRUC_WMI_COEX_CONFIG_CMD_fixed_param, |
| 6114 | WMITLV_GET_STRUCT_TLVLEN( |
Sathish Kumar | 8458a05 | 2017-05-12 15:52:00 +0530 | [diff] [blame] | 6115 | WMI_COEX_CONFIG_CMD_fixed_param)); |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 6116 | |
| 6117 | cmd->vdev_id = param->vdev_id; |
| 6118 | cmd->config_type = param->config_type; |
| 6119 | cmd->config_arg1 = param->config_arg1; |
| 6120 | cmd->config_arg2 = param->config_arg2; |
| 6121 | cmd->config_arg3 = param->config_arg3; |
| 6122 | cmd->config_arg4 = param->config_arg4; |
| 6123 | cmd->config_arg5 = param->config_arg5; |
| 6124 | cmd->config_arg6 = param->config_arg6; |
| 6125 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 6126 | wmi_mtrace(WMI_COEX_CONFIG_CMDID, cmd->vdev_id, 0); |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 6127 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6128 | WMI_COEX_CONFIG_CMDID); |
| 6129 | |
| 6130 | if (ret != 0) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 6131 | WMI_LOGE("Sending COEX CONFIG CMD failed"); |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 6132 | wmi_buf_free(buf); |
| 6133 | } |
| 6134 | |
| 6135 | return ret; |
| 6136 | } |
| 6137 | |
Kiran Venkatappa | 3619e66 | 2018-04-04 14:31:43 +0530 | [diff] [blame] | 6138 | #ifdef WLAN_SUPPORT_TWT |
| 6139 | static void wmi_copy_twt_resource_config(wmi_resource_config *resource_cfg, |
| 6140 | target_resource_config *tgt_res_cfg) |
| 6141 | { |
| 6142 | resource_cfg->twt_ap_pdev_count = tgt_res_cfg->twt_ap_pdev_count; |
| 6143 | resource_cfg->twt_ap_sta_count = tgt_res_cfg->twt_ap_sta_count; |
| 6144 | } |
| 6145 | #else |
| 6146 | static void wmi_copy_twt_resource_config(wmi_resource_config *resource_cfg, |
| 6147 | target_resource_config *tgt_res_cfg) |
| 6148 | { |
| 6149 | resource_cfg->twt_ap_pdev_count = 0; |
| 6150 | resource_cfg->twt_ap_sta_count = 0; |
| 6151 | } |
| 6152 | #endif |
| 6153 | |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 6154 | static |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6155 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6156 | target_resource_config *tgt_res_cfg) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6157 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6158 | resource_cfg->num_vdevs = tgt_res_cfg->num_vdevs; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6159 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 6160 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 6161 | resource_cfg->num_offload_reorder_buffs = |
| 6162 | tgt_res_cfg->num_offload_reorder_buffs; |
| 6163 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 6164 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 6165 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 6166 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 6167 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 6168 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 6169 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 6170 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 6171 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 6172 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 6173 | resource_cfg->scan_max_pending_req = |
| 6174 | tgt_res_cfg->scan_max_pending_req; |
| 6175 | resource_cfg->bmiss_offload_max_vdev = |
| 6176 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 6177 | resource_cfg->roam_offload_max_vdev = |
| 6178 | tgt_res_cfg->roam_offload_max_vdev; |
| 6179 | resource_cfg->roam_offload_max_ap_profiles = |
| 6180 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 6181 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 6182 | resource_cfg->num_mcast_table_elems = |
| 6183 | tgt_res_cfg->num_mcast_table_elems; |
| 6184 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 6185 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 6186 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 6187 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 6188 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 6189 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 6190 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 6191 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 6192 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 6193 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 6194 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 6195 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 6196 | resource_cfg->num_tdls_conn_table_entries = |
| 6197 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 6198 | resource_cfg->beacon_tx_offload_max_vdev = |
| 6199 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 6200 | resource_cfg->num_multicast_filter_entries = |
| 6201 | tgt_res_cfg->num_multicast_filter_entries; |
| 6202 | resource_cfg->num_wow_filters = |
| 6203 | tgt_res_cfg->num_wow_filters; |
| 6204 | resource_cfg->num_keep_alive_pattern = |
| 6205 | tgt_res_cfg->num_keep_alive_pattern; |
| 6206 | resource_cfg->keep_alive_pattern_size = |
| 6207 | tgt_res_cfg->keep_alive_pattern_size; |
| 6208 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 6209 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 6210 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 6211 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 6212 | resource_cfg->wmi_send_separate = |
| 6213 | tgt_res_cfg->wmi_send_separate; |
| 6214 | resource_cfg->num_ocb_vdevs = |
| 6215 | tgt_res_cfg->num_ocb_vdevs; |
| 6216 | resource_cfg->num_ocb_channels = |
| 6217 | tgt_res_cfg->num_ocb_channels; |
| 6218 | resource_cfg->num_ocb_schedules = |
| 6219 | tgt_res_cfg->num_ocb_schedules; |
Nachiket Kukade | ae35a2c | 2018-05-22 12:17:15 +0530 | [diff] [blame] | 6220 | resource_cfg->bpf_instruction_size = tgt_res_cfg->apf_instruction_size; |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 6221 | resource_cfg->max_bssid_rx_filters = tgt_res_cfg->max_bssid_rx_filters; |
| 6222 | resource_cfg->use_pdev_id = tgt_res_cfg->use_pdev_id; |
Mukul Sharma | d7c9e33 | 2017-11-02 17:42:36 +0530 | [diff] [blame] | 6223 | resource_cfg->max_num_dbs_scan_duty_cycle = |
| 6224 | tgt_res_cfg->max_num_dbs_scan_duty_cycle; |
Kris Muthusamy | 3c2c76a | 2017-11-30 01:40:46 -0800 | [diff] [blame] | 6225 | resource_cfg->sched_params = tgt_res_cfg->scheduler_params; |
Dustin Brown | 983c53f | 2018-03-07 11:48:14 -0800 | [diff] [blame] | 6226 | resource_cfg->num_packet_filters = tgt_res_cfg->num_packet_filters; |
| 6227 | resource_cfg->num_max_sta_vdevs = tgt_res_cfg->num_max_sta_vdevs; |
Manoj Ekbote | 0bce58b | 2018-06-06 16:52:39 -0700 | [diff] [blame] | 6228 | resource_cfg->max_bssid_indicator = tgt_res_cfg->max_bssid_indicator; |
Mukul Sharma | d7c9e33 | 2017-11-02 17:42:36 +0530 | [diff] [blame] | 6229 | if (tgt_res_cfg->atf_config) |
| 6230 | WMI_RSRC_CFG_FLAG_ATF_CONFIG_ENABLE_SET(resource_cfg->flag1, 1); |
| 6231 | if (tgt_res_cfg->mgmt_comp_evt_bundle_support) |
| 6232 | WMI_RSRC_CFG_FLAG_MGMT_COMP_EVT_BUNDLE_SUPPORT_SET( |
| 6233 | resource_cfg->flag1, 1); |
| 6234 | if (tgt_res_cfg->tx_msdu_new_partition_id_support) |
| 6235 | WMI_RSRC_CFG_FLAG_TX_MSDU_ID_NEW_PARTITION_SUPPORT_SET( |
| 6236 | resource_cfg->flag1, 1); |
Ruchi, Agrawal | 0a40ba1 | 2017-11-21 14:39:02 +0530 | [diff] [blame] | 6237 | if (tgt_res_cfg->cce_disable) |
| 6238 | WMI_RSRC_CFG_FLAG_TCL_CCE_DISABLE_SET(resource_cfg->flag1, 1); |
Aditya Sathish | 800c737 | 2018-10-02 11:02:55 +0530 | [diff] [blame] | 6239 | if (tgt_res_cfg->eapol_minrate_set) { |
| 6240 | WMI_RSRC_CFG_FLAG_EAPOL_REKEY_MINRATE_SUPPORT_ENABLE_SET( |
| 6241 | resource_cfg->flag1, 1); |
| 6242 | if (tgt_res_cfg->eapol_minrate_ac_set != 3) { |
| 6243 | WMI_RSRC_CFG_FLAG_EAPOL_AC_OVERRIDE_VALID_SET( |
| 6244 | resource_cfg->flag1, 1); |
| 6245 | WMI_RSRC_CFG_FLAG_EAPOL_AC_OVERRIDE_SET( |
| 6246 | resource_cfg->flag1, |
| 6247 | tgt_res_cfg->eapol_minrate_ac_set); |
| 6248 | } |
| 6249 | } |
Kiran Venkatappa | 3619e66 | 2018-04-04 14:31:43 +0530 | [diff] [blame] | 6250 | |
| 6251 | wmi_copy_twt_resource_config(resource_cfg, tgt_res_cfg); |
Chaithanya Garrepalli | bdfea2b | 2018-09-12 17:02:31 +0530 | [diff] [blame] | 6252 | resource_cfg->peer_map_unmap_v2_support = |
| 6253 | tgt_res_cfg->peer_map_unmap_v2; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6254 | } |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 6255 | |
| 6256 | /* copy_hw_mode_id_in_init_cmd() - Helper routine to copy hw_mode in init cmd |
| 6257 | * @wmi_handle: pointer to wmi handle |
| 6258 | * @buf_ptr: pointer to current position in init command buffer |
Jeff Johnson | ac11e17 | 2018-05-06 15:40:42 -0700 | [diff] [blame] | 6259 | * @len: pointer to length. This will be updated with current length of cmd |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 6260 | * @param: point host parameters for init command |
| 6261 | * |
| 6262 | * Return: Updated pointer of buf_ptr. |
| 6263 | */ |
| 6264 | static inline uint8_t *copy_hw_mode_in_init_cmd(struct wmi_unified *wmi_handle, |
| 6265 | uint8_t *buf_ptr, int *len, struct wmi_init_cmd_param *param) |
| 6266 | { |
| 6267 | uint16_t idx; |
| 6268 | |
| 6269 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) { |
| 6270 | wmi_pdev_set_hw_mode_cmd_fixed_param *hw_mode; |
| 6271 | wmi_pdev_band_to_mac *band_to_mac; |
| 6272 | |
| 6273 | hw_mode = (wmi_pdev_set_hw_mode_cmd_fixed_param *) |
| 6274 | (buf_ptr + sizeof(wmi_init_cmd_fixed_param) + |
| 6275 | sizeof(wmi_resource_config) + |
| 6276 | WMI_TLV_HDR_SIZE + (param->num_mem_chunks * |
| 6277 | sizeof(wlan_host_memory_chunk))); |
| 6278 | |
| 6279 | WMITLV_SET_HDR(&hw_mode->tlv_header, |
| 6280 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 6281 | (WMITLV_GET_STRUCT_TLVLEN |
| 6282 | (wmi_pdev_set_hw_mode_cmd_fixed_param))); |
| 6283 | |
| 6284 | hw_mode->hw_mode_index = param->hw_mode_id; |
| 6285 | hw_mode->num_band_to_mac = param->num_band_to_mac; |
| 6286 | |
| 6287 | buf_ptr = (uint8_t *) (hw_mode + 1); |
| 6288 | band_to_mac = (wmi_pdev_band_to_mac *) (buf_ptr + |
| 6289 | WMI_TLV_HDR_SIZE); |
| 6290 | for (idx = 0; idx < param->num_band_to_mac; idx++) { |
| 6291 | WMITLV_SET_HDR(&band_to_mac[idx].tlv_header, |
| 6292 | WMITLV_TAG_STRUC_wmi_pdev_band_to_mac, |
| 6293 | WMITLV_GET_STRUCT_TLVLEN |
| 6294 | (wmi_pdev_band_to_mac)); |
| 6295 | band_to_mac[idx].pdev_id = |
| 6296 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 6297 | param->band_to_mac[idx].pdev_id); |
| 6298 | band_to_mac[idx].start_freq = |
| 6299 | param->band_to_mac[idx].start_freq; |
| 6300 | band_to_mac[idx].end_freq = |
| 6301 | param->band_to_mac[idx].end_freq; |
| 6302 | } |
| 6303 | *len += sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 6304 | (param->num_band_to_mac * |
| 6305 | sizeof(wmi_pdev_band_to_mac)) + |
| 6306 | WMI_TLV_HDR_SIZE; |
| 6307 | |
| 6308 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6309 | (param->num_band_to_mac * |
| 6310 | sizeof(wmi_pdev_band_to_mac))); |
| 6311 | } |
| 6312 | |
| 6313 | return buf_ptr; |
| 6314 | } |
| 6315 | |
| 6316 | static inline void copy_fw_abi_version_tlv(wmi_unified_t wmi_handle, |
| 6317 | wmi_init_cmd_fixed_param *cmd) |
| 6318 | { |
| 6319 | int num_whitelist; |
| 6320 | wmi_abi_version my_vers; |
| 6321 | |
| 6322 | num_whitelist = sizeof(version_whitelist) / |
| 6323 | sizeof(wmi_whitelist_version_info); |
| 6324 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 6325 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 6326 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 6327 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 6328 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 6329 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 6330 | |
| 6331 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 6332 | &my_vers, |
| 6333 | (struct _wmi_abi_version *)&wmi_handle->fw_abi_version, |
| 6334 | &cmd->host_abi_vers); |
| 6335 | |
| 6336 | qdf_print("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
| 6337 | __func__, |
| 6338 | WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 6339 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 6340 | cmd->host_abi_vers.abi_version_ns_0, |
| 6341 | cmd->host_abi_vers.abi_version_ns_1, |
| 6342 | cmd->host_abi_vers.abi_version_ns_2, |
| 6343 | cmd->host_abi_vers.abi_version_ns_3); |
| 6344 | |
| 6345 | /* Save version sent from host - |
| 6346 | * Will be used to check ready event |
| 6347 | */ |
| 6348 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
| 6349 | sizeof(wmi_abi_version)); |
| 6350 | } |
| 6351 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6352 | static QDF_STATUS save_fw_version_cmd_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6353 | { |
| 6354 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 6355 | wmi_service_ready_event_fixed_param *ev; |
| 6356 | |
| 6357 | |
| 6358 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 6359 | |
| 6360 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 6361 | if (!ev) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6362 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6363 | |
| 6364 | /*Save fw version from service ready message */ |
| 6365 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6366 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6367 | sizeof(wmi_handle->fw_abi_version)); |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 6368 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6369 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6370 | } |
| 6371 | |
| 6372 | /** |
| 6373 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 6374 | * @wmi_handle: pointer to wmi handle |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 6375 | * @res_cfg: resource config |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6376 | * @num_mem_chunks: no of mem chunck |
| 6377 | * @mem_chunk: pointer to mem chunck structure |
| 6378 | * |
| 6379 | * This function sends IE information to firmware |
| 6380 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6381 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6382 | * |
| 6383 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6384 | static QDF_STATUS check_and_update_fw_version_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6385 | void *evt_buf) |
| 6386 | { |
| 6387 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 6388 | wmi_ready_event_fixed_param *ev = NULL; |
| 6389 | |
| 6390 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 6391 | ev = param_buf->fixed_param; |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 6392 | if (!wmi_versions_are_compatible((struct _wmi_abi_version *) |
| 6393 | &wmi_handle->final_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6394 | &ev->fw_abi_vers)) { |
| 6395 | /* |
| 6396 | * Error: Our host version and the given firmware version |
| 6397 | * are incompatible. |
| 6398 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6399 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 6400 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6401 | __func__, |
| 6402 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 6403 | abi_version_0), |
| 6404 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 6405 | abi_version_0), |
| 6406 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 6407 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 6408 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 6409 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 6410 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 6411 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 6412 | ev->fw_abi_vers.abi_version_ns_0, |
| 6413 | ev->fw_abi_vers.abi_version_ns_1, |
| 6414 | ev->fw_abi_vers.abi_version_ns_2, |
| 6415 | ev->fw_abi_vers.abi_version_ns_3); |
| 6416 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6417 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6418 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6419 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6420 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6421 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6422 | sizeof(wmi_abi_version)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6423 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6424 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 6425 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6426 | |
| 6427 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6428 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 6429 | * @handle: wmi handle |
| 6430 | * @event: Event received from FW |
| 6431 | * @len: Length of the event |
| 6432 | * |
| 6433 | * Enables the low frequency events and disables the high frequency |
| 6434 | * events. Bit 17 indicates if the event if low/high frequency. |
| 6435 | * 1 - high frequency, 0 - low frequency |
| 6436 | * |
| 6437 | * Return: 0 on successfully enabling/disabling the events |
| 6438 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6439 | static QDF_STATUS send_log_supported_evt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6440 | uint8_t *event, |
| 6441 | uint32_t len) |
| 6442 | { |
| 6443 | uint32_t num_of_diag_events_logs; |
| 6444 | wmi_diag_event_log_config_fixed_param *cmd; |
| 6445 | wmi_buf_t buf; |
| 6446 | uint8_t *buf_ptr; |
| 6447 | uint32_t *cmd_args, *evt_args; |
| 6448 | uint32_t buf_len, i; |
| 6449 | |
| 6450 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 6451 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 6452 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6453 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6454 | |
| 6455 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 6456 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6457 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6458 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6459 | } |
| 6460 | wmi_event = param_buf->fixed_param; |
| 6461 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
Amar Singhal | 5593c90 | 2017-10-03 13:00:29 -0700 | [diff] [blame] | 6462 | |
| 6463 | if (num_of_diag_events_logs > |
| 6464 | param_buf->num_diag_events_logs_list) { |
| 6465 | WMI_LOGE("message number of events %d is more than tlv hdr content %d", |
| 6466 | num_of_diag_events_logs, |
| 6467 | param_buf->num_diag_events_logs_list); |
| 6468 | return QDF_STATUS_E_INVAL; |
| 6469 | } |
| 6470 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6471 | evt_args = param_buf->diag_events_logs_list; |
| 6472 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6473 | WMI_LOGE("%s: Event list is empty, num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6474 | __func__, num_of_diag_events_logs); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6475 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6476 | } |
| 6477 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6478 | WMI_LOGD("%s: num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6479 | __func__, num_of_diag_events_logs); |
| 6480 | |
| 6481 | /* Free any previous allocation */ |
| 6482 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6483 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6484 | |
Varun Reddy Yeturu | c799752 | 2017-08-20 13:41:02 -0700 | [diff] [blame] | 6485 | if (num_of_diag_events_logs > |
| 6486 | (WMI_SVC_MSG_MAX_SIZE / sizeof(uint32_t))) { |
| 6487 | WMI_LOGE("%s: excess num of logs:%d", __func__, |
| 6488 | num_of_diag_events_logs); |
| 6489 | QDF_ASSERT(0); |
| 6490 | return QDF_STATUS_E_INVAL; |
| 6491 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6492 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6493 | wmi_handle->events_logs_list = qdf_mem_malloc(num_of_diag_events_logs * |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6494 | sizeof(uint32_t)); |
| 6495 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6496 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6497 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6498 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6499 | } |
| 6500 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 6501 | |
| 6502 | /* Prepare the send buffer */ |
| 6503 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 6504 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 6505 | |
| 6506 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 6507 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6508 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6509 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6510 | wmi_handle->events_logs_list = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6511 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6512 | } |
| 6513 | |
| 6514 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 6515 | buf_ptr = (uint8_t *) cmd; |
| 6516 | |
| 6517 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6518 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 6519 | WMITLV_GET_STRUCT_TLVLEN( |
| 6520 | wmi_diag_event_log_config_fixed_param)); |
| 6521 | |
| 6522 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 6523 | |
| 6524 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 6525 | |
| 6526 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6527 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 6528 | |
| 6529 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6530 | |
| 6531 | /* Populate the events */ |
| 6532 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 6533 | /* Low freq (0) - Enable (1) the event |
| 6534 | * High freq (1) - Disable (0) the event |
| 6535 | */ |
| 6536 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 6537 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 6538 | /* Set the event ID */ |
| 6539 | WMI_DIAG_ID_SET(cmd_args[i], |
| 6540 | WMI_DIAG_ID_GET(evt_args[i])); |
| 6541 | /* Set the type */ |
| 6542 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 6543 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6544 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6545 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 6546 | } |
| 6547 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 6548 | wmi_mtrace(WMI_DIAG_EVENT_LOG_CONFIG_CMDID, NO_SESSION, 0); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6549 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 6550 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6551 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6552 | __func__); |
| 6553 | wmi_buf_free(buf); |
| 6554 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 6555 | * Host can still have this list |
| 6556 | */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6557 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6558 | } |
| 6559 | |
| 6560 | return 0; |
| 6561 | } |
| 6562 | |
| 6563 | /** |
| 6564 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 6565 | * @wmi_handle: wmi handle |
| 6566 | * @start_log: Start logging related parameters |
| 6567 | * |
| 6568 | * Send the command to the FW based on which specific logging of diag |
| 6569 | * event/log id can be started/stopped |
| 6570 | * |
| 6571 | * Return: None |
| 6572 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6573 | static QDF_STATUS send_enable_specific_fw_logs_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6574 | struct wmi_wifi_start_log *start_log) |
| 6575 | { |
| 6576 | wmi_diag_event_log_config_fixed_param *cmd; |
| 6577 | wmi_buf_t buf; |
| 6578 | uint8_t *buf_ptr; |
| 6579 | uint32_t len, count, log_level, i; |
| 6580 | uint32_t *cmd_args; |
| 6581 | uint32_t total_len; |
| 6582 | count = 0; |
| 6583 | |
| 6584 | if (!wmi_handle->events_logs_list) { |
Yeshwanth Sriram Guntuka | b0ced00 | 2018-08-23 18:25:28 +0530 | [diff] [blame] | 6585 | WMI_LOGD("%s: Not received event/log list from FW, yet", |
| 6586 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6587 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6588 | } |
| 6589 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 6590 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 6591 | */ |
| 6592 | total_len = 0; |
| 6593 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 6594 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 6595 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 6596 | total_len++; |
| 6597 | } |
| 6598 | |
| 6599 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 6600 | (total_len * sizeof(uint32_t)); |
| 6601 | |
| 6602 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6603 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6604 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6605 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6606 | } |
| 6607 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 6608 | buf_ptr = (uint8_t *) cmd; |
| 6609 | |
| 6610 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6611 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 6612 | WMITLV_GET_STRUCT_TLVLEN( |
| 6613 | wmi_diag_event_log_config_fixed_param)); |
| 6614 | |
| 6615 | cmd->num_of_diag_events_logs = total_len; |
| 6616 | |
| 6617 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 6618 | |
| 6619 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6620 | (total_len * sizeof(uint32_t))); |
| 6621 | |
| 6622 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6623 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 6624 | if (start_log->verbose_level >= WMI_LOG_LEVEL_ACTIVE) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6625 | log_level = 1; |
| 6626 | else |
| 6627 | log_level = 0; |
| 6628 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6629 | WMI_LOGD("%s: Length:%d, Log_level:%d", __func__, total_len, log_level); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6630 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 6631 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 6632 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 6633 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 6634 | |
| 6635 | WMI_DIAG_ID_SET(cmd_args[count], |
| 6636 | WMI_DIAG_ID_GET(val)); |
| 6637 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 6638 | WMI_DIAG_TYPE_GET(val)); |
| 6639 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 6640 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6641 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6642 | count++; |
| 6643 | } |
| 6644 | } |
| 6645 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 6646 | wmi_mtrace(WMI_DIAG_EVENT_LOG_CONFIG_CMDID, NO_SESSION, 0); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6647 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6648 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6649 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6650 | __func__); |
| 6651 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6652 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6653 | } |
| 6654 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6655 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6656 | } |
| 6657 | |
| 6658 | /** |
| 6659 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 6660 | * @wmi_handle: WMI handle |
| 6661 | * |
| 6662 | * This function is used to send the flush command to the FW, |
| 6663 | * that will flush the fw logs that are residue in the FW |
| 6664 | * |
| 6665 | * Return: None |
| 6666 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6667 | static QDF_STATUS send_flush_logs_to_fw_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6668 | { |
| 6669 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 6670 | wmi_buf_t buf; |
| 6671 | int len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6672 | QDF_STATUS ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6673 | |
| 6674 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6675 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6676 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6677 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6678 | } |
| 6679 | |
| 6680 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 6681 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6682 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 6683 | WMITLV_GET_STRUCT_TLVLEN( |
| 6684 | wmi_debug_mesg_flush_fixed_param)); |
| 6685 | cmd->reserved0 = 0; |
| 6686 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 6687 | wmi_mtrace(WMI_DEBUG_MESG_FLUSH_CMDID, NO_SESSION, 0); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6688 | ret = wmi_unified_cmd_send(wmi_handle, |
| 6689 | buf, |
| 6690 | len, |
| 6691 | WMI_DEBUG_MESG_FLUSH_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6692 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6693 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6694 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6695 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6696 | } |
Yeshwanth Sriram Guntuka | b0ced00 | 2018-08-23 18:25:28 +0530 | [diff] [blame] | 6697 | WMI_LOGD("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6698 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6699 | return ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6700 | } |
| 6701 | |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 6702 | #ifdef BIG_ENDIAN_HOST |
| 6703 | /** |
| 6704 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 6705 | * @param data_len - data length |
| 6706 | * @param data - pointer to data |
| 6707 | * |
| 6708 | * Return: QDF_STATUS - success or error status |
| 6709 | */ |
| 6710 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 6711 | struct fips_params *param) |
| 6712 | { |
| 6713 | unsigned char *key_unaligned, *data_unaligned; |
| 6714 | int c; |
| 6715 | u_int8_t *key_aligned = NULL; |
| 6716 | u_int8_t *data_aligned = NULL; |
| 6717 | |
| 6718 | /* Assigning unaligned space to copy the key */ |
| 6719 | key_unaligned = qdf_mem_malloc( |
| 6720 | sizeof(u_int8_t)*param->key_len + FIPS_ALIGN); |
| 6721 | data_unaligned = qdf_mem_malloc( |
| 6722 | sizeof(u_int8_t)*param->data_len + FIPS_ALIGN); |
| 6723 | |
Jeff Johnson | da26399 | 2018-05-12 14:22:00 -0700 | [diff] [blame] | 6724 | /* Checking if kmalloc is successful to allocate space */ |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 6725 | if (key_unaligned == NULL) |
| 6726 | return QDF_STATUS_SUCCESS; |
| 6727 | /* Checking if space is aligned */ |
| 6728 | if (!FIPS_IS_ALIGNED(key_unaligned, FIPS_ALIGN)) { |
| 6729 | /* align to 4 */ |
| 6730 | key_aligned = |
| 6731 | (u_int8_t *)FIPS_ALIGNTO(key_unaligned, |
| 6732 | FIPS_ALIGN); |
| 6733 | } else { |
| 6734 | key_aligned = (u_int8_t *)key_unaligned; |
| 6735 | } |
| 6736 | |
| 6737 | /* memset and copy content from key to key aligned */ |
| 6738 | OS_MEMSET(key_aligned, 0, param->key_len); |
| 6739 | OS_MEMCPY(key_aligned, param->key, param->key_len); |
| 6740 | |
| 6741 | /* print a hexdump for host debug */ |
| 6742 | print_hex_dump(KERN_DEBUG, |
| 6743 | "\t Aligned and Copied Key:@@@@ ", |
| 6744 | DUMP_PREFIX_NONE, |
| 6745 | 16, 1, key_aligned, param->key_len, true); |
| 6746 | |
Jeff Johnson | da26399 | 2018-05-12 14:22:00 -0700 | [diff] [blame] | 6747 | /* Checking if kmalloc is successful to allocate space */ |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 6748 | if (data_unaligned == NULL) |
| 6749 | return QDF_STATUS_SUCCESS; |
| 6750 | /* Checking of space is aligned */ |
| 6751 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 6752 | /* align to 4 */ |
| 6753 | data_aligned = |
| 6754 | (u_int8_t *)FIPS_ALIGNTO(data_unaligned, |
| 6755 | FIPS_ALIGN); |
| 6756 | } else { |
| 6757 | data_aligned = (u_int8_t *)data_unaligned; |
| 6758 | } |
| 6759 | |
| 6760 | /* memset and copy content from data to data aligned */ |
| 6761 | OS_MEMSET(data_aligned, 0, param->data_len); |
| 6762 | OS_MEMCPY(data_aligned, param->data, param->data_len); |
| 6763 | |
| 6764 | /* print a hexdump for host debug */ |
| 6765 | print_hex_dump(KERN_DEBUG, |
| 6766 | "\t Properly Aligned and Copied Data:@@@@ ", |
| 6767 | DUMP_PREFIX_NONE, |
| 6768 | 16, 1, data_aligned, param->data_len, true); |
| 6769 | |
| 6770 | /* converting to little Endian both key_aligned and |
| 6771 | * data_aligned*/ |
| 6772 | for (c = 0; c < param->key_len/4; c++) { |
| 6773 | *((u_int32_t *)key_aligned+c) = |
| 6774 | qdf_cpu_to_le32(*((u_int32_t *)key_aligned+c)); |
| 6775 | } |
| 6776 | for (c = 0; c < param->data_len/4; c++) { |
| 6777 | *((u_int32_t *)data_aligned+c) = |
| 6778 | qdf_cpu_to_le32(*((u_int32_t *)data_aligned+c)); |
| 6779 | } |
| 6780 | |
| 6781 | /* update endian data to key and data vectors */ |
| 6782 | OS_MEMCPY(param->key, key_aligned, param->key_len); |
| 6783 | OS_MEMCPY(param->data, data_aligned, param->data_len); |
| 6784 | |
| 6785 | /* clean up allocated spaces */ |
| 6786 | qdf_mem_free(key_unaligned); |
| 6787 | key_unaligned = NULL; |
| 6788 | key_aligned = NULL; |
| 6789 | |
| 6790 | qdf_mem_free(data_unaligned); |
| 6791 | data_unaligned = NULL; |
| 6792 | data_aligned = NULL; |
| 6793 | |
| 6794 | return QDF_STATUS_SUCCESS; |
| 6795 | } |
| 6796 | #else |
| 6797 | /** |
| 6798 | * fips_align_data_be() - DUMMY for LE platform |
| 6799 | * |
| 6800 | * Return: QDF_STATUS - success |
| 6801 | */ |
| 6802 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 6803 | struct fips_params *param) |
| 6804 | { |
| 6805 | return QDF_STATUS_SUCCESS; |
| 6806 | } |
| 6807 | #endif |
| 6808 | |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 6809 | /** |
| 6810 | * send_pdev_fips_cmd_tlv() - send pdev fips cmd to fw |
| 6811 | * @wmi_handle: wmi handle |
| 6812 | * @param: pointer to hold pdev fips param |
| 6813 | * |
| 6814 | * Return: 0 for success or error code |
| 6815 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6816 | static QDF_STATUS |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 6817 | send_pdev_fips_cmd_tlv(wmi_unified_t wmi_handle, |
| 6818 | struct fips_params *param) |
| 6819 | { |
| 6820 | wmi_pdev_fips_cmd_fixed_param *cmd; |
| 6821 | wmi_buf_t buf; |
| 6822 | uint8_t *buf_ptr; |
| 6823 | uint32_t len = sizeof(wmi_pdev_fips_cmd_fixed_param); |
| 6824 | QDF_STATUS retval = QDF_STATUS_SUCCESS; |
| 6825 | |
| 6826 | /* Length TLV placeholder for array of bytes */ |
| 6827 | len += WMI_TLV_HDR_SIZE; |
| 6828 | if (param->data_len) |
| 6829 | len += (param->data_len*sizeof(uint8_t)); |
| 6830 | |
| 6831 | /* |
| 6832 | * Data length must be multiples of 16 bytes - checked against 0xF - |
| 6833 | * and must be less than WMI_SVC_MSG_SIZE - static size of |
| 6834 | * wmi_pdev_fips_cmd structure |
| 6835 | */ |
| 6836 | |
| 6837 | /* do sanity on the input */ |
| 6838 | if (!(((param->data_len & 0xF) == 0) && |
| 6839 | ((param->data_len > 0) && |
| 6840 | (param->data_len < (WMI_HOST_MAX_BUFFER_SIZE - |
| 6841 | sizeof(wmi_pdev_fips_cmd_fixed_param)))))) { |
| 6842 | return QDF_STATUS_E_INVAL; |
| 6843 | } |
| 6844 | |
| 6845 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6846 | if (!buf) { |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 6847 | qdf_print("%s:wmi_buf_alloc failed", __func__); |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 6848 | return QDF_STATUS_E_FAILURE; |
| 6849 | } |
| 6850 | |
| 6851 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6852 | cmd = (wmi_pdev_fips_cmd_fixed_param *)buf_ptr; |
| 6853 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6854 | WMITLV_TAG_STRUC_wmi_pdev_fips_cmd_fixed_param, |
| 6855 | WMITLV_GET_STRUCT_TLVLEN |
| 6856 | (wmi_pdev_fips_cmd_fixed_param)); |
| 6857 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 6858 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 6859 | param->pdev_id); |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 6860 | if (param->key != NULL && param->data != NULL) { |
| 6861 | cmd->key_len = param->key_len; |
| 6862 | cmd->data_len = param->data_len; |
| 6863 | cmd->fips_cmd = !!(param->op); |
| 6864 | |
| 6865 | if (fips_align_data_be(wmi_handle, param) != QDF_STATUS_SUCCESS) |
| 6866 | return QDF_STATUS_E_FAILURE; |
| 6867 | |
| 6868 | qdf_mem_copy(cmd->key, param->key, param->key_len); |
| 6869 | |
| 6870 | if (param->mode == FIPS_ENGINE_AES_CTR || |
| 6871 | param->mode == FIPS_ENGINE_AES_MIC) { |
| 6872 | cmd->mode = param->mode; |
| 6873 | } else { |
| 6874 | cmd->mode = FIPS_ENGINE_AES_CTR; |
| 6875 | } |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 6876 | qdf_print("Key len = %d, Data len = %d", |
| 6877 | cmd->key_len, cmd->data_len); |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 6878 | |
| 6879 | print_hex_dump(KERN_DEBUG, "Key: ", DUMP_PREFIX_NONE, 16, 1, |
| 6880 | cmd->key, cmd->key_len, true); |
| 6881 | buf_ptr += sizeof(*cmd); |
| 6882 | |
| 6883 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->data_len); |
| 6884 | |
| 6885 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6886 | if (param->data_len) |
| 6887 | qdf_mem_copy(buf_ptr, |
| 6888 | (uint8_t *) param->data, param->data_len); |
| 6889 | |
| 6890 | print_hex_dump(KERN_DEBUG, "Plain text: ", DUMP_PREFIX_NONE, |
| 6891 | 16, 1, buf_ptr, cmd->data_len, true); |
| 6892 | |
| 6893 | buf_ptr += param->data_len; |
| 6894 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 6895 | wmi_mtrace(WMI_PDEV_FIPS_CMDID, NO_SESSION, 0); |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 6896 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6897 | WMI_PDEV_FIPS_CMDID); |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 6898 | qdf_print("%s return value %d", __func__, retval); |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 6899 | } else { |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 6900 | qdf_print("\n%s:%d Key or Data is NULL", __func__, __LINE__); |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 6901 | wmi_buf_free(buf); |
| 6902 | retval = -QDF_STATUS_E_BADMSG; |
| 6903 | } |
| 6904 | |
| 6905 | return retval; |
| 6906 | } |
| 6907 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6908 | /** |
| 6909 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 6910 | * @wmi_handle: wmi handle |
| 6911 | * @request: SSID hotlist set request |
| 6912 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6913 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6914 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6915 | static QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6916 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 6917 | struct ssid_hotlist_request_params *request) |
| 6918 | { |
| 6919 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 6920 | wmi_buf_t wmi_buf; |
| 6921 | uint32_t len; |
| 6922 | uint32_t array_size; |
| 6923 | uint8_t *buf_ptr; |
| 6924 | |
| 6925 | /* length of fixed portion */ |
| 6926 | len = sizeof(*cmd); |
| 6927 | |
| 6928 | /* length of variable portion */ |
| 6929 | array_size = |
| 6930 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 6931 | len += WMI_TLV_HDR_SIZE + array_size; |
| 6932 | |
| 6933 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6934 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6935 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6936 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6937 | } |
| 6938 | |
| 6939 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6940 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 6941 | buf_ptr; |
| 6942 | WMITLV_SET_HDR |
| 6943 | (&cmd->tlv_header, |
| 6944 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 6945 | WMITLV_GET_STRUCT_TLVLEN |
| 6946 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 6947 | |
| 6948 | cmd->request_id = request->request_id; |
| 6949 | cmd->requestor_id = 0; |
| 6950 | cmd->vdev_id = request->session_id; |
| 6951 | cmd->table_id = 0; |
| 6952 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 6953 | cmd->total_entries = request->ssid_count; |
| 6954 | cmd->num_entries_in_page = request->ssid_count; |
| 6955 | cmd->first_entry_index = 0; |
| 6956 | |
| 6957 | buf_ptr += sizeof(*cmd); |
| 6958 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 6959 | |
| 6960 | if (request->ssid_count) { |
| 6961 | wmi_extscan_hotlist_ssid_entry *entry; |
| 6962 | int i; |
| 6963 | |
| 6964 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6965 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 6966 | for (i = 0; i < request->ssid_count; i++) { |
| 6967 | WMITLV_SET_HDR |
| 6968 | (entry, |
| 6969 | WMITLV_TAG_ARRAY_STRUC, |
| 6970 | WMITLV_GET_STRUCT_TLVLEN |
| 6971 | (wmi_extscan_hotlist_ssid_entry)); |
| 6972 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6973 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6974 | request->ssids[i].ssid.mac_ssid, |
| 6975 | request->ssids[i].ssid.length); |
| 6976 | entry->band = request->ssids[i].band; |
| 6977 | entry->min_rssi = request->ssids[i].rssi_low; |
| 6978 | entry->max_rssi = request->ssids[i].rssi_high; |
| 6979 | entry++; |
| 6980 | } |
| 6981 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 6982 | } else { |
| 6983 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 6984 | } |
| 6985 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 6986 | wmi_mtrace(WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID, |
| 6987 | cmd->vdev_id, 0); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6988 | if (wmi_unified_cmd_send |
| 6989 | (wmi_handle, wmi_buf, len, |
| 6990 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6991 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6992 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6993 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6994 | } |
| 6995 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6996 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 6997 | } |
| 6998 | |
| 6999 | /** |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 7000 | * send_fw_test_cmd_tlv() - send fw test command to fw. |
| 7001 | * @wmi_handle: wmi handle |
| 7002 | * @wmi_fwtest: fw test command |
| 7003 | * |
| 7004 | * This function sends fw test command to fw. |
| 7005 | * |
| 7006 | * Return: CDF STATUS |
| 7007 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 7008 | static |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 7009 | QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, |
| 7010 | struct set_fwtest_params *wmi_fwtest) |
| 7011 | { |
| 7012 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 7013 | wmi_buf_t wmi_buf; |
| 7014 | uint16_t len; |
| 7015 | |
| 7016 | len = sizeof(*cmd); |
| 7017 | |
| 7018 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7019 | if (!wmi_buf) { |
| 7020 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 7021 | return QDF_STATUS_E_NOMEM; |
| 7022 | } |
| 7023 | |
| 7024 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 7025 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7026 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 7027 | WMITLV_GET_STRUCT_TLVLEN( |
| 7028 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 7029 | cmd->param_id = wmi_fwtest->arg; |
| 7030 | cmd->param_value = wmi_fwtest->value; |
| 7031 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 7032 | wmi_mtrace(WMI_FWTEST_CMDID, NO_SESSION, 0); |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 7033 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7034 | WMI_FWTEST_CMDID)) { |
| 7035 | WMI_LOGP("%s: failed to send fw test command", __func__); |
Rakshith Suresh Patkar | 9eb15ee | 2018-09-12 16:51:30 +0530 | [diff] [blame] | 7036 | wmi_buf_free(wmi_buf); |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 7037 | return QDF_STATUS_E_FAILURE; |
| 7038 | } |
| 7039 | |
| 7040 | return QDF_STATUS_SUCCESS; |
| 7041 | } |
| 7042 | |
| 7043 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 7044 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 7045 | * @wmi_handle: wmi handle |
| 7046 | * @wmi_utest: unit test command |
| 7047 | * |
| 7048 | * This function send unit test command to fw. |
| 7049 | * |
| 7050 | * Return: CDF STATUS |
| 7051 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7052 | static QDF_STATUS send_unit_test_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 7053 | struct wmi_unit_test_cmd *wmi_utest) |
| 7054 | { |
| 7055 | wmi_unit_test_cmd_fixed_param *cmd; |
| 7056 | wmi_buf_t wmi_buf; |
| 7057 | uint8_t *buf_ptr; |
| 7058 | int i; |
| 7059 | uint16_t len, args_tlv_len; |
Vivek | c582309 | 2018-03-22 23:27:21 +0530 | [diff] [blame] | 7060 | uint32_t *unit_test_cmd_args; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 7061 | |
| 7062 | args_tlv_len = |
Vivek | c582309 | 2018-03-22 23:27:21 +0530 | [diff] [blame] | 7063 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(uint32_t); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 7064 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 7065 | |
| 7066 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7067 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7068 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 7069 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 7070 | } |
| 7071 | |
| 7072 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 7073 | buf_ptr = (uint8_t *) cmd; |
| 7074 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7075 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 7076 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 7077 | cmd->vdev_id = wmi_utest->vdev_id; |
| 7078 | cmd->module_id = wmi_utest->module_id; |
| 7079 | cmd->num_args = wmi_utest->num_args; |
Adil Saeed Musthafa | d280596 | 2017-08-23 17:32:11 -0700 | [diff] [blame] | 7080 | cmd->diag_token = wmi_utest->diag_token; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 7081 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 7082 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 7083 | (wmi_utest->num_args * sizeof(uint32_t))); |
Vivek | c582309 | 2018-03-22 23:27:21 +0530 | [diff] [blame] | 7084 | unit_test_cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 7085 | WMI_LOGI("%s: VDEV ID: %d", __func__, cmd->vdev_id); |
| 7086 | WMI_LOGI("%s: MODULE ID: %d", __func__, cmd->module_id); |
| 7087 | WMI_LOGI("%s: TOKEN: %d", __func__, cmd->diag_token); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7088 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Shaakir Mohamed | 66ebeca | 2018-01-19 15:49:23 -0800 | [diff] [blame] | 7089 | for (i = 0; (i < wmi_utest->num_args && i < WMI_UNIT_TEST_MAX_NUM_ARGS); i++) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 7090 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7091 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 7092 | } |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 7093 | wmi_mtrace(WMI_UNIT_TEST_CMDID, cmd->vdev_id, 0); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 7094 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7095 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7096 | WMI_LOGP("%s: failed to send unit test command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7097 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7098 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 7099 | } |
| 7100 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7101 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 7102 | } |
| 7103 | |
| 7104 | /** |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 7105 | * send_power_dbg_cmd_tlv() - send power debug commands |
| 7106 | * @wmi_handle: wmi handle |
| 7107 | * @param: wmi power debug parameter |
| 7108 | * |
| 7109 | * Send WMI_POWER_DEBUG_CMDID parameters to fw. |
| 7110 | * |
| 7111 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 7112 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 7113 | static QDF_STATUS send_power_dbg_cmd_tlv(wmi_unified_t wmi_handle, |
| 7114 | struct wmi_power_dbg_params *param) |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 7115 | { |
| 7116 | wmi_buf_t buf = NULL; |
| 7117 | QDF_STATUS status; |
| 7118 | int len, args_tlv_len; |
| 7119 | uint8_t *buf_ptr; |
| 7120 | uint8_t i; |
| 7121 | wmi_pdev_wal_power_debug_cmd_fixed_param *cmd; |
| 7122 | uint32_t *cmd_args; |
| 7123 | |
| 7124 | /* Prepare and send power debug cmd parameters */ |
| 7125 | args_tlv_len = WMI_TLV_HDR_SIZE + param->num_args * sizeof(uint32_t); |
| 7126 | len = sizeof(*cmd) + args_tlv_len; |
| 7127 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7128 | if (!buf) { |
| 7129 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7130 | return QDF_STATUS_E_NOMEM; |
| 7131 | } |
| 7132 | |
| 7133 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7134 | cmd = (wmi_pdev_wal_power_debug_cmd_fixed_param *) buf_ptr; |
| 7135 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7136 | WMITLV_TAG_STRUC_wmi_pdev_wal_power_debug_cmd_fixed_param, |
| 7137 | WMITLV_GET_STRUCT_TLVLEN |
| 7138 | (wmi_pdev_wal_power_debug_cmd_fixed_param)); |
| 7139 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 7140 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 7141 | param->pdev_id); |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 7142 | cmd->module_id = param->module_id; |
| 7143 | cmd->num_args = param->num_args; |
| 7144 | buf_ptr += sizeof(*cmd); |
| 7145 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 7146 | (param->num_args * sizeof(uint32_t))); |
| 7147 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 7148 | WMI_LOGI("%s: %d num of args = ", __func__, param->num_args); |
Varun Reddy Yeturu | e6f8be3 | 2018-02-27 13:46:11 -0800 | [diff] [blame] | 7149 | for (i = 0; (i < param->num_args && i < WMI_MAX_POWER_DBG_ARGS); i++) { |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 7150 | cmd_args[i] = param->args[i]; |
| 7151 | WMI_LOGI("%d,", param->args[i]); |
| 7152 | } |
| 7153 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 7154 | wmi_mtrace(WMI_PDEV_WAL_POWER_DEBUG_CMDID, NO_SESSION, 0); |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 7155 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7156 | len, WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
| 7157 | if (QDF_IS_STATUS_ERROR(status)) { |
| 7158 | WMI_LOGE("wmi_unified_cmd_send WMI_PDEV_WAL_POWER_DEBUG_CMDID returned Error %d", |
| 7159 | status); |
| 7160 | goto error; |
| 7161 | } |
| 7162 | |
| 7163 | return QDF_STATUS_SUCCESS; |
| 7164 | error: |
| 7165 | wmi_buf_free(buf); |
| 7166 | |
| 7167 | return status; |
| 7168 | } |
| 7169 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7170 | /** |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 7171 | * send_dfs_phyerr_offload_en_cmd_tlv() - send dfs phyerr offload enable cmd |
| 7172 | * @wmi_handle: wmi handle |
| 7173 | * @pdev_id: pdev id |
| 7174 | * |
| 7175 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID command to firmware. |
| 7176 | * |
| 7177 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 7178 | */ |
| 7179 | static QDF_STATUS send_dfs_phyerr_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 7180 | uint32_t pdev_id) |
| 7181 | { |
| 7182 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *cmd; |
| 7183 | wmi_buf_t buf; |
| 7184 | uint16_t len; |
| 7185 | QDF_STATUS ret; |
| 7186 | |
| 7187 | len = sizeof(*cmd); |
| 7188 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7189 | |
| 7190 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 7191 | |
| 7192 | if (!buf) { |
| 7193 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7194 | return QDF_STATUS_E_NOMEM; |
| 7195 | } |
| 7196 | |
| 7197 | cmd = (wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *) |
| 7198 | wmi_buf_data(buf); |
| 7199 | |
| 7200 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7201 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param, |
| 7202 | WMITLV_GET_STRUCT_TLVLEN( |
| 7203 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param)); |
| 7204 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 7205 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 7206 | wmi_mtrace(WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID, NO_SESSION, 0); |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 7207 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7208 | WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID); |
| 7209 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 7210 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 7211 | __func__, ret, pdev_id); |
| 7212 | wmi_buf_free(buf); |
| 7213 | return QDF_STATUS_E_FAILURE; |
| 7214 | } |
| 7215 | |
| 7216 | return QDF_STATUS_SUCCESS; |
| 7217 | } |
| 7218 | |
| 7219 | /** |
| 7220 | * send_dfs_phyerr_offload_dis_cmd_tlv() - send dfs phyerr offload disable cmd |
| 7221 | * @wmi_handle: wmi handle |
| 7222 | * @pdev_id: pdev id |
| 7223 | * |
| 7224 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID command to firmware. |
| 7225 | * |
| 7226 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 7227 | */ |
| 7228 | static QDF_STATUS send_dfs_phyerr_offload_dis_cmd_tlv(wmi_unified_t wmi_handle, |
| 7229 | uint32_t pdev_id) |
| 7230 | { |
| 7231 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *cmd; |
| 7232 | wmi_buf_t buf; |
| 7233 | uint16_t len; |
| 7234 | QDF_STATUS ret; |
| 7235 | |
| 7236 | len = sizeof(*cmd); |
| 7237 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7238 | |
| 7239 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 7240 | |
| 7241 | if (!buf) { |
| 7242 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7243 | return QDF_STATUS_E_NOMEM; |
| 7244 | } |
| 7245 | |
| 7246 | cmd = (wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *) |
| 7247 | wmi_buf_data(buf); |
| 7248 | |
| 7249 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7250 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param, |
| 7251 | WMITLV_GET_STRUCT_TLVLEN( |
| 7252 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param)); |
| 7253 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 7254 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 7255 | wmi_mtrace(WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID, NO_SESSION, 0); |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 7256 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7257 | WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID); |
| 7258 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 7259 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 7260 | __func__, ret, pdev_id); |
| 7261 | wmi_buf_free(buf); |
| 7262 | return QDF_STATUS_E_FAILURE; |
| 7263 | } |
| 7264 | |
| 7265 | return QDF_STATUS_SUCCESS; |
| 7266 | } |
| 7267 | |
| 7268 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7269 | * init_cmd_send_tlv() - send initialization cmd to fw |
| 7270 | * @wmi_handle: wmi handle |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 7271 | * @param param: pointer to wmi init param |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7272 | * |
| 7273 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 7274 | */ |
| 7275 | static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 7276 | struct wmi_init_cmd_param *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7277 | { |
| 7278 | wmi_buf_t buf; |
| 7279 | wmi_init_cmd_fixed_param *cmd; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7280 | uint8_t *buf_ptr; |
| 7281 | wmi_resource_config *resource_cfg; |
| 7282 | wlan_host_memory_chunk *host_mem_chunks; |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 7283 | uint32_t mem_chunk_len = 0, hw_mode_len = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7284 | uint16_t idx; |
| 7285 | int len; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7286 | QDF_STATUS ret; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7287 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 7288 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + |
| 7289 | WMI_TLV_HDR_SIZE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7290 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 7291 | |
| 7292 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) |
| 7293 | hw_mode_len = sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 7294 | WMI_TLV_HDR_SIZE + |
| 7295 | (param->num_band_to_mac * sizeof(wmi_pdev_band_to_mac)); |
| 7296 | |
| 7297 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len + hw_mode_len); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7298 | if (!buf) { |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 7299 | qdf_print("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7300 | return QDF_STATUS_E_FAILURE; |
| 7301 | } |
| 7302 | |
| 7303 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7304 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 7305 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 7306 | |
| 7307 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 7308 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 7309 | + WMI_TLV_HDR_SIZE); |
| 7310 | |
| 7311 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7312 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 7313 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 7314 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 7315 | wmi_copy_resource_config(resource_cfg, param->res_cfg); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7316 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 7317 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 7318 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 7319 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 7320 | for (idx = 0; idx < param->num_mem_chunks; ++idx) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7321 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 7322 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 7323 | WMITLV_GET_STRUCT_TLVLEN |
| 7324 | (wlan_host_memory_chunk)); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 7325 | host_mem_chunks[idx].ptr = param->mem_chunks[idx].paddr; |
| 7326 | host_mem_chunks[idx].size = param->mem_chunks[idx].len; |
| 7327 | host_mem_chunks[idx].req_id = param->mem_chunks[idx].req_id; |
Vivek | f85a42b | 2017-06-21 11:38:28 +0530 | [diff] [blame] | 7328 | QDF_TRACE(QDF_MODULE_ID_ANY, QDF_TRACE_LEVEL_DEBUG, |
| 7329 | "chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7330 | idx, host_mem_chunks[idx].size, |
| 7331 | host_mem_chunks[idx].ptr); |
| 7332 | } |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 7333 | cmd->num_host_mem_chunks = param->num_mem_chunks; |
| 7334 | len += (param->num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 7335 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7336 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 7337 | WMITLV_TAG_ARRAY_STRUC, |
| 7338 | (sizeof(wlan_host_memory_chunk) * |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 7339 | param->num_mem_chunks)); |
| 7340 | |
| 7341 | /* Fill hw mode id config */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 7342 | buf_ptr = copy_hw_mode_in_init_cmd(wmi_handle, buf_ptr, &len, param); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7343 | |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 7344 | /* Fill fw_abi_vers */ |
| 7345 | copy_fw_abi_version_tlv(wmi_handle, cmd); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7346 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 7347 | wmi_mtrace(WMI_INIT_CMDID, NO_SESSION, 0); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7348 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID); |
| 7349 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 7350 | WMI_LOGE("wmi_unified_cmd_send WMI_INIT_CMDID returned Error %d", |
| 7351 | ret); |
| 7352 | wmi_buf_free(buf); |
| 7353 | } |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 7354 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7355 | return ret; |
| 7356 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7357 | } |
| 7358 | |
| 7359 | /** |
Gyanranjan Hazarika | 3f3b471 | 2018-01-12 13:27:43 -0800 | [diff] [blame] | 7360 | * send_addba_send_cmd_tlv() - send addba send command to fw |
| 7361 | * @wmi_handle: wmi handle |
| 7362 | * @param: pointer to delba send params |
| 7363 | * @macaddr: peer mac address |
| 7364 | * |
| 7365 | * Send WMI_ADDBA_SEND_CMDID command to firmware |
| 7366 | * Return: QDF_STATUS_SUCCESS on success. QDF_STATUS_E** on error |
| 7367 | */ |
| 7368 | static QDF_STATUS |
| 7369 | send_addba_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 7370 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 7371 | struct addba_send_params *param) |
| 7372 | { |
| 7373 | wmi_addba_send_cmd_fixed_param *cmd; |
| 7374 | wmi_buf_t buf; |
| 7375 | uint16_t len; |
| 7376 | QDF_STATUS ret; |
| 7377 | |
| 7378 | len = sizeof(*cmd); |
| 7379 | |
| 7380 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7381 | if (!buf) { |
| 7382 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7383 | return QDF_STATUS_E_NOMEM; |
| 7384 | } |
| 7385 | |
| 7386 | cmd = (wmi_addba_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 7387 | |
| 7388 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7389 | WMITLV_TAG_STRUC_wmi_addba_send_cmd_fixed_param, |
| 7390 | WMITLV_GET_STRUCT_TLVLEN(wmi_addba_send_cmd_fixed_param)); |
| 7391 | |
| 7392 | cmd->vdev_id = param->vdev_id; |
| 7393 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 7394 | cmd->tid = param->tidno; |
| 7395 | cmd->buffersize = param->buffersize; |
| 7396 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 7397 | wmi_mtrace(WMI_ADDBA_SEND_CMDID, cmd->vdev_id, 0); |
Gyanranjan Hazarika | 3f3b471 | 2018-01-12 13:27:43 -0800 | [diff] [blame] | 7398 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_ADDBA_SEND_CMDID); |
| 7399 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 7400 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d", __func__, ret); |
| 7401 | wmi_buf_free(buf); |
| 7402 | return QDF_STATUS_E_FAILURE; |
| 7403 | } |
| 7404 | |
| 7405 | return QDF_STATUS_SUCCESS; |
| 7406 | } |
| 7407 | |
| 7408 | /** |
| 7409 | * send_delba_send_cmd_tlv() - send delba send command to fw |
| 7410 | * @wmi_handle: wmi handle |
| 7411 | * @param: pointer to delba send params |
| 7412 | * @macaddr: peer mac address |
| 7413 | * |
| 7414 | * Send WMI_DELBA_SEND_CMDID command to firmware |
| 7415 | * Return: QDF_STATUS_SUCCESS on success. QDF_STATUS_E** on error |
| 7416 | */ |
| 7417 | static QDF_STATUS |
| 7418 | send_delba_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 7419 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 7420 | struct delba_send_params *param) |
| 7421 | { |
| 7422 | wmi_delba_send_cmd_fixed_param *cmd; |
| 7423 | wmi_buf_t buf; |
| 7424 | uint16_t len; |
| 7425 | QDF_STATUS ret; |
| 7426 | |
| 7427 | len = sizeof(*cmd); |
| 7428 | |
| 7429 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7430 | if (!buf) { |
| 7431 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7432 | return QDF_STATUS_E_NOMEM; |
| 7433 | } |
| 7434 | |
| 7435 | cmd = (wmi_delba_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 7436 | |
| 7437 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7438 | WMITLV_TAG_STRUC_wmi_delba_send_cmd_fixed_param, |
| 7439 | WMITLV_GET_STRUCT_TLVLEN(wmi_delba_send_cmd_fixed_param)); |
| 7440 | |
| 7441 | cmd->vdev_id = param->vdev_id; |
| 7442 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 7443 | cmd->tid = param->tidno; |
| 7444 | cmd->initiator = param->initiator; |
| 7445 | cmd->reasoncode = param->reasoncode; |
| 7446 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 7447 | wmi_mtrace(WMI_DELBA_SEND_CMDID, cmd->vdev_id, 0); |
Gyanranjan Hazarika | 3f3b471 | 2018-01-12 13:27:43 -0800 | [diff] [blame] | 7448 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_DELBA_SEND_CMDID); |
| 7449 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 7450 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d", __func__, ret); |
| 7451 | wmi_buf_free(buf); |
| 7452 | return QDF_STATUS_E_FAILURE; |
| 7453 | } |
| 7454 | |
| 7455 | return QDF_STATUS_SUCCESS; |
| 7456 | } |
| 7457 | |
| 7458 | /** |
Gyanranjan Hazarika | cd535f9 | 2018-01-17 19:29:45 -0800 | [diff] [blame] | 7459 | * send_addba_clearresponse_cmd_tlv() - send addba clear response command |
| 7460 | * to fw |
| 7461 | * @wmi_handle: wmi handle |
| 7462 | * @param: pointer to addba clearresp params |
| 7463 | * @macaddr: peer mac address |
| 7464 | * Return: 0 for success or error code |
| 7465 | */ |
| 7466 | static QDF_STATUS |
| 7467 | send_addba_clearresponse_cmd_tlv(wmi_unified_t wmi_handle, |
| 7468 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 7469 | struct addba_clearresponse_params *param) |
| 7470 | { |
| 7471 | wmi_addba_clear_resp_cmd_fixed_param *cmd; |
| 7472 | wmi_buf_t buf; |
| 7473 | uint16_t len; |
| 7474 | QDF_STATUS ret; |
| 7475 | |
| 7476 | len = sizeof(*cmd); |
| 7477 | |
| 7478 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7479 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 7480 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Gyanranjan Hazarika | cd535f9 | 2018-01-17 19:29:45 -0800 | [diff] [blame] | 7481 | return QDF_STATUS_E_FAILURE; |
| 7482 | } |
| 7483 | cmd = (wmi_addba_clear_resp_cmd_fixed_param *)wmi_buf_data(buf); |
| 7484 | |
| 7485 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7486 | WMITLV_TAG_STRUC_wmi_addba_clear_resp_cmd_fixed_param, |
| 7487 | WMITLV_GET_STRUCT_TLVLEN(wmi_addba_clear_resp_cmd_fixed_param)); |
| 7488 | |
| 7489 | cmd->vdev_id = param->vdev_id; |
| 7490 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 7491 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 7492 | wmi_mtrace(WMI_ADDBA_CLEAR_RESP_CMDID, cmd->vdev_id, 0); |
Gyanranjan Hazarika | cd535f9 | 2018-01-17 19:29:45 -0800 | [diff] [blame] | 7493 | ret = wmi_unified_cmd_send(wmi_handle, |
| 7494 | buf, len, WMI_ADDBA_CLEAR_RESP_CMDID); |
| 7495 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 7496 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d", __func__, ret); |
| 7497 | wmi_buf_free(buf); |
| 7498 | return QDF_STATUS_E_FAILURE; |
| 7499 | } |
| 7500 | |
| 7501 | return QDF_STATUS_SUCCESS; |
| 7502 | } |
| 7503 | |
Pratik Gandhi | 3fd97d6 | 2018-09-17 16:47:12 +0530 | [diff] [blame] | 7504 | #ifdef OBSS_PD |
| 7505 | /** |
| 7506 | * send_obss_spatial_reuse_set_cmd_tlv - send obss spatial reuse set cmd to fw |
| 7507 | * @wmi_handle: wmi handle |
| 7508 | * @obss_spatial_reuse_param: pointer to obss_spatial_reuse_param |
| 7509 | * |
| 7510 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 7511 | */ |
| 7512 | static |
| 7513 | QDF_STATUS send_obss_spatial_reuse_set_cmd_tlv(wmi_unified_t wmi_handle, |
| 7514 | struct wmi_host_obss_spatial_reuse_set_param |
| 7515 | *obss_spatial_reuse_param) |
| 7516 | { |
| 7517 | wmi_buf_t buf; |
| 7518 | wmi_obss_spatial_reuse_set_cmd_fixed_param *cmd; |
| 7519 | QDF_STATUS ret; |
| 7520 | uint32_t len; |
| 7521 | |
| 7522 | len = sizeof(*cmd); |
| 7523 | |
| 7524 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7525 | if (!buf) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 7526 | qdf_print("%s: wmi_buf_alloc failed", __func__); |
Pratik Gandhi | 3fd97d6 | 2018-09-17 16:47:12 +0530 | [diff] [blame] | 7527 | return QDF_STATUS_E_FAILURE; |
| 7528 | } |
| 7529 | |
| 7530 | cmd = (wmi_obss_spatial_reuse_set_cmd_fixed_param *)wmi_buf_data(buf); |
| 7531 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7532 | WMITLV_TAG_STRUC_wmi_obss_spatial_reuse_set_cmd_fixed_param, |
| 7533 | WMITLV_GET_STRUCT_TLVLEN |
| 7534 | (wmi_obss_spatial_reuse_set_cmd_fixed_param)); |
| 7535 | |
| 7536 | cmd->enable = obss_spatial_reuse_param->enable; |
| 7537 | cmd->obss_min = obss_spatial_reuse_param->obss_min; |
| 7538 | cmd->obss_max = obss_spatial_reuse_param->obss_max; |
| 7539 | cmd->vdev_id = obss_spatial_reuse_param->vdev_id; |
| 7540 | |
| 7541 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7542 | WMI_PDEV_OBSS_PD_SPATIAL_REUSE_CMDID); |
| 7543 | |
| 7544 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 7545 | WMI_LOGE( |
| 7546 | "WMI_PDEV_OBSS_PD_SPATIAL_REUSE_CMDID send returned Error %d", |
| 7547 | ret); |
| 7548 | wmi_buf_free(buf); |
| 7549 | } |
| 7550 | |
| 7551 | return ret; |
| 7552 | } |
| 7553 | #endif |
| 7554 | |
Naveen Rawat | 963ee94 | 2018-04-13 16:38:36 -0700 | [diff] [blame] | 7555 | #ifdef QCA_SUPPORT_CP_STATS |
| 7556 | /** |
| 7557 | * extract_cca_stats_tlv - api to extract congestion stats from event buffer |
| 7558 | * @wmi_handle: wma handle |
| 7559 | * @evt_buf: event buffer |
| 7560 | * @out_buff: buffer to populated after stats extraction |
| 7561 | * |
| 7562 | * Return: status of operation |
| 7563 | */ |
| 7564 | static QDF_STATUS extract_cca_stats_tlv(wmi_unified_t wmi_handle, |
| 7565 | void *evt_buf, struct wmi_host_congestion_stats *out_buff) |
| 7566 | { |
| 7567 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 7568 | wmi_congestion_stats *congestion_stats; |
| 7569 | |
| 7570 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *)evt_buf; |
| 7571 | congestion_stats = param_buf->congestion_stats; |
| 7572 | if (!congestion_stats) { |
| 7573 | WMI_LOGD("%s: no cca stats in event buffer", __func__); |
| 7574 | return QDF_STATUS_E_INVAL; |
| 7575 | } |
| 7576 | |
| 7577 | out_buff->vdev_id = congestion_stats->vdev_id; |
| 7578 | out_buff->congestion = congestion_stats->congestion; |
| 7579 | |
| 7580 | WMI_LOGD("%s: cca stats event processed", __func__); |
| 7581 | return QDF_STATUS_SUCCESS; |
| 7582 | } |
| 7583 | #endif /* QCA_SUPPORT_CP_STATS */ |
| 7584 | |
Kiran Venkatappa | 7fe3afc | 2017-11-08 19:32:23 +0530 | [diff] [blame] | 7585 | /** |
Alok Singh | 0243e7d | 2018-09-20 16:07:28 +0530 | [diff] [blame] | 7586 | * extract_ctl_failsafe_check_ev_param_tlv() - extract ctl data from |
| 7587 | * event |
| 7588 | * @wmi_handle: wmi handle |
| 7589 | * @param evt_buf: pointer to event buffer |
| 7590 | * @param param: Pointer to hold peer ctl data |
| 7591 | * |
| 7592 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 7593 | */ |
| 7594 | static QDF_STATUS extract_ctl_failsafe_check_ev_param_tlv( |
| 7595 | wmi_unified_t wmi_handle, |
| 7596 | void *evt_buf, |
| 7597 | struct wmi_host_pdev_ctl_failsafe_event *param) |
| 7598 | { |
| 7599 | WMI_PDEV_CTL_FAILSAFE_CHECK_EVENTID_param_tlvs *param_buf; |
| 7600 | wmi_pdev_ctl_failsafe_check_fixed_param *fix_param; |
| 7601 | |
| 7602 | param_buf = (WMI_PDEV_CTL_FAILSAFE_CHECK_EVENTID_param_tlvs *)evt_buf; |
| 7603 | if (!param_buf) { |
| 7604 | WMI_LOGE("Invalid ctl_failsafe event buffer"); |
| 7605 | return QDF_STATUS_E_INVAL; |
| 7606 | } |
| 7607 | |
| 7608 | fix_param = param_buf->fixed_param; |
| 7609 | param->ctl_failsafe_status = fix_param->ctl_FailsafeStatus; |
| 7610 | |
| 7611 | return QDF_STATUS_SUCCESS; |
| 7612 | } |
| 7613 | |
| 7614 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7615 | * save_service_bitmap_tlv() - save service bitmap |
| 7616 | * @wmi_handle: wmi handle |
| 7617 | * @param evt_buf: pointer to event buffer |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 7618 | * @param bitmap_buf: bitmap buffer, for converged legacy support |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7619 | * |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7620 | * Return: QDF_STATUS |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7621 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 7622 | static |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7623 | QDF_STATUS save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 7624 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7625 | { |
| 7626 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7627 | struct wmi_soc *soc = wmi_handle->soc; |
| 7628 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7629 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 7630 | |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7631 | /* If it is already allocated, use that buffer. This can happen |
| 7632 | * during target stop/start scenarios where host allocation is skipped. |
| 7633 | */ |
| 7634 | if (!soc->wmi_service_bitmap) { |
| 7635 | soc->wmi_service_bitmap = |
| 7636 | qdf_mem_malloc(WMI_SERVICE_BM_SIZE * sizeof(uint32_t)); |
| 7637 | if (!soc->wmi_service_bitmap) { |
| 7638 | WMI_LOGE("Failed memory allocation for service bitmap"); |
| 7639 | return QDF_STATUS_E_NOMEM; |
| 7640 | } |
| 7641 | } |
| 7642 | |
| 7643 | qdf_mem_copy(soc->wmi_service_bitmap, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7644 | param_buf->wmi_service_bitmap, |
| 7645 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 7646 | |
| 7647 | if (bitmap_buf) |
| 7648 | qdf_mem_copy(bitmap_buf, |
| 7649 | param_buf->wmi_service_bitmap, |
| 7650 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7651 | |
| 7652 | return QDF_STATUS_SUCCESS; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7653 | } |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7654 | |
| 7655 | /** |
| 7656 | * save_ext_service_bitmap_tlv() - save extendend service bitmap |
| 7657 | * @wmi_handle: wmi handle |
| 7658 | * @param evt_buf: pointer to event buffer |
| 7659 | * @param bitmap_buf: bitmap buffer, for converged legacy support |
| 7660 | * |
| 7661 | * Return: QDF_STATUS |
| 7662 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 7663 | static |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7664 | QDF_STATUS save_ext_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 7665 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7666 | { |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7667 | WMI_SERVICE_AVAILABLE_EVENTID_param_tlvs *param_buf; |
| 7668 | wmi_service_available_event_fixed_param *ev; |
| 7669 | struct wmi_soc *soc = wmi_handle->soc; |
| 7670 | |
| 7671 | param_buf = (WMI_SERVICE_AVAILABLE_EVENTID_param_tlvs *) evt_buf; |
| 7672 | |
| 7673 | ev = param_buf->fixed_param; |
| 7674 | |
| 7675 | /* If it is already allocated, use that buffer. This can happen |
| 7676 | * during target stop/start scenarios where host allocation is skipped. |
| 7677 | */ |
| 7678 | if (!soc->wmi_ext_service_bitmap) { |
| 7679 | soc->wmi_ext_service_bitmap = qdf_mem_malloc( |
| 7680 | WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(uint32_t)); |
| 7681 | if (!soc->wmi_ext_service_bitmap) { |
| 7682 | WMI_LOGE("Failed memory allocation for service bitmap"); |
| 7683 | return QDF_STATUS_E_NOMEM; |
| 7684 | } |
| 7685 | } |
| 7686 | |
| 7687 | qdf_mem_copy(soc->wmi_ext_service_bitmap, |
| 7688 | ev->wmi_service_segment_bitmap, |
| 7689 | (WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(uint32_t))); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7690 | |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 7691 | WMI_LOGD("wmi_ext_service_bitmap 0:0x%x, 1:0x%x, 2:0x%x, 3:0x%x", |
Om Prakash Tripathi | 3bfb50c | 2017-11-07 14:37:22 +0530 | [diff] [blame] | 7692 | soc->wmi_ext_service_bitmap[0], soc->wmi_ext_service_bitmap[1], |
| 7693 | soc->wmi_ext_service_bitmap[2], soc->wmi_ext_service_bitmap[3]); |
| 7694 | |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 7695 | if (bitmap_buf) |
| 7696 | qdf_mem_copy(bitmap_buf, |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7697 | soc->wmi_ext_service_bitmap, |
| 7698 | (WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(uint32_t))); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7699 | |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7700 | return QDF_STATUS_SUCCESS; |
| 7701 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7702 | /** |
| 7703 | * is_service_enabled_tlv() - Check if service enabled |
| 7704 | * @param wmi_handle: wmi handle |
| 7705 | * @param service_id: service identifier |
| 7706 | * |
| 7707 | * Return: 1 enabled, 0 disabled |
| 7708 | */ |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7709 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 7710 | uint32_t service_id) |
| 7711 | { |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7712 | struct wmi_soc *soc = wmi_handle->soc; |
| 7713 | |
| 7714 | if (!soc->wmi_service_bitmap) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 7715 | WMI_LOGE("WMI service bit map is not saved yet"); |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7716 | return false; |
| 7717 | } |
| 7718 | |
Sourav Mohapatra | a7b454d | 2017-12-03 11:44:44 +0530 | [diff] [blame] | 7719 | /* if wmi_service_enabled was received with extended bitmap, |
| 7720 | * use WMI_SERVICE_EXT_IS_ENABLED to check the services. |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7721 | */ |
| 7722 | if (soc->wmi_ext_service_bitmap) |
| 7723 | return WMI_SERVICE_EXT_IS_ENABLED(soc->wmi_service_bitmap, |
| 7724 | soc->wmi_ext_service_bitmap, |
| 7725 | service_id); |
| 7726 | |
Zhu Jianmin | 3ed26de | 2018-04-19 17:55:30 +0800 | [diff] [blame] | 7727 | if (service_id >= WMI_MAX_SERVICE) { |
| 7728 | WMI_LOGE("Service id %d but WMI ext service bitmap is NULL", |
| 7729 | service_id); |
| 7730 | return false; |
| 7731 | } |
| 7732 | |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 7733 | return WMI_SERVICE_IS_ENABLED(soc->wmi_service_bitmap, |
| 7734 | service_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7735 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7736 | |
Nandha Kishore Easwaran | a769b36 | 2017-06-15 10:29:29 +0530 | [diff] [blame] | 7737 | static inline void copy_ht_cap_info(uint32_t ev_target_cap, |
| 7738 | struct wlan_psoc_target_capability_info *cap) |
| 7739 | { |
| 7740 | /* except LDPC all flags are common betwen legacy and here |
| 7741 | * also IBFEER is not defined for TLV |
| 7742 | */ |
| 7743 | cap->ht_cap_info |= ev_target_cap & ( |
| 7744 | WMI_HT_CAP_ENABLED |
| 7745 | | WMI_HT_CAP_HT20_SGI |
| 7746 | | WMI_HT_CAP_DYNAMIC_SMPS |
| 7747 | | WMI_HT_CAP_TX_STBC |
| 7748 | | WMI_HT_CAP_TX_STBC_MASK_SHIFT |
| 7749 | | WMI_HT_CAP_RX_STBC |
| 7750 | | WMI_HT_CAP_RX_STBC_MASK_SHIFT |
| 7751 | | WMI_HT_CAP_LDPC |
| 7752 | | WMI_HT_CAP_L_SIG_TXOP_PROT |
| 7753 | | WMI_HT_CAP_MPDU_DENSITY |
| 7754 | | WMI_HT_CAP_MPDU_DENSITY_MASK_SHIFT |
| 7755 | | WMI_HT_CAP_HT40_SGI); |
| 7756 | if (ev_target_cap & WMI_HT_CAP_LDPC) |
| 7757 | cap->ht_cap_info |= WMI_HOST_HT_CAP_RX_LDPC | |
| 7758 | WMI_HOST_HT_CAP_TX_LDPC; |
| 7759 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7760 | /** |
| 7761 | * extract_service_ready_tlv() - extract service ready event |
| 7762 | * @wmi_handle: wmi handle |
| 7763 | * @param evt_buf: pointer to received event buffer |
| 7764 | * @param cap: pointer to hold target capability information extracted from even |
| 7765 | * |
| 7766 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 7767 | */ |
| 7768 | static QDF_STATUS extract_service_ready_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 7769 | void *evt_buf, struct wlan_psoc_target_capability_info *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7770 | { |
| 7771 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 7772 | wmi_service_ready_event_fixed_param *ev; |
| 7773 | |
| 7774 | |
| 7775 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 7776 | |
| 7777 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 7778 | if (!ev) { |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 7779 | qdf_print("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7780 | return QDF_STATUS_E_FAILURE; |
| 7781 | } |
| 7782 | |
| 7783 | cap->phy_capability = ev->phy_capability; |
| 7784 | cap->max_frag_entry = ev->max_frag_entry; |
| 7785 | cap->num_rf_chains = ev->num_rf_chains; |
Nandha Kishore Easwaran | a769b36 | 2017-06-15 10:29:29 +0530 | [diff] [blame] | 7786 | copy_ht_cap_info(ev->ht_cap_info, cap); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7787 | cap->vht_cap_info = ev->vht_cap_info; |
| 7788 | cap->vht_supp_mcs = ev->vht_supp_mcs; |
| 7789 | cap->hw_min_tx_power = ev->hw_min_tx_power; |
| 7790 | cap->hw_max_tx_power = ev->hw_max_tx_power; |
| 7791 | cap->sys_cap_info = ev->sys_cap_info; |
| 7792 | cap->min_pkt_size_enable = ev->min_pkt_size_enable; |
| 7793 | cap->max_bcn_ie_size = ev->max_bcn_ie_size; |
| 7794 | cap->max_num_scan_channels = ev->max_num_scan_channels; |
| 7795 | cap->max_supported_macs = ev->max_supported_macs; |
| 7796 | cap->wmi_fw_sub_feat_caps = ev->wmi_fw_sub_feat_caps; |
| 7797 | cap->txrx_chainmask = ev->txrx_chainmask; |
| 7798 | cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; |
| 7799 | cap->num_msdu_desc = ev->num_msdu_desc; |
Kiran Venkatappa | 59d6e1f | 2017-10-12 15:04:22 +0530 | [diff] [blame] | 7800 | cap->fw_version = ev->fw_build_vers; |
| 7801 | /* fw_version_1 is not available in TLV. */ |
| 7802 | cap->fw_version_1 = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7803 | |
| 7804 | return QDF_STATUS_SUCCESS; |
| 7805 | } |
| 7806 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 7807 | /* convert_wireless_modes_tlv() - Convert REGDMN_MODE values sent by target |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 7808 | * to host internal WMI_HOST_REGDMN_MODE values. |
| 7809 | * REGULATORY TODO : REGDMN_MODE_11AC_VHT*_2G values are not used by the |
| 7810 | * host currently. Add this in the future if required. |
| 7811 | * 11AX (Phase II) : 11ax related values are not currently |
| 7812 | * advertised separately by FW. As part of phase II regulatory bring-up, |
| 7813 | * finalize the advertisement mechanism. |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 7814 | * @target_wireless_mode: target wireless mode received in message |
| 7815 | * |
| 7816 | * Return: returns the host internal wireless mode. |
| 7817 | */ |
| 7818 | static inline uint32_t convert_wireless_modes_tlv(uint32_t target_wireless_mode) |
| 7819 | { |
| 7820 | |
| 7821 | uint32_t wireless_modes = 0; |
| 7822 | |
| 7823 | if (target_wireless_mode & REGDMN_MODE_11A) |
| 7824 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A; |
| 7825 | |
| 7826 | if (target_wireless_mode & REGDMN_MODE_TURBO) |
| 7827 | wireless_modes |= WMI_HOST_REGDMN_MODE_TURBO; |
| 7828 | |
| 7829 | if (target_wireless_mode & REGDMN_MODE_11B) |
| 7830 | wireless_modes |= WMI_HOST_REGDMN_MODE_11B; |
| 7831 | |
| 7832 | if (target_wireless_mode & REGDMN_MODE_PUREG) |
| 7833 | wireless_modes |= WMI_HOST_REGDMN_MODE_PUREG; |
| 7834 | |
| 7835 | if (target_wireless_mode & REGDMN_MODE_11G) |
| 7836 | wireless_modes |= WMI_HOST_REGDMN_MODE_11G; |
| 7837 | |
| 7838 | if (target_wireless_mode & REGDMN_MODE_108G) |
| 7839 | wireless_modes |= WMI_HOST_REGDMN_MODE_108G; |
| 7840 | |
| 7841 | if (target_wireless_mode & REGDMN_MODE_108A) |
| 7842 | wireless_modes |= WMI_HOST_REGDMN_MODE_108A; |
| 7843 | |
| 7844 | if (target_wireless_mode & REGDMN_MODE_XR) |
| 7845 | wireless_modes |= WMI_HOST_REGDMN_MODE_XR; |
| 7846 | |
| 7847 | if (target_wireless_mode & REGDMN_MODE_11A_HALF_RATE) |
| 7848 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_HALF_RATE; |
| 7849 | |
| 7850 | if (target_wireless_mode & REGDMN_MODE_11A_QUARTER_RATE) |
| 7851 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_QUARTER_RATE; |
| 7852 | |
| 7853 | if (target_wireless_mode & REGDMN_MODE_11NG_HT20) |
| 7854 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT20; |
| 7855 | |
| 7856 | if (target_wireless_mode & REGDMN_MODE_11NA_HT20) |
| 7857 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT20; |
| 7858 | |
| 7859 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40PLUS) |
| 7860 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40PLUS; |
| 7861 | |
| 7862 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40MINUS) |
| 7863 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40MINUS; |
| 7864 | |
| 7865 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40PLUS) |
| 7866 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40PLUS; |
| 7867 | |
| 7868 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40MINUS) |
| 7869 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40MINUS; |
| 7870 | |
| 7871 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT20) |
| 7872 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT20; |
| 7873 | |
| 7874 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40PLUS) |
| 7875 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40PLUS; |
| 7876 | |
| 7877 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40MINUS) |
| 7878 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40MINUS; |
| 7879 | |
| 7880 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80) |
| 7881 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80; |
| 7882 | |
| 7883 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT160) |
| 7884 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT160; |
| 7885 | |
| 7886 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80_80) |
| 7887 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80_80; |
| 7888 | |
| 7889 | return wireless_modes; |
| 7890 | } |
| 7891 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7892 | /** |
| 7893 | * extract_hal_reg_cap_tlv() - extract HAL registered capabilities |
| 7894 | * @wmi_handle: wmi handle |
| 7895 | * @param evt_buf: Pointer to event buffer |
| 7896 | * @param cap: pointer to hold HAL reg capabilities |
| 7897 | * |
| 7898 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 7899 | */ |
| 7900 | static QDF_STATUS extract_hal_reg_cap_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 7901 | void *evt_buf, struct wlan_psoc_hal_reg_capability *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7902 | { |
| 7903 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 7904 | |
| 7905 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 7906 | |
| 7907 | qdf_mem_copy(cap, (((uint8_t *)param_buf->hal_reg_capabilities) + |
| 7908 | sizeof(uint32_t)), |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 7909 | sizeof(struct wlan_psoc_hal_reg_capability)); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7910 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 7911 | cap->wireless_modes = convert_wireless_modes_tlv( |
| 7912 | param_buf->hal_reg_capabilities->wireless_modes); |
Pratik Gandhi | 33bb714 | 2017-01-05 19:38:41 +0530 | [diff] [blame] | 7913 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7914 | return QDF_STATUS_SUCCESS; |
| 7915 | } |
| 7916 | |
| 7917 | /** |
| 7918 | * extract_host_mem_req_tlv() - Extract host memory request event |
| 7919 | * @wmi_handle: wmi handle |
| 7920 | * @param evt_buf: pointer to event buffer |
| 7921 | * @param num_entries: pointer to hold number of entries requested |
| 7922 | * |
| 7923 | * Return: Number of entries requested |
| 7924 | */ |
| 7925 | static host_mem_req *extract_host_mem_req_tlv(wmi_unified_t wmi_handle, |
| 7926 | void *evt_buf, uint8_t *num_entries) |
| 7927 | { |
| 7928 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 7929 | wmi_service_ready_event_fixed_param *ev; |
| 7930 | |
| 7931 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 7932 | |
| 7933 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 7934 | if (!ev) { |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 7935 | qdf_print("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7936 | return NULL; |
| 7937 | } |
| 7938 | |
| 7939 | *num_entries = ev->num_mem_reqs; |
| 7940 | |
| 7941 | return (host_mem_req *)param_buf->mem_reqs; |
| 7942 | } |
| 7943 | |
| 7944 | /** |
| 7945 | * save_fw_version_in_service_ready_tlv() - Save fw version in service |
| 7946 | * ready function |
| 7947 | * @wmi_handle: wmi handle |
| 7948 | * @param evt_buf: pointer to event buffer |
| 7949 | * |
| 7950 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 7951 | */ |
| 7952 | static QDF_STATUS |
| 7953 | save_fw_version_in_service_ready_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 7954 | { |
| 7955 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 7956 | wmi_service_ready_event_fixed_param *ev; |
| 7957 | |
| 7958 | |
| 7959 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 7960 | |
| 7961 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 7962 | if (!ev) { |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 7963 | qdf_print("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7964 | return QDF_STATUS_E_FAILURE; |
| 7965 | } |
| 7966 | |
| 7967 | /*Save fw version from service ready message */ |
| 7968 | /*This will be used while sending INIT message */ |
| 7969 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
| 7970 | sizeof(wmi_handle->fw_abi_version)); |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 7971 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7972 | return QDF_STATUS_SUCCESS; |
| 7973 | } |
| 7974 | |
| 7975 | /** |
| 7976 | * ready_extract_init_status_tlv() - Extract init status from ready event |
| 7977 | * @wmi_handle: wmi handle |
| 7978 | * @param evt_buf: Pointer to event buffer |
| 7979 | * |
| 7980 | * Return: ready status |
| 7981 | */ |
| 7982 | static uint32_t ready_extract_init_status_tlv(wmi_unified_t wmi_handle, |
| 7983 | void *evt_buf) |
| 7984 | { |
| 7985 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 7986 | wmi_ready_event_fixed_param *ev = NULL; |
| 7987 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7988 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 7989 | ev = param_buf->fixed_param; |
| 7990 | |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 7991 | qdf_print("%s:%d", __func__, ev->status); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7992 | |
| 7993 | return ev->status; |
| 7994 | } |
| 7995 | |
| 7996 | /** |
| 7997 | * ready_extract_mac_addr_tlv() - extract mac address from ready event |
| 7998 | * @wmi_handle: wmi handle |
| 7999 | * @param evt_buf: pointer to event buffer |
| 8000 | * @param macaddr: Pointer to hold MAC address |
| 8001 | * |
| 8002 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8003 | */ |
| 8004 | static QDF_STATUS ready_extract_mac_addr_tlv(wmi_unified_t wmi_hamdle, |
| 8005 | void *evt_buf, uint8_t *macaddr) |
| 8006 | { |
| 8007 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 8008 | wmi_ready_event_fixed_param *ev = NULL; |
| 8009 | |
| 8010 | |
| 8011 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 8012 | ev = param_buf->fixed_param; |
| 8013 | |
| 8014 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, macaddr); |
| 8015 | |
| 8016 | return QDF_STATUS_SUCCESS; |
| 8017 | } |
| 8018 | |
| 8019 | /** |
Manoj Ekbote | dd27390 | 2017-07-09 23:28:56 -0700 | [diff] [blame] | 8020 | * ready_extract_mac_addr_list_tlv() - extract MAC address list from ready event |
| 8021 | * @wmi_handle: wmi handle |
| 8022 | * @param evt_buf: pointer to event buffer |
| 8023 | * @param macaddr: Pointer to hold number of MAC addresses |
| 8024 | * |
| 8025 | * Return: Pointer to addr list |
| 8026 | */ |
| 8027 | static wmi_host_mac_addr *ready_extract_mac_addr_list_tlv(wmi_unified_t wmi_hamdle, |
| 8028 | void *evt_buf, uint8_t *num_mac) |
| 8029 | { |
| 8030 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 8031 | wmi_ready_event_fixed_param *ev = NULL; |
| 8032 | |
| 8033 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 8034 | ev = param_buf->fixed_param; |
| 8035 | |
| 8036 | *num_mac = ev->num_extra_mac_addr; |
| 8037 | |
| 8038 | return (wmi_host_mac_addr *) param_buf->mac_addr_list; |
| 8039 | } |
| 8040 | |
| 8041 | /** |
Kiran Venkatappa | 094c24f | 2017-11-10 20:50:12 +0530 | [diff] [blame] | 8042 | * extract_ready_params_tlv() - Extract data from ready event apart from |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 8043 | * status, macaddr and version. |
Kiran Venkatappa | 094c24f | 2017-11-10 20:50:12 +0530 | [diff] [blame] | 8044 | * @wmi_handle: Pointer to WMI handle. |
| 8045 | * @evt_buf: Pointer to Ready event buffer. |
| 8046 | * @ev_param: Pointer to host defined struct to copy the data from event. |
| 8047 | * |
| 8048 | * Return: QDF_STATUS_SUCCESS on success. |
| 8049 | */ |
| 8050 | static QDF_STATUS extract_ready_event_params_tlv(wmi_unified_t wmi_handle, |
| 8051 | void *evt_buf, struct wmi_host_ready_ev_param *ev_param) |
| 8052 | { |
| 8053 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 8054 | wmi_ready_event_fixed_param *ev = NULL; |
| 8055 | |
| 8056 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 8057 | ev = param_buf->fixed_param; |
| 8058 | |
Kiran Venkatappa | b458a1c | 2017-11-28 12:23:24 +0530 | [diff] [blame] | 8059 | ev_param->status = ev->status; |
Kiran Venkatappa | 094c24f | 2017-11-10 20:50:12 +0530 | [diff] [blame] | 8060 | ev_param->num_dscp_table = ev->num_dscp_table; |
| 8061 | ev_param->num_extra_mac_addr = ev->num_extra_mac_addr; |
| 8062 | ev_param->num_total_peer = ev->num_total_peers; |
Kiran Venkatappa | b458a1c | 2017-11-28 12:23:24 +0530 | [diff] [blame] | 8063 | ev_param->num_extra_peer = ev->num_extra_peers; |
Kiran Venkatappa | 094c24f | 2017-11-10 20:50:12 +0530 | [diff] [blame] | 8064 | /* Agile_cap in ready event is not supported in TLV target */ |
| 8065 | ev_param->agile_capability = false; |
| 8066 | |
| 8067 | return QDF_STATUS_SUCCESS; |
| 8068 | } |
| 8069 | |
| 8070 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8071 | * extract_dbglog_data_len_tlv() - extract debuglog data length |
| 8072 | * @wmi_handle: wmi handle |
| 8073 | * @param evt_buf: pointer to event buffer |
| 8074 | * |
| 8075 | * Return: length |
| 8076 | */ |
| 8077 | static uint8_t *extract_dbglog_data_len_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 029b9ea | 2017-01-25 12:46:21 -0800 | [diff] [blame] | 8078 | void *evt_buf, uint32_t *len) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8079 | { |
| 8080 | WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf; |
| 8081 | |
| 8082 | param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) evt_buf; |
| 8083 | |
| 8084 | *len = param_buf->num_bufp; |
| 8085 | |
| 8086 | return param_buf->bufp; |
| 8087 | } |
| 8088 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8089 | |
Jinwei Chen | b69924c | 2018-08-20 11:31:31 +0800 | [diff] [blame] | 8090 | #ifdef CONFIG_MCL |
| 8091 | #define IS_WMI_RX_MGMT_FRAME_STATUS_INVALID(_status) \ |
| 8092 | ((_status) & WMI_RXERR_DECRYPT) |
| 8093 | #else |
| 8094 | #define IS_WMI_RX_MGMT_FRAME_STATUS_INVALID(_status) false |
| 8095 | #endif |
| 8096 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8097 | /** |
| 8098 | * extract_mgmt_rx_params_tlv() - extract management rx params from event |
| 8099 | * @wmi_handle: wmi handle |
| 8100 | * @param evt_buf: pointer to event buffer |
| 8101 | * @param hdr: Pointer to hold header |
| 8102 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 8103 | * |
| 8104 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8105 | */ |
| 8106 | static QDF_STATUS extract_mgmt_rx_params_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | b4992a4 | 2017-01-05 14:23:18 +0530 | [diff] [blame] | 8107 | void *evt_buf, struct mgmt_rx_event_params *hdr, |
| 8108 | uint8_t **bufp) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8109 | { |
| 8110 | WMI_MGMT_RX_EVENTID_param_tlvs *param_tlvs = NULL; |
| 8111 | wmi_mgmt_rx_hdr *ev_hdr = NULL; |
gaurank kathpalia | 6a51f2b | 2018-01-29 18:09:06 +0530 | [diff] [blame] | 8112 | int i; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8113 | |
| 8114 | param_tlvs = (WMI_MGMT_RX_EVENTID_param_tlvs *) evt_buf; |
| 8115 | if (!param_tlvs) { |
| 8116 | WMI_LOGE("Get NULL point message from FW"); |
| 8117 | return QDF_STATUS_E_INVAL; |
| 8118 | } |
| 8119 | |
| 8120 | ev_hdr = param_tlvs->hdr; |
| 8121 | if (!hdr) { |
| 8122 | WMI_LOGE("Rx event is NULL"); |
| 8123 | return QDF_STATUS_E_INVAL; |
| 8124 | } |
| 8125 | |
Jinwei Chen | b69924c | 2018-08-20 11:31:31 +0800 | [diff] [blame] | 8126 | if (IS_WMI_RX_MGMT_FRAME_STATUS_INVALID(ev_hdr->status)) { |
| 8127 | WMI_LOGE("%s: RX mgmt frame decrypt error, discard it", |
| 8128 | __func__); |
| 8129 | return QDF_STATUS_E_INVAL; |
| 8130 | } |
| 8131 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 8132 | hdr->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 8133 | ev_hdr->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8134 | |
| 8135 | hdr->channel = ev_hdr->channel; |
| 8136 | hdr->snr = ev_hdr->snr; |
| 8137 | hdr->rate = ev_hdr->rate; |
| 8138 | hdr->phy_mode = ev_hdr->phy_mode; |
| 8139 | hdr->buf_len = ev_hdr->buf_len; |
| 8140 | hdr->status = ev_hdr->status; |
| 8141 | hdr->flags = ev_hdr->flags; |
| 8142 | hdr->rssi = ev_hdr->rssi; |
| 8143 | hdr->tsf_delta = ev_hdr->tsf_delta; |
gaurank kathpalia | 6a51f2b | 2018-01-29 18:09:06 +0530 | [diff] [blame] | 8144 | for (i = 0; i < ATH_MAX_ANTENNA; i++) |
| 8145 | hdr->rssi_ctl[i] = ev_hdr->rssi_ctl[i]; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8146 | |
| 8147 | *bufp = param_tlvs->bufp; |
| 8148 | |
| 8149 | return QDF_STATUS_SUCCESS; |
| 8150 | } |
| 8151 | |
| 8152 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8153 | * extract_vdev_roam_param_tlv() - extract vdev roam param from event |
| 8154 | * @wmi_handle: wmi handle |
| 8155 | * @param evt_buf: pointer to event buffer |
| 8156 | * @param param: Pointer to hold roam param |
| 8157 | * |
| 8158 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8159 | */ |
| 8160 | static QDF_STATUS extract_vdev_roam_param_tlv(wmi_unified_t wmi_handle, |
| 8161 | void *evt_buf, wmi_host_roam_event *param) |
| 8162 | { |
| 8163 | WMI_ROAM_EVENTID_param_tlvs *param_buf; |
| 8164 | wmi_roam_event_fixed_param *evt; |
| 8165 | |
| 8166 | param_buf = (WMI_ROAM_EVENTID_param_tlvs *) evt_buf; |
| 8167 | if (!param_buf) { |
| 8168 | WMI_LOGE("Invalid roam event buffer"); |
| 8169 | return QDF_STATUS_E_INVAL; |
| 8170 | } |
| 8171 | |
| 8172 | evt = param_buf->fixed_param; |
| 8173 | qdf_mem_zero(param, sizeof(*param)); |
| 8174 | |
| 8175 | param->vdev_id = evt->vdev_id; |
| 8176 | param->reason = evt->reason; |
| 8177 | param->rssi = evt->rssi; |
| 8178 | |
| 8179 | return QDF_STATUS_SUCCESS; |
| 8180 | } |
| 8181 | |
| 8182 | /** |
| 8183 | * extract_vdev_scan_ev_param_tlv() - extract vdev scan param from event |
| 8184 | * @wmi_handle: wmi handle |
| 8185 | * @param evt_buf: pointer to event buffer |
| 8186 | * @param param: Pointer to hold vdev scan param |
| 8187 | * |
| 8188 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8189 | */ |
| 8190 | static QDF_STATUS extract_vdev_scan_ev_param_tlv(wmi_unified_t wmi_handle, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8191 | void *evt_buf, struct scan_event *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8192 | { |
| 8193 | WMI_SCAN_EVENTID_param_tlvs *param_buf = NULL; |
| 8194 | wmi_scan_event_fixed_param *evt = NULL; |
| 8195 | |
| 8196 | param_buf = (WMI_SCAN_EVENTID_param_tlvs *) evt_buf; |
| 8197 | evt = param_buf->fixed_param; |
| 8198 | |
| 8199 | qdf_mem_zero(param, sizeof(*param)); |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 8200 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8201 | switch (evt->event) { |
| 8202 | case WMI_SCAN_EVENT_STARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8203 | param->type = SCAN_EVENT_TYPE_STARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8204 | break; |
| 8205 | case WMI_SCAN_EVENT_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8206 | param->type = SCAN_EVENT_TYPE_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8207 | break; |
| 8208 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8209 | param->type = SCAN_EVENT_TYPE_BSS_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8210 | break; |
| 8211 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8212 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8213 | break; |
| 8214 | case WMI_SCAN_EVENT_DEQUEUED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8215 | param->type = SCAN_EVENT_TYPE_DEQUEUED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8216 | break; |
| 8217 | case WMI_SCAN_EVENT_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8218 | param->type = SCAN_EVENT_TYPE_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8219 | break; |
| 8220 | case WMI_SCAN_EVENT_START_FAILED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8221 | param->type = SCAN_EVENT_TYPE_START_FAILED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8222 | break; |
| 8223 | case WMI_SCAN_EVENT_RESTARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8224 | param->type = SCAN_EVENT_TYPE_RESTARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8225 | break; |
Sreelakshmi Konamki | 76d62af | 2017-05-25 18:11:03 +0530 | [diff] [blame] | 8226 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8227 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8228 | break; |
| 8229 | case WMI_SCAN_EVENT_MAX: |
| 8230 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8231 | param->type = SCAN_EVENT_TYPE_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8232 | break; |
| 8233 | }; |
| 8234 | |
| 8235 | switch (evt->reason) { |
| 8236 | case WMI_SCAN_REASON_NONE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8237 | param->reason = SCAN_REASON_NONE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8238 | break; |
| 8239 | case WMI_SCAN_REASON_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8240 | param->reason = SCAN_REASON_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8241 | break; |
| 8242 | case WMI_SCAN_REASON_CANCELLED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8243 | param->reason = SCAN_REASON_CANCELLED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8244 | break; |
| 8245 | case WMI_SCAN_REASON_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8246 | param->reason = SCAN_REASON_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8247 | break; |
| 8248 | case WMI_SCAN_REASON_TIMEDOUT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8249 | param->reason = SCAN_REASON_TIMEDOUT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8250 | break; |
| 8251 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8252 | param->reason = SCAN_REASON_INTERNAL_FAILURE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8253 | break; |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 8254 | case WMI_SCAN_REASON_SUSPENDED: |
| 8255 | param->reason = SCAN_REASON_SUSPENDED; |
| 8256 | break; |
Abhijit Pradhan | f6694f8 | 2018-10-17 10:13:15 +0530 | [diff] [blame] | 8257 | case WMI_SCAN_REASON_DFS_VIOLATION: |
| 8258 | param->reason = SCAN_REASON_DFS_VIOLATION; |
| 8259 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8260 | case WMI_SCAN_REASON_MAX: |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 8261 | param->reason = SCAN_REASON_MAX; |
| 8262 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8263 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8264 | param->reason = SCAN_REASON_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8265 | break; |
| 8266 | }; |
| 8267 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 8268 | param->chan_freq = evt->channel_freq; |
| 8269 | param->requester = evt->requestor; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8270 | param->scan_id = evt->scan_id; |
| 8271 | param->vdev_id = evt->vdev_id; |
Sathish Kumar | b863315 | 2017-08-11 15:00:04 +0530 | [diff] [blame] | 8272 | param->timestamp = evt->tsf_timestamp; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8273 | |
| 8274 | return QDF_STATUS_SUCCESS; |
| 8275 | } |
| 8276 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8277 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8278 | * extract_all_stats_counts_tlv() - extract all stats count from event |
| 8279 | * @wmi_handle: wmi handle |
| 8280 | * @param evt_buf: pointer to event buffer |
| 8281 | * @param stats_param: Pointer to hold stats count |
| 8282 | * |
| 8283 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8284 | */ |
| 8285 | static QDF_STATUS extract_all_stats_counts_tlv(wmi_unified_t wmi_handle, |
| 8286 | void *evt_buf, wmi_host_stats_event *stats_param) |
| 8287 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8288 | wmi_stats_event_fixed_param *ev; |
Naveen Rawat | 57e47aa | 2018-04-06 10:57:20 -0700 | [diff] [blame] | 8289 | wmi_per_chain_rssi_stats *rssi_event; |
| 8290 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
Jianmin Zhu | f1b8d51 | 2018-09-03 20:08:27 +0800 | [diff] [blame] | 8291 | uint64_t min_data_len; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8292 | |
Naveen Rawat | 57e47aa | 2018-04-06 10:57:20 -0700 | [diff] [blame] | 8293 | qdf_mem_zero(stats_param, sizeof(*stats_param)); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8294 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8295 | ev = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
Naveen Rawat | 57e47aa | 2018-04-06 10:57:20 -0700 | [diff] [blame] | 8296 | rssi_event = param_buf->chain_stats; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8297 | if (!ev) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 8298 | WMI_LOGE("%s: event fixed param NULL", __func__); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8299 | return QDF_STATUS_E_FAILURE; |
| 8300 | } |
| 8301 | |
Jianmin Zhu | f1b8d51 | 2018-09-03 20:08:27 +0800 | [diff] [blame] | 8302 | if (param_buf->num_data > WMI_SVC_MSG_MAX_SIZE - sizeof(*ev)) { |
| 8303 | WMI_LOGE("num_data : %u is invalid", param_buf->num_data); |
| 8304 | return QDF_STATUS_E_FAULT; |
| 8305 | } |
| 8306 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8307 | switch (ev->stats_id) { |
| 8308 | case WMI_REQUEST_PEER_STAT: |
| 8309 | stats_param->stats_id = WMI_HOST_REQUEST_PEER_STAT; |
| 8310 | break; |
| 8311 | |
| 8312 | case WMI_REQUEST_AP_STAT: |
| 8313 | stats_param->stats_id = WMI_HOST_REQUEST_AP_STAT; |
| 8314 | break; |
| 8315 | |
| 8316 | case WMI_REQUEST_PDEV_STAT: |
| 8317 | stats_param->stats_id = WMI_HOST_REQUEST_PDEV_STAT; |
| 8318 | break; |
| 8319 | |
| 8320 | case WMI_REQUEST_VDEV_STAT: |
| 8321 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_STAT; |
| 8322 | break; |
| 8323 | |
| 8324 | case WMI_REQUEST_BCNFLT_STAT: |
| 8325 | stats_param->stats_id = WMI_HOST_REQUEST_BCNFLT_STAT; |
| 8326 | break; |
| 8327 | |
| 8328 | case WMI_REQUEST_VDEV_RATE_STAT: |
| 8329 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT; |
| 8330 | break; |
| 8331 | |
Gurumoorthi Gnanasambandhan | b5fb836 | 2017-11-06 22:04:17 +0530 | [diff] [blame] | 8332 | case WMI_REQUEST_BCN_STAT: |
| 8333 | stats_param->stats_id |= WMI_HOST_REQUEST_BCN_STAT; |
| 8334 | break; |
| 8335 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8336 | default: |
| 8337 | stats_param->stats_id = 0; |
| 8338 | break; |
| 8339 | |
| 8340 | } |
| 8341 | |
Jianmin Zhu | f1b8d51 | 2018-09-03 20:08:27 +0800 | [diff] [blame] | 8342 | /* ev->num_*_stats may cause uint32_t overflow, so use uint64_t |
| 8343 | * to save total length calculated |
| 8344 | */ |
| 8345 | min_data_len = |
Nandha Kishore Easwaran | 6dd231d | 2018-10-10 11:04:09 +0530 | [diff] [blame] | 8346 | (((uint64_t)ev->num_pdev_stats) * sizeof(wmi_pdev_stats_v2)) + |
Jianmin Zhu | f1b8d51 | 2018-09-03 20:08:27 +0800 | [diff] [blame] | 8347 | (((uint64_t)ev->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 8348 | (((uint64_t)ev->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 8349 | (((uint64_t)ev->num_bcnflt_stats) * |
| 8350 | sizeof(wmi_bcnfilter_stats_t)) + |
| 8351 | (((uint64_t)ev->num_chan_stats) * sizeof(wmi_chan_stats)) + |
| 8352 | (((uint64_t)ev->num_mib_stats) * sizeof(wmi_mib_stats)) + |
| 8353 | (((uint64_t)ev->num_bcn_stats) * sizeof(wmi_bcn_stats)) + |
| 8354 | (((uint64_t)ev->num_peer_extd_stats) * |
| 8355 | sizeof(wmi_peer_extd_stats)); |
| 8356 | if (param_buf->num_data != min_data_len) { |
| 8357 | WMI_LOGE("data len: %u isn't same as calculated: %llu", |
| 8358 | param_buf->num_data, min_data_len); |
| 8359 | return QDF_STATUS_E_FAULT; |
| 8360 | } |
| 8361 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8362 | stats_param->num_pdev_stats = ev->num_pdev_stats; |
| 8363 | stats_param->num_pdev_ext_stats = 0; |
| 8364 | stats_param->num_vdev_stats = ev->num_vdev_stats; |
| 8365 | stats_param->num_peer_stats = ev->num_peer_stats; |
| 8366 | stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; |
| 8367 | stats_param->num_chan_stats = ev->num_chan_stats; |
Gurumoorthi Gnanasambandhan | b5fb836 | 2017-11-06 22:04:17 +0530 | [diff] [blame] | 8368 | stats_param->num_bcn_stats = ev->num_bcn_stats; |
Gurumoorthi Gnanasambandhan | 305aeae | 2017-08-10 22:12:36 +0530 | [diff] [blame] | 8369 | stats_param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 8370 | ev->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8371 | |
Naveen Rawat | 57e47aa | 2018-04-06 10:57:20 -0700 | [diff] [blame] | 8372 | /* if chain_stats is not populated */ |
| 8373 | if (!param_buf->chain_stats || !param_buf->num_chain_stats) |
| 8374 | return QDF_STATUS_SUCCESS; |
| 8375 | |
| 8376 | if (WMITLV_TAG_STRUC_wmi_per_chain_rssi_stats != |
| 8377 | WMITLV_GET_TLVTAG(rssi_event->tlv_header)) |
| 8378 | return QDF_STATUS_SUCCESS; |
| 8379 | |
| 8380 | if (WMITLV_GET_STRUCT_TLVLEN(wmi_per_chain_rssi_stats) != |
Naveen Rawat | a8e19e7 | 2018-06-01 17:12:31 -0700 | [diff] [blame] | 8381 | WMITLV_GET_TLVLEN(rssi_event->tlv_header)) |
Naveen Rawat | 57e47aa | 2018-04-06 10:57:20 -0700 | [diff] [blame] | 8382 | return QDF_STATUS_SUCCESS; |
| 8383 | |
Harprit Chhabada | 4efe1fa | 2018-09-28 12:06:49 -0700 | [diff] [blame] | 8384 | if (rssi_event->num_per_chain_rssi_stats >= |
| 8385 | WMITLV_GET_TLVLEN(rssi_event->tlv_header)) { |
| 8386 | WMI_LOGE("num_per_chain_rssi_stats:%u is out of bounds", |
| 8387 | rssi_event->num_per_chain_rssi_stats); |
| 8388 | return QDF_STATUS_E_INVAL; |
| 8389 | } |
Naveen Rawat | 57e47aa | 2018-04-06 10:57:20 -0700 | [diff] [blame] | 8390 | stats_param->num_rssi_stats = rssi_event->num_per_chain_rssi_stats; |
| 8391 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8392 | return QDF_STATUS_SUCCESS; |
| 8393 | } |
| 8394 | |
| 8395 | /** |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 8396 | * extract_pdev_tx_stats() - extract pdev tx stats from event |
| 8397 | */ |
Nandha Kishore Easwaran | 6dd231d | 2018-10-10 11:04:09 +0530 | [diff] [blame] | 8398 | static void extract_pdev_tx_stats(wmi_host_dbg_tx_stats *tx, |
| 8399 | struct wlan_dbg_tx_stats_v2 *tx_stats) |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 8400 | { |
| 8401 | /* Tx Stats */ |
| 8402 | tx->comp_queued = tx_stats->comp_queued; |
| 8403 | tx->comp_delivered = tx_stats->comp_delivered; |
| 8404 | tx->msdu_enqued = tx_stats->msdu_enqued; |
| 8405 | tx->mpdu_enqued = tx_stats->mpdu_enqued; |
| 8406 | tx->wmm_drop = tx_stats->wmm_drop; |
| 8407 | tx->local_enqued = tx_stats->local_enqued; |
| 8408 | tx->local_freed = tx_stats->local_freed; |
| 8409 | tx->hw_queued = tx_stats->hw_queued; |
| 8410 | tx->hw_reaped = tx_stats->hw_reaped; |
| 8411 | tx->underrun = tx_stats->underrun; |
| 8412 | tx->tx_abort = tx_stats->tx_abort; |
| 8413 | tx->mpdus_requed = tx_stats->mpdus_requed; |
| 8414 | tx->data_rc = tx_stats->data_rc; |
| 8415 | tx->self_triggers = tx_stats->self_triggers; |
| 8416 | tx->sw_retry_failure = tx_stats->sw_retry_failure; |
| 8417 | tx->illgl_rate_phy_err = tx_stats->illgl_rate_phy_err; |
| 8418 | tx->pdev_cont_xretry = tx_stats->pdev_cont_xretry; |
| 8419 | tx->pdev_tx_timeout = tx_stats->pdev_tx_timeout; |
| 8420 | tx->pdev_resets = tx_stats->pdev_resets; |
| 8421 | tx->stateless_tid_alloc_failure = tx_stats->stateless_tid_alloc_failure; |
| 8422 | tx->phy_underrun = tx_stats->phy_underrun; |
| 8423 | tx->txop_ovf = tx_stats->txop_ovf; |
| 8424 | |
| 8425 | return; |
| 8426 | } |
| 8427 | |
| 8428 | |
| 8429 | /** |
| 8430 | * extract_pdev_rx_stats() - extract pdev rx stats from event |
| 8431 | */ |
Nandha Kishore Easwaran | 6dd231d | 2018-10-10 11:04:09 +0530 | [diff] [blame] | 8432 | static void extract_pdev_rx_stats(wmi_host_dbg_rx_stats *rx, |
| 8433 | struct wlan_dbg_rx_stats_v2 *rx_stats) |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 8434 | { |
| 8435 | /* Rx Stats */ |
| 8436 | rx->mid_ppdu_route_change = rx_stats->mid_ppdu_route_change; |
| 8437 | rx->status_rcvd = rx_stats->status_rcvd; |
| 8438 | rx->r0_frags = rx_stats->r0_frags; |
| 8439 | rx->r1_frags = rx_stats->r1_frags; |
| 8440 | rx->r2_frags = rx_stats->r2_frags; |
| 8441 | /* Only TLV */ |
| 8442 | rx->r3_frags = 0; |
| 8443 | rx->htt_msdus = rx_stats->htt_msdus; |
| 8444 | rx->htt_mpdus = rx_stats->htt_mpdus; |
| 8445 | rx->loc_msdus = rx_stats->loc_msdus; |
| 8446 | rx->loc_mpdus = rx_stats->loc_mpdus; |
| 8447 | rx->oversize_amsdu = rx_stats->oversize_amsdu; |
| 8448 | rx->phy_errs = rx_stats->phy_errs; |
| 8449 | rx->phy_err_drop = rx_stats->phy_err_drop; |
| 8450 | rx->mpdu_errs = rx_stats->mpdu_errs; |
| 8451 | |
| 8452 | return; |
| 8453 | } |
| 8454 | |
| 8455 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8456 | * extract_pdev_stats_tlv() - extract pdev stats from event |
| 8457 | * @wmi_handle: wmi handle |
| 8458 | * @param evt_buf: pointer to event buffer |
| 8459 | * @param index: Index into pdev stats |
| 8460 | * @param pdev_stats: Pointer to hold pdev stats |
| 8461 | * |
| 8462 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8463 | */ |
| 8464 | static QDF_STATUS extract_pdev_stats_tlv(wmi_unified_t wmi_handle, |
| 8465 | void *evt_buf, uint32_t index, wmi_host_pdev_stats *pdev_stats) |
| 8466 | { |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 8467 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 8468 | wmi_stats_event_fixed_param *ev_param; |
| 8469 | uint8_t *data; |
| 8470 | |
| 8471 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 8472 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 8473 | |
| 8474 | data = param_buf->data; |
| 8475 | |
| 8476 | if (index < ev_param->num_pdev_stats) { |
Nandha Kishore Easwaran | 6dd231d | 2018-10-10 11:04:09 +0530 | [diff] [blame] | 8477 | wmi_pdev_stats_v2 *ev = (wmi_pdev_stats_v2 *) ((data) + |
| 8478 | (index * sizeof(wmi_pdev_stats_v2))); |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 8479 | |
| 8480 | pdev_stats->chan_nf = ev->chan_nf; |
| 8481 | pdev_stats->tx_frame_count = ev->tx_frame_count; |
| 8482 | pdev_stats->rx_frame_count = ev->rx_frame_count; |
| 8483 | pdev_stats->rx_clear_count = ev->rx_clear_count; |
| 8484 | pdev_stats->cycle_count = ev->cycle_count; |
| 8485 | pdev_stats->phy_err_count = ev->phy_err_count; |
| 8486 | pdev_stats->chan_tx_pwr = ev->chan_tx_pwr; |
| 8487 | |
| 8488 | extract_pdev_tx_stats(&(pdev_stats->pdev_stats.tx), |
| 8489 | &(ev->pdev_stats.tx)); |
| 8490 | extract_pdev_rx_stats(&(pdev_stats->pdev_stats.rx), |
| 8491 | &(ev->pdev_stats.rx)); |
| 8492 | } |
| 8493 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8494 | return QDF_STATUS_SUCCESS; |
| 8495 | } |
| 8496 | |
| 8497 | /** |
Adil Saeed Musthafa | d280596 | 2017-08-23 17:32:11 -0700 | [diff] [blame] | 8498 | * extract_unit_test_tlv() - extract unit test data |
| 8499 | * @wmi_handle: wmi handle |
| 8500 | * @param evt_buf: pointer to event buffer |
| 8501 | * @param unit_test: pointer to hold unit test data |
| 8502 | * @param maxspace: Amount of space in evt_buf |
| 8503 | * |
| 8504 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8505 | */ |
| 8506 | static QDF_STATUS extract_unit_test_tlv(wmi_unified_t wmi_handle, |
| 8507 | void *evt_buf, wmi_unit_test_event *unit_test, uint32_t maxspace) |
| 8508 | { |
| 8509 | WMI_UNIT_TEST_EVENTID_param_tlvs *param_buf; |
| 8510 | wmi_unit_test_event_fixed_param *ev_param; |
| 8511 | uint32_t num_bufp; |
| 8512 | uint32_t copy_size; |
| 8513 | uint8_t *bufp; |
| 8514 | |
| 8515 | param_buf = (WMI_UNIT_TEST_EVENTID_param_tlvs *) evt_buf; |
| 8516 | ev_param = param_buf->fixed_param; |
| 8517 | bufp = param_buf->bufp; |
| 8518 | num_bufp = param_buf->num_bufp; |
| 8519 | unit_test->vdev_id = ev_param->vdev_id; |
| 8520 | unit_test->module_id = ev_param->module_id; |
| 8521 | unit_test->diag_token = ev_param->diag_token; |
| 8522 | unit_test->flag = ev_param->flag; |
| 8523 | unit_test->payload_len = ev_param->payload_len; |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 8524 | WMI_LOGI("%s:vdev_id:%d mod_id:%d diag_token:%d flag:%d", __func__, |
Adil Saeed Musthafa | d280596 | 2017-08-23 17:32:11 -0700 | [diff] [blame] | 8525 | ev_param->vdev_id, |
| 8526 | ev_param->module_id, |
| 8527 | ev_param->diag_token, |
| 8528 | ev_param->flag); |
| 8529 | WMI_LOGD("%s: Unit-test data given below %d", __func__, num_bufp); |
| 8530 | qdf_trace_hex_dump(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG, |
| 8531 | bufp, num_bufp); |
| 8532 | copy_size = (num_bufp < maxspace) ? num_bufp : maxspace; |
| 8533 | qdf_mem_copy(unit_test->buffer, bufp, copy_size); |
| 8534 | unit_test->buffer_len = copy_size; |
| 8535 | |
| 8536 | return QDF_STATUS_SUCCESS; |
| 8537 | } |
| 8538 | |
| 8539 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8540 | * extract_pdev_ext_stats_tlv() - extract extended pdev stats from event |
| 8541 | * @wmi_handle: wmi handle |
| 8542 | * @param evt_buf: pointer to event buffer |
| 8543 | * @param index: Index into extended pdev stats |
| 8544 | * @param pdev_ext_stats: Pointer to hold extended pdev stats |
| 8545 | * |
| 8546 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8547 | */ |
| 8548 | static QDF_STATUS extract_pdev_ext_stats_tlv(wmi_unified_t wmi_handle, |
| 8549 | void *evt_buf, uint32_t index, wmi_host_pdev_ext_stats *pdev_ext_stats) |
| 8550 | { |
| 8551 | return QDF_STATUS_SUCCESS; |
| 8552 | } |
| 8553 | |
| 8554 | /** |
| 8555 | * extract_vdev_stats_tlv() - extract vdev stats from event |
| 8556 | * @wmi_handle: wmi handle |
| 8557 | * @param evt_buf: pointer to event buffer |
| 8558 | * @param index: Index into vdev stats |
| 8559 | * @param vdev_stats: Pointer to hold vdev stats |
| 8560 | * |
| 8561 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8562 | */ |
| 8563 | static QDF_STATUS extract_vdev_stats_tlv(wmi_unified_t wmi_handle, |
| 8564 | void *evt_buf, uint32_t index, wmi_host_vdev_stats *vdev_stats) |
| 8565 | { |
| 8566 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 8567 | wmi_stats_event_fixed_param *ev_param; |
| 8568 | uint8_t *data; |
| 8569 | |
| 8570 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 8571 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 8572 | data = (uint8_t *) param_buf->data; |
| 8573 | |
| 8574 | if (index < ev_param->num_vdev_stats) { |
| 8575 | wmi_vdev_stats *ev = (wmi_vdev_stats *) ((data) + |
| 8576 | ((ev_param->num_pdev_stats) * |
Nandha Kishore Easwaran | 6dd231d | 2018-10-10 11:04:09 +0530 | [diff] [blame] | 8577 | sizeof(wmi_pdev_stats_v2)) + |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8578 | (index * sizeof(wmi_vdev_stats))); |
| 8579 | |
| 8580 | vdev_stats->vdev_id = ev->vdev_id; |
| 8581 | vdev_stats->vdev_snr.bcn_snr = ev->vdev_snr.bcn_snr; |
| 8582 | vdev_stats->vdev_snr.dat_snr = ev->vdev_snr.dat_snr; |
| 8583 | |
| 8584 | OS_MEMCPY(vdev_stats->tx_frm_cnt, ev->tx_frm_cnt, |
| 8585 | sizeof(ev->tx_frm_cnt)); |
| 8586 | vdev_stats->rx_frm_cnt = ev->rx_frm_cnt; |
| 8587 | OS_MEMCPY(vdev_stats->multiple_retry_cnt, |
| 8588 | ev->multiple_retry_cnt, |
| 8589 | sizeof(ev->multiple_retry_cnt)); |
| 8590 | OS_MEMCPY(vdev_stats->fail_cnt, ev->fail_cnt, |
| 8591 | sizeof(ev->fail_cnt)); |
| 8592 | vdev_stats->rts_fail_cnt = ev->rts_fail_cnt; |
| 8593 | vdev_stats->rts_succ_cnt = ev->rts_succ_cnt; |
| 8594 | vdev_stats->rx_err_cnt = ev->rx_err_cnt; |
| 8595 | vdev_stats->rx_discard_cnt = ev->rx_discard_cnt; |
| 8596 | vdev_stats->ack_fail_cnt = ev->ack_fail_cnt; |
| 8597 | OS_MEMCPY(vdev_stats->tx_rate_history, ev->tx_rate_history, |
| 8598 | sizeof(ev->tx_rate_history)); |
| 8599 | OS_MEMCPY(vdev_stats->bcn_rssi_history, ev->bcn_rssi_history, |
| 8600 | sizeof(ev->bcn_rssi_history)); |
| 8601 | |
| 8602 | } |
| 8603 | |
| 8604 | return QDF_STATUS_SUCCESS; |
| 8605 | } |
| 8606 | |
| 8607 | /** |
Naveen Rawat | d211572 | 2018-04-12 08:17:55 -0700 | [diff] [blame] | 8608 | * extract_per_chain_rssi_stats_tlv() - api to extract rssi stats from event |
| 8609 | * buffer |
| 8610 | * @wmi_handle: wmi handle |
| 8611 | * @evt_buf: pointer to event buffer |
| 8612 | * @index: Index into vdev stats |
| 8613 | * @rssi_stats: Pointer to hold rssi stats |
| 8614 | * |
| 8615 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8616 | */ |
| 8617 | static QDF_STATUS extract_per_chain_rssi_stats_tlv(wmi_unified_t wmi_handle, |
| 8618 | void *evt_buf, uint32_t index, |
| 8619 | struct wmi_host_per_chain_rssi_stats *rssi_stats) |
| 8620 | { |
| 8621 | uint8_t *data; |
| 8622 | wmi_rssi_stats *fw_rssi_stats; |
| 8623 | wmi_per_chain_rssi_stats *rssi_event; |
| 8624 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 8625 | |
| 8626 | if (!evt_buf) { |
| 8627 | WMI_LOGE("evt_buf is null"); |
| 8628 | return QDF_STATUS_E_NULL_VALUE; |
| 8629 | } |
| 8630 | |
| 8631 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 8632 | rssi_event = param_buf->chain_stats; |
| 8633 | |
| 8634 | if (index >= rssi_event->num_per_chain_rssi_stats) { |
| 8635 | WMI_LOGE("invalid index"); |
| 8636 | return QDF_STATUS_E_INVAL; |
| 8637 | } |
| 8638 | |
| 8639 | data = ((uint8_t *)(&rssi_event[1])) + WMI_TLV_HDR_SIZE; |
| 8640 | fw_rssi_stats = &((wmi_rssi_stats *)data)[index]; |
| 8641 | |
| 8642 | rssi_stats->vdev_id = fw_rssi_stats->vdev_id; |
| 8643 | qdf_mem_copy(rssi_stats->rssi_avg_beacon, |
| 8644 | fw_rssi_stats->rssi_avg_beacon, |
| 8645 | sizeof(fw_rssi_stats->rssi_avg_beacon)); |
| 8646 | qdf_mem_copy(rssi_stats->rssi_avg_data, |
| 8647 | fw_rssi_stats->rssi_avg_data, |
| 8648 | sizeof(fw_rssi_stats->rssi_avg_data)); |
| 8649 | qdf_mem_copy(&rssi_stats->peer_macaddr, |
| 8650 | &fw_rssi_stats->peer_macaddr, |
| 8651 | sizeof(fw_rssi_stats->peer_macaddr)); |
| 8652 | |
| 8653 | return QDF_STATUS_SUCCESS; |
| 8654 | } |
| 8655 | |
| 8656 | |
| 8657 | |
| 8658 | /** |
Gurumoorthi Gnanasambandhan | b5fb836 | 2017-11-06 22:04:17 +0530 | [diff] [blame] | 8659 | * extract_bcn_stats_tlv() - extract bcn stats from event |
| 8660 | * @wmi_handle: wmi handle |
| 8661 | * @param evt_buf: pointer to event buffer |
| 8662 | * @param index: Index into vdev stats |
| 8663 | * @param bcn_stats: Pointer to hold bcn stats |
| 8664 | * |
| 8665 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8666 | */ |
| 8667 | static QDF_STATUS extract_bcn_stats_tlv(wmi_unified_t wmi_handle, |
| 8668 | void *evt_buf, uint32_t index, wmi_host_bcn_stats *bcn_stats) |
| 8669 | { |
| 8670 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 8671 | wmi_stats_event_fixed_param *ev_param; |
| 8672 | uint8_t *data; |
| 8673 | |
| 8674 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 8675 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 8676 | data = (uint8_t *) param_buf->data; |
| 8677 | |
| 8678 | if (index < ev_param->num_bcn_stats) { |
| 8679 | wmi_bcn_stats *ev = (wmi_bcn_stats *) ((data) + |
Nandha Kishore Easwaran | 6dd231d | 2018-10-10 11:04:09 +0530 | [diff] [blame] | 8680 | ((ev_param->num_pdev_stats) * |
| 8681 | sizeof(wmi_pdev_stats_v2)) + |
Gurumoorthi Gnanasambandhan | b5fb836 | 2017-11-06 22:04:17 +0530 | [diff] [blame] | 8682 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 8683 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 8684 | ((ev_param->num_chan_stats) * sizeof(wmi_chan_stats)) + |
| 8685 | ((ev_param->num_mib_stats) * sizeof(wmi_mib_stats)) + |
| 8686 | (index * sizeof(wmi_bcn_stats))); |
| 8687 | |
| 8688 | bcn_stats->vdev_id = ev->vdev_id; |
| 8689 | bcn_stats->tx_bcn_succ_cnt = ev->tx_bcn_succ_cnt; |
| 8690 | bcn_stats->tx_bcn_outage_cnt = ev->tx_bcn_outage_cnt; |
| 8691 | } |
| 8692 | |
| 8693 | return QDF_STATUS_SUCCESS; |
| 8694 | } |
| 8695 | |
| 8696 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8697 | * extract_peer_stats_tlv() - extract peer stats from event |
| 8698 | * @wmi_handle: wmi handle |
| 8699 | * @param evt_buf: pointer to event buffer |
| 8700 | * @param index: Index into peer stats |
| 8701 | * @param peer_stats: Pointer to hold peer stats |
| 8702 | * |
| 8703 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8704 | */ |
| 8705 | static QDF_STATUS extract_peer_stats_tlv(wmi_unified_t wmi_handle, |
| 8706 | void *evt_buf, uint32_t index, wmi_host_peer_stats *peer_stats) |
| 8707 | { |
| 8708 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 8709 | wmi_stats_event_fixed_param *ev_param; |
| 8710 | uint8_t *data; |
| 8711 | |
| 8712 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 8713 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 8714 | data = (uint8_t *) param_buf->data; |
| 8715 | |
| 8716 | if (index < ev_param->num_peer_stats) { |
| 8717 | wmi_peer_stats *ev = (wmi_peer_stats *) ((data) + |
Nandha Kishore Easwaran | 6dd231d | 2018-10-10 11:04:09 +0530 | [diff] [blame] | 8718 | ((ev_param->num_pdev_stats) * |
| 8719 | sizeof(wmi_pdev_stats_v2)) + |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8720 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 8721 | (index * sizeof(wmi_peer_stats))); |
| 8722 | |
| 8723 | OS_MEMSET(peer_stats, 0, sizeof(wmi_host_peer_stats)); |
| 8724 | |
| 8725 | OS_MEMCPY(&(peer_stats->peer_macaddr), |
| 8726 | &(ev->peer_macaddr), sizeof(wmi_mac_addr)); |
| 8727 | |
| 8728 | peer_stats->peer_rssi = ev->peer_rssi; |
| 8729 | peer_stats->peer_tx_rate = ev->peer_tx_rate; |
| 8730 | peer_stats->peer_rx_rate = ev->peer_rx_rate; |
| 8731 | } |
| 8732 | |
| 8733 | return QDF_STATUS_SUCCESS; |
| 8734 | } |
| 8735 | |
| 8736 | /** |
| 8737 | * extract_bcnflt_stats_tlv() - extract bcn fault stats from event |
| 8738 | * @wmi_handle: wmi handle |
| 8739 | * @param evt_buf: pointer to event buffer |
| 8740 | * @param index: Index into bcn fault stats |
| 8741 | * @param bcnflt_stats: Pointer to hold bcn fault stats |
| 8742 | * |
| 8743 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8744 | */ |
| 8745 | static QDF_STATUS extract_bcnflt_stats_tlv(wmi_unified_t wmi_handle, |
| 8746 | void *evt_buf, uint32_t index, wmi_host_bcnflt_stats *peer_stats) |
| 8747 | { |
| 8748 | return QDF_STATUS_SUCCESS; |
| 8749 | } |
| 8750 | |
| 8751 | /** |
| 8752 | * extract_peer_extd_stats_tlv() - extract extended peer stats from event |
| 8753 | * @wmi_handle: wmi handle |
| 8754 | * @param evt_buf: pointer to event buffer |
| 8755 | * @param index: Index into extended peer stats |
| 8756 | * @param peer_extd_stats: Pointer to hold extended peer stats |
| 8757 | * |
| 8758 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8759 | */ |
| 8760 | static QDF_STATUS extract_peer_extd_stats_tlv(wmi_unified_t wmi_handle, |
| 8761 | void *evt_buf, uint32_t index, |
| 8762 | wmi_host_peer_extd_stats *peer_extd_stats) |
| 8763 | { |
| 8764 | return QDF_STATUS_SUCCESS; |
| 8765 | } |
| 8766 | |
| 8767 | /** |
| 8768 | * extract_chan_stats_tlv() - extract chan stats from event |
| 8769 | * @wmi_handle: wmi handle |
| 8770 | * @param evt_buf: pointer to event buffer |
| 8771 | * @param index: Index into chan stats |
| 8772 | * @param vdev_extd_stats: Pointer to hold chan stats |
| 8773 | * |
| 8774 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8775 | */ |
| 8776 | static QDF_STATUS extract_chan_stats_tlv(wmi_unified_t wmi_handle, |
| 8777 | void *evt_buf, uint32_t index, wmi_host_chan_stats *chan_stats) |
| 8778 | { |
| 8779 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 8780 | wmi_stats_event_fixed_param *ev_param; |
| 8781 | uint8_t *data; |
| 8782 | |
| 8783 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 8784 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 8785 | data = (uint8_t *) param_buf->data; |
| 8786 | |
| 8787 | if (index < ev_param->num_chan_stats) { |
| 8788 | wmi_chan_stats *ev = (wmi_chan_stats *) ((data) + |
Nandha Kishore Easwaran | 6dd231d | 2018-10-10 11:04:09 +0530 | [diff] [blame] | 8789 | ((ev_param->num_pdev_stats) * |
| 8790 | sizeof(wmi_pdev_stats_v2)) + |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8791 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 8792 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 8793 | (index * sizeof(wmi_chan_stats))); |
| 8794 | |
| 8795 | |
Jeff Johnson | 79eaacb | 2018-05-06 17:53:18 -0700 | [diff] [blame] | 8796 | /* Non-TLV doesn't have num_chan_stats */ |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8797 | chan_stats->chan_mhz = ev->chan_mhz; |
| 8798 | chan_stats->sampling_period_us = ev->sampling_period_us; |
| 8799 | chan_stats->rx_clear_count = ev->rx_clear_count; |
| 8800 | chan_stats->tx_duration_us = ev->tx_duration_us; |
| 8801 | chan_stats->rx_duration_us = ev->rx_duration_us; |
| 8802 | } |
| 8803 | |
| 8804 | return QDF_STATUS_SUCCESS; |
| 8805 | } |
| 8806 | |
| 8807 | /** |
| 8808 | * extract_profile_ctx_tlv() - extract profile context from event |
| 8809 | * @wmi_handle: wmi handle |
| 8810 | * @param evt_buf: pointer to event buffer |
| 8811 | * @idx: profile stats index to extract |
| 8812 | * @param profile_ctx: Pointer to hold profile context |
| 8813 | * |
| 8814 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8815 | */ |
| 8816 | static QDF_STATUS extract_profile_ctx_tlv(wmi_unified_t wmi_handle, |
| 8817 | void *evt_buf, wmi_host_wlan_profile_ctx_t *profile_ctx) |
| 8818 | { |
| 8819 | return QDF_STATUS_SUCCESS; |
| 8820 | } |
| 8821 | |
| 8822 | /** |
| 8823 | * extract_profile_data_tlv() - extract profile data from event |
| 8824 | * @wmi_handle: wmi handle |
| 8825 | * @param evt_buf: pointer to event buffer |
| 8826 | * @param profile_data: Pointer to hold profile data |
| 8827 | * |
| 8828 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8829 | */ |
| 8830 | static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, |
| 8831 | void *evt_buf, uint8_t idx, wmi_host_wlan_profile_t *profile_data) |
| 8832 | { |
| 8833 | |
| 8834 | return QDF_STATUS_SUCCESS; |
| 8835 | } |
| 8836 | |
| 8837 | /** |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 8838 | * extract_pdev_utf_event_tlv() - extract UTF data info from event |
| 8839 | * @wmi_handle: WMI handle |
| 8840 | * @param evt_buf: Pointer to event buffer |
| 8841 | * @param param: Pointer to hold data |
| 8842 | * |
| 8843 | * Return : QDF_STATUS_SUCCESS for success or error code |
| 8844 | */ |
| 8845 | static QDF_STATUS extract_pdev_utf_event_tlv(wmi_unified_t wmi_handle, |
| 8846 | uint8_t *evt_buf, |
| 8847 | struct wmi_host_pdev_utf_event *event) |
| 8848 | { |
| 8849 | WMI_PDEV_UTF_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 8850 | struct wmi_host_utf_seg_header_info *seg_hdr; |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 8851 | |
| 8852 | param_buf = (WMI_PDEV_UTF_EVENTID_param_tlvs *)evt_buf; |
| 8853 | event->data = param_buf->data; |
| 8854 | event->datalen = param_buf->num_data; |
Pragaspathi Thilagaraj | d8d0e15 | 2018-09-04 14:39:09 +0530 | [diff] [blame] | 8855 | |
| 8856 | if (event->datalen < sizeof(struct wmi_host_utf_seg_header_info)) { |
| 8857 | WMI_LOGE("%s: Invalid datalen: %d ", __func__, event->datalen); |
| 8858 | return QDF_STATUS_E_INVAL; |
| 8859 | } |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 8860 | seg_hdr = (struct wmi_host_utf_seg_header_info *)param_buf->data; |
Kiran Venkatappa | 15978c6 | 2017-02-28 12:42:36 +0530 | [diff] [blame] | 8861 | /* Set pdev_id=1 until FW adds support to include pdev_id */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 8862 | event->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 8863 | seg_hdr->pdev_id); |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 8864 | |
| 8865 | return QDF_STATUS_SUCCESS; |
| 8866 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8867 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 8868 | /** |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 8869 | * extract_chainmask_tables_tlv() - extract chain mask tables from event |
| 8870 | * @wmi_handle: wmi handle |
| 8871 | * @param evt_buf: pointer to event buffer |
| 8872 | * @param param: Pointer to hold evt buf |
| 8873 | * |
| 8874 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8875 | */ |
| 8876 | static QDF_STATUS extract_chainmask_tables_tlv(wmi_unified_t wmi_handle, |
| 8877 | uint8_t *event, struct wlan_psoc_host_chainmask_table *chainmask_table) |
| 8878 | { |
| 8879 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 8880 | WMI_MAC_PHY_CHAINMASK_CAPABILITY *chainmask_caps; |
| 8881 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 8882 | uint8_t i = 0, j = 0; |
| 8883 | |
| 8884 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 8885 | if (!param_buf) |
| 8886 | return QDF_STATUS_E_INVAL; |
| 8887 | |
| 8888 | hw_caps = param_buf->soc_hw_mode_caps; |
| 8889 | if (!hw_caps) |
| 8890 | return QDF_STATUS_E_INVAL; |
| 8891 | |
Wu Gao | 5d1c9ed | 2018-10-12 18:16:09 +0800 | [diff] [blame] | 8892 | if ((!hw_caps->num_chainmask_tables) || |
| 8893 | (hw_caps->num_chainmask_tables > PSOC_MAX_CHAINMASK_TABLES)) |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 8894 | return QDF_STATUS_E_INVAL; |
| 8895 | |
| 8896 | chainmask_caps = param_buf->mac_phy_chainmask_caps; |
| 8897 | |
| 8898 | if (chainmask_caps == NULL) |
| 8899 | return QDF_STATUS_E_INVAL; |
| 8900 | |
| 8901 | for (i = 0; i < hw_caps->num_chainmask_tables; i++) { |
| 8902 | |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 8903 | qdf_print("Dumping chain mask combo data for table : %d", i); |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 8904 | for (j = 0; j < chainmask_table[i].num_valid_chainmasks; j++) { |
| 8905 | |
| 8906 | chainmask_table[i].cap_list[j].chainmask = |
| 8907 | chainmask_caps->chainmask; |
| 8908 | |
| 8909 | chainmask_table[i].cap_list[j].supports_chan_width_20 = |
| 8910 | WMI_SUPPORT_CHAN_WIDTH_20_GET(chainmask_caps->supported_flags); |
| 8911 | |
| 8912 | chainmask_table[i].cap_list[j].supports_chan_width_40 = |
| 8913 | WMI_SUPPORT_CHAN_WIDTH_40_GET(chainmask_caps->supported_flags); |
| 8914 | |
| 8915 | chainmask_table[i].cap_list[j].supports_chan_width_80 = |
| 8916 | WMI_SUPPORT_CHAN_WIDTH_80_GET(chainmask_caps->supported_flags); |
| 8917 | |
| 8918 | chainmask_table[i].cap_list[j].supports_chan_width_160 = |
| 8919 | WMI_SUPPORT_CHAN_WIDTH_160_GET(chainmask_caps->supported_flags); |
| 8920 | |
| 8921 | chainmask_table[i].cap_list[j].supports_chan_width_80P80 = |
| 8922 | WMI_SUPPORT_CHAN_WIDTH_80P80_GET(chainmask_caps->supported_flags); |
| 8923 | |
| 8924 | chainmask_table[i].cap_list[j].chain_mask_2G = |
| 8925 | WMI_SUPPORT_CHAIN_MASK_2G_GET(chainmask_caps->supported_flags); |
| 8926 | |
| 8927 | chainmask_table[i].cap_list[j].chain_mask_5G = |
| 8928 | WMI_SUPPORT_CHAIN_MASK_5G_GET(chainmask_caps->supported_flags); |
| 8929 | |
| 8930 | chainmask_table[i].cap_list[j].chain_mask_tx = |
| 8931 | WMI_SUPPORT_CHAIN_MASK_TX_GET(chainmask_caps->supported_flags); |
| 8932 | |
| 8933 | chainmask_table[i].cap_list[j].chain_mask_rx = |
| 8934 | WMI_SUPPORT_CHAIN_MASK_RX_GET(chainmask_caps->supported_flags); |
| 8935 | |
| 8936 | chainmask_table[i].cap_list[j].supports_aDFS = |
| 8937 | WMI_SUPPORT_CHAIN_MASK_ADFS_GET(chainmask_caps->supported_flags); |
| 8938 | |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 8939 | qdf_print("supported_flags: 0x%08x chainmasks: 0x%08x", |
| 8940 | chainmask_caps->supported_flags, |
| 8941 | chainmask_caps->chainmask |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 8942 | ); |
| 8943 | chainmask_caps++; |
| 8944 | } |
| 8945 | } |
| 8946 | |
| 8947 | return QDF_STATUS_SUCCESS; |
| 8948 | } |
| 8949 | |
| 8950 | /** |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 8951 | * extract_service_ready_ext_tlv() - extract basic extended service ready params |
| 8952 | * from event |
| 8953 | * @wmi_handle: wmi handle |
| 8954 | * @param evt_buf: pointer to event buffer |
| 8955 | * @param param: Pointer to hold evt buf |
| 8956 | * |
| 8957 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 8958 | */ |
| 8959 | static QDF_STATUS extract_service_ready_ext_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 8960 | uint8_t *event, struct wlan_psoc_host_service_ext_param *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 8961 | { |
| 8962 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 8963 | wmi_service_ready_ext_event_fixed_param *ev; |
| 8964 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 8965 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 8966 | WMI_MAC_PHY_CHAINMASK_COMBO *chain_mask_combo; |
| 8967 | uint8_t i = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 8968 | |
| 8969 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 8970 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 8971 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 8972 | |
| 8973 | ev = param_buf->fixed_param; |
| 8974 | if (!ev) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 8975 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 8976 | |
| 8977 | /* Move this to host based bitmap */ |
| 8978 | param->default_conc_scan_config_bits = |
| 8979 | ev->default_conc_scan_config_bits; |
| 8980 | param->default_fw_config_bits = ev->default_fw_config_bits; |
| 8981 | param->he_cap_info = ev->he_cap_info; |
| 8982 | param->mpdu_density = ev->mpdu_density; |
| 8983 | param->max_bssid_rx_filters = ev->max_bssid_rx_filters; |
Kiran Venkatappa | 59d6e1f | 2017-10-12 15:04:22 +0530 | [diff] [blame] | 8984 | param->fw_build_vers_ext = ev->fw_build_vers_ext; |
Sathish Kumar | f396c72 | 2017-11-17 17:30:41 +0530 | [diff] [blame] | 8985 | param->num_dbr_ring_caps = param_buf->num_dma_ring_caps; |
Manoj Ekbote | 0bce58b | 2018-06-06 16:52:39 -0700 | [diff] [blame] | 8986 | param->max_bssid_indicator = ev->max_bssid_indicator; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 8987 | qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); |
| 8988 | |
| 8989 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 8990 | if (hw_caps) |
| 8991 | param->num_hw_modes = hw_caps->num_hw_modes; |
| 8992 | else |
| 8993 | param->num_hw_modes = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 8994 | |
| 8995 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 8996 | if (reg_caps) |
| 8997 | param->num_phy = reg_caps->num_phy; |
| 8998 | else |
| 8999 | param->num_phy = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9000 | |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 9001 | if (hw_caps) { |
| 9002 | param->num_chainmask_tables = hw_caps->num_chainmask_tables; |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 9003 | qdf_print("Num chain mask tables: %d", hw_caps->num_chainmask_tables); |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 9004 | } else |
| 9005 | param->num_chainmask_tables = 0; |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 9006 | |
| 9007 | chain_mask_combo = param_buf->mac_phy_chainmask_combo; |
| 9008 | |
| 9009 | if (chain_mask_combo == NULL) |
| 9010 | return QDF_STATUS_SUCCESS; |
| 9011 | |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 9012 | qdf_print("Dumping chain mask combo data"); |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 9013 | |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 9014 | for (i = 0; i < param->num_chainmask_tables; i++) { |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 9015 | |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 9016 | qdf_print("table_id : %d Num valid chainmasks: %d", |
| 9017 | chain_mask_combo->chainmask_table_id, |
| 9018 | chain_mask_combo->num_valid_chainmask |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 9019 | ); |
| 9020 | |
| 9021 | param->chainmask_table[i].table_id = |
| 9022 | chain_mask_combo->chainmask_table_id; |
| 9023 | param->chainmask_table[i].num_valid_chainmasks = |
| 9024 | chain_mask_combo->num_valid_chainmask; |
| 9025 | chain_mask_combo++; |
| 9026 | } |
Aditya Sathish | 45d7ada | 2018-07-02 17:31:55 +0530 | [diff] [blame] | 9027 | qdf_print("chain mask combo end"); |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 9028 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9029 | return QDF_STATUS_SUCCESS; |
| 9030 | } |
| 9031 | |
| 9032 | /** |
Kabilan Kannan | 0d0f935 | 2018-06-21 16:55:47 -0700 | [diff] [blame] | 9033 | * extract_sar_cap_service_ready_ext_tlv() - |
| 9034 | * extract SAR cap from service ready event |
| 9035 | * @wmi_handle: wmi handle |
| 9036 | * @event: pointer to event buffer |
| 9037 | * @ext_param: extended target info |
| 9038 | * |
| 9039 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 9040 | */ |
| 9041 | static QDF_STATUS extract_sar_cap_service_ready_ext_tlv( |
| 9042 | wmi_unified_t wmi_handle, |
| 9043 | uint8_t *event, |
| 9044 | struct wlan_psoc_host_service_ext_param *ext_param) |
| 9045 | { |
| 9046 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 9047 | WMI_SAR_CAPABILITIES *sar_caps; |
| 9048 | |
| 9049 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *)event; |
| 9050 | |
Kabilan Kannan | ee8d27a | 2018-07-06 11:52:32 -0700 | [diff] [blame] | 9051 | if (!param_buf) |
Kabilan Kannan | 0d0f935 | 2018-06-21 16:55:47 -0700 | [diff] [blame] | 9052 | return QDF_STATUS_E_INVAL; |
| 9053 | |
Kabilan Kannan | ee8d27a | 2018-07-06 11:52:32 -0700 | [diff] [blame] | 9054 | sar_caps = param_buf->sar_caps; |
| 9055 | if (sar_caps) |
| 9056 | ext_param->sar_version = sar_caps->active_version; |
| 9057 | else |
| 9058 | ext_param->sar_version = 0; |
Kabilan Kannan | 0d0f935 | 2018-06-21 16:55:47 -0700 | [diff] [blame] | 9059 | |
| 9060 | return QDF_STATUS_SUCCESS; |
| 9061 | } |
| 9062 | |
| 9063 | /** |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9064 | * extract_hw_mode_cap_service_ready_ext_tlv() - |
| 9065 | * extract HW mode cap from service ready event |
| 9066 | * @wmi_handle: wmi handle |
| 9067 | * @param evt_buf: pointer to event buffer |
| 9068 | * @param param: Pointer to hold evt buf |
| 9069 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 9070 | * |
| 9071 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 9072 | */ |
| 9073 | static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( |
| 9074 | wmi_unified_t wmi_handle, |
| 9075 | uint8_t *event, uint8_t hw_mode_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 9076 | struct wlan_psoc_host_hw_mode_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9077 | { |
| 9078 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 9079 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 9080 | |
| 9081 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 9082 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 9083 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9084 | |
| 9085 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 9086 | if (!hw_caps) |
| 9087 | return QDF_STATUS_E_INVAL; |
| 9088 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9089 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 9090 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9091 | |
| 9092 | param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; |
| 9093 | param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; |
| 9094 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 9095 | param->hw_mode_config_type = |
| 9096 | param_buf->hw_mode_caps[hw_mode_idx].hw_mode_config_type; |
| 9097 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9098 | return QDF_STATUS_SUCCESS; |
| 9099 | } |
| 9100 | |
| 9101 | /** |
| 9102 | * extract_mac_phy_cap_service_ready_ext_tlv() - |
| 9103 | * extract MAC phy cap from service ready event |
| 9104 | * @wmi_handle: wmi handle |
| 9105 | * @param evt_buf: pointer to event buffer |
| 9106 | * @param param: Pointer to hold evt buf |
| 9107 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 9108 | * @param phy_id: phy id within hw_mode |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9109 | * |
| 9110 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 9111 | */ |
| 9112 | static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( |
| 9113 | wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 9114 | uint8_t *event, uint8_t hw_mode_id, uint8_t phy_id, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 9115 | struct wlan_psoc_host_mac_phy_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9116 | { |
| 9117 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9118 | WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 9119 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 9120 | uint32_t phy_map; |
| 9121 | uint8_t hw_idx, phy_idx = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9122 | |
| 9123 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 9124 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 9125 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9126 | |
| 9127 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 9128 | if (!hw_caps) |
| 9129 | return QDF_STATUS_E_INVAL; |
| 9130 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 9131 | for (hw_idx = 0; hw_idx < hw_caps->num_hw_modes; hw_idx++) { |
| 9132 | if (hw_mode_id == param_buf->hw_mode_caps[hw_idx].hw_mode_id) |
| 9133 | break; |
| 9134 | |
| 9135 | phy_map = param_buf->hw_mode_caps[hw_idx].phy_id_map; |
| 9136 | while (phy_map) { |
| 9137 | phy_map >>= 1; |
| 9138 | phy_idx++; |
| 9139 | } |
| 9140 | } |
| 9141 | |
| 9142 | if (hw_idx == hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 9143 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9144 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 9145 | phy_idx += phy_id; |
| 9146 | if (phy_idx >= param_buf->num_mac_phy_caps) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 9147 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 9148 | |
| 9149 | mac_phy_caps = ¶m_buf->mac_phy_caps[phy_idx]; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9150 | |
| 9151 | param->hw_mode_id = mac_phy_caps->hw_mode_id; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9152 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 9153 | mac_phy_caps->pdev_id); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9154 | param->phy_id = mac_phy_caps->phy_id; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 9155 | param->supports_11b = |
| 9156 | WMI_SUPPORT_11B_GET(mac_phy_caps->supported_flags); |
| 9157 | param->supports_11g = |
| 9158 | WMI_SUPPORT_11G_GET(mac_phy_caps->supported_flags); |
| 9159 | param->supports_11a = |
| 9160 | WMI_SUPPORT_11A_GET(mac_phy_caps->supported_flags); |
| 9161 | param->supports_11n = |
| 9162 | WMI_SUPPORT_11N_GET(mac_phy_caps->supported_flags); |
| 9163 | param->supports_11ac = |
| 9164 | WMI_SUPPORT_11AC_GET(mac_phy_caps->supported_flags); |
| 9165 | param->supports_11ax = |
| 9166 | WMI_SUPPORT_11AX_GET(mac_phy_caps->supported_flags); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9167 | |
| 9168 | param->supported_bands = mac_phy_caps->supported_bands; |
| 9169 | param->ampdu_density = mac_phy_caps->ampdu_density; |
| 9170 | param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; |
| 9171 | param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; |
| 9172 | param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; |
| 9173 | param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; |
Gyanranjan Hazarika | e881c7c | 2018-08-17 01:54:48 -0700 | [diff] [blame] | 9174 | param->he_cap_info_2G[WMI_HOST_HECAP_MAC_WORD1] = |
| 9175 | mac_phy_caps->he_cap_info_2G; |
| 9176 | param->he_cap_info_2G[WMI_HOST_HECAP_MAC_WORD2] = |
| 9177 | mac_phy_caps->he_cap_info_2G_ext; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9178 | param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; |
| 9179 | param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; |
| 9180 | param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; |
| 9181 | param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; |
| 9182 | param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; |
| 9183 | param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; |
| 9184 | param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; |
Gyanranjan Hazarika | e881c7c | 2018-08-17 01:54:48 -0700 | [diff] [blame] | 9185 | param->he_cap_info_5G[WMI_HOST_HECAP_MAC_WORD1] = |
| 9186 | mac_phy_caps->he_cap_info_5G; |
| 9187 | param->he_cap_info_5G[WMI_HOST_HECAP_MAC_WORD2] = |
| 9188 | mac_phy_caps->he_cap_info_5G_ext; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9189 | param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; |
| 9190 | param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; |
| 9191 | param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; |
Kris Muthusamy | 61fe369 | 2017-02-20 02:35:47 -0800 | [diff] [blame] | 9192 | qdf_mem_copy(¶m->he_cap_phy_info_2G, |
| 9193 | &mac_phy_caps->he_cap_phy_info_2G, |
| 9194 | sizeof(param->he_cap_phy_info_2G)); |
| 9195 | qdf_mem_copy(¶m->he_cap_phy_info_5G, |
| 9196 | &mac_phy_caps->he_cap_phy_info_5G, |
| 9197 | sizeof(param->he_cap_phy_info_5G)); |
| 9198 | qdf_mem_copy(¶m->he_ppet2G, &mac_phy_caps->he_ppet2G, |
| 9199 | sizeof(param->he_ppet2G)); |
| 9200 | qdf_mem_copy(¶m->he_ppet5G, &mac_phy_caps->he_ppet5G, |
| 9201 | sizeof(param->he_ppet5G)); |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 9202 | param->chainmask_table_id = mac_phy_caps->chainmask_table_id; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9203 | |
| 9204 | return QDF_STATUS_SUCCESS; |
| 9205 | } |
| 9206 | |
| 9207 | /** |
| 9208 | * extract_reg_cap_service_ready_ext_tlv() - |
| 9209 | * extract REG cap from service ready event |
| 9210 | * @wmi_handle: wmi handle |
| 9211 | * @param evt_buf: pointer to event buffer |
| 9212 | * @param param: Pointer to hold evt buf |
| 9213 | * @param phy_idx: phy idx should be less than num_mode |
| 9214 | * |
| 9215 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 9216 | */ |
| 9217 | static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( |
| 9218 | wmi_unified_t wmi_handle, |
| 9219 | uint8_t *event, uint8_t phy_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 9220 | struct wlan_psoc_host_hal_reg_capabilities_ext *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9221 | { |
| 9222 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 9223 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 9224 | WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; |
| 9225 | |
| 9226 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 9227 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 9228 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9229 | |
| 9230 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 9231 | if (!reg_caps) |
| 9232 | return QDF_STATUS_E_INVAL; |
| 9233 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9234 | if (phy_idx >= reg_caps->num_phy) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 9235 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9236 | |
| 9237 | ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; |
| 9238 | |
| 9239 | param->phy_id = ext_reg_cap->phy_id; |
| 9240 | param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; |
| 9241 | param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; |
| 9242 | param->regcap1 = ext_reg_cap->regcap1; |
| 9243 | param->regcap2 = ext_reg_cap->regcap2; |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 9244 | param->wireless_modes = convert_wireless_modes_tlv( |
| 9245 | ext_reg_cap->wireless_modes); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 9246 | param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; |
| 9247 | param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; |
| 9248 | param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; |
| 9249 | param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; |
| 9250 | |
| 9251 | return QDF_STATUS_SUCCESS; |
| 9252 | } |
| 9253 | |
Sathish Kumar | f396c72 | 2017-11-17 17:30:41 +0530 | [diff] [blame] | 9254 | static QDF_STATUS extract_dbr_ring_cap_service_ready_ext_tlv( |
| 9255 | wmi_unified_t wmi_handle, |
| 9256 | uint8_t *event, uint8_t idx, |
| 9257 | struct wlan_psoc_host_dbr_ring_caps *param) |
| 9258 | { |
| 9259 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 9260 | WMI_DMA_RING_CAPABILITIES *dbr_ring_caps; |
| 9261 | |
| 9262 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *)event; |
| 9263 | if (!param_buf) |
| 9264 | return QDF_STATUS_E_INVAL; |
| 9265 | |
| 9266 | dbr_ring_caps = ¶m_buf->dma_ring_caps[idx]; |
| 9267 | |
| 9268 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 9269 | dbr_ring_caps->pdev_id); |
| 9270 | param->mod_id = dbr_ring_caps->mod_id; |
| 9271 | param->ring_elems_min = dbr_ring_caps->ring_elems_min; |
| 9272 | param->min_buf_size = dbr_ring_caps->min_buf_size; |
| 9273 | param->min_buf_align = dbr_ring_caps->min_buf_align; |
| 9274 | |
| 9275 | return QDF_STATUS_SUCCESS; |
| 9276 | } |
| 9277 | |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 9278 | /** |
| 9279 | * extract_thermal_stats_tlv() - extract thermal stats from event |
| 9280 | * @wmi_handle: wmi handle |
| 9281 | * @param evt_buf: Pointer to event buffer |
| 9282 | * @param temp: Pointer to hold extracted temperature |
| 9283 | * @param level: Pointer to hold extracted level |
| 9284 | * |
| 9285 | * Return: 0 for success or error code |
| 9286 | */ |
| 9287 | static QDF_STATUS |
| 9288 | extract_thermal_stats_tlv(wmi_unified_t wmi_handle, |
| 9289 | void *evt_buf, uint32_t *temp, |
| 9290 | uint32_t *level, uint32_t *pdev_id) |
| 9291 | { |
| 9292 | WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf; |
| 9293 | wmi_therm_throt_stats_event_fixed_param *tt_stats_event; |
| 9294 | |
| 9295 | param_buf = |
| 9296 | (WMI_THERM_THROT_STATS_EVENTID_param_tlvs *) evt_buf; |
| 9297 | if (!param_buf) |
| 9298 | return QDF_STATUS_E_INVAL; |
| 9299 | |
| 9300 | tt_stats_event = param_buf->fixed_param; |
| 9301 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9302 | *pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 9303 | tt_stats_event->pdev_id); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 9304 | *temp = tt_stats_event->temp; |
| 9305 | *level = tt_stats_event->level; |
| 9306 | |
| 9307 | return QDF_STATUS_SUCCESS; |
| 9308 | } |
| 9309 | |
| 9310 | /** |
| 9311 | * extract_thermal_level_stats_tlv() - extract thermal level stats from event |
| 9312 | * @wmi_handle: wmi handle |
| 9313 | * @param evt_buf: pointer to event buffer |
| 9314 | * @param idx: Index to level stats |
| 9315 | * @param levelcount: Pointer to hold levelcount |
| 9316 | * @param dccount: Pointer to hold dccount |
| 9317 | * |
| 9318 | * Return: 0 for success or error code |
| 9319 | */ |
| 9320 | static QDF_STATUS |
| 9321 | extract_thermal_level_stats_tlv(wmi_unified_t wmi_handle, |
| 9322 | void *evt_buf, uint8_t idx, uint32_t *levelcount, |
| 9323 | uint32_t *dccount) |
| 9324 | { |
| 9325 | WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf; |
| 9326 | wmi_therm_throt_level_stats_info *tt_level_info; |
| 9327 | |
| 9328 | param_buf = |
| 9329 | (WMI_THERM_THROT_STATS_EVENTID_param_tlvs *) evt_buf; |
| 9330 | if (!param_buf) |
| 9331 | return QDF_STATUS_E_INVAL; |
| 9332 | |
| 9333 | tt_level_info = param_buf->therm_throt_level_stats_info; |
| 9334 | |
| 9335 | if (idx < THERMAL_LEVELS) { |
| 9336 | *levelcount = tt_level_info[idx].level_count; |
| 9337 | *dccount = tt_level_info[idx].dc_count; |
| 9338 | return QDF_STATUS_SUCCESS; |
| 9339 | } |
| 9340 | |
| 9341 | return QDF_STATUS_E_FAILURE; |
| 9342 | } |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 9343 | #ifdef BIG_ENDIAN_HOST |
| 9344 | /** |
| 9345 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 9346 | * @param data_len - data length |
| 9347 | * @param data - pointer to data |
| 9348 | * |
| 9349 | * Return: QDF_STATUS - success or error status |
| 9350 | */ |
| 9351 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 9352 | { |
| 9353 | uint8_t *data_aligned = NULL; |
| 9354 | int c; |
| 9355 | unsigned char *data_unaligned; |
| 9356 | |
| 9357 | data_unaligned = qdf_mem_malloc(((sizeof(uint8_t) * data_len) + |
| 9358 | FIPS_ALIGN)); |
| 9359 | /* Assigning unaligned space to copy the data */ |
Jeff Johnson | da26399 | 2018-05-12 14:22:00 -0700 | [diff] [blame] | 9360 | /* Checking if kmalloc does successful allocation */ |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 9361 | if (data_unaligned == NULL) |
| 9362 | return QDF_STATUS_E_FAILURE; |
| 9363 | |
| 9364 | /* Checking if space is alligned */ |
| 9365 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 9366 | /* align the data space */ |
| 9367 | data_aligned = |
| 9368 | (uint8_t *)FIPS_ALIGNTO(data_unaligned, FIPS_ALIGN); |
| 9369 | } else { |
| 9370 | data_aligned = (u_int8_t *)data_unaligned; |
| 9371 | } |
| 9372 | |
| 9373 | /* memset and copy content from data to data aligned */ |
| 9374 | OS_MEMSET(data_aligned, 0, data_len); |
| 9375 | OS_MEMCPY(data_aligned, data, data_len); |
| 9376 | /* Endianness to LE */ |
| 9377 | for (c = 0; c < data_len/4; c++) { |
| 9378 | *((u_int32_t *)data_aligned + c) = |
Padma Raghunathan | 1edbf23 | 2017-08-31 15:26:47 +0530 | [diff] [blame] | 9379 | qdf_le32_to_cpu(*((u_int32_t *)data_aligned + c)); |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 9380 | } |
| 9381 | |
| 9382 | /* Copy content to event->data */ |
| 9383 | OS_MEMCPY(data, data_aligned, data_len); |
| 9384 | |
| 9385 | /* clean up allocated space */ |
| 9386 | qdf_mem_free(data_unaligned); |
| 9387 | data_aligned = NULL; |
| 9388 | data_unaligned = NULL; |
| 9389 | |
| 9390 | /*************************************************************/ |
| 9391 | |
| 9392 | return QDF_STATUS_SUCCESS; |
| 9393 | } |
| 9394 | #else |
| 9395 | /** |
| 9396 | * fips_conv_data_be() - DUMMY for LE platform |
| 9397 | * |
| 9398 | * Return: QDF_STATUS - success |
| 9399 | */ |
| 9400 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 9401 | { |
| 9402 | return QDF_STATUS_SUCCESS; |
| 9403 | } |
| 9404 | #endif |
| 9405 | |
| 9406 | /** |
| 9407 | * extract_fips_event_data_tlv() - extract fips event data |
| 9408 | * @wmi_handle: wmi handle |
| 9409 | * @param evt_buf: pointer to event buffer |
| 9410 | * @param param: pointer FIPS event params |
| 9411 | * |
| 9412 | * Return: 0 for success or error code |
| 9413 | */ |
| 9414 | static QDF_STATUS extract_fips_event_data_tlv(wmi_unified_t wmi_handle, |
| 9415 | void *evt_buf, struct wmi_host_fips_event_param *param) |
| 9416 | { |
| 9417 | WMI_PDEV_FIPS_EVENTID_param_tlvs *param_buf; |
| 9418 | wmi_pdev_fips_event_fixed_param *event; |
| 9419 | |
| 9420 | param_buf = (WMI_PDEV_FIPS_EVENTID_param_tlvs *) evt_buf; |
| 9421 | event = (wmi_pdev_fips_event_fixed_param *) param_buf->fixed_param; |
| 9422 | |
| 9423 | if (fips_conv_data_be(event->data_len, param_buf->data) != |
| 9424 | QDF_STATUS_SUCCESS) |
| 9425 | return QDF_STATUS_E_FAILURE; |
| 9426 | |
| 9427 | param->data = (uint32_t *)param_buf->data; |
| 9428 | param->data_len = event->data_len; |
| 9429 | param->error_status = event->error_status; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9430 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 9431 | event->pdev_id); |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 9432 | |
| 9433 | return QDF_STATUS_SUCCESS; |
| 9434 | } |
| 9435 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 9436 | static bool is_management_record_tlv(uint32_t cmd_id) |
| 9437 | { |
Rajeev Kumar | 173bef4 | 2018-09-18 16:45:39 -0700 | [diff] [blame] | 9438 | switch (cmd_id) { |
| 9439 | case WMI_MGMT_TX_SEND_CMDID: |
| 9440 | case WMI_MGMT_TX_COMPLETION_EVENTID: |
| 9441 | case WMI_OFFCHAN_DATA_TX_SEND_CMDID: |
| 9442 | case WMI_MGMT_RX_EVENTID: |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 9443 | return true; |
Rajeev Kumar | 173bef4 | 2018-09-18 16:45:39 -0700 | [diff] [blame] | 9444 | default: |
| 9445 | return false; |
jiad | 36c94d2 | 2018-01-22 15:37:03 +0800 | [diff] [blame] | 9446 | } |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 9447 | } |
| 9448 | |
Rajeev Kumar | b64e128 | 2018-09-19 13:02:23 -0700 | [diff] [blame] | 9449 | static bool is_diag_event_tlv(uint32_t event_id) |
| 9450 | { |
| 9451 | if (WMI_DIAG_EVENTID == event_id) |
| 9452 | return true; |
| 9453 | |
| 9454 | return false; |
| 9455 | } |
| 9456 | |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 9457 | static uint16_t wmi_tag_vdev_set_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 9458 | { |
| 9459 | wmi_vdev_set_param_cmd_fixed_param *set_cmd; |
| 9460 | |
| 9461 | set_cmd = (wmi_vdev_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 9462 | |
| 9463 | switch (set_cmd->param_id) { |
| 9464 | case WMI_VDEV_PARAM_LISTEN_INTERVAL: |
| 9465 | case WMI_VDEV_PARAM_DTIM_POLICY: |
| 9466 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 9467 | default: |
| 9468 | break; |
| 9469 | } |
| 9470 | |
| 9471 | return 0; |
| 9472 | } |
| 9473 | |
| 9474 | static uint16_t wmi_tag_sta_powersave_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 9475 | { |
| 9476 | wmi_sta_powersave_param_cmd_fixed_param *ps_cmd; |
| 9477 | |
| 9478 | ps_cmd = (wmi_sta_powersave_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 9479 | |
| 9480 | switch (ps_cmd->param) { |
| 9481 | case WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD: |
| 9482 | case WMI_STA_PS_PARAM_INACTIVITY_TIME: |
| 9483 | case WMI_STA_PS_ENABLE_QPOWER: |
| 9484 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 9485 | default: |
| 9486 | break; |
| 9487 | } |
| 9488 | |
| 9489 | return 0; |
| 9490 | } |
| 9491 | |
| 9492 | static uint16_t wmi_tag_common_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf, |
| 9493 | uint32_t cmd_id) |
| 9494 | { |
| 9495 | if (qdf_atomic_read(&wmi_hdl->is_wow_bus_suspended)) |
| 9496 | return 0; |
| 9497 | |
| 9498 | switch (cmd_id) { |
| 9499 | case WMI_VDEV_SET_PARAM_CMDID: |
| 9500 | return wmi_tag_vdev_set_cmd(wmi_hdl, buf); |
| 9501 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 9502 | return wmi_tag_sta_powersave_cmd(wmi_hdl, buf); |
| 9503 | default: |
| 9504 | break; |
| 9505 | } |
| 9506 | |
| 9507 | return 0; |
| 9508 | } |
| 9509 | |
| 9510 | static uint16_t wmi_tag_fw_hang_cmd(wmi_unified_t wmi_handle) |
| 9511 | { |
| 9512 | uint16_t tag = 0; |
| 9513 | |
| 9514 | if (qdf_atomic_read(&wmi_handle->is_target_suspended)) { |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 9515 | pr_err("%s: Target is already suspended, Ignore FW Hang Command", |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 9516 | __func__); |
| 9517 | return tag; |
| 9518 | } |
| 9519 | |
| 9520 | if (wmi_handle->tag_crash_inject) |
| 9521 | tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 9522 | |
| 9523 | wmi_handle->tag_crash_inject = false; |
| 9524 | return tag; |
| 9525 | } |
| 9526 | |
| 9527 | /** |
| 9528 | * wmi_set_htc_tx_tag_tlv() - set HTC TX tag for WMI commands |
| 9529 | * @wmi_handle: WMI handle |
| 9530 | * @buf: WMI buffer |
| 9531 | * @cmd_id: WMI command Id |
| 9532 | * |
| 9533 | * Return htc_tx_tag |
| 9534 | */ |
| 9535 | static uint16_t wmi_set_htc_tx_tag_tlv(wmi_unified_t wmi_handle, |
| 9536 | wmi_buf_t buf, |
| 9537 | uint32_t cmd_id) |
| 9538 | { |
| 9539 | uint16_t htc_tx_tag = 0; |
| 9540 | |
| 9541 | switch (cmd_id) { |
| 9542 | case WMI_WOW_ENABLE_CMDID: |
| 9543 | case WMI_PDEV_SUSPEND_CMDID: |
| 9544 | case WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID: |
| 9545 | case WMI_WOW_ADD_WAKE_PATTERN_CMDID: |
| 9546 | case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: |
| 9547 | case WMI_PDEV_RESUME_CMDID: |
| 9548 | case WMI_WOW_DEL_WAKE_PATTERN_CMDID: |
| 9549 | case WMI_WOW_SET_ACTION_WAKE_UP_CMDID: |
| 9550 | #ifdef FEATURE_WLAN_D0WOW |
| 9551 | case WMI_D0_WOW_ENABLE_DISABLE_CMDID: |
| 9552 | #endif |
| 9553 | htc_tx_tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 9554 | break; |
| 9555 | case WMI_FORCE_FW_HANG_CMDID: |
| 9556 | htc_tx_tag = wmi_tag_fw_hang_cmd(wmi_handle); |
| 9557 | break; |
| 9558 | case WMI_VDEV_SET_PARAM_CMDID: |
| 9559 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 9560 | htc_tx_tag = wmi_tag_common_cmd(wmi_handle, buf, cmd_id); |
| 9561 | default: |
| 9562 | break; |
| 9563 | } |
| 9564 | |
| 9565 | return htc_tx_tag; |
| 9566 | } |
| 9567 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 9568 | static struct cur_reg_rule |
| 9569 | *create_reg_rules_from_wmi(uint32_t num_reg_rules, |
| 9570 | wmi_regulatory_rule_struct *wmi_reg_rule) |
| 9571 | { |
| 9572 | struct cur_reg_rule *reg_rule_ptr; |
| 9573 | uint32_t count; |
| 9574 | |
| 9575 | reg_rule_ptr = qdf_mem_malloc(num_reg_rules * sizeof(*reg_rule_ptr)); |
| 9576 | |
| 9577 | if (NULL == reg_rule_ptr) { |
| 9578 | WMI_LOGE("memory allocation failure"); |
| 9579 | return NULL; |
| 9580 | } |
| 9581 | |
| 9582 | for (count = 0; count < num_reg_rules; count++) { |
| 9583 | reg_rule_ptr[count].start_freq = |
| 9584 | WMI_REG_RULE_START_FREQ_GET( |
| 9585 | wmi_reg_rule[count].freq_info); |
| 9586 | reg_rule_ptr[count].end_freq = |
| 9587 | WMI_REG_RULE_END_FREQ_GET( |
| 9588 | wmi_reg_rule[count].freq_info); |
| 9589 | reg_rule_ptr[count].max_bw = |
| 9590 | WMI_REG_RULE_MAX_BW_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 9591 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 9592 | reg_rule_ptr[count].reg_power = |
| 9593 | WMI_REG_RULE_REG_POWER_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 9594 | wmi_reg_rule[count].bw_pwr_info); |
Abhijit Pradhan | b5a1d24 | 2017-04-27 20:36:31 +0530 | [diff] [blame] | 9595 | reg_rule_ptr[count].ant_gain = |
| 9596 | WMI_REG_RULE_ANTENNA_GAIN_GET( |
| 9597 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 9598 | reg_rule_ptr[count].flags = |
| 9599 | WMI_REG_RULE_FLAGS_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 9600 | wmi_reg_rule[count].flag_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 9601 | } |
| 9602 | |
| 9603 | return reg_rule_ptr; |
| 9604 | } |
| 9605 | |
| 9606 | static QDF_STATUS extract_reg_chan_list_update_event_tlv( |
| 9607 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 9608 | struct cur_regulatory_info *reg_info, uint32_t len) |
| 9609 | { |
| 9610 | WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *param_buf; |
| 9611 | wmi_reg_chan_list_cc_event_fixed_param *chan_list_event_hdr; |
| 9612 | wmi_regulatory_rule_struct *wmi_reg_rule; |
| 9613 | uint32_t num_2g_reg_rules, num_5g_reg_rules; |
| 9614 | |
| 9615 | WMI_LOGD("processing regulatory channel list"); |
| 9616 | |
| 9617 | param_buf = (WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *)evt_buf; |
| 9618 | if (!param_buf) { |
| 9619 | WMI_LOGE("invalid channel list event buf"); |
| 9620 | return QDF_STATUS_E_FAILURE; |
| 9621 | } |
| 9622 | |
| 9623 | chan_list_event_hdr = param_buf->fixed_param; |
| 9624 | |
| 9625 | reg_info->num_2g_reg_rules = chan_list_event_hdr->num_2g_reg_rules; |
| 9626 | reg_info->num_5g_reg_rules = chan_list_event_hdr->num_5g_reg_rules; |
| 9627 | qdf_mem_copy(reg_info->alpha2, &(chan_list_event_hdr->alpha2), |
Amar Singhal | 7d20402 | 2017-06-23 12:17:00 +0530 | [diff] [blame] | 9628 | REG_ALPHA2_LEN); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 9629 | reg_info->dfs_region = chan_list_event_hdr->dfs_region; |
| 9630 | reg_info->phybitmap = chan_list_event_hdr->phybitmap; |
Amar Singhal | a2d575f | 2017-05-04 17:12:34 -0700 | [diff] [blame] | 9631 | reg_info->offload_enabled = true; |
Amar Singhal | a522f21 | 2017-05-12 16:39:23 -0700 | [diff] [blame] | 9632 | reg_info->num_phy = chan_list_event_hdr->num_phy; |
Amar Singhal | 7d20402 | 2017-06-23 12:17:00 +0530 | [diff] [blame] | 9633 | reg_info->phy_id = chan_list_event_hdr->phy_id; |
Amar Singhal | a522f21 | 2017-05-12 16:39:23 -0700 | [diff] [blame] | 9634 | reg_info->ctry_code = chan_list_event_hdr->country_id; |
| 9635 | reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code; |
| 9636 | if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_PASS) |
| 9637 | reg_info->status_code = REG_SET_CC_STATUS_PASS; |
| 9638 | else if (chan_list_event_hdr->status_code == |
| 9639 | WMI_REG_CURRENT_ALPHA2_NOT_FOUND) |
| 9640 | reg_info->status_code = REG_CURRENT_ALPHA2_NOT_FOUND; |
| 9641 | else if (chan_list_event_hdr->status_code == |
| 9642 | WMI_REG_INIT_ALPHA2_NOT_FOUND) |
| 9643 | reg_info->status_code = REG_INIT_ALPHA2_NOT_FOUND; |
| 9644 | else if (chan_list_event_hdr->status_code == |
| 9645 | WMI_REG_SET_CC_CHANGE_NOT_ALLOWED) |
| 9646 | reg_info->status_code = REG_SET_CC_CHANGE_NOT_ALLOWED; |
| 9647 | else if (chan_list_event_hdr->status_code == |
| 9648 | WMI_REG_SET_CC_STATUS_NO_MEMORY) |
| 9649 | reg_info->status_code = REG_SET_CC_STATUS_NO_MEMORY; |
| 9650 | else if (chan_list_event_hdr->status_code == |
| 9651 | WMI_REG_SET_CC_STATUS_FAIL) |
| 9652 | reg_info->status_code = REG_SET_CC_STATUS_FAIL; |
| 9653 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 9654 | reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g; |
| 9655 | reg_info->max_bw_2g = chan_list_event_hdr->max_bw_2g; |
| 9656 | reg_info->min_bw_5g = chan_list_event_hdr->min_bw_5g; |
| 9657 | reg_info->max_bw_5g = chan_list_event_hdr->max_bw_5g; |
| 9658 | |
| 9659 | num_2g_reg_rules = reg_info->num_2g_reg_rules; |
| 9660 | num_5g_reg_rules = reg_info->num_5g_reg_rules; |
| 9661 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 9662 | WMI_LOGD("%s:cc %s dsf %d BW: min_2g %d max_2g %d min_5g %d max_5g %d", |
| 9663 | __func__, reg_info->alpha2, reg_info->dfs_region, |
| 9664 | reg_info->min_bw_2g, reg_info->max_bw_2g, |
| 9665 | reg_info->min_bw_5g, reg_info->max_bw_5g); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 9666 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 9667 | WMI_LOGD("%s: num_2g_reg_rules %d num_5g_reg_rules %d", __func__, |
| 9668 | num_2g_reg_rules, num_5g_reg_rules); |
Kiran Kumar Lokere | dd64e04 | 2017-03-31 15:50:26 -0700 | [diff] [blame] | 9669 | wmi_reg_rule = |
| 9670 | (wmi_regulatory_rule_struct *)((uint8_t *)chan_list_event_hdr |
| 9671 | + sizeof(wmi_reg_chan_list_cc_event_fixed_param) |
| 9672 | + WMI_TLV_HDR_SIZE); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 9673 | reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules, |
| 9674 | wmi_reg_rule); |
| 9675 | wmi_reg_rule += num_2g_reg_rules; |
| 9676 | |
| 9677 | reg_info->reg_rules_5g_ptr = create_reg_rules_from_wmi(num_5g_reg_rules, |
| 9678 | wmi_reg_rule); |
| 9679 | |
| 9680 | WMI_LOGD("processed regulatory channel list"); |
| 9681 | |
| 9682 | return QDF_STATUS_SUCCESS; |
| 9683 | } |
| 9684 | |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 9685 | static QDF_STATUS extract_reg_11d_new_country_event_tlv( |
| 9686 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 9687 | struct reg_11d_new_country *reg_11d_country, uint32_t len) |
| 9688 | { |
| 9689 | wmi_11d_new_country_event_fixed_param *reg_11d_country_event; |
| 9690 | WMI_11D_NEW_COUNTRY_EVENTID_param_tlvs *param_buf; |
| 9691 | |
| 9692 | param_buf = (WMI_11D_NEW_COUNTRY_EVENTID_param_tlvs *)evt_buf; |
| 9693 | if (!param_buf) { |
| 9694 | WMI_LOGE("invalid 11d country event buf"); |
| 9695 | return QDF_STATUS_E_FAILURE; |
| 9696 | } |
| 9697 | |
| 9698 | reg_11d_country_event = param_buf->fixed_param; |
| 9699 | |
| 9700 | qdf_mem_copy(reg_11d_country->alpha2, |
| 9701 | ®_11d_country_event->new_alpha2, REG_ALPHA2_LEN); |
Jianmin Zhu | f6d5a65 | 2018-10-11 20:30:58 +0800 | [diff] [blame] | 9702 | reg_11d_country->alpha2[REG_ALPHA2_LEN] = '\0'; |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 9703 | |
| 9704 | WMI_LOGD("processed 11d country event, new cc %s", |
| 9705 | reg_11d_country->alpha2); |
| 9706 | |
| 9707 | return QDF_STATUS_SUCCESS; |
| 9708 | } |
Kiran Kumar Lokere | ec65bb4 | 2017-06-30 19:13:02 -0700 | [diff] [blame] | 9709 | |
| 9710 | static QDF_STATUS extract_reg_ch_avoid_event_tlv( |
| 9711 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 9712 | struct ch_avoid_ind_type *ch_avoid_ind, uint32_t len) |
| 9713 | { |
| 9714 | wmi_avoid_freq_ranges_event_fixed_param *afr_fixed_param; |
| 9715 | wmi_avoid_freq_range_desc *afr_desc; |
| 9716 | uint32_t num_freq_ranges, freq_range_idx; |
| 9717 | WMI_WLAN_FREQ_AVOID_EVENTID_param_tlvs *param_buf = |
| 9718 | (WMI_WLAN_FREQ_AVOID_EVENTID_param_tlvs *) evt_buf; |
| 9719 | |
| 9720 | if (!param_buf) { |
| 9721 | WMI_LOGE("Invalid channel avoid event buffer"); |
| 9722 | return QDF_STATUS_E_INVAL; |
| 9723 | } |
| 9724 | |
| 9725 | afr_fixed_param = param_buf->fixed_param; |
| 9726 | if (!afr_fixed_param) { |
| 9727 | WMI_LOGE("Invalid channel avoid event fixed param buffer"); |
| 9728 | return QDF_STATUS_E_INVAL; |
| 9729 | } |
| 9730 | |
| 9731 | if (!ch_avoid_ind) { |
| 9732 | WMI_LOGE("Invalid channel avoid indication buffer"); |
| 9733 | return QDF_STATUS_E_INVAL; |
| 9734 | } |
Kiran Kumar Lokere | 7d31204 | 2018-09-19 16:55:34 -0700 | [diff] [blame] | 9735 | if (param_buf->num_avd_freq_range < afr_fixed_param->num_freq_ranges) { |
| 9736 | WMI_LOGE(FL("no.of freq ranges exceeded the limit")); |
| 9737 | return QDF_STATUS_E_INVAL; |
| 9738 | } |
Kiran Kumar Lokere | ec65bb4 | 2017-06-30 19:13:02 -0700 | [diff] [blame] | 9739 | num_freq_ranges = (afr_fixed_param->num_freq_ranges > |
| 9740 | CH_AVOID_MAX_RANGE) ? CH_AVOID_MAX_RANGE : |
| 9741 | afr_fixed_param->num_freq_ranges; |
| 9742 | |
| 9743 | WMI_LOGD("Channel avoid event received with %d ranges", |
| 9744 | num_freq_ranges); |
| 9745 | |
| 9746 | ch_avoid_ind->ch_avoid_range_cnt = num_freq_ranges; |
| 9747 | afr_desc = (wmi_avoid_freq_range_desc *)(param_buf->avd_freq_range); |
| 9748 | for (freq_range_idx = 0; freq_range_idx < num_freq_ranges; |
| 9749 | freq_range_idx++) { |
| 9750 | ch_avoid_ind->avoid_freq_range[freq_range_idx].start_freq = |
| 9751 | afr_desc->start_freq; |
| 9752 | ch_avoid_ind->avoid_freq_range[freq_range_idx].end_freq = |
| 9753 | afr_desc->end_freq; |
| 9754 | WMI_LOGD("range %d tlv id %u, start freq %u, end freq %u", |
| 9755 | freq_range_idx, afr_desc->tlv_header, |
| 9756 | afr_desc->start_freq, afr_desc->end_freq); |
| 9757 | afr_desc++; |
| 9758 | } |
| 9759 | |
| 9760 | return QDF_STATUS_SUCCESS; |
| 9761 | } |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 9762 | |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 9763 | #ifdef DFS_COMPONENT_ENABLE |
| 9764 | /** |
| 9765 | * extract_dfs_cac_complete_event_tlv() - extract cac complete event |
| 9766 | * @wmi_handle: wma handle |
| 9767 | * @evt_buf: event buffer |
| 9768 | * @vdev_id: vdev id |
| 9769 | * @len: length of buffer |
| 9770 | * |
| 9771 | * Return: 0 for success or error code |
| 9772 | */ |
| 9773 | static QDF_STATUS extract_dfs_cac_complete_event_tlv(wmi_unified_t wmi_handle, |
| 9774 | uint8_t *evt_buf, |
| 9775 | uint32_t *vdev_id, |
| 9776 | uint32_t len) |
| 9777 | { |
| 9778 | WMI_VDEV_DFS_CAC_COMPLETE_EVENTID_param_tlvs *param_tlvs; |
| 9779 | wmi_vdev_dfs_cac_complete_event_fixed_param *cac_event; |
| 9780 | |
| 9781 | param_tlvs = (WMI_VDEV_DFS_CAC_COMPLETE_EVENTID_param_tlvs *) evt_buf; |
| 9782 | if (!param_tlvs) { |
| 9783 | WMI_LOGE("invalid cac complete event buf"); |
| 9784 | return QDF_STATUS_E_FAILURE; |
| 9785 | } |
| 9786 | |
| 9787 | cac_event = param_tlvs->fixed_param; |
| 9788 | *vdev_id = cac_event->vdev_id; |
| 9789 | WMI_LOGD("processed cac complete event vdev %d", *vdev_id); |
| 9790 | |
| 9791 | return QDF_STATUS_SUCCESS; |
| 9792 | } |
| 9793 | |
| 9794 | /** |
| 9795 | * extract_dfs_radar_detection_event_tlv() - extract radar found event |
| 9796 | * @wmi_handle: wma handle |
| 9797 | * @evt_buf: event buffer |
| 9798 | * @radar_found: radar found event info |
| 9799 | * @len: length of buffer |
| 9800 | * |
| 9801 | * Return: 0 for success or error code |
| 9802 | */ |
| 9803 | static QDF_STATUS extract_dfs_radar_detection_event_tlv( |
| 9804 | wmi_unified_t wmi_handle, |
| 9805 | uint8_t *evt_buf, |
| 9806 | struct radar_found_info *radar_found, |
| 9807 | uint32_t len) |
| 9808 | { |
| 9809 | WMI_PDEV_DFS_RADAR_DETECTION_EVENTID_param_tlvs *param_tlv; |
| 9810 | wmi_pdev_dfs_radar_detection_event_fixed_param *radar_event; |
| 9811 | |
| 9812 | param_tlv = (WMI_PDEV_DFS_RADAR_DETECTION_EVENTID_param_tlvs *) evt_buf; |
| 9813 | if (!param_tlv) { |
| 9814 | WMI_LOGE("invalid radar detection event buf"); |
| 9815 | return QDF_STATUS_E_FAILURE; |
| 9816 | } |
| 9817 | |
| 9818 | radar_event = param_tlv->fixed_param; |
Arif Hussain | b522ac9 | 2018-06-27 10:51:06 -0700 | [diff] [blame] | 9819 | radar_found->pdev_id = convert_target_pdev_id_to_host_pdev_id( |
| 9820 | radar_event->pdev_id); |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 9821 | radar_found->detection_mode = radar_event->detection_mode; |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame] | 9822 | radar_found->chan_freq = radar_event->chan_freq; |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 9823 | radar_found->chan_width = radar_event->chan_width; |
| 9824 | radar_found->detector_id = radar_event->detector_id; |
| 9825 | radar_found->segment_id = radar_event->segment_id; |
| 9826 | radar_found->timestamp = radar_event->timestamp; |
| 9827 | radar_found->is_chirp = radar_event->is_chirp; |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame] | 9828 | radar_found->freq_offset = radar_event->freq_offset; |
| 9829 | radar_found->sidx = radar_event->sidx; |
| 9830 | |
Shaakir Mohamed | 3a72d0a | 2017-11-30 14:36:16 -0800 | [diff] [blame] | 9831 | WMI_LOGI("processed radar found event pdev %d," |
| 9832 | "Radar Event Info:pdev_id %d,timestamp %d,chan_freq (dur) %d," |
| 9833 | "chan_width (RSSI) %d,detector_id (false_radar) %d," |
| 9834 | "freq_offset (radar_check) %d,segment_id %d,sidx %d," |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 9835 | "is_chirp %d,detection mode %d", |
Arif Hussain | b522ac9 | 2018-06-27 10:51:06 -0700 | [diff] [blame] | 9836 | radar_event->pdev_id, radar_found->pdev_id, |
Shaakir Mohamed | 3a72d0a | 2017-11-30 14:36:16 -0800 | [diff] [blame] | 9837 | radar_event->timestamp, radar_event->chan_freq, |
| 9838 | radar_event->chan_width, radar_event->detector_id, |
| 9839 | radar_event->freq_offset, radar_event->segment_id, |
| 9840 | radar_event->sidx, radar_event->is_chirp, |
| 9841 | radar_event->detection_mode); |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 9842 | |
| 9843 | return QDF_STATUS_SUCCESS; |
| 9844 | } |
bings | 1ea1253 | 2017-12-18 16:56:53 +0800 | [diff] [blame] | 9845 | |
| 9846 | #ifdef QCA_MCL_DFS_SUPPORT |
| 9847 | /** |
| 9848 | * extract_wlan_radar_event_info_tlv() - extract radar pulse event |
| 9849 | * @wmi_handle: wma handle |
| 9850 | * @evt_buf: event buffer |
| 9851 | * @wlan_radar_event: Pointer to struct radar_event_info |
| 9852 | * @len: length of buffer |
| 9853 | * |
| 9854 | * Return: QDF_STATUS |
| 9855 | */ |
| 9856 | static QDF_STATUS extract_wlan_radar_event_info_tlv( |
| 9857 | wmi_unified_t wmi_handle, |
| 9858 | uint8_t *evt_buf, |
| 9859 | struct radar_event_info *wlan_radar_event, |
| 9860 | uint32_t len) |
| 9861 | { |
| 9862 | WMI_DFS_RADAR_EVENTID_param_tlvs *param_tlv; |
| 9863 | wmi_dfs_radar_event_fixed_param *radar_event; |
| 9864 | |
| 9865 | param_tlv = (WMI_DFS_RADAR_EVENTID_param_tlvs *)evt_buf; |
| 9866 | if (!param_tlv) { |
| 9867 | WMI_LOGE("invalid wlan radar event buf"); |
| 9868 | return QDF_STATUS_E_FAILURE; |
| 9869 | } |
| 9870 | |
| 9871 | radar_event = param_tlv->fixed_param; |
| 9872 | wlan_radar_event->pulse_is_chirp = radar_event->pulse_is_chirp; |
| 9873 | wlan_radar_event->pulse_center_freq = radar_event->pulse_center_freq; |
| 9874 | wlan_radar_event->pulse_duration = radar_event->pulse_duration; |
| 9875 | wlan_radar_event->rssi = radar_event->rssi; |
| 9876 | wlan_radar_event->pulse_detect_ts = radar_event->pulse_detect_ts; |
| 9877 | wlan_radar_event->upload_fullts_high = radar_event->upload_fullts_high; |
| 9878 | wlan_radar_event->upload_fullts_low = radar_event->upload_fullts_low; |
| 9879 | wlan_radar_event->peak_sidx = radar_event->peak_sidx; |
bings | fd46164 | 2018-01-03 16:38:00 +0800 | [diff] [blame] | 9880 | wlan_radar_event->delta_peak = radar_event->pulse_delta_peak; |
| 9881 | wlan_radar_event->delta_diff = radar_event->pulse_delta_diff; |
bings | 26d46df | 2018-02-11 16:40:08 +0800 | [diff] [blame] | 9882 | if (radar_event->pulse_flags & |
| 9883 | WMI_DFS_RADAR_PULSE_FLAG_MASK_PSIDX_DIFF_VALID) { |
| 9884 | wlan_radar_event->is_psidx_diff_valid = true; |
| 9885 | wlan_radar_event->psidx_diff = radar_event->psidx_diff; |
| 9886 | } else { |
| 9887 | wlan_radar_event->is_psidx_diff_valid = false; |
| 9888 | } |
| 9889 | |
bings | 1ea1253 | 2017-12-18 16:56:53 +0800 | [diff] [blame] | 9890 | wlan_radar_event->pdev_id = radar_event->pdev_id; |
| 9891 | |
| 9892 | return QDF_STATUS_SUCCESS; |
| 9893 | } |
| 9894 | #else |
| 9895 | static QDF_STATUS extract_wlan_radar_event_info_tlv( |
| 9896 | wmi_unified_t wmi_handle, |
| 9897 | uint8_t *evt_buf, |
| 9898 | struct radar_event_info *wlan_radar_event, |
| 9899 | uint32_t len) |
| 9900 | { |
| 9901 | return QDF_STATUS_SUCCESS; |
| 9902 | } |
| 9903 | #endif |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 9904 | #endif |
| 9905 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 9906 | /** |
Rajeev Kumar Sirasanagandla | ab4275d | 2016-11-22 21:28:54 +0530 | [diff] [blame] | 9907 | * send_get_rcpi_cmd_tlv() - send request for rcpi value |
| 9908 | * @wmi_handle: wmi handle |
| 9909 | * @get_rcpi_param: rcpi params |
| 9910 | * |
| 9911 | * Return: QDF status |
| 9912 | */ |
| 9913 | static QDF_STATUS send_get_rcpi_cmd_tlv(wmi_unified_t wmi_handle, |
| 9914 | struct rcpi_req *get_rcpi_param) |
| 9915 | { |
| 9916 | wmi_buf_t buf; |
| 9917 | wmi_request_rcpi_cmd_fixed_param *cmd; |
| 9918 | uint8_t len = sizeof(wmi_request_rcpi_cmd_fixed_param); |
| 9919 | |
| 9920 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9921 | if (!buf) { |
| 9922 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 9923 | return QDF_STATUS_E_NOMEM; |
| 9924 | } |
| 9925 | |
| 9926 | cmd = (wmi_request_rcpi_cmd_fixed_param *) wmi_buf_data(buf); |
| 9927 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9928 | WMITLV_TAG_STRUC_wmi_request_rcpi_cmd_fixed_param, |
| 9929 | WMITLV_GET_STRUCT_TLVLEN |
| 9930 | (wmi_request_rcpi_cmd_fixed_param)); |
| 9931 | |
| 9932 | cmd->vdev_id = get_rcpi_param->vdev_id; |
| 9933 | WMI_CHAR_ARRAY_TO_MAC_ADDR(get_rcpi_param->mac_addr, |
| 9934 | &cmd->peer_macaddr); |
Tushnim Bhattacharyya | 9c8a954 | 2018-03-28 13:05:48 -0700 | [diff] [blame] | 9935 | |
| 9936 | switch (get_rcpi_param->measurement_type) { |
| 9937 | |
| 9938 | case RCPI_MEASUREMENT_TYPE_AVG_MGMT: |
| 9939 | cmd->measurement_type = WMI_RCPI_MEASUREMENT_TYPE_AVG_MGMT; |
| 9940 | break; |
| 9941 | |
| 9942 | case RCPI_MEASUREMENT_TYPE_AVG_DATA: |
| 9943 | cmd->measurement_type = WMI_RCPI_MEASUREMENT_TYPE_AVG_DATA; |
| 9944 | break; |
| 9945 | |
| 9946 | case RCPI_MEASUREMENT_TYPE_LAST_MGMT: |
| 9947 | cmd->measurement_type = WMI_RCPI_MEASUREMENT_TYPE_LAST_MGMT; |
| 9948 | break; |
| 9949 | |
| 9950 | case RCPI_MEASUREMENT_TYPE_LAST_DATA: |
| 9951 | cmd->measurement_type = WMI_RCPI_MEASUREMENT_TYPE_LAST_DATA; |
| 9952 | break; |
| 9953 | |
| 9954 | default: |
| 9955 | /* |
| 9956 | * invalid rcpi measurement type, fall back to |
| 9957 | * RCPI_MEASUREMENT_TYPE_AVG_MGMT |
| 9958 | */ |
| 9959 | cmd->measurement_type = WMI_RCPI_MEASUREMENT_TYPE_AVG_MGMT; |
| 9960 | break; |
| 9961 | } |
Rajeev Kumar Sirasanagandla | ab4275d | 2016-11-22 21:28:54 +0530 | [diff] [blame] | 9962 | WMI_LOGD("RCPI REQ VDEV_ID:%d-->", cmd->vdev_id); |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 9963 | wmi_mtrace(WMI_REQUEST_RCPI_CMDID, cmd->vdev_id, 0); |
Rajeev Kumar Sirasanagandla | ab4275d | 2016-11-22 21:28:54 +0530 | [diff] [blame] | 9964 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9965 | WMI_REQUEST_RCPI_CMDID)) { |
| 9966 | |
| 9967 | WMI_LOGE("%s: Failed to send WMI_REQUEST_RCPI_CMDID", |
| 9968 | __func__); |
| 9969 | wmi_buf_free(buf); |
| 9970 | return QDF_STATUS_E_FAILURE; |
| 9971 | } |
| 9972 | |
| 9973 | return QDF_STATUS_SUCCESS; |
| 9974 | } |
| 9975 | |
| 9976 | /** |
| 9977 | * extract_rcpi_response_event_tlv() - Extract RCPI event params |
| 9978 | * @wmi_handle: wmi handle |
| 9979 | * @evt_buf: pointer to event buffer |
| 9980 | * @res: pointer to hold rcpi response from firmware |
| 9981 | * |
| 9982 | * Return: QDF_STATUS_SUCCESS for successful event parse |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 9983 | * else QDF_STATUS_E_INVAL or QDF_STATUS_E_FAILURE |
Rajeev Kumar Sirasanagandla | ab4275d | 2016-11-22 21:28:54 +0530 | [diff] [blame] | 9984 | */ |
| 9985 | static QDF_STATUS |
| 9986 | extract_rcpi_response_event_tlv(wmi_unified_t wmi_handle, |
| 9987 | void *evt_buf, struct rcpi_res *res) |
| 9988 | { |
| 9989 | WMI_UPDATE_RCPI_EVENTID_param_tlvs *param_buf; |
| 9990 | wmi_update_rcpi_event_fixed_param *event; |
| 9991 | |
| 9992 | param_buf = (WMI_UPDATE_RCPI_EVENTID_param_tlvs *)evt_buf; |
| 9993 | if (!param_buf) { |
| 9994 | WMI_LOGE(FL("Invalid rcpi event")); |
| 9995 | return QDF_STATUS_E_INVAL; |
| 9996 | } |
| 9997 | |
| 9998 | event = param_buf->fixed_param; |
| 9999 | res->vdev_id = event->vdev_id; |
| 10000 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->peer_macaddr, res->mac_addr); |
| 10001 | |
| 10002 | switch (event->measurement_type) { |
| 10003 | |
| 10004 | case WMI_RCPI_MEASUREMENT_TYPE_AVG_MGMT: |
| 10005 | res->measurement_type = RCPI_MEASUREMENT_TYPE_AVG_MGMT; |
| 10006 | break; |
| 10007 | |
| 10008 | case WMI_RCPI_MEASUREMENT_TYPE_AVG_DATA: |
| 10009 | res->measurement_type = RCPI_MEASUREMENT_TYPE_AVG_DATA; |
| 10010 | break; |
| 10011 | |
| 10012 | case WMI_RCPI_MEASUREMENT_TYPE_LAST_MGMT: |
| 10013 | res->measurement_type = RCPI_MEASUREMENT_TYPE_LAST_MGMT; |
| 10014 | break; |
| 10015 | |
| 10016 | case WMI_RCPI_MEASUREMENT_TYPE_LAST_DATA: |
| 10017 | res->measurement_type = RCPI_MEASUREMENT_TYPE_LAST_DATA; |
| 10018 | break; |
| 10019 | |
| 10020 | default: |
| 10021 | WMI_LOGE(FL("Invalid rcpi measurement type from firmware")); |
| 10022 | res->measurement_type = RCPI_MEASUREMENT_TYPE_INVALID; |
| 10023 | return QDF_STATUS_E_FAILURE; |
| 10024 | } |
| 10025 | |
| 10026 | if (event->status) |
| 10027 | return QDF_STATUS_E_FAILURE; |
| 10028 | else |
| 10029 | return QDF_STATUS_SUCCESS; |
| 10030 | } |
| 10031 | |
| 10032 | /** |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10033 | * convert_host_pdev_id_to_target_pdev_id_legacy() - Convert pdev_id from |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 10034 | * host to target defines. For legacy there is not conversion |
| 10035 | * required. Just return pdev_id as it is. |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10036 | * @param pdev_id: host pdev_id to be converted. |
| 10037 | * Return: target pdev_id after conversion. |
| 10038 | */ |
| 10039 | static uint32_t convert_host_pdev_id_to_target_pdev_id_legacy( |
| 10040 | uint32_t pdev_id) |
| 10041 | { |
| 10042 | if (pdev_id == WMI_HOST_PDEV_ID_SOC) |
| 10043 | return WMI_PDEV_ID_SOC; |
| 10044 | |
| 10045 | /*No conversion required*/ |
| 10046 | return pdev_id; |
| 10047 | } |
| 10048 | |
| 10049 | /** |
| 10050 | * convert_target_pdev_id_to_host_pdev_id_legacy() - Convert pdev_id from |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 10051 | * target to host defines. For legacy there is not conversion |
| 10052 | * required. Just return pdev_id as it is. |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10053 | * @param pdev_id: target pdev_id to be converted. |
| 10054 | * Return: host pdev_id after conversion. |
| 10055 | */ |
| 10056 | static uint32_t convert_target_pdev_id_to_host_pdev_id_legacy( |
| 10057 | uint32_t pdev_id) |
| 10058 | { |
| 10059 | /*No conversion required*/ |
| 10060 | return pdev_id; |
| 10061 | } |
| 10062 | |
| 10063 | /** |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 10064 | * send_set_country_cmd_tlv() - WMI scan channel list function |
| 10065 | * @param wmi_handle : handle to WMI. |
| 10066 | * @param param : pointer to hold scan channel list parameter |
| 10067 | * |
| 10068 | * Return: 0 on success and -ve on failure. |
| 10069 | */ |
| 10070 | static QDF_STATUS send_set_country_cmd_tlv(wmi_unified_t wmi_handle, |
| 10071 | struct set_country *params) |
| 10072 | { |
| 10073 | wmi_buf_t buf; |
| 10074 | QDF_STATUS qdf_status; |
| 10075 | wmi_set_current_country_cmd_fixed_param *cmd; |
| 10076 | uint16_t len = sizeof(*cmd); |
| 10077 | |
| 10078 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10079 | if (!buf) { |
| 10080 | WMI_LOGE("Failed to allocate memory"); |
| 10081 | qdf_status = QDF_STATUS_E_NOMEM; |
| 10082 | goto end; |
| 10083 | } |
| 10084 | |
| 10085 | cmd = (wmi_set_current_country_cmd_fixed_param *)wmi_buf_data(buf); |
| 10086 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10087 | WMITLV_TAG_STRUC_wmi_set_current_country_cmd_fixed_param, |
| 10088 | WMITLV_GET_STRUCT_TLVLEN |
| 10089 | (wmi_set_current_country_cmd_fixed_param)); |
| 10090 | |
| 10091 | WMI_LOGD("setting cuurnet country to %s", params->country); |
| 10092 | |
| 10093 | qdf_mem_copy((uint8_t *)&cmd->new_alpha2, params->country, 3); |
| 10094 | |
| 10095 | cmd->pdev_id = params->pdev_id; |
| 10096 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 10097 | wmi_mtrace(WMI_SET_CURRENT_COUNTRY_CMDID, NO_SESSION, 0); |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 10098 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 10099 | buf, len, WMI_SET_CURRENT_COUNTRY_CMDID); |
| 10100 | |
| 10101 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 10102 | WMI_LOGE("Failed to send WMI_SET_CURRENT_COUNTRY_CMDID"); |
| 10103 | wmi_buf_free(buf); |
| 10104 | } |
| 10105 | |
| 10106 | end: |
| 10107 | return qdf_status; |
| 10108 | } |
| 10109 | |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 10110 | #define WMI_REG_COUNTRY_ALPHA_SET(alpha, val0, val1, val2) do { \ |
Abhijit Pradhan | d38a269 | 2017-06-29 12:32:20 +0530 | [diff] [blame] | 10111 | WMI_SET_BITS(alpha, 0, 8, val0); \ |
| 10112 | WMI_SET_BITS(alpha, 8, 8, val1); \ |
| 10113 | WMI_SET_BITS(alpha, 16, 8, val2); \ |
| 10114 | } while (0) |
| 10115 | |
| 10116 | static QDF_STATUS send_user_country_code_cmd_tlv(wmi_unified_t wmi_handle, |
| 10117 | uint8_t pdev_id, struct cc_regdmn_s *rd) |
| 10118 | { |
| 10119 | wmi_set_init_country_cmd_fixed_param *cmd; |
| 10120 | uint16_t len; |
| 10121 | wmi_buf_t buf; |
| 10122 | int ret; |
| 10123 | |
| 10124 | len = sizeof(wmi_set_init_country_cmd_fixed_param); |
| 10125 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10126 | if (!buf) { |
| 10127 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 10128 | return QDF_STATUS_E_NOMEM; |
| 10129 | } |
| 10130 | cmd = (wmi_set_init_country_cmd_fixed_param *) wmi_buf_data(buf); |
| 10131 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10132 | WMITLV_TAG_STRUC_wmi_set_init_country_cmd_fixed_param, |
| 10133 | WMITLV_GET_STRUCT_TLVLEN |
| 10134 | (wmi_set_init_country_cmd_fixed_param)); |
| 10135 | |
| 10136 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
| 10137 | |
| 10138 | if (rd->flags == CC_IS_SET) { |
| 10139 | cmd->countrycode_type = WMI_COUNTRYCODE_COUNTRY_ID; |
| 10140 | cmd->country_code.country_id = rd->cc.country_code; |
| 10141 | } else if (rd->flags == ALPHA_IS_SET) { |
| 10142 | cmd->countrycode_type = WMI_COUNTRYCODE_ALPHA2; |
| 10143 | WMI_REG_COUNTRY_ALPHA_SET(cmd->country_code.alpha2, |
| 10144 | rd->cc.alpha[0], |
| 10145 | rd->cc.alpha[1], |
| 10146 | rd->cc.alpha[2]); |
| 10147 | } else if (rd->flags == REGDMN_IS_SET) { |
| 10148 | cmd->countrycode_type = WMI_COUNTRYCODE_DOMAIN_CODE; |
| 10149 | cmd->country_code.domain_code = rd->cc.regdmn_id; |
| 10150 | } |
| 10151 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 10152 | wmi_mtrace(WMI_SET_INIT_COUNTRY_CMDID, NO_SESSION, 0); |
Abhijit Pradhan | d38a269 | 2017-06-29 12:32:20 +0530 | [diff] [blame] | 10153 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10154 | WMI_SET_INIT_COUNTRY_CMDID); |
| 10155 | if (ret) { |
| 10156 | WMI_LOGE("Failed to config wow wakeup event"); |
| 10157 | wmi_buf_free(buf); |
| 10158 | return QDF_STATUS_E_FAILURE; |
| 10159 | } |
| 10160 | |
| 10161 | return QDF_STATUS_SUCCESS; |
| 10162 | } |
| 10163 | |
Ganesh Kondabattini | 40252f5 | 2017-07-10 11:54:11 +0530 | [diff] [blame] | 10164 | /** |
Arif Hussain | c5bfe07 | 2017-12-27 16:23:45 -0800 | [diff] [blame] | 10165 | * send_obss_detection_cfg_cmd_tlv() - send obss detection |
| 10166 | * configurations to firmware. |
| 10167 | * @wmi_handle: wmi handle |
| 10168 | * @obss_cfg_param: obss detection configurations |
| 10169 | * |
| 10170 | * Send WMI_SAP_OBSS_DETECTION_CFG_CMDID parameters to fw. |
| 10171 | * |
| 10172 | * Return: QDF_STATUS |
| 10173 | */ |
| 10174 | static QDF_STATUS send_obss_detection_cfg_cmd_tlv(wmi_unified_t wmi_handle, |
| 10175 | struct wmi_obss_detection_cfg_param *obss_cfg_param) |
| 10176 | { |
| 10177 | wmi_buf_t buf; |
| 10178 | wmi_sap_obss_detection_cfg_cmd_fixed_param *cmd; |
| 10179 | uint8_t len = sizeof(wmi_sap_obss_detection_cfg_cmd_fixed_param); |
| 10180 | |
| 10181 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10182 | if (!buf) { |
| 10183 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 10184 | return QDF_STATUS_E_NOMEM; |
| 10185 | } |
| 10186 | |
| 10187 | cmd = (wmi_sap_obss_detection_cfg_cmd_fixed_param *)wmi_buf_data(buf); |
| 10188 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10189 | WMITLV_TAG_STRUC_wmi_sap_obss_detection_cfg_cmd_fixed_param, |
| 10190 | WMITLV_GET_STRUCT_TLVLEN |
| 10191 | (wmi_sap_obss_detection_cfg_cmd_fixed_param)); |
| 10192 | |
| 10193 | cmd->vdev_id = obss_cfg_param->vdev_id; |
| 10194 | cmd->detect_period_ms = obss_cfg_param->obss_detect_period_ms; |
| 10195 | cmd->b_ap_detect_mode = obss_cfg_param->obss_11b_ap_detect_mode; |
| 10196 | cmd->b_sta_detect_mode = obss_cfg_param->obss_11b_sta_detect_mode; |
| 10197 | cmd->g_ap_detect_mode = obss_cfg_param->obss_11g_ap_detect_mode; |
| 10198 | cmd->a_detect_mode = obss_cfg_param->obss_11a_detect_mode; |
| 10199 | cmd->ht_legacy_detect_mode = obss_cfg_param->obss_ht_legacy_detect_mode; |
| 10200 | cmd->ht_mixed_detect_mode = obss_cfg_param->obss_ht_mixed_detect_mode; |
| 10201 | cmd->ht_20mhz_detect_mode = obss_cfg_param->obss_ht_20mhz_detect_mode; |
Arif Hussain | c5bfe07 | 2017-12-27 16:23:45 -0800 | [diff] [blame] | 10202 | |
Ashish Kumar Dhanotiya | 942a786 | 2018-08-02 21:36:29 +0530 | [diff] [blame] | 10203 | wmi_mtrace(WMI_SAP_OBSS_DETECTION_CFG_CMDID, cmd->vdev_id, 0); |
Arif Hussain | c5bfe07 | 2017-12-27 16:23:45 -0800 | [diff] [blame] | 10204 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10205 | WMI_SAP_OBSS_DETECTION_CFG_CMDID)) { |
| 10206 | WMI_LOGE("Failed to send WMI_SAP_OBSS_DETECTION_CFG_CMDID"); |
| 10207 | wmi_buf_free(buf); |
| 10208 | return QDF_STATUS_E_FAILURE; |
| 10209 | } |
| 10210 | |
yeshwanth sriram guntuka | 07a15b8 | 2017-09-01 17:56:07 +0530 | [diff] [blame] | 10211 | return QDF_STATUS_SUCCESS; |
| 10212 | } |
| 10213 | |
Arif Hussain | 33d9850 | 2018-01-12 13:15:04 -0800 | [diff] [blame] | 10214 | /** |
| 10215 | * extract_obss_detection_info_tlv() - Extract obss detection info |
| 10216 | * received from firmware. |
| 10217 | * @evt_buf: pointer to event buffer |
| 10218 | * @obss_detection: Pointer to hold obss detection info |
| 10219 | * |
| 10220 | * Return: QDF_STATUS |
| 10221 | */ |
| 10222 | static QDF_STATUS extract_obss_detection_info_tlv(uint8_t *evt_buf, |
| 10223 | struct wmi_obss_detect_info |
| 10224 | *obss_detection) |
| 10225 | { |
| 10226 | WMI_SAP_OBSS_DETECTION_REPORT_EVENTID_param_tlvs *param_buf; |
| 10227 | wmi_sap_obss_detection_info_evt_fixed_param *fix_param; |
| 10228 | |
| 10229 | if (!obss_detection) { |
| 10230 | WMI_LOGE("%s: Invalid obss_detection event buffer", __func__); |
| 10231 | return QDF_STATUS_E_INVAL; |
| 10232 | } |
| 10233 | |
| 10234 | param_buf = (WMI_SAP_OBSS_DETECTION_REPORT_EVENTID_param_tlvs *)evt_buf; |
| 10235 | if (!param_buf) { |
| 10236 | WMI_LOGE("%s: Invalid evt_buf", __func__); |
| 10237 | return QDF_STATUS_E_INVAL; |
| 10238 | } |
| 10239 | |
| 10240 | fix_param = param_buf->fixed_param; |
| 10241 | obss_detection->vdev_id = fix_param->vdev_id; |
| 10242 | obss_detection->matched_detection_masks = |
| 10243 | fix_param->matched_detection_masks; |
| 10244 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&fix_param->matched_bssid_addr, |
| 10245 | &obss_detection->matched_bssid_addr[0]); |
| 10246 | switch (fix_param->reason) { |
| 10247 | case WMI_SAP_OBSS_DETECTION_EVENT_REASON_NOT_SUPPORT: |
| 10248 | obss_detection->reason = OBSS_OFFLOAD_DETECTION_DISABLED; |
| 10249 | break; |
| 10250 | case WMI_SAP_OBSS_DETECTION_EVENT_REASON_PRESENT_NOTIFY: |
| 10251 | obss_detection->reason = OBSS_OFFLOAD_DETECTION_PRESENT; |
| 10252 | break; |
| 10253 | case WMI_SAP_OBSS_DETECTION_EVENT_REASON_ABSENT_TIMEOUT: |
| 10254 | obss_detection->reason = OBSS_OFFLOAD_DETECTION_ABSENT; |
| 10255 | break; |
| 10256 | default: |
| 10257 | WMI_LOGE("%s: Invalid reason %d", __func__, fix_param->reason); |
| 10258 | return QDF_STATUS_E_INVAL; |
| 10259 | } |
| 10260 | |
| 10261 | return QDF_STATUS_SUCCESS; |
| 10262 | } |
| 10263 | |
Vignesh Viswanathan | 7f05777 | 2018-01-18 19:06:40 +0530 | [diff] [blame] | 10264 | /** |
Rajeev Kumar Sirasanagandla | d2d1a5e | 2018-03-02 21:12:16 +0530 | [diff] [blame] | 10265 | * send_roam_scan_stats_cmd_tlv() - Send roam scan stats req command to fw |
| 10266 | * @wmi_handle: wmi handle |
| 10267 | * @params: pointer to request structure |
| 10268 | * |
| 10269 | * Return: QDF_STATUS |
| 10270 | */ |
| 10271 | static QDF_STATUS |
| 10272 | send_roam_scan_stats_cmd_tlv(wmi_unified_t wmi_handle, |
| 10273 | struct wmi_roam_scan_stats_req *params) |
| 10274 | { |
| 10275 | wmi_buf_t buf; |
| 10276 | wmi_request_roam_scan_stats_cmd_fixed_param *cmd; |
| 10277 | WMITLV_TAG_ID tag; |
| 10278 | uint32_t size; |
| 10279 | uint32_t len = sizeof(*cmd); |
| 10280 | |
| 10281 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10282 | if (!buf) { |
| 10283 | WMI_LOGE(FL("Failed to allocate wmi buffer")); |
| 10284 | return QDF_STATUS_E_FAILURE; |
| 10285 | } |
| 10286 | |
| 10287 | cmd = (wmi_request_roam_scan_stats_cmd_fixed_param *)wmi_buf_data(buf); |
| 10288 | |
| 10289 | tag = WMITLV_TAG_STRUC_wmi_request_roam_scan_stats_cmd_fixed_param; |
| 10290 | size = WMITLV_GET_STRUCT_TLVLEN( |
| 10291 | wmi_request_roam_scan_stats_cmd_fixed_param); |
| 10292 | WMITLV_SET_HDR(&cmd->tlv_header, tag, size); |
| 10293 | |
| 10294 | cmd->vdev_id = params->vdev_id; |
| 10295 | |
| 10296 | WMI_LOGD(FL("Roam Scan Stats Req vdev_id: %u"), cmd->vdev_id); |
| 10297 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10298 | WMI_REQUEST_ROAM_SCAN_STATS_CMDID)) { |
| 10299 | WMI_LOGE("%s: Failed to send WMI_REQUEST_ROAM_SCAN_STATS_CMDID", |
| 10300 | __func__); |
| 10301 | wmi_buf_free(buf); |
| 10302 | return QDF_STATUS_E_FAILURE; |
| 10303 | } |
| 10304 | |
| 10305 | return QDF_STATUS_SUCCESS; |
| 10306 | } |
| 10307 | |
| 10308 | /** |
| 10309 | * extract_roam_scan_stats_res_evt_tlv() - Extract roam scan stats event |
| 10310 | * @wmi_handle: wmi handle |
| 10311 | * @evt_buf: pointer to event buffer |
| 10312 | * @vdev_id: output pointer to hold vdev id |
| 10313 | * @res_param: output pointer to hold the allocated response |
| 10314 | * |
| 10315 | * Return: QDF_STATUS |
| 10316 | */ |
| 10317 | static QDF_STATUS |
| 10318 | extract_roam_scan_stats_res_evt_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
| 10319 | uint32_t *vdev_id, |
| 10320 | struct wmi_roam_scan_stats_res **res_param) |
| 10321 | { |
| 10322 | WMI_ROAM_SCAN_STATS_EVENTID_param_tlvs *param_buf; |
| 10323 | wmi_roam_scan_stats_event_fixed_param *fixed_param; |
| 10324 | uint32_t *client_id = NULL; |
| 10325 | wmi_roaming_timestamp *timestamp = NULL; |
| 10326 | uint32_t *num_channels = NULL; |
| 10327 | uint32_t *chan_info = NULL; |
| 10328 | wmi_mac_addr *old_bssid = NULL; |
| 10329 | uint32_t *is_roaming_success = NULL; |
| 10330 | wmi_mac_addr *new_bssid = NULL; |
| 10331 | uint32_t *num_roam_candidates = NULL; |
| 10332 | wmi_roam_scan_trigger_reason *roam_reason = NULL; |
| 10333 | wmi_mac_addr *bssid = NULL; |
| 10334 | uint32_t *score = NULL; |
| 10335 | uint32_t *channel = NULL; |
| 10336 | uint32_t *rssi = NULL; |
| 10337 | int chan_idx = 0, cand_idx = 0; |
| 10338 | uint32_t total_len; |
| 10339 | struct wmi_roam_scan_stats_res *res; |
| 10340 | uint32_t i, j; |
| 10341 | uint32_t num_scans; |
| 10342 | |
| 10343 | *res_param = NULL; |
| 10344 | *vdev_id = 0xFF; /* Initialize to invalid vdev id */ |
| 10345 | param_buf = (WMI_ROAM_SCAN_STATS_EVENTID_param_tlvs *)evt_buf; |
| 10346 | if (!param_buf) { |
| 10347 | WMI_LOGE(FL("Invalid roam scan stats event")); |
| 10348 | return QDF_STATUS_E_INVAL; |
| 10349 | } |
| 10350 | |
| 10351 | fixed_param = param_buf->fixed_param; |
| 10352 | total_len = sizeof(*res) + fixed_param->num_roam_scans * |
| 10353 | sizeof(struct wmi_roam_scan_stats_params); |
| 10354 | |
| 10355 | *vdev_id = fixed_param->vdev_id; |
| 10356 | num_scans = fixed_param->num_roam_scans; |
| 10357 | |
| 10358 | res = qdf_mem_malloc(total_len); |
| 10359 | if (!res) { |
| 10360 | WMI_LOGE("Failed to allocate roam scan stats response memory"); |
| 10361 | return QDF_STATUS_E_NOMEM; |
| 10362 | } |
| 10363 | |
| 10364 | if (!num_scans) { |
| 10365 | *res_param = res; |
| 10366 | return QDF_STATUS_SUCCESS; |
| 10367 | } |
| 10368 | |
| 10369 | if (param_buf->client_id && |
| 10370 | param_buf->num_client_id == num_scans) |
| 10371 | client_id = param_buf->client_id; |
| 10372 | |
| 10373 | if (param_buf->timestamp && |
| 10374 | param_buf->num_timestamp == num_scans) |
| 10375 | timestamp = param_buf->timestamp; |
| 10376 | |
| 10377 | if (param_buf->old_bssid && |
| 10378 | param_buf->num_old_bssid == num_scans) |
| 10379 | old_bssid = param_buf->old_bssid; |
| 10380 | |
| 10381 | if (param_buf->new_bssid && |
| 10382 | param_buf->num_new_bssid == num_scans) |
| 10383 | new_bssid = param_buf->new_bssid; |
| 10384 | |
| 10385 | if (param_buf->is_roaming_success && |
| 10386 | param_buf->num_is_roaming_success == num_scans) |
| 10387 | is_roaming_success = param_buf->is_roaming_success; |
| 10388 | |
| 10389 | if (param_buf->roam_reason && |
| 10390 | param_buf->num_roam_reason == num_scans) |
| 10391 | roam_reason = param_buf->roam_reason; |
| 10392 | |
| 10393 | if (param_buf->num_channels && |
| 10394 | param_buf->num_num_channels == num_scans) { |
| 10395 | uint32_t count, chan_info_sum = 0; |
| 10396 | |
| 10397 | num_channels = param_buf->num_channels; |
| 10398 | for (count = 0; count < param_buf->num_num_channels; count++) |
| 10399 | chan_info_sum += param_buf->num_channels[count]; |
| 10400 | |
| 10401 | if (param_buf->chan_info && |
| 10402 | param_buf->num_chan_info == chan_info_sum) |
| 10403 | chan_info = param_buf->chan_info; |
| 10404 | } |
| 10405 | |
| 10406 | if (param_buf->num_roam_candidates && |
| 10407 | param_buf->num_num_roam_candidates == num_scans) { |
| 10408 | uint32_t count, roam_cand_sum = 0; |
| 10409 | |
| 10410 | num_roam_candidates = param_buf->num_roam_candidates; |
| 10411 | for (count = 0; count < param_buf->num_num_roam_candidates; |
| 10412 | count++) |
| 10413 | roam_cand_sum += param_buf->num_roam_candidates[count]; |
| 10414 | |
| 10415 | if (param_buf->bssid && |
| 10416 | param_buf->num_bssid == roam_cand_sum) |
| 10417 | bssid = param_buf->bssid; |
| 10418 | |
| 10419 | if (param_buf->score && |
| 10420 | param_buf->num_score == roam_cand_sum) |
| 10421 | score = param_buf->score; |
| 10422 | |
| 10423 | if (param_buf->channel && |
| 10424 | param_buf->num_channel == roam_cand_sum) |
| 10425 | channel = param_buf->channel; |
| 10426 | |
| 10427 | if (param_buf->rssi && |
| 10428 | param_buf->num_rssi == roam_cand_sum) |
| 10429 | rssi = param_buf->rssi; |
| 10430 | } |
| 10431 | |
| 10432 | res->num_roam_scans = num_scans; |
| 10433 | for (i = 0; i < num_scans; i++) { |
| 10434 | struct wmi_roam_scan_stats_params *roam = &res->roam_scan[i]; |
| 10435 | |
| 10436 | if (timestamp) |
| 10437 | roam->time_stamp = timestamp[i].lower32bit | |
| 10438 | (timestamp[i].upper32bit << 31); |
| 10439 | |
| 10440 | if (client_id) |
| 10441 | roam->client_id = client_id[i]; |
| 10442 | |
| 10443 | if (num_channels) { |
| 10444 | roam->num_scan_chans = num_channels[i]; |
| 10445 | if (chan_info) { |
| 10446 | for (j = 0; j < num_channels[i]; j++) |
| 10447 | roam->scan_freqs[j] = |
| 10448 | chan_info[chan_idx++]; |
| 10449 | } |
| 10450 | } |
| 10451 | |
| 10452 | if (is_roaming_success) |
| 10453 | roam->is_roam_successful = is_roaming_success[i]; |
| 10454 | |
| 10455 | if (roam_reason) { |
| 10456 | roam->trigger_id = roam_reason[i].trigger_id; |
| 10457 | roam->trigger_value = roam_reason[i].trigger_value; |
| 10458 | } |
| 10459 | |
| 10460 | if (num_roam_candidates) { |
| 10461 | roam->num_roam_candidates = num_roam_candidates[i]; |
| 10462 | |
| 10463 | for (j = 0; j < num_roam_candidates[i]; j++) { |
| 10464 | if (score) |
| 10465 | roam->cand[j].score = score[cand_idx]; |
| 10466 | if (rssi) |
| 10467 | roam->cand[j].rssi = rssi[cand_idx]; |
| 10468 | if (channel) |
| 10469 | roam->cand[j].freq = |
| 10470 | channel[cand_idx]; |
| 10471 | |
| 10472 | if (bssid) |
| 10473 | WMI_MAC_ADDR_TO_CHAR_ARRAY( |
| 10474 | &bssid[cand_idx], |
| 10475 | roam->cand[j].bssid); |
| 10476 | |
| 10477 | cand_idx++; |
| 10478 | } |
| 10479 | } |
| 10480 | |
| 10481 | if (old_bssid) |
| 10482 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&old_bssid[i], |
| 10483 | roam->old_bssid); |
| 10484 | |
| 10485 | if (new_bssid) |
| 10486 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&new_bssid[i], |
| 10487 | roam->new_bssid); |
| 10488 | } |
| 10489 | |
| 10490 | *res_param = res; |
| 10491 | |
| 10492 | return QDF_STATUS_SUCCESS; |
| 10493 | } |
| 10494 | |
| 10495 | /** |
Gyanranjan Hazarika | ff074e9 | 2018-10-04 11:26:20 -0700 | [diff] [blame] | 10496 | * extract_offload_bcn_tx_status_evt() - Extract beacon-tx status event |
| 10497 | * @wmi_handle: wmi handle |
| 10498 | * @evt_buf: pointer to event buffer |
| 10499 | * @vdev_id: output pointer to hold vdev id |
| 10500 | * @tx_status: output pointer to hold the tx_status |
| 10501 | * |
| 10502 | * Return: QDF_STATUS |
| 10503 | */ |
| 10504 | static QDF_STATUS extract_offload_bcn_tx_status_evt(wmi_unified_t wmi_handle, |
| 10505 | void *evt_buf, |
| 10506 | uint32_t *vdev_id, |
| 10507 | uint32_t *tx_status) { |
| 10508 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID_param_tlvs *param_buf; |
| 10509 | wmi_offload_bcn_tx_status_event_fixed_param *bcn_tx_status_event; |
| 10510 | |
| 10511 | param_buf = (WMI_OFFLOAD_BCN_TX_STATUS_EVENTID_param_tlvs *)evt_buf; |
| 10512 | if (!param_buf) { |
| 10513 | WMI_LOGE("Invalid offload bcn tx status event buffer"); |
| 10514 | return QDF_STATUS_E_INVAL; |
| 10515 | } |
| 10516 | |
| 10517 | bcn_tx_status_event = param_buf->fixed_param; |
| 10518 | *vdev_id = bcn_tx_status_event->vdev_id; |
| 10519 | *tx_status = bcn_tx_status_event->tx_status; |
| 10520 | |
| 10521 | return QDF_STATUS_SUCCESS; |
| 10522 | } |
| 10523 | |
Himanshu Agarwal | 157e478 | 2018-01-24 22:24:17 +0530 | [diff] [blame] | 10524 | #ifdef WLAN_SUPPORT_GREEN_AP |
| 10525 | static QDF_STATUS extract_green_ap_egap_status_info_tlv( |
| 10526 | uint8_t *evt_buf, |
| 10527 | struct wlan_green_ap_egap_status_info *egap_status_info_params) |
| 10528 | { |
| 10529 | WMI_AP_PS_EGAP_INFO_EVENTID_param_tlvs *param_buf; |
| 10530 | wmi_ap_ps_egap_info_event_fixed_param *egap_info_event; |
| 10531 | wmi_ap_ps_egap_info_chainmask_list *chainmask_event; |
| 10532 | |
| 10533 | param_buf = (WMI_AP_PS_EGAP_INFO_EVENTID_param_tlvs *)evt_buf; |
| 10534 | if (!param_buf) { |
| 10535 | WMI_LOGE("Invalid EGAP Info status event buffer"); |
| 10536 | return QDF_STATUS_E_INVAL; |
| 10537 | } |
| 10538 | |
| 10539 | egap_info_event = (wmi_ap_ps_egap_info_event_fixed_param *) |
| 10540 | param_buf->fixed_param; |
| 10541 | chainmask_event = (wmi_ap_ps_egap_info_chainmask_list *) |
| 10542 | param_buf->chainmask_list; |
| 10543 | |
Ashish Kumar Dhanotiya | a90d811 | 2018-10-17 16:45:54 +0530 | [diff] [blame^] | 10544 | if (!egap_info_event || !chainmask_event) { |
| 10545 | WMI_LOGE("Invalid EGAP Info event or chainmask event"); |
| 10546 | return QDF_STATUS_E_INVAL; |
| 10547 | } |
| 10548 | |
Himanshu Agarwal | 157e478 | 2018-01-24 22:24:17 +0530 | [diff] [blame] | 10549 | egap_status_info_params->status = egap_info_event->status; |
| 10550 | egap_status_info_params->mac_id = chainmask_event->mac_id; |
| 10551 | egap_status_info_params->tx_chainmask = chainmask_event->tx_chainmask; |
| 10552 | egap_status_info_params->rx_chainmask = chainmask_event->rx_chainmask; |
| 10553 | |
| 10554 | return QDF_STATUS_SUCCESS; |
| 10555 | } |
| 10556 | #endif |
| 10557 | |
Arif Hussain | ec5cd3c | 2018-01-22 01:19:36 -0800 | [diff] [blame] | 10558 | /* |
Arif Hussain | e0eb730 | 2018-03-01 14:40:59 -0800 | [diff] [blame] | 10559 | * extract_comb_phyerr_tlv() - extract comb phy error from event |
| 10560 | * @wmi_handle: wmi handle |
| 10561 | * @evt_buf: pointer to event buffer |
| 10562 | * @datalen: data length of event buffer |
| 10563 | * @buf_offset: Pointer to hold value of current event buffer offset |
| 10564 | * post extraction |
| 10565 | * @phyerr: Pointer to hold phyerr |
| 10566 | * |
| 10567 | * Return: QDF_STATUS |
| 10568 | */ |
| 10569 | static QDF_STATUS extract_comb_phyerr_tlv(wmi_unified_t wmi_handle, |
| 10570 | void *evt_buf, |
| 10571 | uint16_t datalen, |
| 10572 | uint16_t *buf_offset, |
| 10573 | wmi_host_phyerr_t *phyerr) |
| 10574 | { |
| 10575 | WMI_PHYERR_EVENTID_param_tlvs *param_tlvs; |
| 10576 | wmi_comb_phyerr_rx_hdr *pe_hdr; |
| 10577 | |
| 10578 | param_tlvs = (WMI_PHYERR_EVENTID_param_tlvs *)evt_buf; |
| 10579 | if (!param_tlvs) { |
| 10580 | WMI_LOGD("%s: Received null data from FW", __func__); |
| 10581 | return QDF_STATUS_E_FAILURE; |
| 10582 | } |
| 10583 | |
| 10584 | pe_hdr = param_tlvs->hdr; |
| 10585 | if (!pe_hdr) { |
| 10586 | WMI_LOGD("%s: Received Data PE Header is NULL", __func__); |
| 10587 | return QDF_STATUS_E_FAILURE; |
| 10588 | } |
| 10589 | |
| 10590 | /* Ensure it's at least the size of the header */ |
| 10591 | if (datalen < sizeof(*pe_hdr)) { |
| 10592 | WMI_LOGD("%s: Expected minimum size %zu, received %d", |
| 10593 | __func__, sizeof(*pe_hdr), datalen); |
| 10594 | return QDF_STATUS_E_FAILURE; |
| 10595 | } |
| 10596 | |
| 10597 | phyerr->pdev_id = wmi_handle->ops-> |
| 10598 | convert_pdev_id_target_to_host(pe_hdr->pdev_id); |
| 10599 | phyerr->tsf64 = pe_hdr->tsf_l32; |
| 10600 | phyerr->tsf64 |= (((uint64_t)pe_hdr->tsf_u32) << 32); |
| 10601 | phyerr->bufp = param_tlvs->bufp; |
Yeshwanth Sriram Guntuka | 19e51be | 2018-09-25 15:40:08 +0530 | [diff] [blame] | 10602 | |
| 10603 | if (pe_hdr->buf_len > param_tlvs->num_bufp) { |
| 10604 | WMI_LOGD("Invalid buf_len %d, num_bufp %d", |
| 10605 | pe_hdr->buf_len, param_tlvs->num_bufp); |
| 10606 | return QDF_STATUS_E_FAILURE; |
| 10607 | } |
| 10608 | |
Arif Hussain | e0eb730 | 2018-03-01 14:40:59 -0800 | [diff] [blame] | 10609 | phyerr->buf_len = pe_hdr->buf_len; |
| 10610 | phyerr->phy_err_mask0 = pe_hdr->rsPhyErrMask0; |
| 10611 | phyerr->phy_err_mask1 = pe_hdr->rsPhyErrMask1; |
| 10612 | *buf_offset = sizeof(*pe_hdr) + sizeof(uint32_t); |
| 10613 | |
| 10614 | return QDF_STATUS_SUCCESS; |
| 10615 | } |
| 10616 | |
| 10617 | /** |
| 10618 | * extract_single_phyerr_tlv() - extract single phy error from event |
| 10619 | * @wmi_handle: wmi handle |
| 10620 | * @evt_buf: pointer to event buffer |
| 10621 | * @datalen: data length of event buffer |
| 10622 | * @buf_offset: Pointer to hold value of current event buffer offset |
| 10623 | * post extraction |
| 10624 | * @phyerr: Pointer to hold phyerr |
| 10625 | * |
| 10626 | * Return: QDF_STATUS |
| 10627 | */ |
| 10628 | static QDF_STATUS extract_single_phyerr_tlv(wmi_unified_t wmi_handle, |
| 10629 | void *evt_buf, |
| 10630 | uint16_t datalen, |
| 10631 | uint16_t *buf_offset, |
| 10632 | wmi_host_phyerr_t *phyerr) |
| 10633 | { |
| 10634 | wmi_single_phyerr_rx_event *ev; |
| 10635 | uint16_t n = *buf_offset; |
| 10636 | uint8_t *data = (uint8_t *)evt_buf; |
| 10637 | |
| 10638 | if (n < datalen) { |
| 10639 | if ((datalen - n) < sizeof(ev->hdr)) { |
| 10640 | WMI_LOGD("%s: Not enough space. len=%d, n=%d, hdr=%zu", |
| 10641 | __func__, datalen, n, sizeof(ev->hdr)); |
| 10642 | return QDF_STATUS_E_FAILURE; |
| 10643 | } |
| 10644 | |
| 10645 | /* |
| 10646 | * Obtain a pointer to the beginning of the current event. |
| 10647 | * data[0] is the beginning of the WMI payload. |
| 10648 | */ |
| 10649 | ev = (wmi_single_phyerr_rx_event *)&data[n]; |
| 10650 | |
| 10651 | /* |
| 10652 | * Sanity check the buffer length of the event against |
| 10653 | * what we currently have. |
| 10654 | * |
| 10655 | * Since buf_len is 32 bits, we check if it overflows |
| 10656 | * a large 32 bit value. It's not 0x7fffffff because |
| 10657 | * we increase n by (buf_len + sizeof(hdr)), which would |
| 10658 | * in itself cause n to overflow. |
| 10659 | * |
| 10660 | * If "int" is 64 bits then this becomes a moot point. |
| 10661 | */ |
| 10662 | if (ev->hdr.buf_len > PHYERROR_MAX_BUFFER_LENGTH) { |
| 10663 | WMI_LOGD("%s: buf_len is garbage 0x%x", |
| 10664 | __func__, ev->hdr.buf_len); |
| 10665 | return QDF_STATUS_E_FAILURE; |
| 10666 | } |
| 10667 | |
| 10668 | if ((n + ev->hdr.buf_len) > datalen) { |
| 10669 | WMI_LOGD("%s: len exceeds n=%d, buf_len=%d, datalen=%d", |
| 10670 | __func__, n, ev->hdr.buf_len, datalen); |
| 10671 | return QDF_STATUS_E_FAILURE; |
| 10672 | } |
| 10673 | |
| 10674 | phyerr->phy_err_code = WMI_UNIFIED_PHYERRCODE_GET(&ev->hdr); |
| 10675 | phyerr->tsf_timestamp = ev->hdr.tsf_timestamp; |
| 10676 | phyerr->bufp = &ev->bufp[0]; |
| 10677 | phyerr->buf_len = ev->hdr.buf_len; |
| 10678 | phyerr->rf_info.rssi_comb = WMI_UNIFIED_RSSI_COMB_GET(&ev->hdr); |
| 10679 | |
| 10680 | /* |
| 10681 | * Advance the buffer pointer to the next PHY error. |
| 10682 | * buflen is the length of this payload, so we need to |
| 10683 | * advance past the current header _AND_ the payload. |
| 10684 | */ |
| 10685 | n += sizeof(*ev) + ev->hdr.buf_len; |
| 10686 | } |
| 10687 | *buf_offset = n; |
| 10688 | |
| 10689 | return QDF_STATUS_SUCCESS; |
| 10690 | } |
| 10691 | |
Subrat Mishra | a667b1c | 2018-08-02 15:02:04 +0530 | [diff] [blame] | 10692 | /** |
| 10693 | * extract_esp_estimation_ev_param_tlv() - extract air time from event |
| 10694 | * @wmi_handle: wmi handle |
| 10695 | * @evt_buf: pointer to event buffer |
| 10696 | * @param: Pointer to hold esp event |
| 10697 | * |
| 10698 | * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_INVAL on failure |
| 10699 | */ |
| 10700 | static QDF_STATUS |
| 10701 | extract_esp_estimation_ev_param_tlv(wmi_unified_t wmi_handle, |
| 10702 | void *evt_buf, |
| 10703 | struct esp_estimation_event *param) |
| 10704 | { |
| 10705 | WMI_ESP_ESTIMATE_EVENTID_param_tlvs *param_buf; |
| 10706 | wmi_esp_estimate_event_fixed_param *esp_event; |
| 10707 | |
| 10708 | param_buf = (WMI_ESP_ESTIMATE_EVENTID_param_tlvs *)evt_buf; |
| 10709 | if (!param_buf) { |
| 10710 | WMI_LOGE("Invalid ESP Estimate Event buffer"); |
| 10711 | return QDF_STATUS_E_INVAL; |
| 10712 | } |
| 10713 | esp_event = param_buf->fixed_param; |
| 10714 | param->ac_airtime_percentage = esp_event->ac_airtime_percentage; |
| 10715 | param->pdev_id = convert_target_pdev_id_to_host_pdev_id( |
| 10716 | esp_event->pdev_id); |
| 10717 | |
| 10718 | return QDF_STATUS_SUCCESS; |
| 10719 | } |
| 10720 | |
Qiwei Cai | 3d26b2e | 2018-09-17 19:17:13 +0800 | [diff] [blame] | 10721 | /* |
| 10722 | * send_bss_color_change_enable_cmd_tlv() - Send command to enable or disable of |
| 10723 | * updating bss color change within firmware when AP announces bss color change. |
| 10724 | * @wmi_handle: wmi handle |
| 10725 | * @vdev_id: vdev ID |
| 10726 | * @enable: enable bss color change within firmware |
| 10727 | * |
| 10728 | * Send WMI_BSS_COLOR_CHANGE_ENABLE_CMDID parameters to fw. |
| 10729 | * |
| 10730 | * Return: QDF_STATUS |
| 10731 | */ |
| 10732 | static QDF_STATUS send_bss_color_change_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 10733 | uint32_t vdev_id, |
| 10734 | bool enable) |
| 10735 | { |
| 10736 | wmi_buf_t buf; |
| 10737 | wmi_bss_color_change_enable_fixed_param *cmd; |
| 10738 | uint8_t len = sizeof(wmi_bss_color_change_enable_fixed_param); |
| 10739 | |
| 10740 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10741 | if (!buf) { |
| 10742 | return QDF_STATUS_E_NOMEM; |
| 10743 | } |
| 10744 | |
| 10745 | cmd = (wmi_bss_color_change_enable_fixed_param *)wmi_buf_data(buf); |
| 10746 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10747 | WMITLV_TAG_STRUC_wmi_bss_color_change_enable_fixed_param, |
| 10748 | WMITLV_GET_STRUCT_TLVLEN |
| 10749 | (wmi_bss_color_change_enable_fixed_param)); |
| 10750 | cmd->vdev_id = vdev_id; |
| 10751 | cmd->enable = enable; |
| 10752 | wmi_mtrace(WMI_BSS_COLOR_CHANGE_ENABLE_CMDID, cmd->vdev_id, 0); |
| 10753 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10754 | WMI_BSS_COLOR_CHANGE_ENABLE_CMDID)) { |
| 10755 | WMI_LOGE("Failed to send WMI_BSS_COLOR_CHANGE_ENABLE_CMDID"); |
| 10756 | wmi_buf_free(buf); |
| 10757 | return QDF_STATUS_E_FAILURE; |
| 10758 | } |
| 10759 | |
| 10760 | return QDF_STATUS_SUCCESS; |
| 10761 | } |
| 10762 | |
| 10763 | /** |
| 10764 | * send_obss_color_collision_cfg_cmd_tlv() - send bss color detection |
| 10765 | * configurations to firmware. |
| 10766 | * @wmi_handle: wmi handle |
| 10767 | * @cfg_param: obss detection configurations |
| 10768 | * |
| 10769 | * Send WMI_OBSS_COLOR_COLLISION_DET_CONFIG_CMDID parameters to fw. |
| 10770 | * |
| 10771 | * Return: QDF_STATUS |
| 10772 | */ |
| 10773 | static QDF_STATUS send_obss_color_collision_cfg_cmd_tlv( |
| 10774 | wmi_unified_t wmi_handle, |
| 10775 | struct wmi_obss_color_collision_cfg_param *cfg_param) |
| 10776 | { |
| 10777 | wmi_buf_t buf; |
| 10778 | wmi_obss_color_collision_det_config_fixed_param *cmd; |
| 10779 | uint8_t len = sizeof(wmi_obss_color_collision_det_config_fixed_param); |
| 10780 | |
| 10781 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10782 | if (!buf) { |
| 10783 | return QDF_STATUS_E_NOMEM; |
| 10784 | } |
| 10785 | |
| 10786 | cmd = (wmi_obss_color_collision_det_config_fixed_param *)wmi_buf_data( |
| 10787 | buf); |
| 10788 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10789 | WMITLV_TAG_STRUC_wmi_obss_color_collision_det_config_fixed_param, |
| 10790 | WMITLV_GET_STRUCT_TLVLEN |
| 10791 | (wmi_obss_color_collision_det_config_fixed_param)); |
| 10792 | cmd->vdev_id = cfg_param->vdev_id; |
| 10793 | cmd->flags = cfg_param->flags; |
| 10794 | cmd->current_bss_color = cfg_param->current_bss_color; |
| 10795 | cmd->detection_period_ms = cfg_param->detection_period_ms; |
| 10796 | cmd->scan_period_ms = cfg_param->scan_period_ms; |
| 10797 | cmd->free_slot_expiry_time_ms = cfg_param->free_slot_expiry_time_ms; |
| 10798 | |
| 10799 | switch (cfg_param->evt_type) { |
| 10800 | case OBSS_COLOR_COLLISION_DETECTION_DISABLE: |
| 10801 | cmd->evt_type = WMI_BSS_COLOR_COLLISION_DISABLE; |
| 10802 | break; |
| 10803 | case OBSS_COLOR_COLLISION_DETECTION: |
| 10804 | cmd->evt_type = WMI_BSS_COLOR_COLLISION_DETECTION; |
| 10805 | break; |
| 10806 | case OBSS_COLOR_FREE_SLOT_TIMER_EXPIRY: |
| 10807 | cmd->evt_type = WMI_BSS_COLOR_FREE_SLOT_TIMER_EXPIRY; |
| 10808 | break; |
| 10809 | case OBSS_COLOR_FREE_SLOT_AVAILABLE: |
| 10810 | cmd->evt_type = WMI_BSS_COLOR_FREE_SLOT_AVAILABLE; |
| 10811 | break; |
| 10812 | default: |
| 10813 | WMI_LOGE("%s: invalid event type: %d", |
| 10814 | __func__, cfg_param->evt_type); |
| 10815 | wmi_buf_free(buf); |
| 10816 | return QDF_STATUS_E_FAILURE; |
| 10817 | } |
| 10818 | |
| 10819 | WMI_LOGD("%s: evt_type: %d vdev id: %d current_bss_color: %d\n" |
| 10820 | "detection_period_ms: %d scan_period_ms: %d\n" |
| 10821 | "free_slot_expiry_timer_ms: %d", |
| 10822 | __func__, cmd->evt_type, cmd->vdev_id, cmd->current_bss_color, |
| 10823 | cmd->detection_period_ms, cmd->scan_period_ms, |
| 10824 | cmd->free_slot_expiry_time_ms); |
| 10825 | |
| 10826 | wmi_mtrace(WMI_OBSS_COLOR_COLLISION_DET_CONFIG_CMDID, cmd->vdev_id, 0); |
| 10827 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10828 | WMI_OBSS_COLOR_COLLISION_DET_CONFIG_CMDID)) { |
| 10829 | WMI_LOGE("%s: Sending OBSS color det cmd failed, vdev_id: %d", |
| 10830 | __func__, cfg_param->vdev_id); |
| 10831 | wmi_buf_free(buf); |
| 10832 | return QDF_STATUS_E_FAILURE; |
| 10833 | } |
| 10834 | |
| 10835 | return QDF_STATUS_SUCCESS; |
| 10836 | } |
| 10837 | |
| 10838 | /** |
| 10839 | * extract_obss_color_collision_info_tlv() - Extract bss color collision info |
| 10840 | * received from firmware. |
| 10841 | * @evt_buf: pointer to event buffer |
| 10842 | * @info: Pointer to hold bss collision info |
| 10843 | * |
| 10844 | * Return: QDF_STATUS |
| 10845 | */ |
| 10846 | static QDF_STATUS extract_obss_color_collision_info_tlv(uint8_t *evt_buf, |
| 10847 | struct wmi_obss_color_collision_info *info) |
| 10848 | { |
| 10849 | WMI_OBSS_COLOR_COLLISION_DETECTION_EVENTID_param_tlvs *param_buf; |
| 10850 | wmi_obss_color_collision_evt_fixed_param *fix_param; |
| 10851 | |
| 10852 | if (!info) { |
| 10853 | WMI_LOGE("%s: Invalid obss color buffer", __func__); |
| 10854 | return QDF_STATUS_E_INVAL; |
| 10855 | } |
| 10856 | |
| 10857 | param_buf = (WMI_OBSS_COLOR_COLLISION_DETECTION_EVENTID_param_tlvs *) |
| 10858 | evt_buf; |
| 10859 | if (!param_buf) { |
| 10860 | WMI_LOGE("%s: Invalid evt_buf", __func__); |
| 10861 | return QDF_STATUS_E_INVAL; |
| 10862 | } |
| 10863 | |
| 10864 | fix_param = param_buf->fixed_param; |
| 10865 | info->vdev_id = fix_param->vdev_id; |
| 10866 | info->obss_color_bitmap_bit0to31 = |
| 10867 | fix_param->bss_color_bitmap_bit0to31; |
| 10868 | info->obss_color_bitmap_bit32to63 = |
| 10869 | fix_param->bss_color_bitmap_bit32to63; |
| 10870 | |
| 10871 | switch (fix_param->evt_type) { |
| 10872 | case WMI_BSS_COLOR_COLLISION_DISABLE: |
| 10873 | info->evt_type = OBSS_COLOR_COLLISION_DETECTION_DISABLE; |
| 10874 | break; |
| 10875 | case WMI_BSS_COLOR_COLLISION_DETECTION: |
| 10876 | info->evt_type = OBSS_COLOR_COLLISION_DETECTION; |
| 10877 | break; |
| 10878 | case WMI_BSS_COLOR_FREE_SLOT_TIMER_EXPIRY: |
| 10879 | info->evt_type = OBSS_COLOR_FREE_SLOT_TIMER_EXPIRY; |
| 10880 | break; |
| 10881 | case WMI_BSS_COLOR_FREE_SLOT_AVAILABLE: |
| 10882 | info->evt_type = OBSS_COLOR_FREE_SLOT_AVAILABLE; |
| 10883 | break; |
| 10884 | default: |
| 10885 | WMI_LOGE("%s: invalid event type: %d, vdev_id: %d", |
| 10886 | __func__, fix_param->evt_type, fix_param->vdev_id); |
| 10887 | return QDF_STATUS_E_FAILURE; |
| 10888 | } |
| 10889 | |
| 10890 | return QDF_STATUS_SUCCESS; |
| 10891 | } |
| 10892 | |
| 10893 | static void wmi_11ax_bss_color_attach_tlv(struct wmi_unified *wmi_handle) |
| 10894 | { |
| 10895 | struct wmi_ops *ops = wmi_handle->ops; |
| 10896 | |
| 10897 | ops->send_obss_color_collision_cfg_cmd = |
| 10898 | send_obss_color_collision_cfg_cmd_tlv; |
| 10899 | ops->extract_obss_color_collision_info = |
| 10900 | extract_obss_color_collision_info_tlv; |
| 10901 | } |
| 10902 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 10903 | struct wmi_ops tlv_ops = { |
| 10904 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 10905 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 10906 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 10907 | .send_vdev_start_cmd = send_vdev_start_cmd_tlv, |
| 10908 | .send_hidden_ssid_vdev_restart_cmd = |
| 10909 | send_hidden_ssid_vdev_restart_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 10910 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 10911 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 10912 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 10913 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 10914 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 10915 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 10916 | .send_peer_rx_reorder_queue_setup_cmd = |
| 10917 | send_peer_rx_reorder_queue_setup_cmd_tlv, |
| 10918 | .send_peer_rx_reorder_queue_remove_cmd = |
| 10919 | send_peer_rx_reorder_queue_remove_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 10920 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 10921 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
| 10922 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 10923 | .send_resume_cmd = send_resume_cmd_tlv, |
| 10924 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 10925 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 10926 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 10927 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
Wen Gong | ca17401 | 2018-04-20 16:56:28 +0800 | [diff] [blame] | 10928 | #ifdef FEATURE_FW_LOG_PARSING |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 10929 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
Wen Gong | ca17401 | 2018-04-20 16:56:28 +0800 | [diff] [blame] | 10930 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 10931 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 10932 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 10933 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
gaurank kathpalia | cdfb445 | 2018-02-21 18:58:29 +0530 | [diff] [blame] | 10934 | .send_time_stamp_sync_cmd = send_time_stamp_sync_cmd_tlv, |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 10935 | .send_packet_log_disable_cmd = send_packet_log_disable_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10936 | .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 10937 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 10938 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 10939 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 10940 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 10941 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 10942 | .send_offchan_data_tx_cmd = send_offchan_data_tx_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 10943 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 10944 | .send_set_sta_ps_mode_cmd = send_set_sta_ps_mode_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 10945 | .send_set_sta_uapsd_auto_trig_cmd = |
| 10946 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 10947 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 10948 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 10949 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 10950 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 10951 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 10952 | .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 10953 | .send_probe_rsp_tmpl_send_cmd = |
| 10954 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 10955 | .send_p2p_go_set_beacon_ie_cmd = |
| 10956 | send_p2p_go_set_beacon_ie_cmd_tlv, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 10957 | .send_setup_install_key_cmd = |
| 10958 | send_setup_install_key_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 10959 | .send_scan_probe_setoui_cmd = |
| 10960 | send_scan_probe_setoui_cmd_tlv, |
Sravan Kumar Kairam | 963cad9 | 2018-02-15 23:28:34 +0530 | [diff] [blame] | 10961 | #ifdef IPA_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 10962 | .send_ipa_offload_control_cmd = |
| 10963 | send_ipa_offload_control_cmd_tlv, |
Sravan Kumar Kairam | 963cad9 | 2018-02-15 23:28:34 +0530 | [diff] [blame] | 10964 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 10965 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
| 10966 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 10967 | .send_nlo_mawc_cmd = send_nlo_mawc_cmd_tlv, |
Qiwei Cai | 1ccba22 | 2018-05-21 16:49:39 +0800 | [diff] [blame] | 10968 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 10969 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 10970 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 10971 | .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, |
Qiwei Cai | 1ccba22 | 2018-05-21 16:49:39 +0800 | [diff] [blame] | 10972 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS*/ |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 10973 | .send_congestion_cmd = send_congestion_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10974 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 10975 | .send_snr_cmd = send_snr_cmd_tlv, |
| 10976 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 10977 | #ifdef CONFIG_MCL |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10978 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
Nirav Shah | 66932f7 | 2018-05-17 16:58:12 +0530 | [diff] [blame] | 10979 | #ifndef REMOVE_PKT_LOG |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10980 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
Nirav Shah | 66932f7 | 2018-05-17 16:58:12 +0530 | [diff] [blame] | 10981 | #endif |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10982 | #endif |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 10983 | #ifdef WLAN_SUPPORT_GREEN_AP |
| 10984 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
| 10985 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
Himanshu Agarwal | 157e478 | 2018-01-24 22:24:17 +0530 | [diff] [blame] | 10986 | .extract_green_ap_egap_status_info = |
| 10987 | extract_green_ap_egap_status_info_tlv, |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 10988 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10989 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10990 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
Naveen Rawat | 42cd1e6 | 2017-05-13 15:56:57 -0700 | [diff] [blame] | 10991 | #ifdef WLAN_FEATURE_CIF_CFR |
| 10992 | .send_oem_dma_cfg_cmd = send_oem_dma_cfg_cmd_tlv, |
| 10993 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10994 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 10995 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10996 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10997 | .send_process_dhcpserver_offload_cmd = |
| 10998 | send_process_dhcpserver_offload_cmd_tlv, |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 10999 | .send_pdev_set_regdomain_cmd = |
| 11000 | send_pdev_set_regdomain_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 11001 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11002 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11003 | .check_and_update_fw_version = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11004 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11005 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 11006 | .send_enable_specific_fw_logs_cmd = |
| 11007 | send_enable_specific_fw_logs_cmd_tlv, |
| 11008 | .send_flush_logs_to_fw_cmd = send_flush_logs_to_fw_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11009 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11010 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
Nachiket Kukade | e06beaa | 2018-05-25 14:52:55 +0530 | [diff] [blame] | 11011 | #ifdef FEATURE_WLAN_APF |
| 11012 | .send_set_active_apf_mode_cmd = wmi_send_set_active_apf_mode_cmd_tlv, |
| 11013 | .send_apf_enable_cmd = wmi_send_apf_enable_cmd_tlv, |
| 11014 | .send_apf_write_work_memory_cmd = |
| 11015 | wmi_send_apf_write_work_memory_cmd_tlv, |
| 11016 | .send_apf_read_work_memory_cmd = |
| 11017 | wmi_send_apf_read_work_memory_cmd_tlv, |
| 11018 | .extract_apf_read_memory_resp_event = |
| 11019 | wmi_extract_apf_read_memory_resp_event_tlv, |
| 11020 | #endif /* FEATURE_WLAN_APF */ |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11021 | .init_cmd_send = init_cmd_send_tlv, |
Sathish Kumar | 6011c74 | 2017-11-08 14:49:58 +0530 | [diff] [blame] | 11022 | .send_vdev_set_custom_aggr_size_cmd = |
| 11023 | send_vdev_set_custom_aggr_size_cmd_tlv, |
Venkateswara Swamy Bandaru | 9983ac5 | 2017-12-22 17:16:19 +0530 | [diff] [blame] | 11024 | .send_vdev_set_qdepth_thresh_cmd = |
| 11025 | send_vdev_set_qdepth_thresh_cmd_tlv, |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11026 | .send_set_vap_dscp_tid_map_cmd = send_set_vap_dscp_tid_map_cmd_tlv, |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11027 | .send_vdev_set_fwtest_param_cmd = send_vdev_set_fwtest_param_cmd_tlv, |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 11028 | .send_phyerr_disable_cmd = send_phyerr_disable_cmd_tlv, |
| 11029 | .send_phyerr_enable_cmd = send_phyerr_enable_cmd_tlv, |
Sathish Kumar | 0ff69e4 | 2017-11-02 10:44:39 +0530 | [diff] [blame] | 11030 | .send_periodic_chan_stats_config_cmd = |
| 11031 | send_periodic_chan_stats_config_cmd_tlv, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11032 | .send_vdev_spectral_configure_cmd = |
| 11033 | send_vdev_spectral_configure_cmd_tlv, |
| 11034 | .send_vdev_spectral_enable_cmd = |
| 11035 | send_vdev_spectral_enable_cmd_tlv, |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 11036 | .send_thermal_mitigation_param_cmd = |
| 11037 | send_thermal_mitigation_param_cmd_tlv, |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 11038 | .send_process_update_edca_param_cmd = |
| 11039 | send_process_update_edca_param_cmd_tlv, |
Qiwei Cai | 3d26b2e | 2018-09-17 19:17:13 +0800 | [diff] [blame] | 11040 | .send_bss_color_change_enable_cmd = |
| 11041 | send_bss_color_change_enable_cmd_tlv, |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 11042 | .send_coex_config_cmd = send_coex_config_cmd_tlv, |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 11043 | .send_set_country_cmd = send_set_country_cmd_tlv, |
Gyanranjan Hazarika | 3f3b471 | 2018-01-12 13:27:43 -0800 | [diff] [blame] | 11044 | .send_addba_send_cmd = send_addba_send_cmd_tlv, |
| 11045 | .send_delba_send_cmd = send_delba_send_cmd_tlv, |
Gyanranjan Hazarika | cd535f9 | 2018-01-17 19:29:45 -0800 | [diff] [blame] | 11046 | .send_addba_clearresponse_cmd = send_addba_clearresponse_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11047 | .get_target_cap_from_service_ready = extract_service_ready_tlv, |
| 11048 | .extract_hal_reg_cap = extract_hal_reg_cap_tlv, |
| 11049 | .extract_host_mem_req = extract_host_mem_req_tlv, |
| 11050 | .save_service_bitmap = save_service_bitmap_tlv, |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 11051 | .save_ext_service_bitmap = save_ext_service_bitmap_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11052 | .is_service_enabled = is_service_enabled_tlv, |
| 11053 | .save_fw_version = save_fw_version_in_service_ready_tlv, |
| 11054 | .ready_extract_init_status = ready_extract_init_status_tlv, |
| 11055 | .ready_extract_mac_addr = ready_extract_mac_addr_tlv, |
Manoj Ekbote | dd27390 | 2017-07-09 23:28:56 -0700 | [diff] [blame] | 11056 | .ready_extract_mac_addr_list = ready_extract_mac_addr_list_tlv, |
Kiran Venkatappa | 094c24f | 2017-11-10 20:50:12 +0530 | [diff] [blame] | 11057 | .extract_ready_event_params = extract_ready_event_params_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11058 | .extract_dbglog_data_len = extract_dbglog_data_len_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11059 | .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11060 | .extract_vdev_roam_param = extract_vdev_roam_param_tlv, |
| 11061 | .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11062 | .extract_all_stats_count = extract_all_stats_counts_tlv, |
| 11063 | .extract_pdev_stats = extract_pdev_stats_tlv, |
Adil Saeed Musthafa | d280596 | 2017-08-23 17:32:11 -0700 | [diff] [blame] | 11064 | .extract_unit_test = extract_unit_test_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11065 | .extract_pdev_ext_stats = extract_pdev_ext_stats_tlv, |
| 11066 | .extract_vdev_stats = extract_vdev_stats_tlv, |
Naveen Rawat | d211572 | 2018-04-12 08:17:55 -0700 | [diff] [blame] | 11067 | .extract_per_chain_rssi_stats = extract_per_chain_rssi_stats_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11068 | .extract_peer_stats = extract_peer_stats_tlv, |
Gurumoorthi Gnanasambandhan | b5fb836 | 2017-11-06 22:04:17 +0530 | [diff] [blame] | 11069 | .extract_bcn_stats = extract_bcn_stats_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11070 | .extract_bcnflt_stats = extract_bcnflt_stats_tlv, |
| 11071 | .extract_peer_extd_stats = extract_peer_extd_stats_tlv, |
| 11072 | .extract_chan_stats = extract_chan_stats_tlv, |
| 11073 | .extract_profile_ctx = extract_profile_ctx_tlv, |
| 11074 | .extract_profile_data = extract_profile_data_tlv, |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 11075 | .send_fw_test_cmd = send_fw_test_cmd_tlv, |
Govind Singh | 09523e2 | 2016-09-12 12:29:21 +0530 | [diff] [blame] | 11076 | .send_power_dbg_cmd = send_power_dbg_cmd_tlv, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 11077 | .extract_service_ready_ext = extract_service_ready_ext_tlv, |
| 11078 | .extract_hw_mode_cap_service_ready_ext = |
| 11079 | extract_hw_mode_cap_service_ready_ext_tlv, |
| 11080 | .extract_mac_phy_cap_service_ready_ext = |
| 11081 | extract_mac_phy_cap_service_ready_ext_tlv, |
| 11082 | .extract_reg_cap_service_ready_ext = |
| 11083 | extract_reg_cap_service_ready_ext_tlv, |
Sathish Kumar | f396c72 | 2017-11-17 17:30:41 +0530 | [diff] [blame] | 11084 | .extract_dbr_ring_cap_service_ready_ext = |
| 11085 | extract_dbr_ring_cap_service_ready_ext_tlv, |
Kabilan Kannan | 0d0f935 | 2018-06-21 16:55:47 -0700 | [diff] [blame] | 11086 | .extract_sar_cap_service_ready_ext = |
| 11087 | extract_sar_cap_service_ready_ext_tlv, |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 11088 | .extract_pdev_utf_event = extract_pdev_utf_event_tlv, |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 11089 | .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_tlv, |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 11090 | .extract_fips_event_data = extract_fips_event_data_tlv, |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 11091 | .send_pdev_fips_cmd = send_pdev_fips_cmd_tlv, |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 11092 | .is_management_record = is_management_record_tlv, |
Rajeev Kumar | b64e128 | 2018-09-19 13:02:23 -0700 | [diff] [blame] | 11093 | .is_diag_event = is_diag_event_tlv, |
Rajeev Kumar Sirasanagandla | daadf83 | 2017-09-18 16:47:52 +0530 | [diff] [blame] | 11094 | #ifdef WLAN_FEATURE_ACTION_OUI |
| 11095 | .send_action_oui_cmd = send_action_oui_cmd_tlv, |
| 11096 | #endif |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 11097 | .send_dfs_phyerr_offload_en_cmd = send_dfs_phyerr_offload_en_cmd_tlv, |
| 11098 | .send_dfs_phyerr_offload_dis_cmd = send_dfs_phyerr_offload_dis_cmd_tlv, |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 11099 | .extract_reg_chan_list_update_event = |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 11100 | extract_reg_chan_list_update_event_tlv, |
| 11101 | .extract_chainmask_tables = |
| 11102 | extract_chainmask_tables_tlv, |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 11103 | .extract_thermal_stats = extract_thermal_stats_tlv, |
| 11104 | .extract_thermal_level_stats = extract_thermal_level_stats_tlv, |
Rajeev Kumar Sirasanagandla | ab4275d | 2016-11-22 21:28:54 +0530 | [diff] [blame] | 11105 | .send_get_rcpi_cmd = send_get_rcpi_cmd_tlv, |
| 11106 | .extract_rcpi_response_event = extract_rcpi_response_event_tlv, |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 11107 | #ifdef DFS_COMPONENT_ENABLE |
| 11108 | .extract_dfs_cac_complete_event = extract_dfs_cac_complete_event_tlv, |
| 11109 | .extract_dfs_radar_detection_event = |
| 11110 | extract_dfs_radar_detection_event_tlv, |
bings | 1ea1253 | 2017-12-18 16:56:53 +0800 | [diff] [blame] | 11111 | .extract_wlan_radar_event_info = extract_wlan_radar_event_info_tlv, |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 11112 | #endif |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11113 | .convert_pdev_id_host_to_target = |
| 11114 | convert_host_pdev_id_to_target_pdev_id_legacy, |
| 11115 | .convert_pdev_id_target_to_host = |
| 11116 | convert_target_pdev_id_to_host_pdev_id_legacy, |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 11117 | |
| 11118 | .send_start_11d_scan_cmd = send_start_11d_scan_cmd_tlv, |
| 11119 | .send_stop_11d_scan_cmd = send_stop_11d_scan_cmd_tlv, |
| 11120 | .extract_reg_11d_new_country_event = |
| 11121 | extract_reg_11d_new_country_event_tlv, |
Abhijit Pradhan | d38a269 | 2017-06-29 12:32:20 +0530 | [diff] [blame] | 11122 | .send_user_country_code_cmd = send_user_country_code_cmd_tlv, |
Kiran Kumar Lokere | ec65bb4 | 2017-06-30 19:13:02 -0700 | [diff] [blame] | 11123 | .extract_reg_ch_avoid_event = |
| 11124 | extract_reg_ch_avoid_event_tlv, |
Arif Hussain | c5bfe07 | 2017-12-27 16:23:45 -0800 | [diff] [blame] | 11125 | .send_obss_detection_cfg_cmd = send_obss_detection_cfg_cmd_tlv, |
Arif Hussain | 33d9850 | 2018-01-12 13:15:04 -0800 | [diff] [blame] | 11126 | .extract_obss_detection_info = extract_obss_detection_info_tlv, |
Pratik Gandhi | 67da1bb | 2018-01-30 19:05:41 +0530 | [diff] [blame] | 11127 | .wmi_pdev_id_conversion_enable = wmi_tlv_pdev_id_conversion_enable, |
| 11128 | .wmi_free_allocated_event = wmitlv_free_allocated_event_tlvs, |
| 11129 | .wmi_check_and_pad_event = wmitlv_check_and_pad_event_tlvs, |
| 11130 | .wmi_check_command_params = wmitlv_check_command_tlv_params, |
Arif Hussain | e0eb730 | 2018-03-01 14:40:59 -0800 | [diff] [blame] | 11131 | .extract_comb_phyerr = extract_comb_phyerr_tlv, |
| 11132 | .extract_single_phyerr = extract_single_phyerr_tlv, |
Naveen Rawat | 963ee94 | 2018-04-13 16:38:36 -0700 | [diff] [blame] | 11133 | #ifdef QCA_SUPPORT_CP_STATS |
| 11134 | .extract_cca_stats = extract_cca_stats_tlv, |
| 11135 | #endif |
Subrat Mishra | a667b1c | 2018-08-02 15:02:04 +0530 | [diff] [blame] | 11136 | .extract_esp_estimation_ev_param = |
| 11137 | extract_esp_estimation_ev_param_tlv, |
Rajeev Kumar Sirasanagandla | d2d1a5e | 2018-03-02 21:12:16 +0530 | [diff] [blame] | 11138 | .send_roam_scan_stats_cmd = send_roam_scan_stats_cmd_tlv, |
| 11139 | .extract_roam_scan_stats_res_evt = extract_roam_scan_stats_res_evt_tlv, |
Pratik Gandhi | 3fd97d6 | 2018-09-17 16:47:12 +0530 | [diff] [blame] | 11140 | #ifdef OBSS_PD |
| 11141 | .send_obss_spatial_reuse_set = send_obss_spatial_reuse_set_cmd_tlv, |
| 11142 | #endif |
Gyanranjan Hazarika | ff074e9 | 2018-10-04 11:26:20 -0700 | [diff] [blame] | 11143 | .extract_offload_bcn_tx_status_evt = extract_offload_bcn_tx_status_evt, |
Alok Singh | 0243e7d | 2018-09-20 16:07:28 +0530 | [diff] [blame] | 11144 | .extract_ctl_failsafe_check_ev_param = |
| 11145 | extract_ctl_failsafe_check_ev_param_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 11146 | }; |
| 11147 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11148 | /** |
| 11149 | * populate_tlv_event_id() - populates wmi event ids |
| 11150 | * |
| 11151 | * @param event_ids: Pointer to hold event ids |
| 11152 | * Return: None |
| 11153 | */ |
| 11154 | static void populate_tlv_events_id(uint32_t *event_ids) |
| 11155 | { |
| 11156 | event_ids[wmi_service_ready_event_id] = WMI_SERVICE_READY_EVENTID; |
| 11157 | event_ids[wmi_ready_event_id] = WMI_READY_EVENTID; |
| 11158 | event_ids[wmi_scan_event_id] = WMI_SCAN_EVENTID; |
| 11159 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 11160 | event_ids[wmi_chan_info_event_id] = WMI_CHAN_INFO_EVENTID; |
| 11161 | event_ids[wmi_phyerr_event_id] = WMI_PHYERR_EVENTID; |
| 11162 | event_ids[wmi_pdev_dump_event_id] = WMI_PDEV_DUMP_EVENTID; |
| 11163 | event_ids[wmi_tx_pause_event_id] = WMI_TX_PAUSE_EVENTID; |
| 11164 | event_ids[wmi_dfs_radar_event_id] = WMI_DFS_RADAR_EVENTID; |
| 11165 | event_ids[wmi_pdev_l1ss_track_event_id] = WMI_PDEV_L1SS_TRACK_EVENTID; |
| 11166 | event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID; |
| 11167 | event_ids[wmi_service_ready_ext_event_id] = |
| 11168 | WMI_SERVICE_READY_EXT_EVENTID; |
| 11169 | event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID; |
| 11170 | event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID; |
| 11171 | event_ids[wmi_vdev_install_key_complete_event_id] = |
| 11172 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID; |
| 11173 | event_ids[wmi_vdev_mcc_bcn_intvl_change_req_event_id] = |
| 11174 | WMI_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID; |
| 11175 | |
| 11176 | event_ids[wmi_vdev_tsf_report_event_id] = WMI_VDEV_TSF_REPORT_EVENTID; |
| 11177 | event_ids[wmi_peer_sta_kickout_event_id] = WMI_PEER_STA_KICKOUT_EVENTID; |
| 11178 | event_ids[wmi_peer_info_event_id] = WMI_PEER_INFO_EVENTID; |
| 11179 | event_ids[wmi_peer_tx_fail_cnt_thr_event_id] = |
| 11180 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID; |
| 11181 | event_ids[wmi_peer_estimated_linkspeed_event_id] = |
| 11182 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID; |
| 11183 | event_ids[wmi_peer_state_event_id] = WMI_PEER_STATE_EVENTID; |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 11184 | event_ids[wmi_peer_delete_response_event_id] = |
| 11185 | WMI_PEER_DELETE_RESP_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11186 | event_ids[wmi_mgmt_rx_event_id] = WMI_MGMT_RX_EVENTID; |
| 11187 | event_ids[wmi_host_swba_event_id] = WMI_HOST_SWBA_EVENTID; |
| 11188 | event_ids[wmi_tbttoffset_update_event_id] = |
| 11189 | WMI_TBTTOFFSET_UPDATE_EVENTID; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 11190 | event_ids[wmi_ext_tbttoffset_update_event_id] = |
| 11191 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11192 | event_ids[wmi_offload_bcn_tx_status_event_id] = |
| 11193 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID; |
| 11194 | event_ids[wmi_offload_prob_resp_tx_status_event_id] = |
| 11195 | WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID; |
| 11196 | event_ids[wmi_mgmt_tx_completion_event_id] = |
| 11197 | WMI_MGMT_TX_COMPLETION_EVENTID; |
nobelj | f74583b | 2018-01-25 16:35:36 -0800 | [diff] [blame] | 11198 | event_ids[wmi_pdev_nfcal_power_all_channels_event_id] = |
| 11199 | WMI_PDEV_NFCAL_POWER_ALL_CHANNELS_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11200 | event_ids[wmi_tx_delba_complete_event_id] = |
| 11201 | WMI_TX_DELBA_COMPLETE_EVENTID; |
| 11202 | event_ids[wmi_tx_addba_complete_event_id] = |
| 11203 | WMI_TX_ADDBA_COMPLETE_EVENTID; |
| 11204 | event_ids[wmi_ba_rsp_ssn_event_id] = WMI_BA_RSP_SSN_EVENTID; |
| 11205 | |
| 11206 | event_ids[wmi_aggr_state_trig_event_id] = WMI_AGGR_STATE_TRIG_EVENTID; |
| 11207 | |
| 11208 | event_ids[wmi_roam_event_id] = WMI_ROAM_EVENTID; |
| 11209 | event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; |
| 11210 | |
| 11211 | event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; |
Padma, Santhosh Kumar | 9b21b05 | 2017-10-06 15:42:00 +0530 | [diff] [blame] | 11212 | event_ids[wmi_roam_synch_frame_event_id] = WMI_ROAM_SYNCH_FRAME_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11213 | |
| 11214 | event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; |
| 11215 | |
| 11216 | event_ids[wmi_p2p_noa_event_id] = WMI_P2P_NOA_EVENTID; |
Wu Gao | 84ed340 | 2017-03-15 19:12:20 +0800 | [diff] [blame] | 11217 | event_ids[wmi_p2p_lo_stop_event_id] = |
| 11218 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11219 | event_ids[wmi_pdev_resume_event_id] = WMI_PDEV_RESUME_EVENTID; |
| 11220 | event_ids[wmi_wow_wakeup_host_event_id] = WMI_WOW_WAKEUP_HOST_EVENTID; |
Will Huang | b661c4c | 2017-12-19 10:10:05 +0800 | [diff] [blame] | 11221 | event_ids[wmi_d0_wow_disable_ack_event_id] = |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11222 | WMI_D0_WOW_DISABLE_ACK_EVENTID; |
| 11223 | event_ids[wmi_wow_initial_wakeup_event_id] = |
| 11224 | WMI_WOW_INITIAL_WAKEUP_EVENTID; |
| 11225 | |
| 11226 | event_ids[wmi_rtt_meas_report_event_id] = |
| 11227 | WMI_RTT_MEASUREMENT_REPORT_EVENTID; |
| 11228 | event_ids[wmi_tsf_meas_report_event_id] = |
| 11229 | WMI_TSF_MEASUREMENT_REPORT_EVENTID; |
| 11230 | event_ids[wmi_rtt_error_report_event_id] = WMI_RTT_ERROR_REPORT_EVENTID; |
| 11231 | event_ids[wmi_stats_ext_event_id] = WMI_STATS_EXT_EVENTID; |
| 11232 | event_ids[wmi_iface_link_stats_event_id] = WMI_IFACE_LINK_STATS_EVENTID; |
| 11233 | event_ids[wmi_peer_link_stats_event_id] = WMI_PEER_LINK_STATS_EVENTID; |
| 11234 | event_ids[wmi_radio_link_stats_link] = WMI_RADIO_LINK_STATS_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11235 | event_ids[wmi_diag_event_id_log_supported_event_id] = |
| 11236 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID; |
| 11237 | event_ids[wmi_nlo_match_event_id] = WMI_NLO_MATCH_EVENTID; |
| 11238 | event_ids[wmi_nlo_scan_complete_event_id] = |
| 11239 | WMI_NLO_SCAN_COMPLETE_EVENTID; |
| 11240 | event_ids[wmi_apfind_event_id] = WMI_APFIND_EVENTID; |
| 11241 | event_ids[wmi_passpoint_match_event_id] = WMI_PASSPOINT_MATCH_EVENTID; |
| 11242 | |
| 11243 | event_ids[wmi_gtk_offload_status_event_id] = |
| 11244 | WMI_GTK_OFFLOAD_STATUS_EVENTID; |
| 11245 | event_ids[wmi_gtk_rekey_fail_event_id] = WMI_GTK_REKEY_FAIL_EVENTID; |
| 11246 | event_ids[wmi_csa_handling_event_id] = WMI_CSA_HANDLING_EVENTID; |
| 11247 | event_ids[wmi_chatter_pc_query_event_id] = WMI_CHATTER_PC_QUERY_EVENTID; |
| 11248 | |
| 11249 | event_ids[wmi_echo_event_id] = WMI_ECHO_EVENTID; |
| 11250 | |
| 11251 | event_ids[wmi_pdev_utf_event_id] = WMI_PDEV_UTF_EVENTID; |
| 11252 | |
| 11253 | event_ids[wmi_dbg_msg_event_id] = WMI_DEBUG_MESG_EVENTID; |
| 11254 | event_ids[wmi_update_stats_event_id] = WMI_UPDATE_STATS_EVENTID; |
| 11255 | event_ids[wmi_debug_print_event_id] = WMI_DEBUG_PRINT_EVENTID; |
| 11256 | event_ids[wmi_dcs_interference_event_id] = WMI_DCS_INTERFERENCE_EVENTID; |
| 11257 | event_ids[wmi_pdev_qvit_event_id] = WMI_PDEV_QVIT_EVENTID; |
| 11258 | event_ids[wmi_wlan_profile_data_event_id] = |
| 11259 | WMI_WLAN_PROFILE_DATA_EVENTID; |
| 11260 | event_ids[wmi_pdev_ftm_intg_event_id] = WMI_PDEV_FTM_INTG_EVENTID; |
| 11261 | event_ids[wmi_wlan_freq_avoid_event_id] = WMI_WLAN_FREQ_AVOID_EVENTID; |
| 11262 | event_ids[wmi_vdev_get_keepalive_event_id] = |
| 11263 | WMI_VDEV_GET_KEEPALIVE_EVENTID; |
| 11264 | event_ids[wmi_thermal_mgmt_event_id] = WMI_THERMAL_MGMT_EVENTID; |
| 11265 | |
| 11266 | event_ids[wmi_diag_container_event_id] = |
| 11267 | WMI_DIAG_DATA_CONTAINER_EVENTID; |
| 11268 | |
| 11269 | event_ids[wmi_host_auto_shutdown_event_id] = |
| 11270 | WMI_HOST_AUTO_SHUTDOWN_EVENTID; |
| 11271 | |
| 11272 | event_ids[wmi_update_whal_mib_stats_event_id] = |
| 11273 | WMI_UPDATE_WHAL_MIB_STATS_EVENTID; |
| 11274 | |
| 11275 | /*update ht/vht info based on vdev (rx and tx NSS and preamble) */ |
| 11276 | event_ids[wmi_update_vdev_rate_stats_event_id] = |
| 11277 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID; |
| 11278 | |
| 11279 | event_ids[wmi_diag_event_id] = WMI_DIAG_EVENTID; |
Adil Saeed Musthafa | d280596 | 2017-08-23 17:32:11 -0700 | [diff] [blame] | 11280 | event_ids[wmi_unit_test_event_id] = WMI_UNIT_TEST_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11281 | |
| 11282 | /** Set OCB Sched Response, deprecated */ |
| 11283 | event_ids[wmi_ocb_set_sched_event_id] = WMI_OCB_SET_SCHED_EVENTID; |
| 11284 | |
| 11285 | event_ids[wmi_dbg_mesg_flush_complete_event_id] = |
| 11286 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID; |
| 11287 | event_ids[wmi_rssi_breach_event_id] = WMI_RSSI_BREACH_EVENTID; |
| 11288 | |
| 11289 | /* GPIO Event */ |
| 11290 | event_ids[wmi_gpio_input_event_id] = WMI_GPIO_INPUT_EVENTID; |
| 11291 | event_ids[wmi_uploadh_event_id] = WMI_UPLOADH_EVENTID; |
| 11292 | |
| 11293 | event_ids[wmi_captureh_event_id] = WMI_CAPTUREH_EVENTID; |
| 11294 | event_ids[wmi_rfkill_state_change_event_id] = |
| 11295 | WMI_RFKILL_STATE_CHANGE_EVENTID; |
| 11296 | |
| 11297 | /* TDLS Event */ |
| 11298 | event_ids[wmi_tdls_peer_event_id] = WMI_TDLS_PEER_EVENTID; |
| 11299 | |
| 11300 | event_ids[wmi_batch_scan_enabled_event_id] = |
| 11301 | WMI_BATCH_SCAN_ENABLED_EVENTID; |
| 11302 | event_ids[wmi_batch_scan_result_event_id] = |
| 11303 | WMI_BATCH_SCAN_RESULT_EVENTID; |
| 11304 | /* OEM Event */ |
| 11305 | event_ids[wmi_oem_cap_event_id] = WMI_OEM_CAPABILITY_EVENTID; |
| 11306 | event_ids[wmi_oem_meas_report_event_id] = |
| 11307 | WMI_OEM_MEASUREMENT_REPORT_EVENTID; |
| 11308 | event_ids[wmi_oem_report_event_id] = WMI_OEM_ERROR_REPORT_EVENTID; |
| 11309 | |
| 11310 | /* NAN Event */ |
| 11311 | event_ids[wmi_nan_event_id] = WMI_NAN_EVENTID; |
| 11312 | |
| 11313 | /* LPI Event */ |
| 11314 | event_ids[wmi_lpi_result_event_id] = WMI_LPI_RESULT_EVENTID; |
| 11315 | event_ids[wmi_lpi_status_event_id] = WMI_LPI_STATUS_EVENTID; |
| 11316 | event_ids[wmi_lpi_handoff_event_id] = WMI_LPI_HANDOFF_EVENTID; |
| 11317 | |
| 11318 | /* ExtScan events */ |
| 11319 | event_ids[wmi_extscan_start_stop_event_id] = |
| 11320 | WMI_EXTSCAN_START_STOP_EVENTID; |
| 11321 | event_ids[wmi_extscan_operation_event_id] = |
| 11322 | WMI_EXTSCAN_OPERATION_EVENTID; |
| 11323 | event_ids[wmi_extscan_table_usage_event_id] = |
| 11324 | WMI_EXTSCAN_TABLE_USAGE_EVENTID; |
| 11325 | event_ids[wmi_extscan_cached_results_event_id] = |
| 11326 | WMI_EXTSCAN_CACHED_RESULTS_EVENTID; |
| 11327 | event_ids[wmi_extscan_wlan_change_results_event_id] = |
| 11328 | WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID; |
| 11329 | event_ids[wmi_extscan_hotlist_match_event_id] = |
| 11330 | WMI_EXTSCAN_HOTLIST_MATCH_EVENTID; |
| 11331 | event_ids[wmi_extscan_capabilities_event_id] = |
| 11332 | WMI_EXTSCAN_CAPABILITIES_EVENTID; |
| 11333 | event_ids[wmi_extscan_hotlist_ssid_match_event_id] = |
| 11334 | WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID; |
| 11335 | |
| 11336 | /* mDNS offload events */ |
| 11337 | event_ids[wmi_mdns_stats_event_id] = WMI_MDNS_STATS_EVENTID; |
| 11338 | |
| 11339 | /* SAP Authentication offload events */ |
| 11340 | event_ids[wmi_sap_ofl_add_sta_event_id] = WMI_SAP_OFL_ADD_STA_EVENTID; |
| 11341 | event_ids[wmi_sap_ofl_del_sta_event_id] = WMI_SAP_OFL_DEL_STA_EVENTID; |
| 11342 | |
| 11343 | /** Out-of-context-of-bss (OCB) events */ |
| 11344 | event_ids[wmi_ocb_set_config_resp_event_id] = |
| 11345 | WMI_OCB_SET_CONFIG_RESP_EVENTID; |
| 11346 | event_ids[wmi_ocb_get_tsf_timer_resp_event_id] = |
| 11347 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID; |
| 11348 | event_ids[wmi_dcc_get_stats_resp_event_id] = |
| 11349 | WMI_DCC_GET_STATS_RESP_EVENTID; |
| 11350 | event_ids[wmi_dcc_update_ndl_resp_event_id] = |
| 11351 | WMI_DCC_UPDATE_NDL_RESP_EVENTID; |
| 11352 | event_ids[wmi_dcc_stats_event_id] = WMI_DCC_STATS_EVENTID; |
| 11353 | /* System-On-Chip events */ |
| 11354 | event_ids[wmi_soc_set_hw_mode_resp_event_id] = |
| 11355 | WMI_SOC_SET_HW_MODE_RESP_EVENTID; |
| 11356 | event_ids[wmi_soc_hw_mode_transition_event_id] = |
| 11357 | WMI_SOC_HW_MODE_TRANSITION_EVENTID; |
| 11358 | event_ids[wmi_soc_set_dual_mac_config_resp_event_id] = |
| 11359 | WMI_SOC_SET_DUAL_MAC_CONFIG_RESP_EVENTID; |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 11360 | event_ids[wmi_pdev_fips_event_id] = WMI_PDEV_FIPS_EVENTID; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 11361 | event_ids[wmi_pdev_csa_switch_count_status_event_id] = |
| 11362 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID; |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 11363 | event_ids[wmi_reg_chan_list_cc_event_id] = WMI_REG_CHAN_LIST_CC_EVENTID; |
Sathish Kumar | f91f5a9 | 2017-03-22 15:37:26 +0530 | [diff] [blame] | 11364 | event_ids[wmi_inst_rssi_stats_event_id] = WMI_INST_RSSI_STATS_EVENTID; |
| 11365 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 11366 | event_ids[wmi_peer_sta_ps_statechg_event_id] = |
| 11367 | WMI_PEER_STA_PS_STATECHG_EVENTID; |
| 11368 | event_ids[wmi_pdev_channel_hopping_event_id] = |
| 11369 | WMI_PDEV_CHANNEL_HOPPING_EVENTID; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 11370 | event_ids[wmi_offchan_data_tx_completion_event] = |
| 11371 | WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID; |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 11372 | event_ids[wmi_dfs_cac_complete_id] = WMI_VDEV_DFS_CAC_COMPLETE_EVENTID; |
| 11373 | event_ids[wmi_dfs_radar_detection_event_id] = |
| 11374 | WMI_PDEV_DFS_RADAR_DETECTION_EVENTID; |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 11375 | event_ids[wmi_tt_stats_event_id] = WMI_THERM_THROT_STATS_EVENTID; |
Amar Singhal | 7db15c8 | 2017-05-19 16:39:34 -0700 | [diff] [blame] | 11376 | event_ids[wmi_11d_new_country_event_id] = WMI_11D_NEW_COUNTRY_EVENTID; |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 11377 | event_ids[wmi_pdev_tpc_event_id] = WMI_PDEV_TPC_EVENTID; |
Anurag Chouhan | 97f0042 | 2017-09-11 14:56:30 +0530 | [diff] [blame] | 11378 | event_ids[wmi_get_arp_stats_req_id] = WMI_VDEV_GET_ARP_STAT_EVENTID; |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 11379 | event_ids[wmi_service_available_event_id] = |
| 11380 | WMI_SERVICE_AVAILABLE_EVENTID; |
Rajeev Kumar Sirasanagandla | ab4275d | 2016-11-22 21:28:54 +0530 | [diff] [blame] | 11381 | event_ids[wmi_update_rcpi_event_id] = WMI_UPDATE_RCPI_EVENTID; |
Balamurugan Mahalingam | f209829 | 2017-10-26 15:14:57 +0530 | [diff] [blame] | 11382 | event_ids[wmi_pdev_check_cal_version_event_id] = WMI_PDEV_CHECK_CAL_VERSION_EVENTID; |
Mukul Sharma | 2c66f7e | 2017-11-03 19:26:54 +0530 | [diff] [blame] | 11383 | /* NDP events */ |
| 11384 | event_ids[wmi_ndp_initiator_rsp_event_id] = |
| 11385 | WMI_NDP_INITIATOR_RSP_EVENTID; |
| 11386 | event_ids[wmi_ndp_indication_event_id] = WMI_NDP_INDICATION_EVENTID; |
| 11387 | event_ids[wmi_ndp_confirm_event_id] = WMI_NDP_CONFIRM_EVENTID; |
| 11388 | event_ids[wmi_ndp_responder_rsp_event_id] = |
| 11389 | WMI_NDP_RESPONDER_RSP_EVENTID; |
| 11390 | event_ids[wmi_ndp_end_indication_event_id] = |
| 11391 | WMI_NDP_END_INDICATION_EVENTID; |
| 11392 | event_ids[wmi_ndp_end_rsp_event_id] = WMI_NDP_END_RSP_EVENTID; |
Naveen Rawat | d42ce38 | 2018-01-09 17:54:41 -0800 | [diff] [blame] | 11393 | event_ids[wmi_ndl_schedule_update_event_id] = |
| 11394 | WMI_NDL_SCHEDULE_UPDATE_EVENTID; |
Mukul Sharma | 2c66f7e | 2017-11-03 19:26:54 +0530 | [diff] [blame] | 11395 | |
| 11396 | event_ids[wmi_oem_response_event_id] = WMI_OEM_RESPONSE_EVENTID; |
| 11397 | event_ids[wmi_peer_stats_info_event_id] = WMI_PEER_STATS_INFO_EVENTID; |
| 11398 | event_ids[wmi_pdev_chip_power_stats_event_id] = |
| 11399 | WMI_PDEV_CHIP_POWER_STATS_EVENTID; |
| 11400 | event_ids[wmi_ap_ps_egap_info_event_id] = WMI_AP_PS_EGAP_INFO_EVENTID; |
| 11401 | event_ids[wmi_peer_assoc_conf_event_id] = WMI_PEER_ASSOC_CONF_EVENTID; |
| 11402 | event_ids[wmi_vdev_delete_resp_event_id] = WMI_VDEV_DELETE_RESP_EVENTID; |
Nachiket Kukade | ae35a2c | 2018-05-22 12:17:15 +0530 | [diff] [blame] | 11403 | event_ids[wmi_apf_capability_info_event_id] = |
Mukul Sharma | 2c66f7e | 2017-11-03 19:26:54 +0530 | [diff] [blame] | 11404 | WMI_BPF_CAPABILIY_INFO_EVENTID; |
| 11405 | event_ids[wmi_vdev_encrypt_decrypt_data_rsp_event_id] = |
| 11406 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_RESP_EVENTID; |
| 11407 | event_ids[wmi_report_rx_aggr_failure_event_id] = |
| 11408 | WMI_REPORT_RX_AGGR_FAILURE_EVENTID; |
| 11409 | event_ids[wmi_pdev_chip_pwr_save_failure_detect_event_id] = |
| 11410 | WMI_PDEV_CHIP_POWER_SAVE_FAILURE_DETECTED_EVENTID; |
| 11411 | event_ids[wmi_peer_antdiv_info_event_id] = WMI_PEER_ANTDIV_INFO_EVENTID; |
| 11412 | event_ids[wmi_pdev_set_hw_mode_rsp_event_id] = |
| 11413 | WMI_PDEV_SET_HW_MODE_RESP_EVENTID; |
| 11414 | event_ids[wmi_pdev_hw_mode_transition_event_id] = |
| 11415 | WMI_PDEV_HW_MODE_TRANSITION_EVENTID; |
| 11416 | event_ids[wmi_pdev_set_mac_config_resp_event_id] = |
| 11417 | WMI_PDEV_SET_MAC_CONFIG_RESP_EVENTID; |
| 11418 | event_ids[wmi_coex_bt_activity_event_id] = |
| 11419 | WMI_WLAN_COEX_BT_ACTIVITY_EVENTID; |
| 11420 | event_ids[wmi_mgmt_tx_bundle_completion_event_id] = |
| 11421 | WMI_MGMT_TX_BUNDLE_COMPLETION_EVENTID; |
| 11422 | event_ids[wmi_radio_tx_power_level_stats_event_id] = |
| 11423 | WMI_RADIO_TX_POWER_LEVEL_STATS_EVENTID; |
| 11424 | event_ids[wmi_report_stats_event_id] = WMI_REPORT_STATS_EVENTID; |
Sathish Kumar | f396c72 | 2017-11-17 17:30:41 +0530 | [diff] [blame] | 11425 | event_ids[wmi_dma_buf_release_event_id] = |
| 11426 | WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID; |
Arif Hussain | c5bfe07 | 2017-12-27 16:23:45 -0800 | [diff] [blame] | 11427 | event_ids[wmi_sap_obss_detection_report_event_id] = |
| 11428 | WMI_SAP_OBSS_DETECTION_REPORT_EVENTID; |
Subrat Mishra | d7c7a56 | 2017-09-27 14:41:20 +0530 | [diff] [blame] | 11429 | event_ids[wmi_host_swfda_event_id] = WMI_HOST_SWFDA_EVENTID; |
Jeff Johnson | 4783f90 | 2017-12-14 15:50:16 -0800 | [diff] [blame] | 11430 | event_ids[wmi_sar_get_limits_event_id] = WMI_SAR_GET_LIMITS_EVENTID; |
Arif Hussain | ec5cd3c | 2018-01-22 01:19:36 -0800 | [diff] [blame] | 11431 | event_ids[wmi_obss_color_collision_report_event_id] = |
| 11432 | WMI_OBSS_COLOR_COLLISION_DETECTION_EVENTID; |
lifeng | fa98305 | 2018-04-03 19:01:45 +0800 | [diff] [blame] | 11433 | event_ids[wmi_pdev_div_rssi_antid_event_id] = |
| 11434 | WMI_PDEV_DIV_RSSI_ANTID_EVENTID; |
Varun Reddy Yeturu | 2c8c912 | 2018-04-17 11:04:27 -0700 | [diff] [blame] | 11435 | event_ids[wmi_twt_enable_complete_event_id] = |
| 11436 | WMI_TWT_ENABLE_COMPLETE_EVENTID; |
Nachiket Kukade | e06beaa | 2018-05-25 14:52:55 +0530 | [diff] [blame] | 11437 | event_ids[wmi_apf_get_vdev_work_memory_resp_event_id] = |
| 11438 | WMI_BPF_GET_VDEV_WORK_MEMORY_RESP_EVENTID; |
Kabilan Kannan | 0d0f935 | 2018-06-21 16:55:47 -0700 | [diff] [blame] | 11439 | event_ids[wmi_wlan_sar2_result_event_id] = WMI_SAR2_RESULT_EVENTID; |
Subrat Mishra | a667b1c | 2018-08-02 15:02:04 +0530 | [diff] [blame] | 11440 | event_ids[wmi_esp_estimate_event_id] = WMI_ESP_ESTIMATE_EVENTID; |
Rajeev Kumar Sirasanagandla | d2d1a5e | 2018-03-02 21:12:16 +0530 | [diff] [blame] | 11441 | event_ids[wmi_roam_scan_stats_event_id] = WMI_ROAM_SCAN_STATS_EVENTID; |
Kiran Venkatappa | d73f4eb | 2018-07-19 22:22:29 +0530 | [diff] [blame] | 11442 | #ifdef AST_HKV1_WORKAROUND |
| 11443 | event_ids[wmi_wds_peer_event_id] = WMI_WDS_PEER_EVENTID; |
| 11444 | #endif |
Alok Singh | 0243e7d | 2018-09-20 16:07:28 +0530 | [diff] [blame] | 11445 | event_ids[wmi_pdev_ctl_failsafe_check_event_id] = |
| 11446 | WMI_PDEV_CTL_FAILSAFE_CHECK_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11447 | } |
| 11448 | |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 11449 | /** |
| 11450 | * populate_tlv_service() - populates wmi services |
| 11451 | * |
| 11452 | * @param wmi_service: Pointer to hold wmi_service |
| 11453 | * Return: None |
| 11454 | */ |
| 11455 | static void populate_tlv_service(uint32_t *wmi_service) |
| 11456 | { |
| 11457 | wmi_service[wmi_service_beacon_offload] = WMI_SERVICE_BEACON_OFFLOAD; |
Sathish Kumar | eefe27e | 2017-10-04 09:58:00 +0530 | [diff] [blame] | 11458 | wmi_service[wmi_service_ack_timeout] = WMI_SERVICE_ACK_TIMEOUT; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 11459 | wmi_service[wmi_service_scan_offload] = WMI_SERVICE_SCAN_OFFLOAD; |
| 11460 | wmi_service[wmi_service_roam_scan_offload] = |
| 11461 | WMI_SERVICE_ROAM_SCAN_OFFLOAD; |
| 11462 | wmi_service[wmi_service_bcn_miss_offload] = |
| 11463 | WMI_SERVICE_BCN_MISS_OFFLOAD; |
| 11464 | wmi_service[wmi_service_sta_pwrsave] = WMI_SERVICE_STA_PWRSAVE; |
| 11465 | wmi_service[wmi_service_sta_advanced_pwrsave] = |
| 11466 | WMI_SERVICE_STA_ADVANCED_PWRSAVE; |
| 11467 | wmi_service[wmi_service_ap_uapsd] = WMI_SERVICE_AP_UAPSD; |
| 11468 | wmi_service[wmi_service_ap_dfs] = WMI_SERVICE_AP_DFS; |
| 11469 | wmi_service[wmi_service_11ac] = WMI_SERVICE_11AC; |
| 11470 | wmi_service[wmi_service_blockack] = WMI_SERVICE_BLOCKACK; |
| 11471 | wmi_service[wmi_service_phyerr] = WMI_SERVICE_PHYERR; |
| 11472 | wmi_service[wmi_service_bcn_filter] = WMI_SERVICE_BCN_FILTER; |
| 11473 | wmi_service[wmi_service_rtt] = WMI_SERVICE_RTT; |
| 11474 | wmi_service[wmi_service_wow] = WMI_SERVICE_WOW; |
| 11475 | wmi_service[wmi_service_ratectrl_cache] = WMI_SERVICE_RATECTRL_CACHE; |
| 11476 | wmi_service[wmi_service_iram_tids] = WMI_SERVICE_IRAM_TIDS; |
| 11477 | wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_ARPNS_OFFLOAD; |
| 11478 | wmi_service[wmi_service_nlo] = WMI_SERVICE_NLO; |
| 11479 | wmi_service[wmi_service_gtk_offload] = WMI_SERVICE_GTK_OFFLOAD; |
| 11480 | wmi_service[wmi_service_scan_sch] = WMI_SERVICE_SCAN_SCH; |
| 11481 | wmi_service[wmi_service_csa_offload] = WMI_SERVICE_CSA_OFFLOAD; |
| 11482 | wmi_service[wmi_service_chatter] = WMI_SERVICE_CHATTER; |
| 11483 | wmi_service[wmi_service_coex_freqavoid] = WMI_SERVICE_COEX_FREQAVOID; |
| 11484 | wmi_service[wmi_service_packet_power_save] = |
| 11485 | WMI_SERVICE_PACKET_POWER_SAVE; |
| 11486 | wmi_service[wmi_service_force_fw_hang] = WMI_SERVICE_FORCE_FW_HANG; |
| 11487 | wmi_service[wmi_service_gpio] = WMI_SERVICE_GPIO; |
| 11488 | wmi_service[wmi_service_sta_dtim_ps_modulated_dtim] = |
| 11489 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM; |
| 11490 | wmi_service[wmi_sta_uapsd_basic_auto_trig] = |
| 11491 | WMI_STA_UAPSD_BASIC_AUTO_TRIG; |
| 11492 | wmi_service[wmi_sta_uapsd_var_auto_trig] = WMI_STA_UAPSD_VAR_AUTO_TRIG; |
| 11493 | wmi_service[wmi_service_sta_keep_alive] = WMI_SERVICE_STA_KEEP_ALIVE; |
| 11494 | wmi_service[wmi_service_tx_encap] = WMI_SERVICE_TX_ENCAP; |
| 11495 | wmi_service[wmi_service_ap_ps_detect_out_of_sync] = |
| 11496 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC; |
| 11497 | wmi_service[wmi_service_early_rx] = WMI_SERVICE_EARLY_RX; |
| 11498 | wmi_service[wmi_service_sta_smps] = WMI_SERVICE_STA_SMPS; |
| 11499 | wmi_service[wmi_service_fwtest] = WMI_SERVICE_FWTEST; |
| 11500 | wmi_service[wmi_service_sta_wmmac] = WMI_SERVICE_STA_WMMAC; |
| 11501 | wmi_service[wmi_service_tdls] = WMI_SERVICE_TDLS; |
| 11502 | wmi_service[wmi_service_burst] = WMI_SERVICE_BURST; |
| 11503 | wmi_service[wmi_service_mcc_bcn_interval_change] = |
| 11504 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE; |
| 11505 | wmi_service[wmi_service_adaptive_ocs] = WMI_SERVICE_ADAPTIVE_OCS; |
| 11506 | wmi_service[wmi_service_ba_ssn_support] = WMI_SERVICE_BA_SSN_SUPPORT; |
| 11507 | wmi_service[wmi_service_filter_ipsec_natkeepalive] = |
| 11508 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE; |
| 11509 | wmi_service[wmi_service_wlan_hb] = WMI_SERVICE_WLAN_HB; |
| 11510 | wmi_service[wmi_service_lte_ant_share_support] = |
| 11511 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT; |
| 11512 | wmi_service[wmi_service_batch_scan] = WMI_SERVICE_BATCH_SCAN; |
| 11513 | wmi_service[wmi_service_qpower] = WMI_SERVICE_QPOWER; |
| 11514 | wmi_service[wmi_service_plmreq] = WMI_SERVICE_PLMREQ; |
| 11515 | wmi_service[wmi_service_thermal_mgmt] = WMI_SERVICE_THERMAL_MGMT; |
| 11516 | wmi_service[wmi_service_rmc] = WMI_SERVICE_RMC; |
| 11517 | wmi_service[wmi_service_mhf_offload] = WMI_SERVICE_MHF_OFFLOAD; |
| 11518 | wmi_service[wmi_service_coex_sar] = WMI_SERVICE_COEX_SAR; |
| 11519 | wmi_service[wmi_service_bcn_txrate_override] = |
| 11520 | WMI_SERVICE_BCN_TXRATE_OVERRIDE; |
| 11521 | wmi_service[wmi_service_nan] = WMI_SERVICE_NAN; |
| 11522 | wmi_service[wmi_service_l1ss_stat] = WMI_SERVICE_L1SS_STAT; |
| 11523 | wmi_service[wmi_service_estimate_linkspeed] = |
| 11524 | WMI_SERVICE_ESTIMATE_LINKSPEED; |
| 11525 | wmi_service[wmi_service_obss_scan] = WMI_SERVICE_OBSS_SCAN; |
| 11526 | wmi_service[wmi_service_tdls_offchan] = WMI_SERVICE_TDLS_OFFCHAN; |
| 11527 | wmi_service[wmi_service_tdls_uapsd_buffer_sta] = |
| 11528 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA; |
| 11529 | wmi_service[wmi_service_tdls_uapsd_sleep_sta] = |
| 11530 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA; |
| 11531 | wmi_service[wmi_service_ibss_pwrsave] = WMI_SERVICE_IBSS_PWRSAVE; |
| 11532 | wmi_service[wmi_service_lpass] = WMI_SERVICE_LPASS; |
| 11533 | wmi_service[wmi_service_extscan] = WMI_SERVICE_EXTSCAN; |
| 11534 | wmi_service[wmi_service_d0wow] = WMI_SERVICE_D0WOW; |
| 11535 | wmi_service[wmi_service_hsoffload] = WMI_SERVICE_HSOFFLOAD; |
| 11536 | wmi_service[wmi_service_roam_ho_offload] = WMI_SERVICE_ROAM_HO_OFFLOAD; |
| 11537 | wmi_service[wmi_service_rx_full_reorder] = WMI_SERVICE_RX_FULL_REORDER; |
| 11538 | wmi_service[wmi_service_dhcp_offload] = WMI_SERVICE_DHCP_OFFLOAD; |
| 11539 | wmi_service[wmi_service_sta_rx_ipa_offload_support] = |
| 11540 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT; |
| 11541 | wmi_service[wmi_service_mdns_offload] = WMI_SERVICE_MDNS_OFFLOAD; |
| 11542 | wmi_service[wmi_service_sap_auth_offload] = |
| 11543 | WMI_SERVICE_SAP_AUTH_OFFLOAD; |
| 11544 | wmi_service[wmi_service_dual_band_simultaneous_support] = |
| 11545 | WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT; |
| 11546 | wmi_service[wmi_service_ocb] = WMI_SERVICE_OCB; |
| 11547 | wmi_service[wmi_service_ap_arpns_offload] = |
| 11548 | WMI_SERVICE_AP_ARPNS_OFFLOAD; |
| 11549 | wmi_service[wmi_service_per_band_chainmask_support] = |
| 11550 | WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT; |
| 11551 | wmi_service[wmi_service_packet_filter_offload] = |
| 11552 | WMI_SERVICE_PACKET_FILTER_OFFLOAD; |
| 11553 | wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT; |
| 11554 | wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI; |
| 11555 | wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG; |
| 11556 | wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC; |
| 11557 | wmi_service[wmi_service_multiple_vdev_restart] = |
| 11558 | WMI_SERVICE_MULTIPLE_VDEV_RESTART; |
| 11559 | |
| 11560 | wmi_service[wmi_service_roam_offload] = WMI_SERVICE_UNAVAILABLE; |
| 11561 | wmi_service[wmi_service_ratectrl] = WMI_SERVICE_UNAVAILABLE; |
| 11562 | wmi_service[wmi_service_smart_antenna_sw_support] = |
| 11563 | WMI_SERVICE_UNAVAILABLE; |
| 11564 | wmi_service[wmi_service_smart_antenna_hw_support] = |
| 11565 | WMI_SERVICE_UNAVAILABLE; |
| 11566 | wmi_service[wmi_service_enhanced_proxy_sta] = WMI_SERVICE_UNAVAILABLE; |
Om Prakash Tripathi | 3bfb50c | 2017-11-07 14:37:22 +0530 | [diff] [blame] | 11567 | wmi_service[wmi_service_tt] = WMI_SERVICE_THERM_THROT; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11568 | wmi_service[wmi_service_atf] = WMI_SERVICE_ATF; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 11569 | wmi_service[wmi_service_peer_caching] = WMI_SERVICE_UNAVAILABLE; |
| 11570 | wmi_service[wmi_service_coex_gpio] = WMI_SERVICE_UNAVAILABLE; |
| 11571 | wmi_service[wmi_service_aux_spectral_intf] = WMI_SERVICE_UNAVAILABLE; |
| 11572 | wmi_service[wmi_service_aux_chan_load_intf] = WMI_SERVICE_UNAVAILABLE; |
| 11573 | wmi_service[wmi_service_bss_channel_info_64] = WMI_SERVICE_UNAVAILABLE; |
| 11574 | wmi_service[wmi_service_ext_res_cfg_support] = WMI_SERVICE_UNAVAILABLE; |
| 11575 | wmi_service[wmi_service_mesh] = WMI_SERVICE_UNAVAILABLE; |
| 11576 | wmi_service[wmi_service_restrt_chnl_support] = WMI_SERVICE_UNAVAILABLE; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 11577 | wmi_service[wmi_service_peer_stats] = WMI_SERVICE_UNAVAILABLE; |
| 11578 | wmi_service[wmi_service_mesh_11s] = WMI_SERVICE_UNAVAILABLE; |
| 11579 | wmi_service[wmi_service_periodic_chan_stat_support] = |
Sathish Kumar | 0ff69e4 | 2017-11-02 10:44:39 +0530 | [diff] [blame] | 11580 | WMI_SERVICE_PERIODIC_CHAN_STAT_SUPPORT; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 11581 | wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE; |
| 11582 | wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE; |
| 11583 | wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE; |
| 11584 | wmi_service[wmi_service_btcoex_duty_cycle] = WMI_SERVICE_UNAVAILABLE; |
| 11585 | wmi_service[wmi_service_4_wire_coex_support] = WMI_SERVICE_UNAVAILABLE; |
| 11586 | wmi_service[wmi_service_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
Kiran Venkatappa | 95c82a6 | 2017-05-10 14:34:17 +0530 | [diff] [blame] | 11587 | wmi_service[wmi_service_peer_assoc_conf] = WMI_SERVICE_PEER_ASSOC_CONF; |
| 11588 | wmi_service[wmi_service_egap] = WMI_SERVICE_EGAP; |
| 11589 | wmi_service[wmi_service_sta_pmf_offload] = WMI_SERVICE_STA_PMF_OFFLOAD; |
| 11590 | wmi_service[wmi_service_unified_wow_capability] = |
| 11591 | WMI_SERVICE_UNIFIED_WOW_CAPABILITY; |
| 11592 | wmi_service[wmi_service_enterprise_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
Nachiket Kukade | ae35a2c | 2018-05-22 12:17:15 +0530 | [diff] [blame] | 11593 | wmi_service[wmi_service_apf_offload] = WMI_SERVICE_BPF_OFFLOAD; |
Kiran Venkatappa | 95c82a6 | 2017-05-10 14:34:17 +0530 | [diff] [blame] | 11594 | wmi_service[wmi_service_sync_delete_cmds] = |
| 11595 | WMI_SERVICE_SYNC_DELETE_CMDS; |
| 11596 | wmi_service[wmi_service_ratectrl_limit_max_min_rates] = |
| 11597 | WMI_SERVICE_RATECTRL_LIMIT_MAX_MIN_RATES; |
| 11598 | wmi_service[wmi_service_nan_data] = WMI_SERVICE_NAN_DATA; |
| 11599 | wmi_service[wmi_service_nan_rtt] = WMI_SERVICE_NAN_RTT; |
| 11600 | wmi_service[wmi_service_11ax] = WMI_SERVICE_11AX; |
| 11601 | wmi_service[wmi_service_deprecated_replace] = |
| 11602 | WMI_SERVICE_DEPRECATED_REPLACE; |
| 11603 | wmi_service[wmi_service_tdls_conn_tracker_in_host_mode] = |
| 11604 | WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE; |
| 11605 | wmi_service[wmi_service_enhanced_mcast_filter] = |
| 11606 | WMI_SERVICE_ENHANCED_MCAST_FILTER; |
| 11607 | wmi_service[wmi_service_half_rate_quarter_rate_support] = |
| 11608 | WMI_SERVICE_HALF_RATE_QUARTER_RATE_SUPPORT; |
| 11609 | wmi_service[wmi_service_vdev_rx_filter] = WMI_SERVICE_VDEV_RX_FILTER; |
| 11610 | wmi_service[wmi_service_p2p_listen_offload_support] = |
| 11611 | WMI_SERVICE_P2P_LISTEN_OFFLOAD_SUPPORT; |
| 11612 | wmi_service[wmi_service_mark_first_wakeup_packet] = |
| 11613 | WMI_SERVICE_MARK_FIRST_WAKEUP_PACKET; |
| 11614 | wmi_service[wmi_service_multiple_mcast_filter_set] = |
| 11615 | WMI_SERVICE_MULTIPLE_MCAST_FILTER_SET; |
| 11616 | wmi_service[wmi_service_host_managed_rx_reorder] = |
| 11617 | WMI_SERVICE_HOST_MANAGED_RX_REORDER; |
| 11618 | wmi_service[wmi_service_flash_rdwr_support] = |
| 11619 | WMI_SERVICE_FLASH_RDWR_SUPPORT; |
| 11620 | wmi_service[wmi_service_wlan_stats_report] = |
| 11621 | WMI_SERVICE_WLAN_STATS_REPORT; |
| 11622 | wmi_service[wmi_service_tx_msdu_id_new_partition_support] = |
| 11623 | WMI_SERVICE_TX_MSDU_ID_NEW_PARTITION_SUPPORT; |
| 11624 | wmi_service[wmi_service_dfs_phyerr_offload] = |
| 11625 | WMI_SERVICE_DFS_PHYERR_OFFLOAD; |
| 11626 | wmi_service[wmi_service_rcpi_support] = WMI_SERVICE_RCPI_SUPPORT; |
| 11627 | wmi_service[wmi_service_fw_mem_dump_support] = |
| 11628 | WMI_SERVICE_FW_MEM_DUMP_SUPPORT; |
| 11629 | wmi_service[wmi_service_peer_stats_info] = WMI_SERVICE_PEER_STATS_INFO; |
| 11630 | wmi_service[wmi_service_regulatory_db] = WMI_SERVICE_REGULATORY_DB; |
| 11631 | wmi_service[wmi_service_11d_offload] = WMI_SERVICE_11D_OFFLOAD; |
| 11632 | wmi_service[wmi_service_hw_data_filtering] = |
| 11633 | WMI_SERVICE_HW_DATA_FILTERING; |
| 11634 | wmi_service[wmi_service_pkt_routing] = WMI_SERVICE_PKT_ROUTING; |
| 11635 | wmi_service[wmi_service_offchan_tx_wmi] = WMI_SERVICE_OFFCHAN_TX_WMI; |
Venkateswara Swamy Bandaru | 23e00ed | 2017-06-07 20:57:28 +0530 | [diff] [blame] | 11636 | wmi_service[wmi_service_chan_load_info] = WMI_SERVICE_CHAN_LOAD_INFO; |
Soumya Bhat | 8db697d | 2017-08-29 18:49:13 +0530 | [diff] [blame] | 11637 | wmi_service[wmi_service_extended_nss_support] = |
| 11638 | WMI_SERVICE_EXTENDED_NSS_SUPPORT; |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 11639 | wmi_service[wmi_service_widebw_scan] = WMI_SERVICE_SCAN_PHYMODE_SUPPORT; |
Kiran Venkatappa | 7fe3afc | 2017-11-08 19:32:23 +0530 | [diff] [blame] | 11640 | wmi_service[wmi_service_bcn_offload_start_stop_support] = |
| 11641 | WMI_SERVICE_BCN_OFFLOAD_START_STOP_SUPPORT; |
Kiran Venkatappa | 9c625d2 | 2017-11-17 17:08:02 +0530 | [diff] [blame] | 11642 | wmi_service[wmi_service_offchan_data_tid_support] = |
| 11643 | WMI_SERVICE_OFFCHAN_DATA_TID_SUPPORT; |
Sathish Kumar | f396c72 | 2017-11-17 17:30:41 +0530 | [diff] [blame] | 11644 | wmi_service[wmi_service_support_dma] = |
| 11645 | WMI_SERVICE_SUPPORT_DIRECT_DMA; |
Sourav Mohapatra | a7b454d | 2017-12-03 11:44:44 +0530 | [diff] [blame] | 11646 | wmi_service[wmi_service_8ss_tx_bfee] = WMI_SERVICE_8SS_TX_BFEE; |
| 11647 | wmi_service[wmi_service_fils_support] = WMI_SERVICE_FILS_SUPPORT; |
| 11648 | wmi_service[wmi_service_mawc_support] = WMI_SERVICE_MAWC_SUPPORT; |
bings | 00d767c | 2018-05-31 15:33:02 +0800 | [diff] [blame] | 11649 | wmi_service[wmi_service_wow_wakeup_by_timer_pattern] = |
| 11650 | WMI_SERVICE_WOW_WAKEUP_BY_TIMER_PATTERN; |
Arunk Khandavalli | 22a7d54 | 2018-02-08 11:52:23 +0530 | [diff] [blame] | 11651 | wmi_service[wmi_service_11k_neighbour_report_support] = |
| 11652 | WMI_SERVICE_11K_NEIGHBOUR_REPORT_SUPPORT; |
Arif Hussain | d9978f8 | 2018-02-09 16:42:05 -0800 | [diff] [blame] | 11653 | wmi_service[wmi_service_ap_obss_detection_offload] = |
| 11654 | WMI_SERVICE_AP_OBSS_DETECTION_OFFLOAD; |
| 11655 | wmi_service[wmi_service_bss_color_offload] = |
| 11656 | WMI_SERVICE_BSS_COLOR_OFFLOAD; |
Padma, Santhosh Kumar | 5e751d4 | 2018-02-02 18:18:34 +0530 | [diff] [blame] | 11657 | wmi_service[wmi_service_gmac_offload_support] = |
| 11658 | WMI_SERVICE_GMAC_OFFLOAD_SUPPORT; |
Zhu Jianmin | 3ed26de | 2018-04-19 17:55:30 +0800 | [diff] [blame] | 11659 | wmi_service[wmi_service_dual_beacon_on_single_mac_scc_support] = |
| 11660 | WMI_SERVICE_DUAL_BEACON_ON_SINGLE_MAC_SCC_SUPPORT; |
| 11661 | wmi_service[wmi_service_dual_beacon_on_single_mac_mcc_support] = |
| 11662 | WMI_SERVICE_DUAL_BEACON_ON_SINGLE_MAC_MCC_SUPPORT; |
Varun Reddy Yeturu | 94107f9 | 2018-05-30 15:31:13 -0700 | [diff] [blame] | 11663 | wmi_service[wmi_service_twt_requestor] = WMI_SERVICE_STA_TWT; |
| 11664 | wmi_service[wmi_service_twt_responder] = WMI_SERVICE_AP_TWT; |
Nachiket Kukade | ed200e5 | 2018-06-04 21:12:08 +0530 | [diff] [blame] | 11665 | wmi_service[wmi_service_listen_interval_offload_support] = |
| 11666 | WMI_SERVICE_LISTEN_INTERVAL_OFFLOAD_SUPPORT; |
Subrat Mishra | 791d0fc | 2018-09-17 18:09:14 +0530 | [diff] [blame] | 11667 | wmi_service[wmi_service_esp_support] = WMI_SERVICE_ESP_SUPPORT; |
Pratik Gandhi | 3fd97d6 | 2018-09-17 16:47:12 +0530 | [diff] [blame] | 11668 | wmi_service[wmi_service_obss_spatial_reuse] = |
| 11669 | WMI_SERVICE_OBSS_SPATIAL_REUSE; |
Sourav Mohapatra | a7b454d | 2017-12-03 11:44:44 +0530 | [diff] [blame] | 11670 | |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 11671 | } |
| 11672 | |
Sourav Mohapatra | a7b454d | 2017-12-03 11:44:44 +0530 | [diff] [blame] | 11673 | #ifndef CONFIG_MCL |
| 11674 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11675 | /** |
| 11676 | * populate_pdev_param_tlv() - populates pdev params |
| 11677 | * |
| 11678 | * @param pdev_param: Pointer to hold pdev params |
| 11679 | * Return: None |
| 11680 | */ |
| 11681 | static void populate_pdev_param_tlv(uint32_t *pdev_param) |
| 11682 | { |
| 11683 | pdev_param[wmi_pdev_param_tx_chain_mask] = WMI_PDEV_PARAM_TX_CHAIN_MASK; |
| 11684 | pdev_param[wmi_pdev_param_rx_chain_mask] = WMI_PDEV_PARAM_RX_CHAIN_MASK; |
| 11685 | pdev_param[wmi_pdev_param_txpower_limit2g] = |
| 11686 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G; |
| 11687 | pdev_param[wmi_pdev_param_txpower_limit5g] = |
| 11688 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G; |
| 11689 | pdev_param[wmi_pdev_param_txpower_scale] = WMI_PDEV_PARAM_TXPOWER_SCALE; |
| 11690 | pdev_param[wmi_pdev_param_beacon_gen_mode] = |
| 11691 | WMI_PDEV_PARAM_BEACON_GEN_MODE; |
| 11692 | pdev_param[wmi_pdev_param_beacon_tx_mode] = |
| 11693 | WMI_PDEV_PARAM_BEACON_TX_MODE; |
| 11694 | pdev_param[wmi_pdev_param_resmgr_offchan_mode] = |
| 11695 | WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE; |
| 11696 | pdev_param[wmi_pdev_param_protection_mode] = |
| 11697 | WMI_PDEV_PARAM_PROTECTION_MODE; |
| 11698 | pdev_param[wmi_pdev_param_dynamic_bw] = WMI_PDEV_PARAM_DYNAMIC_BW; |
| 11699 | pdev_param[wmi_pdev_param_non_agg_sw_retry_th] = |
| 11700 | WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH; |
| 11701 | pdev_param[wmi_pdev_param_agg_sw_retry_th] = |
| 11702 | WMI_PDEV_PARAM_AGG_SW_RETRY_TH; |
| 11703 | pdev_param[wmi_pdev_param_sta_kickout_th] = |
| 11704 | WMI_PDEV_PARAM_STA_KICKOUT_TH; |
| 11705 | pdev_param[wmi_pdev_param_ac_aggrsize_scaling] = |
| 11706 | WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING; |
| 11707 | pdev_param[wmi_pdev_param_ltr_enable] = WMI_PDEV_PARAM_LTR_ENABLE; |
| 11708 | pdev_param[wmi_pdev_param_ltr_ac_latency_be] = |
| 11709 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BE; |
| 11710 | pdev_param[wmi_pdev_param_ltr_ac_latency_bk] = |
| 11711 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BK; |
| 11712 | pdev_param[wmi_pdev_param_ltr_ac_latency_vi] = |
| 11713 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VI; |
| 11714 | pdev_param[wmi_pdev_param_ltr_ac_latency_vo] = |
| 11715 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VO; |
| 11716 | pdev_param[wmi_pdev_param_ltr_ac_latency_timeout] = |
| 11717 | WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT; |
| 11718 | pdev_param[wmi_pdev_param_ltr_sleep_override] = |
| 11719 | WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE; |
| 11720 | pdev_param[wmi_pdev_param_ltr_rx_override] = |
| 11721 | WMI_PDEV_PARAM_LTR_RX_OVERRIDE; |
| 11722 | pdev_param[wmi_pdev_param_ltr_tx_activity_timeout] = |
| 11723 | WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT; |
| 11724 | pdev_param[wmi_pdev_param_l1ss_enable] = WMI_PDEV_PARAM_L1SS_ENABLE; |
| 11725 | pdev_param[wmi_pdev_param_dsleep_enable] = WMI_PDEV_PARAM_DSLEEP_ENABLE; |
| 11726 | pdev_param[wmi_pdev_param_pcielp_txbuf_flush] = |
| 11727 | WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH; |
| 11728 | pdev_param[wmi_pdev_param_pcielp_txbuf_watermark] = |
| 11729 | WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK; |
| 11730 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_en] = |
| 11731 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN; |
| 11732 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_value] = |
| 11733 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE; |
| 11734 | pdev_param[wmi_pdev_param_pdev_stats_update_period] = |
| 11735 | WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD; |
| 11736 | pdev_param[wmi_pdev_param_vdev_stats_update_period] = |
| 11737 | WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD; |
| 11738 | pdev_param[wmi_pdev_param_peer_stats_update_period] = |
| 11739 | WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD; |
| 11740 | pdev_param[wmi_pdev_param_bcnflt_stats_update_period] = |
| 11741 | WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD; |
| 11742 | pdev_param[wmi_pdev_param_pmf_qos] = WMI_PDEV_PARAM_PMF_QOS; |
| 11743 | pdev_param[wmi_pdev_param_arp_ac_override] = |
| 11744 | WMI_PDEV_PARAM_ARP_AC_OVERRIDE; |
| 11745 | pdev_param[wmi_pdev_param_dcs] = WMI_PDEV_PARAM_DCS; |
| 11746 | pdev_param[wmi_pdev_param_ani_enable] = WMI_PDEV_PARAM_ANI_ENABLE; |
| 11747 | pdev_param[wmi_pdev_param_ani_poll_period] = |
| 11748 | WMI_PDEV_PARAM_ANI_POLL_PERIOD; |
| 11749 | pdev_param[wmi_pdev_param_ani_listen_period] = |
| 11750 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD; |
| 11751 | pdev_param[wmi_pdev_param_ani_ofdm_level] = |
| 11752 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL; |
| 11753 | pdev_param[wmi_pdev_param_ani_cck_level] = WMI_PDEV_PARAM_ANI_CCK_LEVEL; |
| 11754 | pdev_param[wmi_pdev_param_dyntxchain] = WMI_PDEV_PARAM_DYNTXCHAIN; |
| 11755 | pdev_param[wmi_pdev_param_proxy_sta] = WMI_PDEV_PARAM_PROXY_STA; |
| 11756 | pdev_param[wmi_pdev_param_idle_ps_config] = |
| 11757 | WMI_PDEV_PARAM_IDLE_PS_CONFIG; |
| 11758 | pdev_param[wmi_pdev_param_power_gating_sleep] = |
| 11759 | WMI_PDEV_PARAM_POWER_GATING_SLEEP; |
| 11760 | pdev_param[wmi_pdev_param_rfkill_enable] = WMI_PDEV_PARAM_RFKILL_ENABLE; |
| 11761 | pdev_param[wmi_pdev_param_burst_dur] = WMI_PDEV_PARAM_BURST_DUR; |
| 11762 | pdev_param[wmi_pdev_param_burst_enable] = WMI_PDEV_PARAM_BURST_ENABLE; |
| 11763 | pdev_param[wmi_pdev_param_hw_rfkill_config] = |
| 11764 | WMI_PDEV_PARAM_HW_RFKILL_CONFIG; |
| 11765 | pdev_param[wmi_pdev_param_low_power_rf_enable] = |
| 11766 | WMI_PDEV_PARAM_LOW_POWER_RF_ENABLE; |
| 11767 | pdev_param[wmi_pdev_param_l1ss_track] = WMI_PDEV_PARAM_L1SS_TRACK; |
| 11768 | pdev_param[wmi_pdev_param_hyst_en] = WMI_PDEV_PARAM_HYST_EN; |
| 11769 | pdev_param[wmi_pdev_param_power_collapse_enable] = |
| 11770 | WMI_PDEV_PARAM_POWER_COLLAPSE_ENABLE; |
| 11771 | pdev_param[wmi_pdev_param_led_sys_state] = WMI_PDEV_PARAM_LED_SYS_STATE; |
| 11772 | pdev_param[wmi_pdev_param_led_enable] = WMI_PDEV_PARAM_LED_ENABLE; |
| 11773 | pdev_param[wmi_pdev_param_audio_over_wlan_latency] = |
| 11774 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY; |
| 11775 | pdev_param[wmi_pdev_param_audio_over_wlan_enable] = |
| 11776 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE; |
| 11777 | pdev_param[wmi_pdev_param_whal_mib_stats_update_enable] = |
| 11778 | WMI_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE; |
| 11779 | pdev_param[wmi_pdev_param_vdev_rate_stats_update_period] = |
| 11780 | WMI_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD; |
| 11781 | pdev_param[wmi_pdev_param_cts_cbw] = WMI_PDEV_PARAM_CTS_CBW; |
| 11782 | pdev_param[wmi_pdev_param_wnts_config] = WMI_PDEV_PARAM_WNTS_CONFIG; |
| 11783 | pdev_param[wmi_pdev_param_adaptive_early_rx_enable] = |
| 11784 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_ENABLE; |
| 11785 | pdev_param[wmi_pdev_param_adaptive_early_rx_min_sleep_slop] = |
| 11786 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_MIN_SLEEP_SLOP; |
| 11787 | pdev_param[wmi_pdev_param_adaptive_early_rx_inc_dec_step] = |
| 11788 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_INC_DEC_STEP; |
| 11789 | pdev_param[wmi_pdev_param_early_rx_fix_sleep_slop] = |
| 11790 | WMI_PDEV_PARAM_EARLY_RX_FIX_SLEEP_SLOP; |
| 11791 | pdev_param[wmi_pdev_param_bmiss_based_adaptive_bto_enable] = |
| 11792 | WMI_PDEV_PARAM_BMISS_BASED_ADAPTIVE_BTO_ENABLE; |
| 11793 | pdev_param[wmi_pdev_param_bmiss_bto_min_bcn_timeout] = |
| 11794 | WMI_PDEV_PARAM_BMISS_BTO_MIN_BCN_TIMEOUT; |
| 11795 | pdev_param[wmi_pdev_param_bmiss_bto_inc_dec_step] = |
| 11796 | WMI_PDEV_PARAM_BMISS_BTO_INC_DEC_STEP; |
| 11797 | pdev_param[wmi_pdev_param_bto_fix_bcn_timeout] = |
| 11798 | WMI_PDEV_PARAM_BTO_FIX_BCN_TIMEOUT; |
| 11799 | pdev_param[wmi_pdev_param_ce_based_adaptive_bto_enable] = |
| 11800 | WMI_PDEV_PARAM_CE_BASED_ADAPTIVE_BTO_ENABLE; |
| 11801 | pdev_param[wmi_pdev_param_ce_bto_combo_ce_value] = |
| 11802 | WMI_PDEV_PARAM_CE_BTO_COMBO_CE_VALUE; |
| 11803 | pdev_param[wmi_pdev_param_tx_chain_mask_2g] = |
| 11804 | WMI_PDEV_PARAM_TX_CHAIN_MASK_2G; |
| 11805 | pdev_param[wmi_pdev_param_rx_chain_mask_2g] = |
| 11806 | WMI_PDEV_PARAM_RX_CHAIN_MASK_2G; |
| 11807 | pdev_param[wmi_pdev_param_tx_chain_mask_5g] = |
| 11808 | WMI_PDEV_PARAM_TX_CHAIN_MASK_5G; |
| 11809 | pdev_param[wmi_pdev_param_rx_chain_mask_5g] = |
| 11810 | WMI_PDEV_PARAM_RX_CHAIN_MASK_5G; |
| 11811 | pdev_param[wmi_pdev_param_tx_chain_mask_cck] = |
| 11812 | WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK; |
| 11813 | pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = |
| 11814 | WMI_PDEV_PARAM_TX_CHAIN_MASK_1SS; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 11815 | pdev_param[wmi_pdev_param_rx_filter] = WMI_PDEV_PARAM_RX_FILTER; |
| 11816 | pdev_param[wmi_pdev_set_mcast_to_ucast_tid] = |
| 11817 | WMI_PDEV_SET_MCAST_TO_UCAST_TID; |
Sathish Kumar | d99852a | 2017-07-08 12:32:27 +0530 | [diff] [blame] | 11818 | pdev_param[wmi_pdev_param_mgmt_retry_limit] = |
| 11819 | WMI_PDEV_PARAM_MGMT_RETRY_LIMIT; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 11820 | pdev_param[wmi_pdev_param_aggr_burst] = WMI_PDEV_PARAM_AGGR_BURST; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11821 | pdev_param[wmi_pdev_peer_sta_ps_statechg_enable] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 11822 | WMI_PDEV_PEER_STA_PS_STATECHG_ENABLE; |
| 11823 | pdev_param[wmi_pdev_param_proxy_sta_mode] = |
| 11824 | WMI_PDEV_PARAM_PROXY_STA_MODE; |
| 11825 | pdev_param[wmi_pdev_param_mu_group_policy] = |
| 11826 | WMI_PDEV_PARAM_MU_GROUP_POLICY; |
| 11827 | pdev_param[wmi_pdev_param_noise_detection] = |
| 11828 | WMI_PDEV_PARAM_NOISE_DETECTION; |
| 11829 | pdev_param[wmi_pdev_param_noise_threshold] = |
| 11830 | WMI_PDEV_PARAM_NOISE_THRESHOLD; |
| 11831 | pdev_param[wmi_pdev_param_dpd_enable] = WMI_PDEV_PARAM_DPD_ENABLE; |
| 11832 | pdev_param[wmi_pdev_param_set_mcast_bcast_echo] = |
| 11833 | WMI_PDEV_PARAM_SET_MCAST_BCAST_ECHO; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11834 | pdev_param[wmi_pdev_param_atf_strict_sch] = |
| 11835 | WMI_PDEV_PARAM_ATF_STRICT_SCH; |
| 11836 | pdev_param[wmi_pdev_param_atf_sched_duration] = |
| 11837 | WMI_PDEV_PARAM_ATF_SCHED_DURATION; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 11838 | pdev_param[wmi_pdev_param_ant_plzn] = WMI_PDEV_PARAM_ANT_PLZN; |
| 11839 | pdev_param[wmi_pdev_param_sensitivity_level] = |
| 11840 | WMI_PDEV_PARAM_SENSITIVITY_LEVEL; |
| 11841 | pdev_param[wmi_pdev_param_signed_txpower_2g] = |
| 11842 | WMI_PDEV_PARAM_SIGNED_TXPOWER_2G; |
| 11843 | pdev_param[wmi_pdev_param_signed_txpower_5g] = |
| 11844 | WMI_PDEV_PARAM_SIGNED_TXPOWER_5G; |
Karunakar Dasineni | 39a5ff7 | 2017-08-10 12:12:28 -0700 | [diff] [blame] | 11845 | pdev_param[wmi_pdev_param_enable_per_tid_amsdu] = |
| 11846 | WMI_PDEV_PARAM_ENABLE_PER_TID_AMSDU; |
| 11847 | pdev_param[wmi_pdev_param_enable_per_tid_ampdu] = |
| 11848 | WMI_PDEV_PARAM_ENABLE_PER_TID_AMPDU; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 11849 | pdev_param[wmi_pdev_param_cca_threshold] = |
| 11850 | WMI_PDEV_PARAM_CCA_THRESHOLD; |
| 11851 | pdev_param[wmi_pdev_param_rts_fixed_rate] = |
| 11852 | WMI_PDEV_PARAM_RTS_FIXED_RATE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11853 | pdev_param[wmi_pdev_param_cal_period] = WMI_UNAVAILABLE_PARAM; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 11854 | pdev_param[wmi_pdev_param_pdev_reset] = WMI_PDEV_PARAM_PDEV_RESET; |
| 11855 | pdev_param[wmi_pdev_param_wapi_mbssid_offset] = |
| 11856 | WMI_PDEV_PARAM_WAPI_MBSSID_OFFSET; |
| 11857 | pdev_param[wmi_pdev_param_arp_srcaddr] = |
| 11858 | WMI_PDEV_PARAM_ARP_DBG_SRCADDR; |
| 11859 | pdev_param[wmi_pdev_param_arp_dstaddr] = |
| 11860 | WMI_PDEV_PARAM_ARP_DBG_DSTADDR; |
| 11861 | pdev_param[wmi_pdev_param_txpower_decr_db] = |
| 11862 | WMI_PDEV_PARAM_TXPOWER_DECR_DB; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11863 | pdev_param[wmi_pdev_param_rx_batchmode] = WMI_UNAVAILABLE_PARAM; |
| 11864 | pdev_param[wmi_pdev_param_packet_aggr_delay] = WMI_UNAVAILABLE_PARAM; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11865 | pdev_param[wmi_pdev_param_atf_obss_noise_sch] = |
| 11866 | WMI_PDEV_PARAM_ATF_OBSS_NOISE_SCH; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11867 | pdev_param[wmi_pdev_param_atf_obss_noise_scaling_factor] = |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11868 | WMI_PDEV_PARAM_ATF_OBSS_NOISE_SCALING_FACTOR; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 11869 | pdev_param[wmi_pdev_param_cust_txpower_scale] = |
| 11870 | WMI_PDEV_PARAM_CUST_TXPOWER_SCALE; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11871 | pdev_param[wmi_pdev_param_atf_dynamic_enable] = |
| 11872 | WMI_PDEV_PARAM_ATF_DYNAMIC_ENABLE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11873 | pdev_param[wmi_pdev_param_atf_ssid_group_policy] = |
| 11874 | WMI_UNAVAILABLE_PARAM; |
Sathish Kumar | 210b406 | 2018-07-03 17:25:11 +0530 | [diff] [blame] | 11875 | pdev_param[wmi_pdev_param_igmpmld_override] = |
| 11876 | WMI_PDEV_PARAM_IGMPMLD_AC_OVERRIDE; |
| 11877 | pdev_param[wmi_pdev_param_igmpmld_tid] = |
| 11878 | WMI_PDEV_PARAM_IGMPMLD_AC_OVERRIDE; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 11879 | pdev_param[wmi_pdev_param_antenna_gain] = WMI_PDEV_PARAM_ANTENNA_GAIN; |
| 11880 | pdev_param[wmi_pdev_param_block_interbss] = |
| 11881 | WMI_PDEV_PARAM_BLOCK_INTERBSS; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11882 | pdev_param[wmi_pdev_param_set_disable_reset_cmdid] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 11883 | WMI_PDEV_PARAM_SET_DISABLE_RESET_CMDID; |
| 11884 | pdev_param[wmi_pdev_param_set_msdu_ttl_cmdid] = |
| 11885 | WMI_PDEV_PARAM_SET_MSDU_TTL_CMDID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11886 | pdev_param[wmi_pdev_param_txbf_sound_period_cmdid] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 11887 | WMI_PDEV_PARAM_TXBF_SOUND_PERIOD_CMDID; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 11888 | pdev_param[wmi_pdev_param_set_burst_mode_cmdid] = |
| 11889 | WMI_PDEV_PARAM_SET_BURST_MODE_CMDID; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 11890 | pdev_param[wmi_pdev_param_en_stats] = WMI_PDEV_PARAM_EN_STATS; |
Venkateswara Swamy Bandaru | 21cc1ca | 2017-02-24 17:09:46 +0530 | [diff] [blame] | 11891 | pdev_param[wmi_pdev_param_mesh_mcast_enable] = |
| 11892 | WMI_PDEV_PARAM_MESH_MCAST_ENABLE; |
Sathish Kumar | a059f41 | 2017-03-22 19:10:28 +0530 | [diff] [blame] | 11893 | pdev_param[wmi_pdev_param_set_promisc_mode_cmdid] = |
| 11894 | WMI_PDEV_PARAM_SET_PROMISC_MODE_CMDID; |
| 11895 | pdev_param[wmi_pdev_param_set_ppdu_duration_cmdid] = |
| 11896 | WMI_PDEV_PARAM_SET_PPDU_DURATION_CMDID; |
Sathish Kumar | a059f41 | 2017-03-22 19:10:28 +0530 | [diff] [blame] | 11897 | pdev_param[wmi_pdev_param_remove_mcast2ucast_buffer] = |
| 11898 | WMI_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER; |
| 11899 | pdev_param[wmi_pdev_param_set_mcast2ucast_buffer] = |
| 11900 | WMI_PDEV_PARAM_SET_MCAST2UCAST_BUFFER; |
| 11901 | pdev_param[wmi_pdev_param_set_mcast2ucast_mode] = |
| 11902 | WMI_PDEV_PARAM_SET_MCAST2UCAST_MODE; |
| 11903 | pdev_param[wmi_pdev_param_smart_antenna_default_antenna] = |
| 11904 | WMI_PDEV_PARAM_SMART_ANTENNA_DEFAULT_ANTENNA; |
| 11905 | pdev_param[wmi_pdev_param_fast_channel_reset] = |
| 11906 | WMI_PDEV_PARAM_FAST_CHANNEL_RESET; |
| 11907 | pdev_param[wmi_pdev_param_rx_decap_mode] = WMI_PDEV_PARAM_RX_DECAP_MODE; |
Sathish Kumar | eefe27e | 2017-10-04 09:58:00 +0530 | [diff] [blame] | 11908 | pdev_param[wmi_pdev_param_tx_ack_timeout] = WMI_PDEV_PARAM_ACK_TIMEOUT; |
Shiva Krishna Pittala | 42a4661 | 2018-02-16 21:28:40 +0530 | [diff] [blame] | 11909 | pdev_param[wmi_pdev_param_cck_tx_enable] = WMI_PDEV_PARAM_CCK_TX_ENABLE; |
Priyadarshnee S | 11b41a9 | 2018-07-25 11:08:40 +0530 | [diff] [blame] | 11910 | pdev_param[wmi_pdev_param_antenna_gain_half_db] = |
| 11911 | WMI_PDEV_PARAM_ANTENNA_GAIN_HALF_DB; |
Subrat Mishra | a667b1c | 2018-08-02 15:02:04 +0530 | [diff] [blame] | 11912 | pdev_param[wmi_pdev_param_esp_indication_period] = |
| 11913 | WMI_PDEV_PARAM_ESP_INDICATION_PERIOD; |
Subrat Mishra | 791d0fc | 2018-09-17 18:09:14 +0530 | [diff] [blame] | 11914 | pdev_param[wmi_pdev_param_esp_ba_window] = WMI_PDEV_PARAM_ESP_BA_WINDOW; |
| 11915 | pdev_param[wmi_pdev_param_esp_airtime_fraction] = |
| 11916 | WMI_PDEV_PARAM_ESP_AIRTIME_FRACTION; |
| 11917 | pdev_param[wmi_pdev_param_esp_ppdu_duration] = |
| 11918 | WMI_PDEV_PARAM_ESP_PPDU_DURATION; |
Venkateswara Swamy Bandaru | c990641 | 2018-08-06 20:44:28 +0530 | [diff] [blame] | 11919 | #ifdef WLAN_RU26_SUPPORT |
| 11920 | pdev_param[wmi_pdev_param_ru26_allowed] = WMI_PDEV_PARAM_RU26_ALLOWED; |
| 11921 | #endif |
Abhijit Pradhan | f6694f8 | 2018-10-17 10:13:15 +0530 | [diff] [blame] | 11922 | pdev_param[wmi_pdev_param_use_nol] = WMI_PDEV_PARAM_USE_NOL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11923 | } |
| 11924 | |
| 11925 | /** |
| 11926 | * populate_vdev_param_tlv() - populates vdev params |
| 11927 | * |
| 11928 | * @param vdev_param: Pointer to hold vdev params |
| 11929 | * Return: None |
| 11930 | */ |
| 11931 | static void populate_vdev_param_tlv(uint32_t *vdev_param) |
| 11932 | { |
| 11933 | vdev_param[wmi_vdev_param_rts_threshold] = WMI_VDEV_PARAM_RTS_THRESHOLD; |
| 11934 | vdev_param[wmi_vdev_param_fragmentation_threshold] = |
| 11935 | WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD; |
| 11936 | vdev_param[wmi_vdev_param_beacon_interval] = |
| 11937 | WMI_VDEV_PARAM_BEACON_INTERVAL; |
| 11938 | vdev_param[wmi_vdev_param_listen_interval] = |
| 11939 | WMI_VDEV_PARAM_LISTEN_INTERVAL; |
| 11940 | vdev_param[wmi_vdev_param_multicast_rate] = |
| 11941 | WMI_VDEV_PARAM_MULTICAST_RATE; |
| 11942 | vdev_param[wmi_vdev_param_mgmt_tx_rate] = WMI_VDEV_PARAM_MGMT_TX_RATE; |
| 11943 | vdev_param[wmi_vdev_param_slot_time] = WMI_VDEV_PARAM_SLOT_TIME; |
| 11944 | vdev_param[wmi_vdev_param_preamble] = WMI_VDEV_PARAM_PREAMBLE; |
| 11945 | vdev_param[wmi_vdev_param_swba_time] = WMI_VDEV_PARAM_SWBA_TIME; |
| 11946 | vdev_param[wmi_vdev_stats_update_period] = WMI_VDEV_STATS_UPDATE_PERIOD; |
| 11947 | vdev_param[wmi_vdev_pwrsave_ageout_time] = WMI_VDEV_PWRSAVE_AGEOUT_TIME; |
| 11948 | vdev_param[wmi_vdev_host_swba_interval] = WMI_VDEV_HOST_SWBA_INTERVAL; |
| 11949 | vdev_param[wmi_vdev_param_dtim_period] = WMI_VDEV_PARAM_DTIM_PERIOD; |
| 11950 | vdev_param[wmi_vdev_oc_scheduler_air_time_limit] = |
| 11951 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT; |
| 11952 | vdev_param[wmi_vdev_param_wds] = WMI_VDEV_PARAM_WDS; |
| 11953 | vdev_param[wmi_vdev_param_atim_window] = WMI_VDEV_PARAM_ATIM_WINDOW; |
| 11954 | vdev_param[wmi_vdev_param_bmiss_count_max] = |
| 11955 | WMI_VDEV_PARAM_BMISS_COUNT_MAX; |
| 11956 | vdev_param[wmi_vdev_param_bmiss_first_bcnt] = |
| 11957 | WMI_VDEV_PARAM_BMISS_FIRST_BCNT; |
| 11958 | vdev_param[wmi_vdev_param_bmiss_final_bcnt] = |
| 11959 | WMI_VDEV_PARAM_BMISS_FINAL_BCNT; |
| 11960 | vdev_param[wmi_vdev_param_feature_wmm] = WMI_VDEV_PARAM_FEATURE_WMM; |
| 11961 | vdev_param[wmi_vdev_param_chwidth] = WMI_VDEV_PARAM_CHWIDTH; |
| 11962 | vdev_param[wmi_vdev_param_chextoffset] = WMI_VDEV_PARAM_CHEXTOFFSET; |
| 11963 | vdev_param[wmi_vdev_param_disable_htprotection] = |
| 11964 | WMI_VDEV_PARAM_DISABLE_HTPROTECTION; |
| 11965 | vdev_param[wmi_vdev_param_sta_quickkickout] = |
| 11966 | WMI_VDEV_PARAM_STA_QUICKKICKOUT; |
| 11967 | vdev_param[wmi_vdev_param_mgmt_rate] = WMI_VDEV_PARAM_MGMT_RATE; |
| 11968 | vdev_param[wmi_vdev_param_protection_mode] = |
| 11969 | WMI_VDEV_PARAM_PROTECTION_MODE; |
| 11970 | vdev_param[wmi_vdev_param_fixed_rate] = WMI_VDEV_PARAM_FIXED_RATE; |
| 11971 | vdev_param[wmi_vdev_param_sgi] = WMI_VDEV_PARAM_SGI; |
| 11972 | vdev_param[wmi_vdev_param_ldpc] = WMI_VDEV_PARAM_LDPC; |
| 11973 | vdev_param[wmi_vdev_param_tx_stbc] = WMI_VDEV_PARAM_TX_STBC; |
| 11974 | vdev_param[wmi_vdev_param_rx_stbc] = WMI_VDEV_PARAM_RX_STBC; |
| 11975 | vdev_param[wmi_vdev_param_intra_bss_fwd] = WMI_VDEV_PARAM_INTRA_BSS_FWD; |
| 11976 | vdev_param[wmi_vdev_param_def_keyid] = WMI_VDEV_PARAM_DEF_KEYID; |
| 11977 | vdev_param[wmi_vdev_param_nss] = WMI_VDEV_PARAM_NSS; |
| 11978 | vdev_param[wmi_vdev_param_bcast_data_rate] = |
| 11979 | WMI_VDEV_PARAM_BCAST_DATA_RATE; |
| 11980 | vdev_param[wmi_vdev_param_mcast_data_rate] = |
| 11981 | WMI_VDEV_PARAM_MCAST_DATA_RATE; |
| 11982 | vdev_param[wmi_vdev_param_mcast_indicate] = |
| 11983 | WMI_VDEV_PARAM_MCAST_INDICATE; |
| 11984 | vdev_param[wmi_vdev_param_dhcp_indicate] = |
| 11985 | WMI_VDEV_PARAM_DHCP_INDICATE; |
| 11986 | vdev_param[wmi_vdev_param_unknown_dest_indicate] = |
| 11987 | WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE; |
| 11988 | vdev_param[wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs] = |
| 11989 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS; |
| 11990 | vdev_param[wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs] = |
| 11991 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS; |
| 11992 | vdev_param[wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs] = |
| 11993 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS; |
| 11994 | vdev_param[wmi_vdev_param_ap_enable_nawds] = |
| 11995 | WMI_VDEV_PARAM_AP_ENABLE_NAWDS; |
| 11996 | vdev_param[wmi_vdev_param_enable_rtscts] = WMI_VDEV_PARAM_ENABLE_RTSCTS; |
| 11997 | vdev_param[wmi_vdev_param_txbf] = WMI_VDEV_PARAM_TXBF; |
| 11998 | vdev_param[wmi_vdev_param_packet_powersave] = |
| 11999 | WMI_VDEV_PARAM_PACKET_POWERSAVE; |
| 12000 | vdev_param[wmi_vdev_param_drop_unencry] = WMI_VDEV_PARAM_DROP_UNENCRY; |
| 12001 | vdev_param[wmi_vdev_param_tx_encap_type] = WMI_VDEV_PARAM_TX_ENCAP_TYPE; |
| 12002 | vdev_param[wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs] = |
| 12003 | WMI_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS; |
| 12004 | vdev_param[wmi_vdev_param_early_rx_adjust_enable] = |
| 12005 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE; |
| 12006 | vdev_param[wmi_vdev_param_early_rx_tgt_bmiss_num] = |
| 12007 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM; |
| 12008 | vdev_param[wmi_vdev_param_early_rx_bmiss_sample_cycle] = |
| 12009 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE; |
| 12010 | vdev_param[wmi_vdev_param_early_rx_slop_step] = |
| 12011 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP; |
| 12012 | vdev_param[wmi_vdev_param_early_rx_init_slop] = |
| 12013 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP; |
| 12014 | vdev_param[wmi_vdev_param_early_rx_adjust_pause] = |
| 12015 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE; |
| 12016 | vdev_param[wmi_vdev_param_tx_pwrlimit] = WMI_VDEV_PARAM_TX_PWRLIMIT; |
| 12017 | vdev_param[wmi_vdev_param_snr_num_for_cal] = |
| 12018 | WMI_VDEV_PARAM_SNR_NUM_FOR_CAL; |
| 12019 | vdev_param[wmi_vdev_param_roam_fw_offload] = |
| 12020 | WMI_VDEV_PARAM_ROAM_FW_OFFLOAD; |
| 12021 | vdev_param[wmi_vdev_param_enable_rmc] = WMI_VDEV_PARAM_ENABLE_RMC; |
| 12022 | vdev_param[wmi_vdev_param_ibss_max_bcn_lost_ms] = |
| 12023 | WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS; |
| 12024 | vdev_param[wmi_vdev_param_max_rate] = WMI_VDEV_PARAM_MAX_RATE; |
| 12025 | vdev_param[wmi_vdev_param_early_rx_drift_sample] = |
| 12026 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE; |
| 12027 | vdev_param[wmi_vdev_param_set_ibss_tx_fail_cnt_thr] = |
| 12028 | WMI_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR; |
| 12029 | vdev_param[wmi_vdev_param_ebt_resync_timeout] = |
| 12030 | WMI_VDEV_PARAM_EBT_RESYNC_TIMEOUT; |
| 12031 | vdev_param[wmi_vdev_param_aggr_trig_event_enable] = |
| 12032 | WMI_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE; |
| 12033 | vdev_param[wmi_vdev_param_is_ibss_power_save_allowed] = |
| 12034 | WMI_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED; |
| 12035 | vdev_param[wmi_vdev_param_is_power_collapse_allowed] = |
| 12036 | WMI_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED; |
| 12037 | vdev_param[wmi_vdev_param_is_awake_on_txrx_enabled] = |
| 12038 | WMI_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED; |
| 12039 | vdev_param[wmi_vdev_param_inactivity_cnt] = |
| 12040 | WMI_VDEV_PARAM_INACTIVITY_CNT; |
| 12041 | vdev_param[wmi_vdev_param_txsp_end_inactivity_time_ms] = |
| 12042 | WMI_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS; |
| 12043 | vdev_param[wmi_vdev_param_dtim_policy] = WMI_VDEV_PARAM_DTIM_POLICY; |
| 12044 | vdev_param[wmi_vdev_param_ibss_ps_warmup_time_secs] = |
| 12045 | WMI_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS; |
| 12046 | vdev_param[wmi_vdev_param_ibss_ps_1rx_chain_in_atim_window_enable] = |
| 12047 | WMI_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE; |
| 12048 | vdev_param[wmi_vdev_param_rx_leak_window] = |
| 12049 | WMI_VDEV_PARAM_RX_LEAK_WINDOW; |
| 12050 | vdev_param[wmi_vdev_param_stats_avg_factor] = |
| 12051 | WMI_VDEV_PARAM_STATS_AVG_FACTOR; |
| 12052 | vdev_param[wmi_vdev_param_disconnect_th] = WMI_VDEV_PARAM_DISCONNECT_TH; |
| 12053 | vdev_param[wmi_vdev_param_rtscts_rate] = WMI_VDEV_PARAM_RTSCTS_RATE; |
| 12054 | vdev_param[wmi_vdev_param_mcc_rtscts_protection_enable] = |
| 12055 | WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE; |
| 12056 | vdev_param[wmi_vdev_param_mcc_broadcast_probe_enable] = |
| 12057 | WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 12058 | vdev_param[wmi_vdev_param_mgmt_tx_power] = WMI_VDEV_PARAM_MGMT_TX_POWER; |
| 12059 | vdev_param[wmi_vdev_param_beacon_rate] = WMI_VDEV_PARAM_BEACON_RATE; |
Kalyan Tallapragada | d9a6abd | 2017-01-30 14:25:27 +0530 | [diff] [blame] | 12060 | vdev_param[wmi_vdev_param_rx_decap_type] = WMI_VDEV_PARAM_RX_DECAP_TYPE; |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 12061 | vdev_param[wmi_vdev_param_he_dcm_enable] = WMI_VDEV_PARAM_HE_DCM; |
| 12062 | vdev_param[wmi_vdev_param_he_range_ext_enable] = |
| 12063 | WMI_VDEV_PARAM_HE_RANGE_EXT; |
| 12064 | vdev_param[wmi_vdev_param_he_bss_color] = WMI_VDEV_PARAM_BSS_COLOR; |
| 12065 | vdev_param[wmi_vdev_param_set_hemu_mode] = WMI_VDEV_PARAM_SET_HEMU_MODE; |
Gyanranjan Hazarika | 6d1b942 | 2018-06-22 16:44:59 -0700 | [diff] [blame] | 12066 | vdev_param[wmi_vdev_param_set_he_sounding_mode] |
| 12067 | = WMI_VDEV_PARAM_SET_HE_SOUNDING_MODE; |
Gyanranjan Hazarika | dc75d1c | 2017-10-13 12:36:24 -0700 | [diff] [blame] | 12068 | vdev_param[wmi_vdev_param_set_heop] = WMI_VDEV_PARAM_HEOPS_0_31; |
Kiran Venkatappa | 1f9d67d | 2017-03-13 15:11:44 +0530 | [diff] [blame] | 12069 | vdev_param[wmi_vdev_param_sensor_ap] = WMI_VDEV_PARAM_SENSOR_AP; |
| 12070 | vdev_param[wmi_vdev_param_dtim_enable_cts] = |
| 12071 | WMI_VDEV_PARAM_DTIM_ENABLE_CTS; |
| 12072 | vdev_param[wmi_vdev_param_atf_ssid_sched_policy] = |
| 12073 | WMI_VDEV_PARAM_ATF_SSID_SCHED_POLICY; |
| 12074 | vdev_param[wmi_vdev_param_disable_dyn_bw_rts] = |
| 12075 | WMI_VDEV_PARAM_DISABLE_DYN_BW_RTS; |
Sathish Kumar | 2ac4070 | 2017-03-22 19:18:45 +0530 | [diff] [blame] | 12076 | vdev_param[wmi_vdev_param_mcast2ucast_set] = |
| 12077 | WMI_VDEV_PARAM_MCAST2UCAST_SET; |
| 12078 | vdev_param[wmi_vdev_param_rc_num_retries] = |
| 12079 | WMI_VDEV_PARAM_RC_NUM_RETRIES; |
| 12080 | vdev_param[wmi_vdev_param_cabq_maxdur] = WMI_VDEV_PARAM_CABQ_MAXDUR; |
| 12081 | vdev_param[wmi_vdev_param_mfptest_set] = WMI_VDEV_PARAM_MFPTEST_SET; |
| 12082 | vdev_param[wmi_vdev_param_rts_fixed_rate] = |
| 12083 | WMI_VDEV_PARAM_RTS_FIXED_RATE; |
| 12084 | vdev_param[wmi_vdev_param_vht_sgimask] = WMI_VDEV_PARAM_VHT_SGIMASK; |
| 12085 | vdev_param[wmi_vdev_param_vht80_ratemask] = |
| 12086 | WMI_VDEV_PARAM_VHT80_RATEMASK; |
| 12087 | vdev_param[wmi_vdev_param_proxy_sta] = WMI_VDEV_PARAM_PROXY_STA; |
| 12088 | vdev_param[wmi_vdev_param_bw_nss_ratemask] = |
| 12089 | WMI_VDEV_PARAM_BW_NSS_RATEMASK; |
Gyanranjan Hazarika | 32f0002 | 2018-03-13 17:09:08 -0700 | [diff] [blame] | 12090 | vdev_param[wmi_vdev_param_set_he_ltf] = |
| 12091 | WMI_VDEV_PARAM_HE_LTF; |
Anirban Sirkhell | c6d72b9 | 2017-10-26 13:40:41 +0530 | [diff] [blame] | 12092 | vdev_param[wmi_vdev_param_disable_cabq] = |
| 12093 | WMI_VDEV_PARAM_DISABLE_CABQ; |
Sathish Kumar | 6011c74 | 2017-11-08 14:49:58 +0530 | [diff] [blame] | 12094 | vdev_param[wmi_vdev_param_rate_dropdown_bmap] = |
| 12095 | WMI_VDEV_PARAM_RATE_DROPDOWN_BMAP; |
Rhythm Patwa | 8cdcf67 | 2018-02-15 13:22:39 -0800 | [diff] [blame] | 12096 | vdev_param[wmi_vdev_param_set_ba_mode] = |
| 12097 | WMI_VDEV_PARAM_BA_MODE; |
Neil Zhao | d32a7bd | 2018-01-10 17:00:04 -0800 | [diff] [blame] | 12098 | vdev_param[wmi_vdev_param_capabilities] = |
| 12099 | WMI_VDEV_PARAM_CAPABILITIES; |
Gyanranjan Hazarika | 32f0002 | 2018-03-13 17:09:08 -0700 | [diff] [blame] | 12100 | vdev_param[wmi_vdev_param_autorate_misc_cfg] = |
| 12101 | WMI_VDEV_PARAM_AUTORATE_MISC_CFG; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12102 | } |
| 12103 | #endif |
| 12104 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12105 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 12106 | * populate_target_defines_tlv() - Populate target defines and params |
| 12107 | * @wmi_handle: pointer to wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12108 | * |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 12109 | * Return: None |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12110 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 12111 | #ifndef CONFIG_MCL |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 12112 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12113 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12114 | populate_pdev_param_tlv(wmi_handle->pdev_param); |
| 12115 | populate_vdev_param_tlv(wmi_handle->vdev_param); |
| 12116 | } |
| 12117 | #else |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 12118 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
| 12119 | { } |
| 12120 | #endif |
| 12121 | |
| 12122 | /** |
Zhang Qian | 537fca6 | 2018-01-03 16:33:24 +0800 | [diff] [blame] | 12123 | * wmi_ocb_ut_attach() - Attach OCB test framework |
| 12124 | * @wmi_handle: wmi handle |
| 12125 | * |
| 12126 | * Return: None |
| 12127 | */ |
| 12128 | #ifdef WLAN_OCB_UT |
| 12129 | void wmi_ocb_ut_attach(struct wmi_unified *wmi_handle); |
| 12130 | #else |
| 12131 | static inline void wmi_ocb_ut_attach(struct wmi_unified *wmi_handle) |
| 12132 | { |
| 12133 | return; |
| 12134 | } |
| 12135 | #endif |
| 12136 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12137 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 12138 | * wmi_tlv_attach() - Attach TLV APIs |
| 12139 | * |
| 12140 | * Return: None |
| 12141 | */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 12142 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12143 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 12144 | wmi_handle->ops = &tlv_ops; |
Zhang Qian | 537fca6 | 2018-01-03 16:33:24 +0800 | [diff] [blame] | 12145 | wmi_ocb_ut_attach(wmi_handle); |
Pratik Gandhi | cf3b8b9 | 2018-02-05 17:22:41 +0530 | [diff] [blame] | 12146 | wmi_handle->soc->svc_ids = &multi_svc_ids[0]; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12147 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
Rakesh Pillai | 0511046 | 2017-12-27 14:08:59 +0530 | [diff] [blame] | 12148 | /* Skip saving WMI_CMD_HDR and TLV HDR */ |
Pratik Gandhi | 44811d0 | 2018-10-10 12:12:32 +0530 | [diff] [blame] | 12149 | wmi_handle->soc->buf_offset_command = 8; |
Rakesh Pillai | 0511046 | 2017-12-27 14:08:59 +0530 | [diff] [blame] | 12150 | /* WMI_CMD_HDR is already stripped, skip saving TLV HDR */ |
Pratik Gandhi | 44811d0 | 2018-10-10 12:12:32 +0530 | [diff] [blame] | 12151 | wmi_handle->soc->buf_offset_event = 4; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12152 | #endif |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 12153 | populate_tlv_events_id(wmi_handle->wmi_events); |
Sourav Mohapatra | a7b454d | 2017-12-03 11:44:44 +0530 | [diff] [blame] | 12154 | populate_tlv_service(wmi_handle->services); |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 12155 | populate_target_defines_tlv(wmi_handle); |
Kiran Venkatappa | 136986d | 2018-02-05 10:56:43 +0530 | [diff] [blame] | 12156 | wmi_twt_attach_tlv(wmi_handle); |
Wen Gong | f60f11e | 2018-05-18 16:03:41 +0800 | [diff] [blame] | 12157 | wmi_extscan_attach_tlv(wmi_handle); |
Sathish Kumar | efb25bf | 2018-10-02 11:03:59 +0530 | [diff] [blame] | 12158 | wmi_smart_ant_attach_tlv(wmi_handle); |
| 12159 | wmi_dbr_attach_tlv(wmi_handle); |
| 12160 | wmi_atf_attach_tlv(wmi_handle); |
| 12161 | wmi_ap_attach_tlv(wmi_handle); |
Qiwei Cai | 3d26b2e | 2018-09-17 19:17:13 +0800 | [diff] [blame] | 12162 | wmi_ocb_attach_tlv(wmi_handle); |
| 12163 | wmi_nan_attach_tlv(wmi_handle); |
| 12164 | wmi_p2p_attach_tlv(wmi_handle); |
| 12165 | wmi_roam_attach_tlv(wmi_handle); |
| 12166 | wmi_concurrency_attach_tlv(wmi_handle); |
| 12167 | wmi_pmo_attach_tlv(wmi_handle); |
| 12168 | wmi_sta_attach_tlv(wmi_handle); |
| 12169 | wmi_11ax_bss_color_attach_tlv(wmi_handle); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12170 | } |
Manikandan Mohan | 3dc8c51 | 2018-03-01 16:23:30 -0800 | [diff] [blame] | 12171 | qdf_export_symbol(wmi_tlv_attach); |
Pratik Gandhi | 67da1bb | 2018-01-30 19:05:41 +0530 | [diff] [blame] | 12172 | |
| 12173 | /** |
| 12174 | * wmi_tlv_init() - Initialize WMI TLV module by registering TLV attach routine |
| 12175 | * |
| 12176 | * Return: None |
| 12177 | */ |
| 12178 | void wmi_tlv_init(void) |
| 12179 | { |
| 12180 | wmi_unified_register_module(WMI_TLV_TARGET, &wmi_tlv_attach); |
| 12181 | } |